Exemplo n.º 1
0
  private static PaletteContainer createComplexPartsDrawer() {
    PaletteDrawer drawer =
        new PaletteDrawer(
            LogicMessages.LogicPlugin_Category_ComplexParts_Label,
            ImageDescriptor.createFromFile(Circuit.class, "icons/can.gif")); // $NON-NLS-1$

    List entries = new ArrayList();

    CombinedTemplateCreationEntry combined =
        new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_HalfAdder_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_HalfAdder_Description,
            LogicDiagramFactory.getHalfAdderFactory(),
            ImageDescriptor.createFromFile(Circuit.class, "icons/halfadder16.gif"), // $NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/halfadder24.gif") // $NON-NLS-1$
            );
    entries.add(combined);

    combined =
        new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_FullAdder_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_FullAdder_Description,
            LogicDiagramFactory.getFullAdderFactory(),
            ImageDescriptor.createFromFile(Circuit.class, "icons/fulladder16.gif"), // $NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/fulladder24.gif") // $NON-NLS-1$
            );
    entries.add(combined);

    drawer.addAll(entries);
    return drawer;
  }
/** $Id: UCMEditorPaletteFactory.java,v 1.29 2006/04/01 03:44:03 franco Exp $ $Author: franco $ */
 @Override
 protected void handleFinished() {
   containingDrawer.setVisible(true);
   super.handleFinished();
 }
  /**
   * 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);
  }
Exemplo n.º 5
0
  private static PaletteContainer createComponentsDrawer() {

    PaletteDrawer drawer =
        new PaletteDrawer(
            LogicMessages.LogicPlugin_Category_Components_Label,
            ImageDescriptor.createFromFile(Circuit.class, "icons/comp.gif")); // $NON-NLS-1$

    List entries = new ArrayList();

    CombinedTemplateCreationEntry combined =
        new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_FlowContainer_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_FlowContainer_Description,
            new SimpleFactory(LogicFlowContainer.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/logicflow16.gif"), // $NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/logicflow24.gif") // $NON-NLS-1$
            );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    combined =
        new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_Circuit_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_Circuit_Description,
            new SimpleFactory(Circuit.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/circuit16.gif"), // $NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/circuit24.gif") // $NON-NLS-1$
            );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    entries.add(new PaletteSeparator());

    combined =
        new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_Label_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_Label_Description,
            new SimpleFactory(LogicLabel.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/label16.gif"), // $NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/label24.gif") // $NON-NLS-1$
            );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    combined =
        new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_LED_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_LED_Description,
            new SimpleFactory(LED.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/ledicon16.gif"), // $NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/ledicon24.gif") // $NON-NLS-1$
            );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    combined =
        new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_ORGate_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_ORGate_Description,
            new SimpleFactory(OrGate.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/or16.gif"), // $NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/or24.gif") // $NON-NLS-1$
            );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    combined =
        new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_XORGate_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_XORGate_Description,
            new SimpleFactory(XORGate.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/xor16.gif"), // $NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/xor24.gif") // $NON-NLS-1$
            );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    combined =
        new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_ANDGate_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_ANDGate_Description,
            new SimpleFactory(AndGate.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/and16.gif"), // $NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/and24.gif") // $NON-NLS-1$
            );
    combined.setToolClass(LogicCreationTool.class);
    entries.add(combined);

    PaletteStack liveGroundStack =
        new PaletteStack(
            LogicMessages.LogicPlugin_Tool_CreationTool_LiveGroundStack_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_LiveGroundStack_Description,
            null);

    combined =
        new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_LiveOutput_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_LiveOutput_Description,
            new SimpleFactory(LiveOutput.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/live16.gif"), // $NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/live24.gif") // $NON-NLS-1$
            );
    combined.setToolClass(LogicCreationTool.class);
    liveGroundStack.add(combined);

    combined =
        new CombinedTemplateCreationEntry(
            LogicMessages.LogicPlugin_Tool_CreationTool_Ground_Label,
            LogicMessages.LogicPlugin_Tool_CreationTool_Ground_Description,
            new SimpleFactory(GroundOutput.class),
            ImageDescriptor.createFromFile(Circuit.class, "icons/ground16.gif"), // $NON-NLS-1$
            ImageDescriptor.createFromFile(Circuit.class, "icons/ground24.gif") // $NON-NLS-1$
            );
    combined.setToolClass(LogicCreationTool.class);
    liveGroundStack.add(combined);

    entries.add(liveGroundStack);

    drawer.addAll(entries);
    return drawer;
  }