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

项目: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    文件:DefaultEntryPage.java   
/**
 * Creates a <code>Text</code>. This method is mainly a result of
 * code-factoring.
 * 
 * @param panel
 *            The Composite in which the Text is to be created
 * @param style
 *            The stylebits for the Text
 * @param text
 *            The text to be displayed in the Text
 * @return a text widget with griddata constraint
 */
protected Text createText(Composite panel, int style, String text) {
    if (getEntry() instanceof PaletteSeparator
            || getPermission() < PaletteEntry.PERMISSION_LIMITED_MODIFICATION) {
        style = style | SWT.READ_ONLY;
    }

    Text textBox = new Text(panel, style);
    textBox.setFont(panel.getFont());
    if (text != null)
        textBox.setText(text);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 200;
    textBox.setLayoutData(data);
    return textBox;
}
项目: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    文件: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);
}
项目:erflute    文件:ERDiagramPaletteRoot.java   
private void setupSeparator(final PaletteGroup group) {
    group.add(new PaletteSeparator());
}
项目:gef-gwt    文件:PaletteSeparatorFactory.java   
/**
 * @see org.eclipse.gef.ui.palette.customize.PaletteEntryFactory#createNewEntry(Shell)
 */
public PaletteEntry createNewEntry(Shell shell) {
    PaletteSeparator separator = new PaletteSeparator();
    return separator;
}
项目:gef-gwt    文件:PaletteSeparatorFactory.java   
/**
 * @see org.eclipse.gef.ui.palette.customize.PaletteEntryFactory#determineTypeForNewEntry(org.eclipse.gef.palette.PaletteEntry)
 */
protected Object determineTypeForNewEntry(PaletteEntry selected) {
    return PaletteSeparator.PALETTE_TYPE_SEPARATOR;
}
项目:wt-studio    文件:BODesignerEditorPaletteRoot.java   
public BODesignerEditorPaletteRoot() {
    PaletteGroup group = new PaletteGroup("");

    //增加Select 图标
    PanningSelectionToolEntry selectionToolEntry = new PanningSelectionToolEntry(
            ConstantResource.LABEL_SELECT);
    selectionToolEntry.setToolClass(MovablePanningSelectionTool.class);
    selectionToolEntry.setLargeIcon(Activator.getImageDescriptor("icons/arrow16.gif"));
    selectionToolEntry.setSmallIcon(Activator.getImageDescriptor("icons/arrow16.gif"));
    group.add(selectionToolEntry);
    group.add(new CreationToolEntry("Note", "Note", 
            new SimpleFactory(NoteModel.class), 
            null, 
            null));

    group.add(new PaletteSeparator());
    //增加Table 图标
    group.add(new CreationToolEntry(
            ConstantResource.LABEL_TABLE, 
            ConstantResource.LABEL_CREATE_TABLE, 
            new SimpleFactory(HdbTableModel.class), 
            Activator.getImageDescriptor("icons/model_new.gif"), 
            Activator.getImageDescriptor("icons/model_new.gif")));
    group.add(new CreationToolEntry(
            ConstantResource.LABEL_VIEW, 
            ConstantResource.LABEL_CREATE_VIEW, 
            new SimpleFactory(ViewModel.class), 
            Activator.getImageDescriptor("icons/view.gif"), 
            Activator.getImageDescriptor("icons/view.gif")));
    group.add(new ConnectionCreationToolEntry("Connection",
            "Create a connection",
            null, null, null));

    group.add(new PaletteSeparator());

    //添加关系
    /*ConnectionCreationToolEntry toolEntry1N = new ConnectionCreationToolEntry(
            ConstantResource.label_relation_one_to_many,
            ConstantResource.label_create_relation_one_to_many,
            new SimpleFactory(null), Activator
                    .getImageDescriptor(ImageResource.RELATION_1_N), Activator
                    .getImageDescriptor(ImageResource.RELATION_1_N));
    toolEntry1N.setToolClass(null);     
    group.add(toolEntry1N);     

    ConnectionCreationToolEntry toolEntryNN = new ConnectionCreationToolEntry(
            ConstantResource.label_relation_many_to_many,
            ConstantResource.label_create_relation_many_to_many,
            new SimpleFactory(null), Activator
                    .getImageDescriptor(ImageResource.RELATION_N_N), Activator
                    .getImageDescriptor(ImageResource.RELATION_N_N));
    toolEntryNN.setToolClass(null);     
    group.add(toolEntryNN);     


    ConnectionCreationToolEntry toolEntrySelf = new ConnectionCreationToolEntry(
            ConstantResource.label_relation_self,
            ConstantResource.label_create_relation_self,
            new SimpleFactory(null), Activator
                    .getImageDescriptor(ImageResource.RELATION_SELF), Activator
                    .getImageDescriptor(ImageResource.RELATION_SELF));
    toolEntrySelf.setToolClass(null);       
    group.add(toolEntrySelf);
    */      
    this.add(group);
    this.setDefaultEntry(selectionToolEntry);       

}
项目:ermasterr    文件:ERDiagramPaletteRoot.java   
public ERDiagramPaletteRoot() {
    final PaletteGroup group = new PaletteGroup("");

    // when tooltip equals to label, tooltip is not displayed.
    final PanningSelectionToolEntry selectionTool = new PanningSelectionToolEntry(ResourceString.getResourceString("label.select"));
    selectionTool.setToolClass(MovablePanningSelectionTool.class);
    selectionTool.setLargeIcon(ERDiagramActivator.getImageDescriptor(ImageKey.ARROW));
    selectionTool.setSmallIcon(ERDiagramActivator.getImageDescriptor(ImageKey.ARROW));

    group.add(selectionTool);
    // group.add(new MarqueeToolEntry());

    group.add(new CreationToolEntry(ResourceString.getResourceString("label.table"), ResourceString.getResourceString("label.create.table"), new SimpleFactory(ERTable.class), ERDiagramActivator.getImageDescriptor(ImageKey.TABLE_NEW), ERDiagramActivator.getImageDescriptor(ImageKey.TABLE_NEW)));

    group.add(new CreationToolEntry(ResourceString.getResourceString("label.view"), ResourceString.getResourceString("label.create.view"), new SimpleFactory(View.class), ERDiagramActivator.getImageDescriptor(ImageKey.VIEW), ERDiagramActivator.getImageDescriptor(ImageKey.VIEW)));

    final ConnectionCreationToolEntry oneToManyTool = new ConnectionCreationToolEntry(ResourceString.getResourceString("label.relation.one.to.many"), ResourceString.getResourceString("label.create.relation.one.to.many"), new SimpleFactory(Relation.class), ERDiagramActivator.getImageDescriptor(ImageKey.RELATION_1_N), ERDiagramActivator.getImageDescriptor(ImageKey.RELATION_1_N));
    oneToManyTool.setToolClass(RelationCreationTool.class);
    group.add(oneToManyTool);

    final ConnectionCreationToolEntry relationByExistingTool = new ConnectionCreationToolEntry(ResourceString.getResourceString("label.relation.by.existing.columns"), ResourceString.getResourceString("label.create.relation.by.existing.columns"), new SimpleFactory(RelationByExistingColumns.class), ERDiagramActivator.getImageDescriptor(ImageKey.RELATION_1_N), ERDiagramActivator.getImageDescriptor(ImageKey.RELATION_1_N));
    relationByExistingTool.setToolClass(RelationByExistingColumnsCreationTool.class);
    group.add(relationByExistingTool);

    final ConnectionCreationToolEntry manyToManyTool = new ConnectionCreationToolEntry(ResourceString.getResourceString("label.relation.many.to.many"), ResourceString.getResourceString("label.create.relation.many.to.many"), new SimpleFactory(RelatedTable.class), ERDiagramActivator.getImageDescriptor(ImageKey.RELATION_N_N), ERDiagramActivator.getImageDescriptor(ImageKey.RELATION_N_N));
    manyToManyTool.setToolClass(RelatedTableCreationTool.class);
    group.add(manyToManyTool);

    final ConnectionCreationToolEntry selfRelationTool = new ConnectionCreationToolEntry(ResourceString.getResourceString("label.relation.self"), ResourceString.getResourceString("label.create.relation.self"), new SimpleFactory(SelfRelation.class), ERDiagramActivator.getImageDescriptor(ImageKey.RELATION_SELF), ERDiagramActivator.getImageDescriptor(ImageKey.RELATION_SELF));
    selfRelationTool.setToolClass(SelfRelationCreationTool.class);
    group.add(selfRelationTool);

    group.add(new PaletteSeparator());

    final CreationToolEntry noteTool = new CreationToolEntry(ResourceString.getResourceString("label.note"), ResourceString.getResourceString("label.create.note"), new SimpleFactory(Note.class), ERDiagramActivator.getImageDescriptor(ImageKey.NOTE), ERDiagramActivator.getImageDescriptor(ImageKey.NOTE));
    group.add(noteTool);

    final ConnectionCreationToolEntry commentConnectionTool = new ConnectionCreationToolEntry(ResourceString.getResourceString("label.relation.note"), ResourceString.getResourceString("label.create.relation.note"), new SimpleFactory(CommentConnection.class), ERDiagramActivator.getImageDescriptor(ImageKey.COMMENT_CONNECTION), ERDiagramActivator.getImageDescriptor(ImageKey.COMMENT_CONNECTION));
    group.add(commentConnectionTool);

    group.add(new PaletteSeparator());

    group.add(new CreationToolEntry(ResourceString.getResourceString("label.category"), ResourceString.getResourceString("label.create.category"), new SimpleFactory(Category.class), ERDiagramActivator.getImageDescriptor(ImageKey.CATEGORY), ERDiagramActivator.getImageDescriptor(ImageKey.CATEGORY)));

    group.add(new PaletteSeparator());

    group.add(new InsertImageTool());

    this.add(group);

    setDefaultEntry(selectionTool);
}
项目:gef-gwt    文件:PaletteEditPartFactory.java   
/**
 * Create SeparatorEditPart - edit part for PaletteSeparator
 * 
 * @param parentEditPart
 *            the parent of the new editpart to be created
 * @param model
 *            the PaletteSeparator
 * @return the newly created EditPart
 */
protected EditPart createSeparatorEditPart(EditPart parentEditPart,
        Object model) {
    return new SeparatorEditPart((PaletteSeparator) model);
}
项目:gef-gwt    文件:SeparatorEditPart.java   
/**
 * Constructor
 * 
 * @param separator
 *            The PaletteSeparator for which this EditPart is being created
 */
public SeparatorEditPart(PaletteSeparator separator) {
    super(separator);
}