Do the following for jemf and testemf plugins:
getFileExtensionFilters() in the new files TestemfEditorAdvisor.java and JemfEditorAdvisor.java, change result.addAll(EcoreEditor.FILE_EXTENSION_FILTERS) to result.add(EcoreEditor.ECORE_FILE_EXTENSION).In TestemfEditorAdvisor.initialize(), append the following:
// register resource factories
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("testemf", new XMIResourceFactoryImpl());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("tst", new TstResourceFactoryImpl());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("emf", new XMIResourceFactoryImpl());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("html", new MmaResourceFactoryImpl());
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("tml", new TmlResourceFactoryImpl());
// cause the package to be registered
TestemfPackage testemfPackage = TestemfPackage.eINSTANCE;
EmfPackage emfPackage = EmfPackage.eINSTANCE;
org.eclipse.ui.commands.org.eclipse.ui.commands and select New->category.edu.utk.sqrl.emf.commands.category), name, and description fields.org.eclipse.ui.commands and select New->command.edu.utk.sqrl.emf.commands.cmd, where cmd is the command name in lower case.org.eclipse.ui.menus.org.eclipse.ui.menus and select New->menuContribution.menu:org.eclipse.ui.main.menu?after=additions.edu.utk.sqrl.emf.menus.main), and mnemonic fields.edu.utk.sqrl.emf.menus.cmd, where cmd is the command name in lower case.org.eclipse.ui.handlers.org.eclipse.ui.handlers and select New->handler.edu.utk.sqrl.emf.handlers.CheckModel) that will process this command.execute() method.isEnabled() and isHandled() methods must return true to activate the associated menu item.Note: If a menu item is used by a plug-in higher in the dependency hierarchy AND activeWhen and enabledWhen expressions are needed for that menu item, then an equivalent handler extension point must be added to the using plug-in.
Caveat: This is useful to know but turned out to be the wrong thing to do for ESTA'. It turned out to be better to eliminate the generated File->Open... extension point because Open File... gives you access to Eclipse built in editors (e.g., text and html), while Open... is just configured for EMF generated file types. Removing Open... requires removing the associated action from the org.eclipse.ui.actionSets extension point and the associated command from the org.eclipse.ui.commands extension point (both in plugin.xml).
Anyway, here is the way to remove Open File...:
In the editor advisor class there should be a static WindowAdvisor subclass. Just add the postWindowCreate method below to the WindowAdvisor.
@Override
public void postWindowCreate() {
super.postWindowCreate();
// Find and remove the "Open File" menu item.
//
IMenuManager menuManager = getWindowConfigurer().getActionBarConfigurer().getMenuManager();
IContributionItem[] menuItems = menuManager.getItems();
// For each menu item, check the class.
//
for (int i = 0; i < menuItems.length; i++) {
IContributionItem menuItem = menuItems[i];
// If this is a menu manager, then check the id.
//
if (menuItem instanceof MenuManager) {
// If this is the file menu, then remove the "Open File" menu action.
//
if (menuItem.getId().equals("file")) {
((MenuManager) menuItem).remove("org.eclipse.ui.openLocalFile");
}
}
}
}