Lesson 1: Set up dependencies, import images, and create the Java class

This lesson shows you how to add the dependencies, import images, and to create a Java™ class to handle the view.

About this task

Note: Before you complete this lesson, you should create an Eclipse plug-in project with the following attributes:
  • Project Name: com.ibm.carma.plugin.view
  • Plug-in ID: com.ibm.carma.plugin.view
  • Plug-in Name: New View

To perform the setup for this plug-in:

Procedure

  1. In the Plug-in Development perspective, right-click on the com.ibm.carma.plugin.view plug-in project and select, PDE Tools > Open Manifest. Find the Dependencies tab at the bottom of the Plug-in Editor.
  2. Select the Dependencies tab, and click the Add button. In the dialog box that opens, filter for each of the following if they are not already listed:
    • org.eclipse.ui.ide
    • com.ibm.carma.ui
    For each dependency, as it appears in the list, highlight it, and click OK.
  3. Next, you want to import your files from the local source to the project. In the Package Explorer view, right click com.ibm.carma.plugin.view, and select New > Folder. In the New Folder dialog box that appears, select CARMA Developer View as the parent folder, and enter icons as the name. Click Finish.
    You should see the icons directory appear under the com.ibm.carma.plugin.view plug-in project.
  4. To import the icons, right-click on the icons directory and select Import. In the Import dialog box that opens, select General > File System. Click Next.
  5. Browse for the particular directory where your images are stored. Once you have selected the directory, the directory structure is shown in the left panel below, and the individual files are shown in the right. Mark the files or directories you want to import with a check mark, and click Finish to import the files.
    Back in the Package Explorer view, if you expand the icons directory, you should see your selected files now within the directory.
  6. Finally, you want to set up the Java class that handles the view. Start by creating a package to contain the file; right-click on com.ibm.carma.plugin.view, and select New > Package.
  7. In the New Java Package dialog box that opens, enter view as the package name.
    You should see the package appear under the src directory of the plug-in project.
  8. To add the Java class, right-click on the view package you just created, and select New > Class.
    The New Java Class dialog box opens.
  9. In the Name text field, enter the class name as CARMADeveloperView.
  10. To the left of the Superclass text field, click Browse. The Superclass Selection dialog box opens.
  11. In the text field, enter BaseCarmaBrowser. Select the class that matches your filter, and click OK.
  12. Back in the New Java Class view, click Finish to create the Java class. The dialog box closes and the class opens in the editor.