Time for action – creating a migration component

In order to demonstrate how to migrate a plug-in to Eclipse 4.x technology, a simple example needs to be created. For this purpose, the Eclipse plug-in example library will be used, although the exact sample used by this book can also be checked out from the book's GitHub repository at https://github.com/alblue/com.packtpub.e4/

  1. Create a new plug-in project by navigating to the File | New | Project… menu and choosing the Plug-in Project option. Use com.packtpub.e4.migration as the name of the project, click on Next, and then accept the defaults by clicking on Finish.
  2. Open the META-INF/MANIFEST.MF file and go to the Overview tab. Click on the Extensions link on the right-hand side, under the Extension/Extension Point Content group:
    Time for action – creating a migration component
  3. If a dialog Extension pages hidden is displayed, click on the Yes button to ensure that the Extensions tab is shown:
    Time for action – creating a migration component
  4. Go to the Extensions tab and click on the Add... button. Type views in the filter and uncheck the Show only extension points from the required plug-ins option to show the list. Select Sample View and click on Next:
    Time for action – creating a migration component
  5. Click on the Finish button and accept the defaults to create the plug-in.

    Tip

    An error may temporarily be seen with a message Plug-ins declaring extensions or extension points must set the 'singleton' directive to 'true'. If this is not fixed automatically by the wizard, go to the Overview page and ensure that the This plug-in is a singleton checkbox is selected.

  6. Right-click on the project and choose Run As | Eclipse Application to launch the IDE. Navigate to the Window | Show View | Other… menu in the launched Eclipse instance and choose Sample Category | Sample View. A simple view should be shown:
    Time for action – creating a migration component

What just happened?

In order to migrate an existing application, a sample plug-in needs to be used. The version of the extension point in Eclipse's built-in wizards currently uses the Eclipse 3.x APIs (these samples were taken from Eclipse Neon; the exact code used can be seen from the book's GitHub repository).

A sample view was created using the view extension point, showing a table viewer populated with sample data. The table viewer has a number of actions (which are an Eclipse 2.x technology), along with a view menu, a toolbar, and a context-sensitive pop-up menu. Subsequent sections will show how to refactor each of these in turn into their Eclipse 4.x equivalents.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.186.218