Tuesday, 21 February 2017

JDeveloper Feature: Application Navigator

Once we are all set with JDeveloper installation, we will move ahead to explore features JDeveloper offers.

The very first thing every developer notices and wants to know about is role selection.

Remember, after installation, I asked to select Studio Developer. So, you will get access to all the features JDeveloper offers.

The role selection window looks like the following,
Other roles are also there, different role has different set of components and windows available in the IDE. So, Database Developer role will have Database specific components available and you won't be able to create Java Projects and all in this role selection, similar thing happens for Java Developer role and any other role. Just play around a little bit with different roles and you will be accustomed to the system.

Moving forward, we will see JDeveloper IDE opened with a Start Page

This page is full of links connected to different tutorials and Oracle Documentation. If interested, you can check them. You can also deselect the 'Show on Startup' check box. This will stop JDeveloper to show this page from the next time.

In the left pane, you see Application Navigator, where you can see two buttons 'New Application' and 'Open Application'. While working with JDeveloper, you will create one or more projects, this panel keeps track of all the projects you create under one single hood. You can have more than one Applications in this window. If this window is not visible to you at any point of time, you can get this from here - Window > Applications


Next we'll create an application and a project in the application.
Click on the New Application button and it will open a new application window

As this is the first time we're creating an application and we want to make it simple, we'll go with Java Desktop Application, where we'll create Java Classes and run in console. Then gradually we'll move towards other features.

Click on OK and it will open another window to get input from user. Provide some meaningful name to the application and you may also want o change the directory of the application, if you don't bother for the location, just leave to default.

Then click Next and it will ask for more settings like project name, the directory to store the project files. You can give a name of your choice. Following the convention, I have named it as HelloWorld. Provide the details and click next. It will ask for Java Settings for the project you are developing.

In this window, you will provide the default package all java classes will be in. Also, it will ask you for source code directory and output directory. If you've worked with any build tool like Ant or Maven, you will relate these settings. If you are not getting what to select or provide, just leave it to default. Click Next.

In the last configuration window, you will have to select a build tool. From 12c, JDeveloper comes with two different build tools, Ant and Maven. You can configure your Ant/Maven settings accordingly. You can also select the default JDeveloper Build Tool. For simplicity, I will go with the default JDeveloper's build tool.

That's all the configuration you have to do while creating a Java Application. You can click Finish now and it will generate the complete project for you. You can see this in the Application Navigator now.
If you click on the + icon just beside your project name (HelloWorld in my case), you will find what all files, directories are there in the project.

Now let's create a new class which prints 'Hello World' to the console. Right click on the project and select New, it will open  a selection menu for you, choose Java Class,

Again it will pop up an window for different Java Class configuration. Provide a class name, you can also find that the default package is now coming in this section. I've also selected to provide a main method. Now click on OK.

What happens now is interesting. Take a closer look of each area of the IDE.

You can now see that in the Application Navigator, the project has been expanded and the class is residing in a package. In the editor, you now have your class and a main method in it. In the left pane, now you can check, there are some more accordions present, Application Resources, Data Controls and Recent Files. Also, another window has been populated with data just below Application Navigator - Structure.

Let's look at each of these.

Projects

This accordion shows the hierarchical view of all the available projects in the Application. In this window, there are four small buttons -
  1. Project Properties - if you click this button, you can see different project related properties. You can configure your project using the settings used here.
  2. Refresh - Refreshes the content of the project/application.
  3. Working sets - this button is useful, if you have a large list of projects in an application. Using this feature, you can make a subset of all the available projects in the application.
  4. Application Window options - this button will open a menu for different view configuration. I strongly suggest you to check with different options available. Play a little bit and you will understand what each option means.

Application Resources

This accordion shows all the application related resources like, Build Files, Database Connection, Server Connection, META Data, Related Libraries etc. In the subsequent sections, we will see the use of this window.

Data Controls

This accordion will show you different data related configuration while you will be working with Business Components.

Recent Files

As the name suggests, it shows the recent files.

Structure

This window shows the structure of the content in the editor. Like, in our case, It shows the structure of the HelloWorld class. This is useful when you have a large file open in the editor window. You can find all the related structure and click on it, the editor will show the specific part of the file.

Now, you might have not noticed, in the top of the Application Navigator, we have the application name and in its right side, there is a down arrow present. Click on it and you will find the 'New Application' and 'Open Application' Option. Click on the New Application Button. This time, follow the instructions for application creation, provided earlier.


Following is how it looks like in my system

Check different windows in this application. Now again click on the right Down Arrow beside the application Name in the Application Navigator and you will find two different applications. You can click on either of the projects and the IDE will show you the contents of that application.

You can also create other applications using the same method.

Now, to complete this part of the tutorial, we'll complete both the HelloWorld and HelloUser classes and run them.

Change the content of the classes as your choice. A quick information here, when a file is getting modified in the editor and it is not saved, the file name changes to italics. 

Another tip, while working with Oracle ADF/SOA Suite, you will come across situations where, you will only change a single file in the editor but it will internally modify many files. So, JDeveloper provides a feature to save all the files in the application, regardless of whether the file is modified in the editor. In the menu bar, you will find the Save All icon just beside the Save Icon.

So, you can use this button as well while you have multiple files to save. Now, right click the file and click Run and it will show the console just behind the editor window.

Similarly, with the next file run, I will conclude this section

No comments:

Post a Comment