예제 #1
0
  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;
  }
예제 #2
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;
  }