Java 类org.eclipse.gef.palette.PaletteContainer 实例源码

项目:Hydrograph    文件:CustomPaletteViewer.java   
private void showMatchingContainers(PaletteRoot paletteRoot,
        Map<String, PaletteDrawer> categoryPaletteContainer, List<Component> matchingComponents) {
    List<PaletteContainer> children = paletteRoot.getChildren();
    for (PaletteContainer paletteContainer : children) {
        paletteContainer.setVisible(false);

    }
    for (Component component : matchingComponents) {
        for (int i = 0; i < children.size(); i++) {
            if (children.get(i).equals(categoryPaletteContainer.get(component.getCategory().name()))) {
                children.get(i).setVisible(true);
            }
        }
    }

}
项目:triquetrum    文件:PaletteTreeEditPartFactory.java   
/**
 * @see org.eclipse.gef.EditPartFactory#createEditPart(EditPart, Object)
 */
@Override
public EditPart createEditPart(EditPart parentEditPart, Object model) {
  if (model instanceof UserLibraryTreeNode) {
    return new UserLibraryTreeNodeEditPart((PaletteContainer) model);
  }
  if (model instanceof PaletteContainer) {
    if (parentEditPart instanceof UserLibraryTreeNodeEditPart) {
      return new UserLibraryTreeNodeEditPart((PaletteContainer) model);
    } else {
      return new PaletteTreeNodeEditPart((PaletteContainer) model);
    }
  }
  if (model instanceof PaletteEntry) {
    return new PaletteEntryEditPart((PaletteEntry) model);
  }
  return null;
}
项目:gef-gwt    文件:PaletteEditPartFactory.java   
/**
 * @see org.eclipse.gef.EditPartFactory#createEditPart(EditPart, Object)
 */
public EditPart createEditPart(EditPart parentEditPart, Object model) {
    if (model instanceof PaletteRoot)
        return createMainPaletteEditPart(parentEditPart, model);
    if (model instanceof PaletteStack)
        return createStackEditPart(parentEditPart, model);
    if (model instanceof PaletteContainer) {
        Object type = ((PaletteContainer) model).getType();
        if (PaletteDrawer.PALETTE_TYPE_DRAWER.equals(type))
            return createDrawerEditPart(parentEditPart, model);
        if (PaletteGroup.PALETTE_TYPE_GROUP.equals(type)
                || PaletteContainer.PALETTE_TYPE_UNKNOWN.equals(type))
            return createGroupEditPart(parentEditPart, model);
        if (PaletteToolbar.PALETTE_TYPE_TOOLBAR_GROUP.equals(type))
            return createToolbarEditPart(parentEditPart, model);
    }
    if (model instanceof PaletteTemplateEntry)
        return createTemplateEditPart(parentEditPart, model);
    if (model instanceof PaletteSeparator)
        return createSeparatorEditPart(parentEditPart, model);
    if (model instanceof PaletteEntry)
        return createEntryEditPart(parentEditPart, model);
    return null;
}
项目:gef-gwt    文件:PaletteTreeProvider.java   
/**
 * This method is invoked whenever there is any change in the model. It
 * updates the viewer with the changes that were made to the model.
 * Sub-classes may override this method to change or extend its
 * functionality.
 * 
 * @param evt
 *            The {@link PropertyChangeEvent} that was fired from the model
 */
protected void handlePropertyChanged(PropertyChangeEvent evt) {
    PaletteEntry entry = ((PaletteEntry) evt.getSource());
    String property = evt.getPropertyName();
    if (property.equals(PaletteEntry.PROPERTY_LABEL)
            || property.equals(PaletteEntry.PROPERTY_SMALL_ICON)) {
        viewer.update(entry, null);
    } else if (property.equals(PaletteEntry.PROPERTY_VISIBLE)) {
        viewer.refresh(entry);
    } else if (property.equals(PaletteContainer.PROPERTY_CHILDREN)) {
        viewer.refresh(entry);
        List oldChildren = (List) evt.getOldValue();
        for (Iterator iter = oldChildren.iterator(); iter.hasNext();) {
            PaletteEntry child = (PaletteEntry) iter.next();
            traverseModel(child, false);
        }
        traverseModel(entry, true);
    }
}
项目:UML-Testing-Tool    文件:ClassDiagramPaletteTest.java   
@SuppressWarnings("unchecked")
private <T extends PaletteEntry> T findByLabel(final PaletteContainer thePaletteContainer, final String theLabel) {
    final String[] path = theLabel.split("/");
    PaletteEntry nextEntry = thePaletteContainer;
    NEXT_SEGMENT: for (final String segment : path) {
        if (nextEntry instanceof PaletteContainer) {
            for (final Object o : ((PaletteContainer) nextEntry).getChildren()) {
                final PaletteEntry paletteEntry = (PaletteEntry) o;
                if (segment.equals(paletteEntry.getLabel())) {
                    nextEntry = paletteEntry;
                    continue NEXT_SEGMENT;
                }
            }
            return null;
        } else {
            return null;
        }
    }
    return (T) nextEntry;
}
项目:snaker-designer    文件:PaletteFactory.java   
private PaletteContainer createFieldDrawer() {
    List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
    String group = "表单控件";
    PaletteDrawer drawer = new PaletteDrawer(group,
            ImageDescriptor.createFromFile(TaskFigure.class,
                    "icons/home.png"));

    List<Component> listComp = ConfigManager.getComponents();

    for (int i = 0; i < listComp.size(); i++) {
        Component comp = (Component) listComp.get(i);
        if (!validate(ConfigManager.COMPONENT_TYPE_FIELD, comp)) {
            continue;
        }
        PaletteEntry paletteEntry = createCombinedEntry(comp);
        if (paletteEntry == null) {
            continue;
        }
        entries.add(paletteEntry);
    }

    drawer.addAll(entries);
    drawer.setInitialState(2);
    return drawer;
}
项目:birt    文件:DesignerPaletteFactory.java   
private static PaletteContainer createQuickTools( )
{

    PaletteCategory quickTools = new PaletteCategory( IPreferenceConstants.PALETTE_CONTENT,
            Messages.getString( "DesignerPaletteFactory.quicktool.title" ), //$NON-NLS-1$
            ReportPlatformUIImages.getImageDescriptor( ISharedImages.IMG_OBJ_FOLDER ) );
    ReportElementFactory factory = new ReportElementFactory( AGG_TEMPLATE );
    CombinedTemplateCreationEntry combined = new QuickToolsCombinedTemplateCreationEntry( Messages.getString( "DesignerPaletteFactory.quicktool.agg.title" ), //$NON-NLS-1$
            Messages.getString( "DesignerPaletteFactory.quicktool.agg.toolTip" ), //$NON-NLS-1$
            AGG_TEMPLATE, 
            factory,
            ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_AGGREGATION ),
            ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_AGGREGATION_LARGE ) ) ;
    quickTools.add( combined );

    factory = new ReportElementFactory( TIMEPERIOD_TEMPLATE );
    combined = new QuickToolsCombinedTemplateCreationEntry( Messages.getString( "DesignerPaletteFactory.quicktool.timeperiod.title" ), //$NON-NLS-1$
            Messages.getString( "DesignerPaletteFactory.quicktool.timeperiod.toolTip" ), //$NON-NLS-1$
            TIMEPERIOD_TEMPLATE, 
            factory,
            ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TIMEPERIOD ),
            ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TIMEPERIOD_LARGE ) ) ;
    quickTools.add( combined );
    return quickTools;
}
项目:HelloBrazil    文件:Wc2014PaletteFactory.java   
/**
 * Creates "wc2014" palette tool group
 * @generated
 */
private PaletteContainer createWc20141Group() {
    PaletteGroup paletteContainer = new PaletteGroup(
            Messages.Wc20141Group_title);
    paletteContainer.setId("createWc20141Group"); //$NON-NLS-1$
    paletteContainer.add(createTeam1CreationTool());
    paletteContainer.add(createTeamAtGroup2CreationTool());
    paletteContainer.add(createMatchHome3CreationTool());
    paletteContainer.add(createMatchAway4CreationTool());
    paletteContainer.add(createGroupMatch5CreationTool());
    paletteContainer.add(createEliminationMatch6CreationTool());
    paletteContainer.add(createEliminationMatchWinner7CreationTool());
    paletteContainer.add(createGroup8CreationTool());
    paletteContainer.add(createGroupFirstTeam9CreationTool());
    paletteContainer.add(createGroupSecondTeam10CreationTool());
    return paletteContainer;
}
项目:simplified-bpmn-example    文件:SimpleBPMNPaletteFactory.java   
/**
 * Creates "Objects" palette tool group
 * @generated
 */
private PaletteContainer createObjects1Group() {
    PaletteDrawer paletteContainer = new PaletteDrawer(
            SimpleBPMN.diagram.part.Messages.Objects1Group_title);
    paletteContainer.setId("createObjects1Group"); //$NON-NLS-1$
    paletteContainer.add(createANDGateway1CreationTool());
    paletteContainer.add(createActivity2CreationTool());
    paletteContainer.add(createDataObject3CreationTool());
    paletteContainer.add(createEndEvent4CreationTool());
    paletteContainer.add(createGroup5CreationTool());
    paletteContainer.add(createIntermediateEvent6CreationTool());
    paletteContainer.add(createLane7CreationTool());
    paletteContainer.add(createORGateway8CreationTool());
    paletteContainer.add(createPool9CreationTool());
    paletteContainer.add(createStartEvent10CreationTool());
    paletteContainer.add(createXORGateway11CreationTool());
    return paletteContainer;
}
项目:NIEM-Modeling-Tool    文件:PapyrusUtils.java   
@SuppressWarnings("unchecked")
private static <T extends PaletteEntry> T findByLabel(final PaletteContainer thePaletteContainer, final String theLabel) {
    final String[] path = theLabel.split("/");
    PaletteEntry nextEntry = thePaletteContainer;
    NEXT_SEGMENT: for (final String segment : path) {
        if (nextEntry instanceof PaletteContainer) {
            for (final Object o : ((PaletteContainer) nextEntry).getChildren()) {
                final PaletteEntry paletteEntry = (PaletteEntry) o;
                if (ObjectUtils.equals(segment, paletteEntry.getLabel())) {
                    nextEntry = paletteEntry;
                    continue NEXT_SEGMENT;
                }
            }
            return null;
        } else {
            return null;
        }
    }
    return (T) nextEntry;
}
项目:seg.jUCMNav    文件:ProgressTests.java   
/**
 * Try to find if the palette can create an element of a certain class. Because of current visibility restrictions, we can't actually look for factories or
 * try to create such an element. For now, we have to simply look for the template class used by the CombinedTemplateCreationEntry. Ideally, we should
 * search for the appropriate model creation factory.
 * 
 * @param c
 *            The template to find in one of UcmPaletteRoot's CombinedTemplateCreationEntry
 * @return the CreationTool that was found in the palette or null if none could be found
 */
private CreationTool getToolEntryForClass(Class c) {

    Stack s = new Stack();
    List l = getPaletteRoot().getChildren();
    for (int i = 0; i < l.size(); i++)
        s.push(l.get(i));

    while (s.size() > 0) {
        Object o = s.pop();
        if (o instanceof PaletteContainer) {
            l = ((PaletteContainer) o).getChildren();
            for (int i = 0; i < l.size(); i++)
                s.push(l.get(i));
        } else if (o instanceof CombinedTemplateCreationEntry) {
            Object template = ((CombinedTemplateCreationEntry) o).getTemplate();

            if (template == c) {
                return (CreationTool) ((CombinedTemplateCreationEntry) o).createTool();
            }
        }
    }
    return null;
}
项目:seg.jUCMNav    文件:ProgressTests.java   
/**
 * Take a ToolEntry class and try to find if an instance of this kind of entry is present in the palette.
 * 
 * @param entry
 *            The Class of the tool entry you want to verify the existence in the palette.
 * @return True if the method find a tool entry of the entry type, else false.
 */
private boolean isToolEntryPresent(Class entry) {
    Stack s = new Stack();
    List l = getPaletteRoot().getChildren();
    for (int i = 0; i < l.size(); i++)
        s.push(l.get(i));

    while (s.size() > 0) {
        Object o = s.pop();
        if (o instanceof PaletteContainer) {
            l = ((PaletteContainer) o).getChildren();
            for (int i = 0; i < l.size(); i++)
                s.push(l.get(i));
        } else if (o.getClass() == entry) {
            return true;
        }
    }
    return false;
}
项目:MMINT    文件:MIDDiagramEditor.java   
/**
 * @generated NOT
 */
protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) {

    PaletteRoot root = createPaletteRootGen(existingPaletteRoot);
    ModelRel modelRel = (ModelRel) this.getDiagram().getElement();
    if (!modelRel.isInstancesLevel()) {
        for (Object paletteContainer : root.getChildren()) {
            for (Object paletteEntry : ((PaletteContainer) paletteContainer)
                    .getChildren()) {
                if (paletteEntry instanceof ToolEntry
                        && !(paletteEntry instanceof PanningSelectionToolEntry || paletteEntry instanceof PaletteToolEntry)) {
                    ((ToolEntry) paletteEntry)
                            .setLabel(((ToolEntry) paletteEntry).getLabel() + " " + modelRel.getLevel().toString().charAt(0) + modelRel.getLevel().toString().toLowerCase().substring(1));
                    ((ToolEntry) paletteEntry)
                            .setDescription(((ToolEntry) paletteEntry)
                                    .getDescription() + " " + modelRel.getLevel().toString().charAt(0) + modelRel.getLevel().toString().toLowerCase().substring(1));
                }
            }
        }
    }

    return root;
}
项目:d-case_editor    文件:DcasePaletteFactory.java   
/**
 * Creates "Nodes" palette tool group
 * @generated
 */
private PaletteContainer createNodes1Group() {
    PaletteDrawer paletteContainer = new PaletteDrawer(
            Messages.Nodes1Group_title);
    paletteContainer.setId("createNodes1Group"); //$NON-NLS-1$
    paletteContainer.setDescription(Messages.Nodes1Group_desc);

    paletteContainer.add(createGoal1CreationTool());
    paletteContainer.add(createEvidence3CreationTool());
    paletteContainer.add(createStrategy2CreationTool());
    paletteContainer.add(createContext6CreationTool());
    paletteContainer.add(createJustification7CreationTool());
    paletteContainer.add(createUserdef0044CreationTool());  // Assumption
    paletteContainer.add(createUndeveloped5CreationTool());
    paletteContainer.add(createUserdef0055CreationTool());  // Module
    paletteContainer.add(createUserdef0066CreationTool());  // Contract

    return paletteContainer;
}
项目:d-case_editor    文件:DcasePaletteFactory.java   
/**
 * Creates "Option Nodes" palette tool group
 * @generated
 */
private PaletteContainer createOptionNodes2Group() {
    PaletteDrawer paletteContainer = new PaletteDrawer(
            Messages.OptionNodes2Group_title);
    paletteContainer.setId("createOptionNodes2Group"); //$NON-NLS-1$
    paletteContainer.setDescription(Messages.OptionNodes2Group_desc);

    paletteContainer.add(createMonitor4CreationTool());
    paletteContainer.add(createSystem8CreationTool());
    paletteContainer.add(createPolicy9CreationTool());
    paletteContainer.add(createUserdef0011CreationTool());
    paletteContainer.add(createUserdef0022CreationTool());
    paletteContainer.add(createUserdef0033CreationTool());

    return paletteContainer;
}
项目:Hydrograph    文件:HydrographComponentProposalProvider.java   
@Override
public IContentProposal[] getProposals(String contents, int position) {

    proposalList.clear();
    List<PaletteContainer> paletteEntry = paletteRoot.getChildren();
    for (PaletteContainer paletteContainer : paletteEntry) {
        List<PaletteEntry> paletteDrawersList = paletteContainer.getChildren();
        for (PaletteEntry paletteDrawer : paletteDrawersList) {

            if (StringUtils.containsIgnoreCase(
                    paletteDrawer.getParent().getLabel() + " : " + paletteDrawer.getLabel(), contents)) {
                String componentName = ((Class) ((CombinedTemplateCreationEntry) paletteDrawer).getTemplate())
                        .getSimpleName();
                componentDetails = new ComponentDetails();
                Component component = XMLConfigUtil.INSTANCE.getComponent(componentName);
                componentDetails.setName(componentName);
                componentDetails.setCategoryAndPalletteName(
                        paletteDrawer.getParent().getLabel() + " : " + paletteDrawer.getLabel());
                componentDetails.setDescription(component.getDescription());
                componentDetails.setDescriptor(paletteDrawer.getSmallIcon());
                proposalList.add(new ComponentContentProposal(componentDetails));
            }
        }
    }

    componentDetails = new ComponentDetails();
    componentDetails.setName(COMMENT_BOX);
    componentDetails.setCategoryAndPalletteName(COMMENT_BOX);
    componentDetails.setDescription(COMMENT_BOX);
    componentDetails.setDescriptor(getCommentBoxImageDisDescriptor());
    proposalList.add(new ComponentContentProposal(componentDetails));
    return proposalList.toArray(new IContentProposal[0]);
}
项目:triquetrum    文件:PaletteTreeNodeEditPart.java   
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected List getModelChildren() {
  List children = new ArrayList();
  PaletteEntry entry = (PaletteEntry) getModel();
  if (entry instanceof PaletteContainer) {
    PaletteContainer pc = (PaletteContainer) entry;
    children.addAll(pc.getChildren());
  }
  return children;
}
项目:triquetrum    文件:PaletteTreeViewer.java   
@Override
public void run() {
  PaletteEntry entry = (PaletteEntry) selectedNode.getModel();
  String modelName = entry.getLabel();
  String modelClass = entry.getDescription();
  String elementType = "CompositeActor";

  Map<String, String> properties = new HashMap<>();
  properties.put("displayName", modelName);
  properties.put("class", modelClass);
  properties.put("type", elementType);
  String parentTreePath = selectedNode.getParentTreePath('.');
  properties.put("libraryName", parentTreePath);

  Event event = new Event(LibraryManager.DELETE_EVENT_TOPIC, properties);
  try {
    // Sending events is nice to decouple UI handling from the underlying library management,
    // but we don't get any indication about success/failure.
    // So we may need to replace this by direct method calls.
    TriqEditorPlugin.getDefault().getEventAdminService().sendEvent(event);
    // The palette's model consists of 2 layers : palette entry editparts that have palette entries as model.
    // And way down there's still the Ptolemy UserLibrary as well.
    // Getting all models synchronized via listeners would be the cleanest, but couldn't get it to work.
    // (org.eclipse.gef.editparts.AbstractEditPart.refreshChildren() always caused errors in reorderChild()
    // because of a null parent somewhere. Too complex for me to understand...)
    // So we do all the deletes ourselves in here...
    ((PaletteTreeNodeEditPart) selectedNode.getParent()).removeChild(selectedNode);
    PaletteContainer container = entry.getParent();
    if (container != null) {
      container.remove(entry);
    }
    getTreeViewer().refresh(selectedNode.getParent());
  } catch (NullPointerException e) {
    StatusManager.getManager().handle(
        new Status(IStatus.ERROR, TriqEditorPlugin.getID(), "Event bus not available, impossible to trigger a delete event for the user library."),
        StatusManager.BLOCK);
  }
}
项目:triquetrum    文件:UserLibraryTreeNode.java   
/**
 * checks if the given entry is a PaletteEntry and is a (deep) child of this user library node.
 * 
 * @param entry
 * @return true if the given entry is in this user library subtree
 */
public boolean isMember(Object entry) {
  if (!(entry instanceof PaletteEntry)) {
    return false;
  } else {
    PaletteEntry pe = (PaletteEntry) entry;
    boolean result = false;
    PaletteContainer parent = pe.getParent();
    while (!result && parent != null) {
      result = (this == parent);
      parent = parent.getParent();
    }
    return result;
  }
}
项目:xtext-gef    文件:StatemachinePaletteFactory.java   
/**
 * Creates "statemachine" palette tool group
 * @generated
 */
private PaletteContainer createStatemachine1Group() {
    PaletteGroup paletteContainer = new PaletteGroup(
            Messages.Statemachine1Group_title);
    paletteContainer.setId("createStatemachine1Group"); //$NON-NLS-1$
    paletteContainer.add(createState1CreationTool());
    paletteContainer.add(createTransition2CreationTool());
    return paletteContainer;
}
项目:statecharts    文件:DefaultSCTPaletteFactory.java   
public void createPaletteEntries(PaletteRoot root) {
    PaletteContainer container = createToolsCategory(root);
    createTransitionEntry(container);
    createStateEntry(container);
    createCompositeStateEntry(container);
    createOrthogonalStateEntry(container);
    createRegionEntry(container);
    createInitialStateEntry(container);
    createShallowHistoryEntry(container);
    createDeepHistoryEntry(container);
    createFinalStateEntry(container);
    createExitEntry(container);
    createChoiceEntry(container);
    createSynchronizationEntry(container);
}
项目:gef-gwt    文件:PaletteEditPart.java   
/**
 * @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
 */
public List getModelChildren() {
    List modelChildren;
    if (getModel() instanceof PaletteContainer)
        modelChildren = new ArrayList(
                ((PaletteContainer) getModel()).getChildren());
    else
        return Collections.EMPTY_LIST;

    PaletteEntry prevVisibleEntry = null;
    for (Iterator iter = modelChildren.iterator(); iter.hasNext();) {
        PaletteEntry entry = (PaletteEntry) iter.next();
        if (!entry.isVisible())
            // not visible
            iter.remove();
        else if (entry instanceof PaletteSeparator
                && prevVisibleEntry == null)
            // first visible item in a group is a separator, don't need it
            iter.remove();
        else if (entry instanceof PaletteSeparator
                && prevVisibleEntry instanceof PaletteSeparator)
            // previous visible entry was a separator, don't need it
            iter.remove();
        else
            prevVisibleEntry = entry;
    }
    // check to see if last visible entry was a separator, and thus should
    // be hidden
    if (prevVisibleEntry instanceof PaletteSeparator)
        modelChildren.remove(prevVisibleEntry);

    return modelChildren;
}
项目:gef-gwt    文件:PaletteEditPart.java   
/**
 * @see java.beans.PropertyChangeListener#propertyChange(PropertyChangeEvent)
 */
public void propertyChange(PropertyChangeEvent evt) {
    String property = evt.getPropertyName();
    if (property.equals(PaletteContainer.PROPERTY_CHILDREN)) {
        traverseChildren((List) evt.getOldValue(), false);
        refreshChildren();
        traverseChildren((List) evt.getNewValue(), true);
    } else if (property.equals(PaletteEntry.PROPERTY_LABEL)
            || property.equals(PaletteEntry.PROPERTY_SMALL_ICON)
            || property.equals(PaletteEntry.PROPERTY_LARGE_ICON)
            || property.equals(PaletteEntry.PROPERTY_DESCRIPTION))
        refreshVisuals();
}
项目:gef-gwt    文件:PaletteStackFactory.java   
/**
 * @see org.eclipse.gef.ui.palette.customize.PaletteEntryFactory#createNewEntry(org.eclipse.swt.widgets.Shell,
 *      org.eclipse.gef.palette.PaletteEntry)
 */
public PaletteEntry createNewEntry(Shell shell, PaletteEntry selected) {
    PaletteContainer parent = determineContainerForNewEntry(selected);
    int index = determineIndexForNewEntry(parent, selected);
    PaletteEntry entry = createNewEntry(shell);
    parent.remove(selected);
    parent.add(index - 1, entry);
    ((PaletteStack) entry).add(selected);
    entry.setUserModificationPermission(PaletteEntry.PERMISSION_FULL_MODIFICATION);
    return entry;
}
项目:gef-gwt    文件:PaletteContainerFactory.java   
/**
 * @see PaletteEntryFactory#determineContainerForNewEntry(PaletteEntry)
 */
protected PaletteContainer determineContainerForNewEntry(
        PaletteEntry selected) {
    if (selected instanceof PaletteRoot)
        return (PaletteContainer) selected;
    PaletteContainer current = selected.getParent();
    while (!(current instanceof PaletteRoot))
        current = current.getParent();
    return current;
}
项目:gef-gwt    文件:PaletteContainerFactory.java   
/**
 * @see PaletteEntryFactory#determineIndexForNewEntry(PaletteContainer,
 *      PaletteEntry)
 */
protected int determineIndexForNewEntry(PaletteContainer parent,
        PaletteEntry selected) {
    if (parent == selected) {
        return 0;
    }

    List children = parent.getChildren();
    PaletteEntry current = selected;
    while (!children.contains(current)) {
        current = current.getParent();
    }
    return children.indexOf(current) + 1;
}
项目:gef-gwt    文件:PaletteLabelProvider.java   
/**
 * @see org.eclipse.jface.viewers.ILabelProvider#getImage(Object)
 */
public Image getImage(Object element) {
    PaletteEntry entry = (PaletteEntry) element;
    ImageDescriptor descriptor = entry.getSmallIcon();
    if (descriptor == null) {
        if (entry instanceof PaletteContainer) {
            descriptor = InternalImages.DESC_FOLDER_OPEN;
        } else if (entry instanceof PaletteSeparator) {
            descriptor = InternalImages.DESC_SEPARATOR;
        } else {
            return null;
        }
    }
    return getCachedImage(descriptor);
}
项目:gef-gwt    文件:PaletteTreeProvider.java   
/**
 * If the given element does not have any children, this method should
 * return <code>null</code>. This fixes the problem where a "+" sign is
 * incorrectly placed next to an empty container in the tree.
 * 
 * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object)
 */
public Object[] getChildren(Object parentElement) {
    if (parentElement instanceof PaletteContainer) {
        List children = ((PaletteContainer) parentElement).getChildren();
        if (!children.isEmpty()) {
            return children.toArray();
        }
    }
    return null;
}
项目:ROADDesigner    文件:SmcPaletteFactory.java   
/**
 * Creates "Node" palette tool group
 * @generated
 */
private PaletteContainer createNode1Group() {
    PaletteDrawer paletteContainer = new PaletteDrawer(
            Messages.Node1Group_title);
    paletteContainer.setId("createNode1Group"); //$NON-NLS-1$
    paletteContainer.add(createSMC1CreationTool());
    paletteContainer.add(createRole2CreationTool());
    paletteContainer.add(createContract3CreationTool());
    paletteContainer.add(createFact4CreationTool());
    paletteContainer.add(createPlayer5CreationTool());
    return paletteContainer;
}
项目:ROADDesigner    文件:SmcPaletteFactory.java   
/**
 * Creates "Connection" palette tool group
 * @generated
 */
private PaletteContainer createConnection2Group() {
    PaletteDrawer paletteContainer = new PaletteDrawer(
            Messages.Connection2Group_title);
    paletteContainer.setId("createConnection2Group"); //$NON-NLS-1$
    paletteContainer.add(createContractRoleA1CreationTool());
    paletteContainer.add(createContractRoleB2CreationTool());
    paletteContainer.add(createPlayerBinding3CreationTool());
    paletteContainer.add(createFactLink4CreationTool());
    paletteContainer.add(createExternalFactLink5CreationTool());
    return paletteContainer;
}
项目:snaker-designer    文件:PaletteFactory.java   
private PaletteContainer createTaskDrawer(PaletteRoot root) {
    String group = "流程组件";

    List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
    PaletteDrawer drawer = new PaletteDrawer(group,
            ImageDescriptor.createFromFile(TaskFigure.class,
                    "icons/home.png"));

    ConnectionCreationToolEntry connectionToolEntry = new ConnectionCreationToolEntry(
            "transition", "创建连接", new ModelCreationFactory(null,
                    Transition.class), ImageDescriptor.createFromFile(
                    TaskFigure.class, "icons/flow_sequence.png"),
            ImageDescriptor.createFromFile(TaskFigure.class,
                    "icons/flow_sequence.png"));

    drawer.add(connectionToolEntry);

    List<Component> listComp = ConfigManager.getComponents();

    for (int i = 0; i < listComp.size(); i++) {
        Component comp = (Component) listComp.get(i);
        if (!validate(ConfigManager.COMPONENT_TYPE_PROCESS, comp)) {
            continue;
        }
        PaletteEntry paletteEntry = createCombinedEntry(comp);
        if (paletteEntry == null) {
            continue;
        }
        entries.add(paletteEntry);
    }

    drawer.addAll(entries);
    return drawer;
}
项目:simplified-bpmn-example    文件:SimpleBPMNPaletteFactory.java   
/**
 * Creates "Connections" palette tool group
 * @generated
 */
private PaletteContainer createConnections2Group() {
    PaletteDrawer paletteContainer = new PaletteDrawer(
            SimpleBPMN.diagram.part.Messages.Connections2Group_title);
    paletteContainer.setId("createConnections2Group"); //$NON-NLS-1$
    paletteContainer.add(createAssociation1CreationTool());
    paletteContainer.add(createMessageFlow2CreationTool());
    paletteContainer.add(createSequenceFlow3CreationTool());
    return paletteContainer;
}
项目:wt-studio    文件:PaletteFactory.java   
private static PaletteContainer createControlGroup(PaletteRoot root)
{
    PaletteGroup controlGroup = new PaletteGroup("Control Group");

    List<PaletteEntry> tools = new ArrayList<PaletteEntry>();
    ToolEntry selectionTool = new SelectionToolEntry();
    tools.add(selectionTool);
    root.setDefaultEntry(selectionTool);
    controlGroup.addAll(tools);
    return controlGroup;
}
项目:wt-studio    文件:PaletteFactory.java   
private static PaletteContainer createControlGroup(PaletteRoot root)
{
    PaletteGroup controlGroup = new PaletteGroup("Control Group");

    List<PaletteEntry> tools = new ArrayList<PaletteEntry>();
    ToolEntry selectionTool = new SelectionToolEntry();
    tools.add(selectionTool);
    root.setDefaultEntry(selectionTool);
    // ToolEntry connectionCreationTool = new ConnectionCreationToolEntry("Connection",
    // "Create a connection", null, null, null);
    // tools.add(connectionCreationTool);
    controlGroup.addAll(tools);
    return controlGroup;
}
项目:lunifera-sharky-m2m    文件:ShapesEditorPaletteFactory.java   
/** Create the "Shapes" drawer. */
private static PaletteContainer createShapesDrawer() {
    PaletteDrawer componentsDrawer = new PaletteDrawer("Shapes");

    CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry("Rectangle",
        "Create a rectangular shape", RectangularShape.class, new SimpleFactory(RectangularShape.class),
        ImageDescriptor.createFromFile(ShapesPlugin.class, "icons/rectangle16.gif"),
        ImageDescriptor.createFromFile(ShapesPlugin.class, "icons/rectangle24.gif"));
    componentsDrawer.add(component);

    return componentsDrawer;
}
项目:lunifera-sharky-m2m    文件:ShapesEditorPaletteFactory.java   
/** Create the "Shapes" drawer. */
private static PaletteContainer createShapesDrawer() {
    PaletteDrawer componentsDrawer = new PaletteDrawer("Shapes");

    CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry("Rectangle",
        "Create a rectangular shape", RectangularShape.class, new SimpleFactory(RectangularShape.class),
        ImageDescriptor.createFromFile(ShapesPlugin.class, "icons/rectangle16.gif"),
        ImageDescriptor.createFromFile(ShapesPlugin.class, "icons/rectangle24.gif"));
    componentsDrawer.add(component);

    return componentsDrawer;
}
项目:MMINT    文件:ICSE15_SequenceDiagram_MAVOPaletteFactory.java   
/**
* Creates "Objects" palette tool group
* @generated
*/
private PaletteContainer createObjects1Group() {
    PaletteDrawer paletteContainer = new PaletteDrawer(
            edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.part.Messages.Objects1Group_title);
    paletteContainer.setId("createObjects1Group"); //$NON-NLS-1$
    paletteContainer.add(createClass1CreationTool());
    paletteContainer.add(createLifeline2CreationTool());
    paletteContainer.add(createMessage3CreationTool());
    paletteContainer.add(createOperation4CreationTool());
    return paletteContainer;
}
项目:MMINT    文件:ICSE15_SequenceDiagram_MAVOPaletteFactory.java   
/**
* Creates "Connections" palette tool group
* @generated
*/
private PaletteContainer createConnections2Group() {
    PaletteDrawer paletteContainer = new PaletteDrawer(
            edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.part.Messages.Connections2Group_title);
    paletteContainer.setId("createConnections2Group"); //$NON-NLS-1$
    paletteContainer.add(createClassReference1CreationTool());
    paletteContainer.add(createOperationReference2CreationTool());
    paletteContainer.add(createSourceLifelineReference3CreationTool());
    paletteContainer.add(createTargetLifelineReference4CreationTool());
    return paletteContainer;
}
项目:MMINT    文件:NECSIS14_ClassDiagramPaletteFactory.java   
/**
 * Creates "Objects" palette tool group
 * @generated
 */
private PaletteContainer createObjects1Group() {
    PaletteDrawer paletteContainer = new PaletteDrawer(
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part.Messages.Objects1Group_title);
    paletteContainer.setId("createObjects1Group"); //$NON-NLS-1$
    paletteContainer.add(createAttribute1CreationTool());
    paletteContainer.add(createClass2CreationTool());
    return paletteContainer;
}
项目:MMINT    文件:NECSIS14_ClassDiagramPaletteFactory.java   
/**
 * Creates "Connections" palette tool group
 * @generated
 */
private PaletteContainer createConnections2Group() {
    PaletteDrawer paletteContainer = new PaletteDrawer(
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part.Messages.Connections2Group_title);
    paletteContainer.setId("createConnections2Group"); //$NON-NLS-1$
    paletteContainer.add(createAssociation1CreationTool());
    paletteContainer.add(createParent2CreationTool());
    return paletteContainer;
}