Marcus Hirt's Private Blog

Thursday, February 9, 2012

Speaking at EclipseCon 2012!

Filed under: Programming — Marcus @ 10:56

I will be delivering a talk on the current state of the HotSpot and JRockit JVM convergence at EclipseCon 2012. For more information, see:

http://www.eclipsecon.org/2012/sessions/state-jrockit-hotspot-convergence-presented-oracle

My talk will be on Thursday the 29th of March, 11:00 – 11:45 in room Lake Anne.

Looking forward to seeing you there! Smile

Speaking at Jfokus!

Filed under: Programming — Marcus @ 10:23

I’ve been invited to  present the following session at Jfokus:

Presentation: What to Expect from HotRockit

Oracle is converging the HotSpot and Oracle JRockit JVMs to produce a "best-of-breed JVM." Internally, the project is sometimes referred to as the HotRockit project. This presentation discusses what to expect from the converged JVM over the next two years and how this will benefit the Java community.

My session will take place in A2, at 14:00 on Wednesday the 15th of February. Looking forward to seeing you there!

Wednesday, February 1, 2012

Getting Rid of Unwanted Preference Pages in Eclipse

Filed under: Programming — Marcus @ 10:36

I recently wanted to get rid of a preference page I did not want to expose in Mission Control (an Eclipse RCP based application), and ended up with the following code in my ApplicationWorkbenchWindowAdvisor:

private void removeUnwantedPreferencesPages() {
    PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager();
    IPreferenceNode root = getRoot(pm);
    removePrefsPage(root, "org.eclipse.equinox.security.ui.category"); //$NON-NLS-1$
}


private IPreferenceNode getRoot(PreferenceManager pm) {
    try {
        Method m = PreferenceManager.class.getDeclaredMethod("getRoot", (Class[]) null); //$NON-NLS-1$
        m.setAccessible(true);
        return (IPreferenceNode) m.invoke(pm);
    } catch (Exception e) {
       LoggingToolkit.getLogger().log(Level.WARNING, "Could not get the root node for the preferences, and will not be able to prune unwanted prefs pages.", e); //$NON-NLS-1$
    }
    return null;
}

private void removePrefsPage(IPreferenceNode root, String id) {
    for (IPreferenceNode node : root.getSubNodes()) {
        logPrefsNode(node);
        if (node.getId().equals(id)) {
           root.remove(node);
           LoggingToolkit.getLogger().log(Level.INFO, String.format("Removed preference page %s (ID:%s)", node.getLabelText(), node.getId()));   //$NON-NLS-1$
        } else {
           removePrefsPage(node, id);
        }
    }
}

If you need to know the ID of the preference page you wish to remove, simply walk the tree and print all the nodes instead of removing selected ones.

Hope this helps someone. Blinkar

Powered by WordPress