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 "Eclipse4/RCP/FAQ"

< Eclipse4‎ | RCP
(What is the difference between IEclipseContext#set and IEclipseContext#modify?)
(How do I adopt the Eclipse 4 Application Platform?)
Line 107: Line 107:
 
@Inject @Preference(SAVE_BEFORE_BUILD)
 
@Inject @Preference(SAVE_BEFORE_BUILD)
 
boolean saveBeforeBuild;
 
boolean saveBeforeBuild;
 +
</pre>
 +
</td>
 +
</tr>
 +
<tr>
 +
<td style="background:#ebd3d2;">
 +
<pre>
 +
IPreferenceStore store =
 +
    IDEWorkbenchPlugin.getDefault()
 +
        .getPreferenceStore();
 +
store.putBoolean(SAVE_BEFORE_BUILD, false);
 +
</pre>
 +
</td>
 +
<td style="background:#dbf1d2;">
 +
<pre>
 +
FIXME: there's way to do this...
 +
@Inject @Preference(SAVE_BEFORE_BUILD)
 +
Provider<Boolean> saveBeforeBuild;
 +
...
 +
saveBeforeBuild.set(false);
 
</pre>
 
</pre>
 
</td>
 
</td>

Revision as of 15:25, 7 April 2011

How do I adopt the Eclipse 4 Application Platform?

Accessing the status line

Eclipse 3.x Eclipse 4.0
getViewSite()
  .getActionsBars()
      .getStatusLineManager()
          .setMessage(msg);
@Inject
IStatusLineManager statusLine;
...
statusLine.setMessage(msg);

Associating help context with a control

getSite()
  .getWorkbenchWindow()
    .getWorkbench()
       .getHelpSystem().setHelp(
               viewer.getControl(), some_id)
@Inject
IWorkbenchHelpSystem helpSystem;
...
helpSystem.setHelp(
        viewer.getControl(), some_id);

Handling errors and exceptions

try {
    ...
} catch (Exception ex) {
    IStatus status = new Status(
       IStatus.ERROR, "plugin-id",
       "Error while ...", ex);
    StatusManager.getManager()
        .handle(status, StatusManager.SHOW);
}
@Inject
StatusReporter statusReporter;
...
try{
    ...
} catch (Exception ex) {
    statusReporter.show("Error while ...", ex);
}

Accessing preference values

IPreferenceStore store =
    IDEWorkbenchPlugin.getDefault()
        .getPreferenceStore();
boolean saveBeforeBuild = store
    .getBoolean(SAVE_BEFORE_BUILD);
@Inject @Preference(SAVE_BEFORE_BUILD)
boolean saveBeforeBuild;
IPreferenceStore store =
    IDEWorkbenchPlugin.getDefault()
        .getPreferenceStore();
store.putBoolean(SAVE_BEFORE_BUILD, false);
FIXME: there's way to do this...
@Inject @Preference(SAVE_BEFORE_BUILD)
Provider<Boolean> saveBeforeBuild;
...
saveBeforeBuild.set(false);

Why won't my application start?

E4AP products require having the following plugins:

  • org.eclipse.equinox.ds (must be started)
  • org.eclipse.equinox.event (must be started)

Note that org.eclipse.equinox.ds must be explicitly started. In your product file, you should have a section:

  <configurations>
     <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="2" />
     <plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="3" />
     <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="3" />
  </configurations>


What is the difference between IEclipseContext#set and IEclipseContext#modify?

UI

How do I enable Drag N Drop (DND) of parts?

The DND addon is found in the org.eclipse.e4.ui.workbench.addons.swt plugin. However it requires the compatibility layer and is not available for native E4AP applications.

Back to the top