Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "E4/Compatibility/Running the compatibility layer"

(Running the Code)
Line 4: Line 4:
  
 
The views and editors are created through the LegacyViewFactory, a specialized PartFactory that mimics the part creation protocol (creating the executable extension for the part, calling 'createPartControl'...) in eclipse 3.x.
 
The views and editors are created through the LegacyViewFactory, a specialized PartFactory that mimics the part creation protocol (creating the executable extension for the part, calling 'createPartControl'...) in eclipse 3.x.
 +
 +
<b>NOTE:</b> This is still a work in progress, many things work and many don't. To fill the gaps we'll try to give known 'working' UI gestures to accomplish various activities.
  
 
==Setup==
 
==Setup==
Line 39: Line 41:
 
#Open <code>/org.eclipse.e4.ui.examples.legacy.workbench/legacy-eclipse.product</code>. This gets you a PDE product editor.
 
#Open <code>/org.eclipse.e4.ui.examples.legacy.workbench/legacy-eclipse.product</code>. This gets you a PDE product editor.
 
#Click on the "Launch an Eclipse Application" link.
 
#Click on the "Launch an Eclipse Application" link.
 +
 +
[[Image:E4-compatibility-PDE.PNG|right|200px|thumb|Click here to run the compatibity demo.]]
  
 
The initial workspace is likely to be empty, before proceeding populate it:
 
The initial workspace is likely to be empty, before proceeding populate it:

Revision as of 20:25, 28 May 2009

A screenshot showing the current state of the Eclipse 3.x compatibility layer.

This demo shows the current state of the eclipse 3.x compatibility layer . The image shows a workbench populated from an IPerspectiveFactory. The resulting menu, stacks, views and Editor Area are creating by turning the API calls into changes to the modeled UI's structure.

The views and editors are created through the LegacyViewFactory, a specialized PartFactory that mimics the part creation protocol (creating the executable extension for the part, calling 'createPartControl'...) in eclipse 3.x.

NOTE: This is still a work in progress, many things work and many don't. To fill the gaps we'll try to give known 'working' UI gestures to accomplish various activities.

Setup

Warning: These setup instructions are significantly different from the various e4 demos because of technical constraints on fragment development.

Unlike the demos, we have to sacrifice (possibly) some stability because the current fragment handling code requires that the workspace contains a checked out org.eclipse.ui.workbench project. If the base eclipse that you are running is not recent then the workbench project may fail to compile due to underlying project changes and you could end up 'pulling on a piece of thread' (i.e. checking out multiple other projects one after the other to satisfy the compilation requirements).

Install Eclipse

Start with a fresh install of the latest I-build.

Install EMF

  1. "Help" -> "Install New Software..."
  2. Select the "http://download.eclipse.org/releases/galileo" update site
  3. Open "Models and Model Development"
  4. Check "EMF SDK - Eclipse Modeling Framework SDK"
  5. Hit "Next" as necessary (accepting the license agreement)
  6. Hit "Finish"
  7. Restart eclipse when prompted

Load the compatibility layer

  1. Open the CVS Repositories view
  2. Add a new connection to dev.eclipse.org with the repository path 'cvsroot/eclipse', if you are not a committer simply use 'anonymous' as the User name.
  3. Check out the 'e4\releng' project from HEAD

Now you should have a 'releng' project in your workspace. Drill down into 'org.eclipse.e4.ui.releng', select both 'e4.ui.psf' and 'e4.ui.compatibility.psf', right-click and select 'Import Project Set...'. This will check out the projects that you need in order to run the compatibility layer.

Running the Code

The perspective that comes up was created using the TestPerspectiveFactory.

  1. Open /org.eclipse.e4.ui.examples.legacy.workbench/legacy-eclipse.product. This gets you a PDE product editor.
  2. Click on the "Launch an Eclipse Application" link.
Click here to run the compatibity demo.

The initial workspace is likely to be empty, before proceeding populate it:

You should see a Shell similar to the one depicted above. You should be able to use the Project Explorer to examine the workspace. If you right-click and select Open, the editor(s) for the selected resource(s) will be created.

Adding CSS Styling

OK, it's...um...functional (sort of) and this is e4, we've gotta be able to do better than that...

Close the e4 session if it's open Return to the 'releng' project and import e4.ui.css.psf

Re-run your e4 session, it should now be styled. The path to the CSS file can be found in /org.eclipse.e4.ui.examples.legacy.workbench/plugin.xml

  <property
   name="applicationCSS"
   value="platform:/plugin/org.eclipse.e4.ui.examples.legacy.workbench/css/xp-silver-legacy.css">
  </property>

Edit the file and kick the tires (it's fun...;-) ! You'll have to restart your e4 session to pick up the changes.

Under the Covers

The bulk of the compatibility layer's implementation resides in the /org.eclipse.e4.ui.workbench.fragment project. A 'fragment' is a special type of OSGI bundle that has the ability to provide a relpacement for classes defined in some other bundle (in this case org.eclipse.ui.workbench).

What do we have and how is it done? Providing the ability to host 3.x components in the e4 workbench is a mix of three different approaches...

  • Replace: The only class currently being replaced is PlatformUI, the root singleton through which the rest of the UI functionality is accessed. We expect that over time we will also have to replace some of the (possibly abstract) base classes used in the API such as ViewPart and EditorPart in order to have them integrate correctly into the e4 environment.
  • Re-use: Many of the capabilities available through the Workbench[Window[View|Editor]]] are implemented as discreet classes that encapsulate their functionality. Where appropriate we simply instantiate the 3.x class. In some cases (i.e. providing selections, Command infrastructure) we will be forced to re-implement the functionality in order to merge it into the e4 architecture correctly).
  • Re-implement: Where the API returns an interface and where the existing implementation (if any) is not suitable for use in e4. the layer will re-implement the interface itself, mapping the various method's functionality into the e4 structure.

Back to the top