public void testFormalizedComponentNames() { Component_c component = Component_c.ComponentInstance( modelRoot, new ClassQueryInterface_c() { public boolean evaluate(Object candidate) { return ((Component_c) candidate).getName().equals(testDomain.getName()); } }); assertNotNull(component); if (!component.Isformal()) formalizeComponent(component); TreeItem item = ExplorerUtil.findItem(component); TreeItem fileFacade = item.getItem(0); assertTrue( "The file element in Model Explorer was not named correctly for a formal component.", fileFacade.getText().equals(testDomain.getName() + ": Component Diagram")); // open the component diagram CanvasUtilities.openCanvasEditor(component); GraphicalEditor ce = ((ModelEditor) PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .getActiveEditor()) .getGraphicalEditor(); assertTrue( "The opened diagram does not represent the formal contents of the component.", ce.getModel().getRepresents() instanceof Domain_c); assertTrue( "The editor title did not contain component diagram.", ((IEditorPart) ce).getTitle().indexOf("Component Diagram") != -1); }
@Override public void buildContextMenu(IMenuManager menu) { final MenuManager createMenuManager = new MenuManager("New", "com.mentor.nucleus.bp.ui.newroot"); // $NON-NLS-2$ final MenuManager openMenuManager = new MenuManager("Open With", "com.mentor.nucleus.bp.ui.openroot"); // $NON-NLS-2$ final MenuManager classesMenu = new MenuManager("Classes", "com.mentor.nucleus.bp.ui.classroot"); // $NON-NLS-2$ final MenuManager componentsMenu = new MenuManager("Components", "com.mentor.nucleus.bp.ui.componentroot"); // $NON-NLS-2$ final MenuManager externalMenu = new MenuManager("External", "com.mentor.nucleus.bp.ui.externalroot"); // $NON-NLS-2$ final MenuManager interactionMenu = new MenuManager("Interaction", "com.mentor.nucleus.bp.ui.interactionroot"); // $NON-NLS-2$ final MenuManager activityMenu = new MenuManager("Activity", "com.mentor.nucleus.bp.ui.activityroot"); // $NON-NLS-2$ final MenuManager typesMenu = new MenuManager("Types", "com.mentor.nucleus.bp.ui.typeroot"); // $NON-NLS-2$ final MenuManager useCaseMenu = new MenuManager("Usecase", "com.mentor.nucleus.bp.ui.usecaseroot"); // $NON-NLS-2$ menu.add(createMenuManager); createMenuManager.removeAll(); createMenuManager.add(new GroupMarker("com.mentor.nucleus.bp.ui.newmenu")); // $NON-NLS-1$ createMenuManager.add(activityMenu); activityMenu.removeAll(); activityMenu.add(new GroupMarker("com.mentor.nucleus.bp.ui.newactivitymenu")); createMenuManager.add(classesMenu); classesMenu.removeAll(); classesMenu.add(new GroupMarker("com.mentor.nucleus.bp.ui.newclassmenu")); createMenuManager.add(componentsMenu); componentsMenu.removeAll(); componentsMenu.add(new GroupMarker("com.mentor.nucleus.bp.ui.newcomponentmenu")); createMenuManager.add(externalMenu); externalMenu.removeAll(); externalMenu.add(new GroupMarker("com.mentor.nucleus.bp.ui.newexternalmenu")); createMenuManager.add(interactionMenu); interactionMenu.removeAll(); interactionMenu.add(new GroupMarker("com.mentor.nucleus.bp.ui.newinteractionmenu")); createMenuManager.add(typesMenu); typesMenu.removeAll(); typesMenu.add(new GroupMarker("com.mentor.nucleus.bp.ui.newtypemenu")); createMenuManager.add(useCaseMenu); useCaseMenu.removeAll(); useCaseMenu.add(new GroupMarker("com.mentor.nucleus.bp.ui.newusecasemenu")); menu.add(fEditor.getOpenAction()); menu.add(openMenuManager); openMenuManager.removeAll(); openMenuManager.add(new GroupMarker("com.mentor.nucleus.bp.ui.openmenu")); // $NON-NLS-1$ menu.add(new Separator("com.mentor.nucleus.bp.ui.context-internal")); // $NON-NLS-1$ menu.add(new Separator("com.mentor.nucleus.bp.ui.context-internal-end")); // $NON-NLS-1$ menu.add(new Separator()); menu.add(fEditor.getUndoAction()); menu.add(fEditor.getRedoAction()); menu.add(new Separator()); menu.add(fEditor.getCutAction()); // for some reason we must specifically set enabled here fEditor.getCutAction().setEnabled(fEditor.getCutAction().isEnabled()); menu.add(fEditor.getCopyAction()); fEditor.getCopyAction().setEnabled(fEditor.getCopyAction().isEnabled()); menu.add(fEditor.getPasteAction()); fEditor.getPasteAction().setEnabled(fEditor.getPasteAction().isEnabled()); menu.add(new Separator()); menu.add(fEditor.getSelectAllAction()); fEditor .getDeleteAction() .setEnabled( enableDelete( (IStructuredSelection) fEditor.getSite().getSelectionProvider().getSelection())); menu.add(fEditor.getDeleteAction()); fEditor.getRenameAction().setEnabled(RenameAction.canRenameAction()); menu.add(fEditor.getRenameAction()); menu.add(new Separator()); menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menu.add(new Separator()); menu.add(CorePlugin.getResourceImportAction()); menu.add(CorePlugin.getResourceExportAction()); }