By the way, I found a workaround but I am not satisfied with it. In the function createPartControl of my EditorPart, I cound the number of editor of my type, and if this number is 1, I update the menu with my info. There must be a better than counting.
Below is my current code:
[code]
int nb = 0;
IEditorReference[] editors = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().getEditorReferences();
for (IEditorReference editor : editors) {
if (editor.getId().equals(GameEditor.ID)) {
nb++;
}
}
if (nb == 1) {
IMenuManager menuBar = getEditorSite().getActionBars().getMenuManager();
IMenuManager menu = menuBar.findMenuUsingPath("game_menu/conditions_menu");
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint("fr.wassong.iNatch.conditions");
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] elements = extension.getConfigurationElements();
for (IConfigurationElement element : elements) {
menu.add(new ConditionAction(
element.getAttribute("id"),
element.getAttribute("name"),
element.getAttribute("class")));
}
}
}
[/code]