How to set the light theme as the default theme? - eclipse-rcp

Eclipse RCP 2022-06
After exporting the product, I found that if the current theme of win10 is dark, RCP also uses the dark theme
In other words, eclipse will now decide which theme to choose at startup based on the theme of the operating system
How do disable this feature?? I don't want to use it until the dark theme is complete
Updated as recommended by greg-449
Possibly set system property org.eclipse.swt.internal.win32.useDarkModeExplorerTheme to false. Look at the source of Display to see all the properties that can be set on Windows
This is my exported product profile
-startup
plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.500.v20220509-0833
-clearPersistedState
--launcher.appendVmargs
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=17
-Dorg.eclipse.swt.internal.win32.useDarkModeExplorerTheme=false
-Xms1024m
-Xmx2048m
-XX:+UseG1GC
--add-modules=ALL-SYSTEM
Still unsolvable
Reply to howlger
The exported product is the most basic product
This is a particularly simple test for the new version of RCP export products
Other settings are based on platform feature
plugin.xml
<plugin>
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
application="org.eclipse.ui.ide.workbench"
name="BitFan">
<property
name="appName"
value="BitFan">
</property>
<property
name="windowImages"
value="logo16.png,logo32.png,logo48.png,logo64.png,logo128.png,logo256.png">
</property>
<property
name="startupForegroundColor"
value="FFFFFF">
</property>
<property
name="startupMessageRect"
value="30,272,445,20">
</property>
<property
name="startupProgressRect"
value="28,295,445,15">
</property>
<property
name="applicationCSSResources"
value="platform:/plugin/org.eclipse.ui.themes/images/">
</property>
<property
name="applicationXMI"
value="org.eclipse.platform/LegacyIDE.e4xmi">
</property>
<property
name="cssTheme"
value="org.eclipse.e4.ui.css.theme.e4_default">
</property>
<property
name="buildIdLocation"
value="0,220">
</property>
<property
name="buildIdSize"
value="293,40">
</property>
<property
name="preferenceCustomization"
value="plugin_customization.ini">
</property>
</product>
</extension>
</plugin>
Reply to howlger again
boolean hasDarkTheme = getThemes().stream().anyMatch(t -> t.getId().startsWith(E4_DARK_THEME_ID));
String themeToRestore = Display.isSystemDarkTheme() && hasDarkTheme ? E4_DARK_THEME_ID : alternateTheme;
if (themeToRestore != null && flag) {
setTheme(themeToRestore, false);
}
I tracked that "Display.isSystemDarkTheme()" is true, so the dark theme is set
Then I set
-Dorg.eclipse.swt.internal.win32.useDarkModeExplorerTheme=false in the Run Configurations VM Arguments
clear run, still the dark theme
This parameter has no effect
It judges by reading the registry
public static boolean isSystemDarkTheme () {
boolean isDarkTheme = false;
/*
* The registry settings, and Dark Theme itself, is present since Win10 1809
*/
if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1809) {
int[] result = OS.readRegistryDwords(OS.HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme");
if (result!=null) {
isDarkTheme = (result[0] == 0);
}
}
return isDarkTheme;
}
I think this problem can only be solved by deleting the dark theme , But how to delete it? It seems that the "org.eclipse.ui.activities" extension point cannot disable themes
Maybe I can remove it through removeExtension, but this needs to be done before the workbench starts. At present, I only know that the splashHandlers extension point can be implemented. Should I do this?

Under normal circumstances, there is no way to solve this problem, because the restore method of ThemeEngine determines whether to use dark theme according to the Display
#Override
public void restore(String alternateTheme) {
String prefThemeId = getPreferenceThemeId();
// Bug 562794, 563601: Eclipse once contained two identical themes named
// "Classic" and "Windows Classic" and the second was removed with bug 562794.
// An old workspace using the removed "Windows Classic" theme would be reseted
// to the default theme on update. Since both themes are identical we silently
// change the theme to the remaining "Classic" theme and don't disturb the user.
if ("org.eclipse.e4.ui.css.theme.e4_classic6.0,6.1,6.2,6.3".equals(prefThemeId)) { //$NON-NLS-1$
prefThemeId = "org.eclipse.e4.ui.css.theme.e4_classic"; //$NON-NLS-1$
}
boolean flag = true;
if (prefThemeId != null) {
for (ITheme t : getThemes()) {
if (prefThemeId.equals(t.getId())) {
setTheme(t, false);
flag = false;
break;
}
}
}
/*
* Any Platform: if the system has Dark appearance set and Eclipse is using the
* default settings, then start Eclipse in Dark theme. Check that there is a
* dark theme present.
*/
boolean hasDarkTheme = getThemes().stream().anyMatch(t -> t.getId().startsWith(E4_DARK_THEME_ID));
String themeToRestore = Display.isSystemDarkTheme() && hasDarkTheme ? E4_DARK_THEME_ID : alternateTheme;
if (themeToRestore != null && flag) {
setTheme(themeToRestore, false);
}
}
But "Display.isSystemDarkTheme" is determined based on the operating system registry
public static boolean isSystemDarkTheme () {
boolean isDarkTheme = false;
/*
* The registry settings, and Dark Theme itself, is present since Win10 1809
*/
if (OS.WIN32_BUILD >= OS.WIN32_BUILD_WIN10_1809) {
int[] result = OS.readRegistryDwords(OS.HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme");
if (result!=null) {
isDarkTheme = (result[0] == 0);
}
}
return isDarkTheme;
}
Solution
Remove all themes first
private void removeThemes()throws Exception {
ExtensionRegistry registry = (ExtensionRegistry)Platform.getExtensionRegistry() ;
Field field = ExtensionRegistry.class.getDeclaredField("masterToken") ; //$NON-NLS-1$
field.setAccessible( true ) ;
Object masterToken = field.get(registry) ;
IExtensionPoint extPoint = registry.getExtensionPoint(ThemeEngine.THEME_PLUGIN_ID);
IExtension extensions[] = extPoint.getExtensions() ;
for (IExtension e : extensions ) {
if( "org.eclipse.ui.themes".equals( e.getContributor().getName() ) ) { //$NON-NLS-1$
registry.removeExtension( e , masterToken ) ;
return ;
}
}
}
Then add extension points in the appropriate plug-ins (I defined in the product plug-ins)
<extension
point="org.eclipse.e4.ui.css.swt.theme">
<theme
basestylesheeturi="platform:/plugin/org.eclipse.ui.themes/css/e4_default_win.css"
id="org.eclipse.e4.ui.css.theme.e4_default"
label="Light"
os="win32">
</theme>
</extension>
Finally, modify the start method of the application
#Override
public Object start(IApplicationContext appContext) throws Exception {
removeThemes();
...
...
}

Related

How to ensure that my key bindings have priority over other definitions

I am developing an RCP app. The app has an execution mode where I want to enable various key bindings to control Start, Stop, Continue, Repeat etc. The bindings will be enabled using an 'ExecutionContext' which is set when any of the relevant views are activated.
The context switching is done in each of the 'Execution' views.
#Override
public final void createPartControl(Composite parent)
{
addPartListener();
...
}
private void addPartListener()
{
this.getViewSite().getPage().addPartListener(new IPartListener2()
{
IContextActivation token = null;
#Override
public void partDeactivated(IWorkbenchPartReference partRef)
{
if (token != null)
{
System.out.println("End exec context");
IContextService contextService = (IContextService) PlatformUI.getWorkbench().getService(
IContextService.class);
contextService.deactivateContext(token);
token = null;
}
}
#Override
public void partActivated(IWorkbenchPartReference partRef)
{
System.out.println("Set exec context");
IContextService contextService = (IContextService) PlatformUI.getWorkbench().getService(
IContextService.class);
token = contextService.activateContext("AtfExecutionContext");
}
});
}
I can see via Console messages that my context is being set and some of the key bindings are working as expected.
However, if a key binding has already been assigned from another plugin, that binding has priority. E.g. I want to use Ctrl+F8 to stop but when that is pressed I get the 'Next perspective' action which is the workbench default.
The binding definition is
<extension
point="org.eclipse.ui.bindings">
<scheme
id="atfscheme"
name="atfscheme"
parentId="org.eclipse.ui.defaultAcceleratorConfiguration">
</scheme>
<key
commandId="com.xxx.atf.model.ui.commands.ExecKey.Start"
contextId="AtfExecutionContext"
schemeId="atfscheme"
sequence="M1+M2+F5">
<!-- F5 does not work but Ctrl-Shift-F5 does -->
</key>
</extension>
<extension
point="org.eclipse.ui.contexts">
<context
id="AtfExecutionContext"
name="AtfExecutionContext"
parentId="org.eclipse.debug.ui.debugging">
<!-- have tried various parentid values... -->
</context>
</extension>
It seems that only previously undefined accelerators work. What do I have to do to override existing definitions and activate mine when my context has been set?
There is a separate context service for each part, you must use the correct context service.
It isn't necessary to activate / deactivate the context on part activation / deactivation. The separate context services will deal with that automatically.
So activate in createPartControl with:
IContextService contextService = getSite().getService(IContextService.class);
token = contextService.activateContext("AtfExecutionContext");
and deactivate when the part closes.
You are also defining a new key binding scheme - that has to be activated separately and isn't what you want here. Just remove that and just use org.eclipse.ui.defaultAcceleratorConfiguration as the schemeId

Update Eclipse menu radio state from code

In the command handler for a radio state menu item, I prompt the user if they want to continue. If they choose no, I need to reset the selected menu item back to the previous value.
I am using HandlerUtil.updateRadioState(event.getCommand(), oldScope) but the menu stays with the new value.
Any suggestions?
Command Handler
#Override
public Object execute(ExecutionEvent event) throws ExecutionException {
if (HandlerUtil.matchesRadioState(event))
return null;
String scope = event.getParameter(RadioState.PARAMETER_ID);
if (MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Confirm restart",
"Switching source of Motors requires a restart. Continue?")) {
int connection = MotorDbPreferencesPage.DATABASE_ACCESS_LOCAL;
if ("Cloud".compareToIgnoreCase(scope) == 0) {
connection = MotorDbPreferencesPage.DATABASE_ACCESS_CLOUD;
}
Activator.getDefault().getPreferenceStore().setValue(MotorDbPreferencesPage.DATABASE_ACCESS, connection);
PlatformUI.getWorkbench().restart();
} else {
String oldScope = "Local";
// switch it back to the way it was before the user selected it
if ("Local".compareToIgnoreCase(scope) == 0) {
oldScope = "Cloud";
}
HandlerUtil.updateRadioState(event.getCommand(), oldScope);
}
return null;
}
Command definition in plugin.xml
<command
id="com.client.eclipse.connection"
name="Connection">
<commandParameter
id="org.eclipse.ui.commands.radioStateParameter"
name="State"
optional="false">
</commandParameter>
<state
class="org.eclipse.ui.handlers.RadioState:Cloud"
id="org.eclipse.ui.commands.radioState">
</state>
</command>
And the menu definition from plugin.xml
<menu
label="Connection">
<command
commandId="com.client.eclipse.connection"
label="Local"
style="radio">
<parameter
name="org.eclipse.ui.commands.radioStateParameter"
value="Local">
</parameter>
</command>
<command
commandId="com.client.eclipse.connection"
label="Cloud"
style="radio">
<parameter
name="org.eclipse.ui.commands.radioStateParameter"
value="Cloud">
</parameter>
</command>
</menu>
It's your responsability to call
HandlerUtil.updateRadioState(event.getCommand(), scope);
to make the GUI displays the new state. Without calling it, the radio state won't change.
It means that in the case of user is aborting, don't call this method at all.

How to manage key conflict handler of different commands in multipage editor

I have multipage editor and i'm using different commands in two pages with same key sequence 'M3+O'. I am getting key conflicting handlers.
Error:
!MESSAGE A conflict occurred for ALT+O:
Binding(ALT+O,
ParameterizedCommand(Command(adt.tools.wda_com.sap.adt.wda.controller.ui.addmethcommand,Add Method,
,
Category(org.eclipse.core.commands.categories.autogenerated,Uncategorized,Commands that were either auto-generated or have no category,true),
org.eclipse.ui.internal.MakeHandlersGo#2f2e3d,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
com.sap.adt.wda.controller.ui.contextTabScope,,,system)
Binding(ALT+O,
ParameterizedCommand(Command(adt.tools.wda_com.sap.adt.wda.controller.ui.addnodecommand,Add Node,
,
Category(org.eclipse.core.commands.categories.autogenerated,Uncategorized,Commands that were either auto-generated or have no category,true),
org.eclipse.ui.internal.MakeHandlersGo#184af18,
,,true),null),
org.eclipse.ui.defaultAcceleratorConfiguration,
com.sap.adt.wda.controller.ui.contextTabScope,,,system)
Extensions:
<extension
point="org.eclipse.ui.bindings">
<key
commandId="adt.tools.wda_com.sap.adt.wda.controller.ui.addmethcommand"
contextId="com.sap.adt.wda.controller.ui.contextScope"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M3+O">
</key>
<key
commandId="adt.tools.wda_com.sap.adt.wda.controller.ui.addnodecommand"
contextId="com.sap.adt.wda.controller.ui.contextScope"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M3+O">
</key>
</extension>
My own Context:
<extension
point="org.eclipse.ui.contexts">
<context
description="context scope"
id="com.sap.adt.wda.controller.ui.contextScope"
name="context scope"
parentId="org.eclipse.ui.contexts.window">
</context>
</extension>
Activation and deactivation: It is done through activation and deactivation of context. Below is the code snippet on page change.
Activation in 1st Page:
private void activateHandlers() {
IContextService contextService = (IContextService) (PlatformUI.getWorkbench().getService(IContextService.class));
if (contextService != null) {
activation = contextService.activateContext(IControllerConstants.CONTEXT_TAB_ECLIPSE_CONTEXT_ID);
}
IEditorSite site = getEditor().getEditorSite();
IHandlerService service = (IHandlerService) site.getService(IHandlerService.class);
IHandlerActivation nodeActivation = service.activateHandler(AddNodeHandler.COMMAND_ID, new AddNodeHandler());
activatedHandlers = new ArrayList<IHandlerActivation>();
activatedHandlers.add(nodeActivation );
}
Activation in 2nd Page:
private void activateHandlers() {
IContextService contextService = (IContextService) (PlatformUI.getWorkbench().getService(IContextService.class));
if (contextService != null) {
activation = contextService.activateContext(IControllerConstants.CONTEXT_TAB_ECLIPSE_CONTEXT_ID);
}
IEditorSite site = getEditor().getEditorSite();
IHandlerService service = (IHandlerService) site.getService(IHandlerService.class);
IHandlerActivation methodActivation = service.activateHandler(AddMethodHandler.COMMAND_ID, new AddMethodHandler());
activatedHandlers = new ArrayList<IHandlerActivation>();
activatedHandlers.add(methodActivation );
}
Deactivation similar in respective page:
public void deactivateHandlers() {
IContextService contextService = (IContextService) (PlatformUI.getWorkbench().getService(IContextService.class));
contextService.deactivateContext(activation);
IHandlerService service = (IHandlerService) getEditor().getEditorSite().getService(IHandlerService.class);
if (activatedHandlers != null) {
service.deactivateHandlers(activatedHandlers);
activatedHandlers = null;
}
}
Even after deactivation / activation on page change, the conflict appears.
Please let me know if there is a better approach.
Thanks.
Use a different context id for each page. You could make your main com.sap.adt.wda.controller.ui.contextScope the parent of each page context.

Android Custom Keyboard Implementation

I am developing Android custom keyboard. I imported android.view.inputmethod.InputMethodSubtype in my code while doing this I am getting an error message like this imported one cannot be resolved. Is there any eclipse plugin I need to install, as per my knowledge Android version above 1.6 will support IMF.
The question is very old but I am answering it as it might help another user who sees this.
OP asked if there is any plugin for Eclipse to install to resolve the issue but now we have Android Studio.
For those who want to implement Android Custom Keyboard:
First, download Google sample project for Android Custom Keyboard to start with.
There are three important features to decide which one you want: 1) theme (custom layout), 2) subtype and 3) emoticons.
For themes/ layouts: Create layout files. See the example code below:
<com.domain.keyboard.android.LatinKeyboardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#drawable/kb_bg_9"
android:keyBackground="#drawable/key_bg_fill_white"
android:keyPreviewLayout="#layout/key_preview_layout"
android:keyPreviewOffset="#dimen/keyPreviewOffset"
android:keyTextColor="#color/white"
android:popupLayout="#layout/keyboard_popup_layout" />
And use the following code in SoftKeyboard.java:
#Override
public View onCreateInputView() {
// Set custom theme to input view.
int themeLayout = sharedPreferences.getInt(THEME_KEY, R.layout.input_1);
mInputView = (LatinKeyboardView) getLayoutInflater().inflate(
themeLayout, null);
mInputView.setOnKeyboardActionListener(this);
// Close popup keyboard when screen is touched, if it's showing
mInputView.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
mInputView.closing();
}
return false;
}
});
// Apply the selected keyboard to the input view.
setLatinKeyboard(getSelectedSubtype());
return mInputView;
}
For subtype: Create a copy of qwerty.xml and edit it to replace the keys. Create another instance of LatinKeyboard in SoftKeyboard.java and use if or switch logic.
private LatinKeyboard getSelectedSubtype() {
final InputMethodSubtype subtype = mInputMethodManager.getCurrentInputMethodSubtype();
String s = subtype.getLocale();
switch (s) {
case "ps_AF":
mActiveKeyboard = mPashtoKeyboard;
mCurKeyboard = mPashtoKeyboard;
break;
case "fa_AF":
mCurKeyboard = mFarsiKeyboard;
break;
default:
mCurKeyboard = mQwertyKeyboard;
}
return mCurKeyboard;
}
And edit methods.xml to add subtypes:
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.sunzala.afghankeyboard.android.ImePreferences"
android:supportsSwitchingToNextInputMethod="true">
<subtype
android:imeSubtypeLocale="en_US"
android:imeSubtypeMode="keyboard"
android:label="#string/label_subtype_generic" />
<subtype
android:imeSubtypeLocale="ps_AF"
android:imeSubtypeMode="keyboard"
android:label="#string/label_subtype_generic" />
<subtype
android:imeSubtypeLocale="fa_AF"
android:imeSubtypeMode="keyboard"
android:label="#string/label_subtype_generic" />
</input-method>
For emoticons: Find library and integrate it with a keyboard. The emoticons will display with a key press.
if (primaryCode == -10000) {
showEmoticons();
}
Where -10000 is keycode.

Removing popUpMenus from CNF (Common Navigator Framework) in Eclipse

I have been partially successful at removing almost all the popUp menus from the Commons Navigator Framework simply by configuring the plugin.xml file.
There are 2 menus that refuse to go:
group.edit and
group.reorganize.
My plugin.xml config looks like this:
<extension
point="org.eclipse.ui.navigator.viewer">
<viewer
viewerId="org.eclipse.ui.example.navigator.view">
<popupMenu allowsPlatformContributions="false">
<insertionPoint
name="group.edit" />
<insertionPoint
name="group.reorganize" />
</popupMenu>
</viewer>
<viewerContentBinding
viewerId="org.eclipse.ui.thermo.navigator.view">
<includes>
<contentExtension
pattern="org.eclipse.ui.navigator.resourceContent"/>
</includes>
</viewerContentBinding>
</extension>
Setting the allowsPlatformContribution to false DOES stop contributions to be added to the context menu except for group.edit and group.reorganize... this is starting to look like a bug to me.
The obvious solution is to remove the insertion points from my <popUpMenu> but without them the application throws an exception:
Throwable: java.lang.IllegalArgumentException: Group not found: group.edit
java.lang.IllegalArgumentException: Group not found: group.edit
at org.eclipse.jface.action.ContributionManager.addToGroup(ContributionManager.java:131)
at org.eclipse.jface.action.ContributionManager.appendToGroup(ContributionManager.java:138)
at org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup.fillContextMenu(EditActionGroup.java:74)
at org.eclipse.ui.internal.navigator.resources.actions.EditActionProvider.fillContextMenu(EditActionProvider.java:50)
at org.eclipse.ui.navigator.NavigatorActionService.addCommonActionProviderMenu(NavigatorActionService.java:205)
at org.eclipse.ui.navigator.NavigatorActionService.fillContextMenu(NavigatorActionService.java:172)
at org.eclipse.ui.internal.navigator.CommonNavigatorManager.fillContextMenu(CommonNavigatorManager.java:258)
at org.eclipse.ui.internal.navigator.CommonNavigatorManager$4.menuAboutToShow(CommonNavigatorManager.java:273)
at org.eclipse.jface.action.MenuManager.fireAboutToShow(MenuManager.java:335)
at org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:463)
at org.eclipse.jface.action.MenuManager.access$1(MenuManager.java:459)
at org.eclipse.jface.action.MenuManager$2.menuShown(MenuManager.java:485)
It throws the same exception for the reorganize group.
I succeeded in removing the "group.edit" actions (Copy/Paste) and I've done it that way, using the Common Navigator extension points :
<extension
point="org.eclipse.ui.navigator.viewer">
<viewerActionBinding
viewerId="org.eclipse.ui.navigator.ProjectExplorer">
<includes>
<actionExtension
pattern="my.app.client.actions.MyAppEditActionExtension">
</actionExtension>
</includes>
</viewerActionBinding>
</extension>
<extension
point="org.eclipse.ui.navigator.navigatorContent">
<actionProvider
class="my.app.client.workshop.MyPasteActionProvider"
id="my.app.client.actions.MyAppEditActionExtension"
overrides="org.eclipse.ui.navigator.resources.actions.EditActions"
priority="highest">
<enablement>
<!-- A hack to allways be enabled -->
<not>
<systemTest
property="MyApp"
value="WONT-EVER-BE-SET">
</systemTest>
</not>
</enablement>
</actionProvider>
</extension>
And, with addition of "org.eclipse.ui.navigator.resources" in my plugin dependencies, I implemented "MyPasteActionProvider" like this :
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.internal.navigator.resources.actions.EditActionProvider;
/**
* Create the Edit actions (Cut/Copy/Paste)
* and register then globally in the workbench using EditActionProvider.
* <p/>
* Then, removes the Copy/Paste contributions in the pop-up menu.
*/
public class MyPasteActionProvider extends EditActionProvider {
public void fillContextMenu(IMenuManager menu) { super.fillContextMenu(menu);
// remove Copy/Paste contributions
IContributionItem copyItemRemoved = menu.remove("org.eclipse.ui.CopyAction");
IContributionItem pasteItemRemoved = menu.remove("org.eclipse.ui.PasteAction");
}
}
Well, that's a "discouraged access" but I was getting myself discouraged ;-)
JM.D
Generally you should be using the Command Framework with any recent version of Eclipse (3.3 or higher), this replaces the mechanism for providing popup menus in the Common Navigator.
This thread suggests to remove the things that are causing the menu items to appear in the first place:
They are probably in action sets, so if you can identify the action set that's causing the offensive contribution, you can do something like this in your WorkbenchAdvisor:
ActionSetRegistry reg = WorkbenchPlugin.getDefault()
.getActionSetRegistry();
IActionSetDescriptor[] actionSets = reg.getActionSets();
String[] removeActionSets = new String[] {
"org.eclipse.ui.cheatsheets.actionSet",
"org.eclipse.ui.edit.text.actionSet.annotationNavigation",
"org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
"org.eclipse.ui.WorkingSetActionSet",
"org.eclipse.update.ui.softwareUpdates", };
for (int i = 0; i < actionSets.length; i++)
{
boolean found = false;
for (int j = 0; j < removeActionSets.length; j++)
{
if (removeActionSets[j].equals(actionSets[i].getId()))
found = true;
}
if (!found)
continue;
IExtension ext = actionSets[i].getConfigurationElement()
.getDeclaringExtension();
reg.removeExtension(ext, new Object[] { actionSets[i] });
}
The closest bug I have found is the 145233: Make more obvious way to specify input (for RCP apps), with a similar hack.
Bug 143430 (CommonNavigator requires initialInput to be Adaptable) is a more general one, and would indicate that then CNF has been improved with eclipse3.5 (Galileo).
So do you also have this issue with 3.5 and a custom CNF class?
As mentioned in the article "Eclipse CNF: Navigator Content Extensions", CNF has evolved with eclipse3.5, and this article seems to have some tree with true custom contextual menu entries.