Eclipse RCP Miscs Series 2


Eclipse RCP Miscs Series 2

Perspective listener
-- Define the behavior what to do when perspective is activated or changed.
IWorkbenchWindow.addPerspectiveListener(IPerspectiveListener listener) and removePerspectiveListener(IPerspectiveListener listener).

Allow user to bring job dialog back
After checked the Checkbox "always run in background", there would be no way to re-show it, so RCP application should define one preference to allow user to reshow the dialog.
    protected void createFieldEditors()
    {
       runInBackground = new BooleanFieldEditor(
           IPreferenceConstants.RUN_IN_BACKGROUND,
           "Always run in background",
           getFieldEditorParent());
       addField(runInBackground);
}
    public boolean performOk()
    {
       try
       {
           WorkbenchPlugin
               .getDefault()
               .getPreferenceStore()
               .setValue(IPreferenceConstants.RUN_IN_BACKGROUND, runInBackground.getBooleanValue());
       }
       catch (IOException e)
       {
           e.printStackTrace();
       }
       return super.performOk();
    }
ToolTip for TreeItem

Since SWT/JFace 3.3, your TreeViewer's lable provider can extend ColumnLabelProvider, and implement the cool getTooltip() methods, and enable it by ColumnViewerToolTipSupport.enableFor (viewer);

1. Outside of your rcp project, type
mvn3
org.sonatype.tycho:maven-tycho-plugin:generate-poms -DgroupId=se.mattiasholmqvist -Dtycho.targetPlatform=~/dev/eclipse-3.6.1-delta/
This will create a pom.xml for the current directory (parent project) and a pom.xml for each eclipse project.
2. Building the product
mvn3
clean package -Dtycho.targetPlatform=~/dev/eclipse-3.6.1-delta/

Export product to other platforms
1. Download and install Eclipse DelatPack
In the page, http://download.eclipse.org/eclipse/downloads/, search DeltaPack.
2. Configure org.sonatype.tycho/maven-osgi-packaging-plugin in pom.xml: set the environment values for the target platform.
You can get these values form the delta pack:
org.eclipse.equinox.launcher.${ws}.${os}.${arch}_1.1.0.v20100503
For instance, from
org.eclipse.equinox.launcher.motif.aix.ppc_1.1.0.v20100503, we can see to build a AIX product:
ws should be motif, os should be aix, arch should be ppc.


A concrete example:

Labels

adsense (5) Algorithm (69) Algorithm Series (35) Android (7) ANT (6) bat (8) Big Data (7) Blogger (14) Bugs (6) Cache (5) Chrome (19) Code Example (29) Code Quality (7) Coding Skills (5) Database (7) Debug (16) Design (5) Dev Tips (63) Eclipse (32) Git (5) Google (33) Guava (7) How to (9) Http Client (8) IDE (7) Interview (88) J2EE (13) J2SE (49) Java (186) JavaScript (27) JSON (7) Learning code (9) Lesson Learned (6) Linux (26) Lucene-Solr (112) Mac (10) Maven (8) Network (9) Nutch2 (18) Performance (9) PowerShell (11) Problem Solving (11) Programmer Skills (6) regex (5) Scala (6) Security (9) Soft Skills (38) Spring (22) System Design (11) Testing (7) Text Mining (14) Tips (17) Tools (24) Troubleshooting (29) UIMA (9) Web Development (19) Windows (21) xml (5)