Eclipse RCP (Useful Links)

Eclipse RCP Developer Notes

Eclipse and Command Line

Eclipse RCP Development Collections

Eclipse RCP Custom App Turorials

Java Doc API Sites

General

GUI Builder

== Views ==

Forms API:

== Common Navigator ==

Commands

Eclipse Predefined Commands

== Extension Points ==

== Databinding ==

== Preferences ==

== This n That ==

 

Error: A cycle was detected when generating the classpath

  • Right-Click on the plugin in Package Explorer > PDE Tools > Open Dependencies und dann durchklicken

== Access Resources ==

 

Eclipse RCP Help

Cheat Sheets

Adding a cheat sheet menu action

<extension point=”org.eclipse.ui.actionSets”>
<actionSet
label=”Cheat Sheets”
visible=”true”
id=”org.eclipse.ui.cheatsheets.actionSet”>
<action
label=”Cheat Sheets”
class=”org.eclipse.ui.cheatsheets.
CheatSheetExtensionFactory:helpMenuAction”
menubarPath=”help/group.tutorials”
id=”org.eclipse.ui.cheatsheets.
actions.CheatSheetHelpMenuAction”>
</action>
</actionSet>
</extension>

Show Specific Cheat Sheet Programmatically

In many cases you may want to make your cheat sheets more accessible to the user. They can be included in wizards, help buttons/links, or anywhere else in your plugin. To launch a cheat sheet automatically create a new OpenCheatSheetAction instance with the parameter equal to the id of the desired cheat sheet as defined in the xml file. Running this action will open the cheat sheet.

Welcome Pages

There are 3 ways to contribute Welcome Pages to … Eclipse Help abschreiben …

Welcome Page Universal Reuse (Approach I)

1. Enter Welcome Page Binding inside Application plugin.xml

<extension point=”org.eclipse.ui.intro”>
<introProductBinding introId=”org.eclipse.ui.intro.universal”
productId=”de.tudd.wsageditor.application.product”>
</introProductBinding>
</extension>

2. Set Welcome Page Binding inside Product

  • Open product file
  • go to tab Branding
  • under section Welcome Page choose org.eclipse.ui.intro.universal as Intro ID

3. To complete Launch Config the following dependencies are required:

  • org.eclipse.ui.intro
  • org.eclipse.ui.intro.universal

Welcome Page Custom (Approach II)

Defining a minimal intro configuration

Show Eclipse Welcome Page on every Startup

1. Programmatically via WorkbenchAdvisor.initialize(..)

PrefUtil.getAPIPreferenceStore().setValue(
IWorkbenchPreferenceConstants.SHOW_INTRO, true);
PrefUtil.saveAPIPrefs();

Note: Since PrefUtil is an internal class this is only recommended if you can’t set this property in your xml (e.g. you have an intro which is not based on the Standard Intro page)

2. Allow the user to chose whether the intro page is shown every time

<contentProvider id=”awc” class=”org.eclipse.ui.intro.contentproviders.AlwaysWelcomeCheckbox” pluginId=”org.eclipse.ui.intro”>
<text></text>
</contentProvider>

Put trhat in your intro xml. It displays a small checkbox wherever you place it.

Note: According to the Eclipse RCP Help (help.eclipse.org/galileo/index.jsp?topic=/…) this is an explicit feature of using XHTML.

Run Action from Welcome Page

For There are different solutions for this. See also Eclipse Help > Intro Content File XML Format.

1. Via link attribute

<?xml version=”1.0″ encoding=”utf-8″ ?>
<introContent>

<page id=”root” style=”html/style.css” style-id=”page”>
<title style-id=”intro-header”>Welcome to RapidSLA</title>

<link label=”Getting started ..”
url=”http://org.eclipse.ui.intro/runAction?class=my.plugin.actions.OpenPerspectiveAction&amp;pluginId=my.plugin&amp;pId=my.other.plugin.MyPerspective
id=”tutorials” />

</page>

</introContent>

2. Inside (X)HTML

<a id=”a-ism”
href=”http://org.eclipse.ui.intro/runAction?pluginId=sernet.gs.ui.rcp.main&class=sernet.gs.ui.rcp.main.actions.ShowISMPerspectiveIntroAction“>
Getting started..</a>

Splash Screen and Progress Bars

Eclipse Help: Preferences defaults

The preferenceCustomization property can be used to specify a file containing default preference values for the product.

<property name="preferenceCustomization" value="plugin_customization.ini"/>

This file is a java.io.Properties format file. Typically this file is used to set the values for preferences that are published as part of a plug-in’s public API. That is, you are taking a risk if you refer to preferences that are used by plug-ins but not defined formally in the API.

Eclipse Help: Splash screens with Progress Bar

The product splash screen is specified in the config.ini which is located underneath the product’s configuration directory. The osgi.splashPath property in this file describes places to search for a file called splash.bmp. The osgi.splashLocation property identifes a complete and exact path to the splash screen file to use. Specifying a splash path allows for locale specific splash screens to be used as the given search path can indicate several plug-ins or fragments to search as well as $nl$ style paths. See the platform SDK’s config.ini file for a complete description of properties that can be configured in this file. The image should be supplied in 24-bit color BMP format (RGB format) and should be approximately 500×330 pixels in size.

The location, size, and color of the progress bar and progress message shown in the splash screen during startup can be configured using the properties startupProgressRect, startupMessageRect, and startupForegroundColor. See IProductConstants for more information about these properties. Note that by default, no progress will be reported at startup. To enable startup progress reporting, set the following preference to true, for example in the preference customization file: IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP

Tutorial

0. Create plugin_customization.ini next to splash screen file, which is typically located under product plugin root.

1. Click Browse… on the right of Plug-in test field and select the plug-in project where the splash file resides. Progress bar and Progress message are used to indicate the process status on the splash screen. Add the following value into the plugin_customization.ini file.

org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP=true

2. Next, add the following property to the product extension section of the plugin.xml file.

<extension .. point="org.eclipse.core.runtime.products">
 ...
 <product>
  <property name="preferenceCustomization" value="plugin_customization.ini" />
 </product>
</extension>

3. Then select Add a progress bar in product configuration editor page Splash and configure its properties (offset and size, foreground color of progress message). Run as Eclipse Application.

Further Links

Remove Unwanted Menu Entries Programmatically

Next to the standard way of hiding menu entries through the standard GUI (Window > Customize Perspective..) one wants to hide automatically added menu entries. The problem is that there appears to be at least 3 ways that menu items and toolbar buttons are added to the UI.

  1. The first way is through the newer Command/Menu Extensions
  2. The second way is through the older ActionSets Extension.
  3. Then there are other UI elements that appear to be hard coded into the Workbench and do not have ID strings and cannot be hidden using the Activities Extension. Luckily there are few of this third type of UI element.

Finding Commands

  • Finding commands by Tracing (!!!)
  • Find the ID using Plug-In Spy
    • Press alt+shift+F1 and click on a menu item or toolbar button that you want to be hidden. If there is an ID string under the heading active action definition identifier then you are in luck. This item has been added using the Command Extension and you can use this ID as the pattern argument for the Activities Extension. But not all items that have been added using the Command Extension present their ID string to the plug-in spy.
  • Eclispe RCP API Docs

A Using Activities Extension

  • Open the plugin.xml file and add the org.eclipse.ui.activities extension.
  • Then create an activity node and give it a unique ID.
  • Then create an activityPatternBinding node and use the unique ID for the activity to find the pattern node to the activity node.
  • The activityPatternBinding node requires that you supply a regular expression for the ID string of the UI element that you wish to hide.

An example for hiding the IWorkbenchCommandConstants.WINDOW_SHOW_KEY_ASSIST menu entry is shown next.

<extension point="org.eclipse.ui.activities">
<activity
id="de.tudd.wsageditor.application.activities.hideKeyAssist"
name="Hide Key Assist Menu Entry">
</activity>
<activityPatternBinding
activityId="de.tudd.wsageditor.application.activities.hideKeyAssist"
isEqualityPattern="false"
pattern="org\.eclipse\.ui\.window\.showKeyAssist">
</activityPatternBinding>
</extension>

B Using ActionSetRegistry

public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
        ...
        protected void fillMenuBar(IMenuManager menuBar) {
                ...
                removeUnwantedMenuEntries();
        }

        private void removeUnwantedMenuEntries() {

                ArrayList<string> unwantedMenuEntries = new ArrayList<string>();
                unwantedMenuEntries
                                .add("org.eclipse.ui.edit.text.actionSet.navigation");
                unwantedMenuEntries
                                .add("org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo");
                unwantedMenuEntries.add("org.eclipse.ui.actionSet.openFiles");

                ActionSetRegistry reg = WorkbenchPlugin.getDefault()
                                .getActionSetRegistry();
                IActionSetDescriptor[] actionSets = reg.getActionSets();

                for (int i = 0; i < actionSets.length; i++) {
                        for (String aID : unwantedMenuEntries) {
                                if (!actionSets[i].getId().equals(aID))
                                        continue;
                                IExtension ext = actionSets[i].getConfigurationElement()
                                                .getDeclaringExtension();
                                reg.removeExtension(ext, new Object[] { actionSets[i] });
                        }
                }
        }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s