/** * Loads the default Tool. If a palette has been provided and that palette has a default, then * that tool is loaded. If not, the EditDomain's default tool is loaded. By default, this is the * {@link org.eclipse.gef.tools.SelectionTool}. */ public void loadDefaultTool() { setActiveTool(null); if (paletteRoot != null) { if (paletteRoot.getDefaultEntry() != null) { getPaletteViewer().setActiveTool(paletteRoot.getDefaultEntry()); return; } else getPaletteViewer().setActiveTool(null); } setActiveTool(getDefaultTool()); }
/** * Creates {@code ToolEntry}. * * @param paletteRoot the {@code PaletteRoot} entry * @return the {@code PaletteContainer} instance */ private static void createControlGroup(PaletteRoot paletteRoot) { PaletteGroup controlGroup = new PaletteGroup("Components"); /* Group for storing all the <code>PaletteEntry</code> */ List<PaletteEntry> entries = new ArrayList<PaletteEntry>(); /* Selection tool */ PaletteEntry entry = new SelectionToolEntry(); entries.add(entry); paletteRoot.setDefaultEntry((ToolEntry) entry); /* Marquee tool */ entry = new MarqueeToolEntry(); entries.add(entry); /* Separate the palette */ entry = new PaletteSeparator("org.neclipse.gef.struts2editor.ui.editor.palette.sep1"); entry.setUserModificationPermission(PaletteEntry.PERMISSION_NO_MODIFICATION); entries.add(entry); /* Tool Entry for Result connection creation */ entry = new ConnectionCreationToolEntry( "Result Connection", "Connect to Struts 2 Results", new SimpleFactory(S2ResultConnection.class), S2EditorUI.getImageDescriptor("icons/connection16.gif"), S2EditorUI.getImageDescriptor("icons/connection24.gif")); entries.add(entry); /* Tool Entry for Extends connection creation */ entry = new ConnectionCreationToolEntry( "Extends Connection", "Connect to Struts 2 Package", new SimpleFactory(S2ExtendsConnection.class), S2EditorUI.getImageDescriptor("icons/connection16.gif"), S2EditorUI.getImageDescriptor("icons/connection24.gif")); entries.add(entry); /* Tool Entry for Extends connection creation */ entry = new ConnectionCreationToolEntry( "Comment Connection", "Connect to Struts 2 Comment", new SimpleFactory(Object.class), S2EditorUI.getImageDescriptor("icons/connection16.gif"), S2EditorUI.getImageDescriptor("icons/connection24.gif")); entries.add(entry); controlGroup.addAll(entries); paletteRoot.add(controlGroup); }
@Override protected PaletteRoot getPaletteRoot() { PaletteRoot paletteRoot = new PaletteRoot(); PaletteGroup group = new PaletteGroup("Creation tools"); ImageDescriptor imgDesc = ModelGoonActivator.getImageDescriptor(ModelGoonIcons.COMMENT_ICON); group.add( new CreationToolEntry( "Note", "Insert a new Note in ", new SimpleFactory(Note.class), imgDesc, imgDesc)); paletteRoot.add(group); fillPalette(paletteRoot, group); return paletteRoot; }
private PaletteContainer createControlGroup(PaletteRoot root) { PaletteGroup controlGroup = new PaletteGroup("Control Group"); List<PaletteEntry> entries = new ArrayList<PaletteEntry>(); ToolEntry tool = new SelectionToolEntry(); entries.add(tool); root.setDefaultEntry(tool); tool = new MarqueeToolEntry(); entries.add(tool); PaletteSeparator sep = new PaletteSeparator("com.xrosstools.xdecision.editor.sep1"); sep.setUserModificationPermission(PaletteEntry.PERMISSION_NO_MODIFICATION); entries.add(sep); entries.add( new ConnectionCreationToolEntry( "Connection Creation", "Creating connection between decision nodes", null, Activator.getDefault().getImageRegistry().getDescriptor(Activator.CONNECTION), Activator.getDefault().getImageRegistry().getDescriptor(Activator.CONNECTION))); entries.add( new CombinedTemplateCreationEntry( "Create node", "Create diagram node", DecisionTreeNode.class, new SimpleFactory(DecisionTreeNode.class), Activator.getDefault().getImageRegistry().getDescriptor(Activator.NODE), Activator.getDefault().getImageRegistry().getDescriptor(Activator.NODE))); controlGroup.addAll(entries); return controlGroup; }
/** @generated */ public void fillPalette(PaletteRoot paletteRoot) { paletteRoot.add(createPrimitiveComponentModel1Group()); }
public PaletteRoot createPalette() { PaletteRoot paletteRoot = new PaletteRoot(); paletteRoot.addAll(createCategories(paletteRoot)); return paletteRoot; }
/** @generated */ public void fillPalette(PaletteRoot paletteRoot) { paletteRoot.add(createStatechart1Group()); }
/** $Id: UCMEditorPaletteFactory.java,v 1.29 2006/04/01 03:44:03 franco Exp $ $Author: franco $ */
/** * Creates {@code ToolEntry} for the Struts components. * * @param paletteRoot the {@code PaletteRoot} entry * @return the {@code PaletteContainer} instance */ private static void createStrutsGroup(PaletteRoot paletteRoot) { // PaletteDrawer drawer = new PaletteDrawer("Administrative Elements"); IConfigurationElement[] cElements = S2Plugin.getDefault().getPaletteCategories(); for (IConfigurationElement cElement : cElements) { boolean collapsable = Boolean.getBoolean(cElement.getAttribute("collapsible")); PaletteContainer container = null; if (collapsable) { container = createCollapsableCategory(cElement); } else { container = createCategory(cElement); } paletteRoot.add(container); String categoryName = cElement.getAttribute("name"); PaletteDrawer drawer = new PaletteDrawer(categoryName); IConfigurationElement[] cEntries = cElement.getChildren(); for (IConfigurationElement cEntry : cEntries) { try { String eName = cEntry.getAttribute("name"); Object eClass = cEntry.createExecutableExtension("class"); String iSmall = cEntry.getAttribute("smallimage"); String iLarge = cEntry.getAttribute("largeimage"); String description = cElement.getAttribute("description"); PaletteEntry entry = new CombinedTemplateCreationEntry( eName, description, new SimpleFactory(eClass.getClass()), S2EditorUI.getImageDescriptor(iSmall), S2EditorUI.getImageDescriptor(iLarge)); drawer.add(entry); } catch (CoreException e) { e.printStackTrace(); } } paletteRoot.add(drawer); } // /* Tool Entry for Bean creation */ // PaletteEntry entry = new CombinedTemplateCreationEntry("Bean", // "Create Struts 2 Bean", new SimpleFactory(S2Bean.class), // S2EditorUI.getImageDescriptor("icons/11880.bmp.gif"), // S2EditorUI.getImageDescriptor("icons/11880.bmp.gif")); // drawer.add(entry); // // /* Tool Entry for Constant creation */ // entry = new CombinedTemplateCreationEntry("Constant", // "Create Struts 2 Constant", new SimpleFactory(S2Constant.class), // S2EditorUI.getImageDescriptor("icons/17405.thread_view.png"), // S2EditorUI.getImageDescriptor("icons/17405.thread_view.png")); // drawer.add(entry); // // /* Tool Entry for package creation */ // entry = new CombinedTemplateCreationEntry("Package", // "Create Struts 2 Package", S2Package.class, new SimpleFactory(S2Package.class), // S2EditorUI.getImageDescriptor("icons/10464.package_obj.gif"), // S2EditorUI.getImageDescriptor("icons/10464.package_obj.gif")); // drawer.add(entry); // // /* Tool Entry for Include creation */ // entry = new CombinedTemplateCreationEntry("Include", // "Create Struts 2 Include", new SimpleFactory(S2Include.class), // S2EditorUI.getImageDescriptor("icons/showchild_mode.gif"), // S2EditorUI.getImageDescriptor("icons/showchild_mode.gif")); // drawer.add(entry); // paletteRoot.add(drawer); // // drawer = new PaletteDrawer("Request Handling"); // // /* Tool Entry for Action Creation */ // entry = new CombinedTemplateCreationEntry("Action", // "Create Struts 2 Action", new SimpleFactory(S2Action.class), // S2EditorUI.getImageDescriptor("icons/innerclass_public_obj.gif"), // S2EditorUI.getImageDescriptor("icons/innerclass_public_obj.gif")); // drawer.add(entry); // // /* Tool Entry for default-Action Creation */ // entry = new CombinedTemplateCreationEntry("Default Action Reference", // "Create Struts 2 Default Action Reference", new SimpleFactory(Object.class), // S2EditorUI.getImageDescriptor("icons/innerclass_public_obj.gif"), // S2EditorUI.getImageDescriptor("icons/innerclass_public_obj.gif")); // drawer.add(entry); // // /* Tool Entry for Interceptors creation */ // entry = new CombinedTemplateCreationEntry("Interceptors", // "Create Struts 2 Interceptor", new SimpleFactory(S2Interceptors.class), // S2EditorUI.getImageDescriptor("icons/arraypartition_obj.gif"), // S2EditorUI.getImageDescriptor("icons/arraypartition_obj.gif")); // drawer.add(entry); // // /* Tool Entry for Interceptor creation */ // entry = new CombinedTemplateCreationEntry("Interceptor", // "Create Struts 2 Interceptor", new SimpleFactory(S2Interceptor.class), // S2EditorUI.getImageDescriptor("icons/remove_correction.gif"), // S2EditorUI.getImageDescriptor("icons/remove_correction.gif")); // drawer.add(entry); // // /* Tool Entry for Interceptor-stack creation */ // entry = new CombinedTemplateCreationEntry("Interceptor-Stack", // "Create Struts 2 Interceptor-stack", new SimpleFactory(S2InterceptorStack.class), // S2EditorUI.getImageDescriptor("icons/thin_max_view.gif"), // S2EditorUI.getImageDescriptor("icons/thin_max_view.gif")); // drawer.add(entry); // // /* Tool Entry for Interceptor-ref creation */ // entry = new CombinedTemplateCreationEntry("Interceptor-ref", // "Create Struts 2 Interceptor-ref", new SimpleFactory(S2InterceptorRef.class), // S2EditorUI.getImageDescriptor("icons/change.gif"), // S2EditorUI.getImageDescriptor("icons/change.gif")); // drawer.add(entry); // // paletteRoot.add(drawer); // // drawer = new PaletteDrawer("Error Handling"); // /* Tool Entry for Exception creation */ // entry = new CombinedTemplateCreationEntry("Exception", // "Create Struts 2 Exception mappings", new SimpleFactory(Object.class), // S2EditorUI.getImageDescriptor("icons/10377.enum_obj.gif"), // S2EditorUI.getImageDescriptor("icons/10377.enum_obj.gif")); // drawer.add(entry); // paletteRoot.add(drawer); // // drawer = new PaletteDrawer("Resources"); // /* Tool Entry for JSP/HTML Page creation */ // entry = new CombinedTemplateCreationEntry("JSP/HTML", // "Create JSP/HTML pages", new SimpleFactory(S2JSPHTML.class), // S2EditorUI.getImageDescriptor("icons/14474.PD_Plugin.gif"), // S2EditorUI.getImageDescriptor("icons/14474.PD_Plugin.gif")); // drawer.add(entry); // paletteRoot.add(drawer); // // drawer = new PaletteDrawer("Comments"); // // /* Tool Entry for Comment creation */ // entry = new CombinedTemplateCreationEntry("Comment", // "Create a new Comment", new SimpleFactory(S2Comment.class), // S2EditorUI.getImageDescriptor("icons/10377.enum_obj.gif"), // S2EditorUI.getImageDescriptor("icons/10377.enum_obj.gif")); // drawer.add(entry); // paletteRoot.add(drawer); }
static PaletteRoot createPalette() { PaletteRoot logicPalette = new PaletteRoot(); logicPalette.addAll(createCategories(logicPalette)); return logicPalette; }
private static PaletteContainer createControlGroup(PaletteRoot root) { PaletteGroup controlGroup = new PaletteGroup(LogicMessages.LogicPlugin_Category_ControlGroup_Label); List entries = new ArrayList(); ToolEntry tool = new PanningSelectionToolEntry(); entries.add(tool); root.setDefaultEntry(tool); PaletteStack marqueeStack = new PaletteStack(LogicMessages.Marquee_Stack, "", null); // $NON-NLS-1$ // NODES CONTAINED (default) marqueeStack.add(new MarqueeToolEntry()); // NODES TOUCHED MarqueeToolEntry marquee = new MarqueeToolEntry(); marquee.setToolProperty( MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR, new Integer(MarqueeSelectionTool.BEHAVIOR_NODES_TOUCHED)); marqueeStack.add(marquee); // NODES CONTAINED AND RELATED CONNECTIONS marquee = new MarqueeToolEntry(); marquee.setToolProperty( MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR, new Integer(MarqueeSelectionTool.BEHAVIOR_NODES_CONTAINED_AND_RELATED_CONNECTIONS)); marqueeStack.add(marquee); // NODES TOUCHED AND RELATED CONNECTIONS marquee = new MarqueeToolEntry(); marquee.setToolProperty( MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR, new Integer(MarqueeSelectionTool.BEHAVIOR_NODES_TOUCHED_AND_RELATED_CONNECTIONS)); marqueeStack.add(marquee); // CONNECTIONS CONTAINED marquee = new MarqueeToolEntry(); marquee.setToolProperty( MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR, new Integer(MarqueeSelectionTool.BEHAVIOR_CONNECTIONS_CONTAINED)); marqueeStack.add(marquee); // CONNECTIONS TOUCHED marquee = new MarqueeToolEntry(); marquee.setToolProperty( MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR, new Integer(MarqueeSelectionTool.BEHAVIOR_CONNECTIONS_TOUCHED)); marqueeStack.add(marquee); marqueeStack.setUserModificationPermission(PaletteEntry.PERMISSION_NO_MODIFICATION); entries.add(marqueeStack); tool = new ConnectionCreationToolEntry( LogicMessages.LogicPlugin_Tool_ConnectionCreationTool_ConnectionCreationTool_Label, LogicMessages .LogicPlugin_Tool_ConnectionCreationTool_ConnectionCreationTool_Description, null, ImageDescriptor.createFromFile(Circuit.class, "icons/connection16.gif"), // $NON-NLS-1$ ImageDescriptor.createFromFile(Circuit.class, "icons/connection24.gif") // $NON-NLS-1$ ); entries.add(tool); controlGroup.addAll(entries); return controlGroup; }