コード例 #1
0
  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;
  }
コード例 #2
0
  /**
   * 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);
  }
コード例 #3
0
/** $Id: UCMEditorPaletteFactory.java,v 1.29 2006/04/01 03:44:03 franco Exp $ $Author: franco $ */
コード例 #4
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;
  }