Search in sources :

Example 11 with PaletteDrawer

use of org.eclipse.gef.palette.PaletteDrawer in project statecharts by Yakindu.

the class DefaultSCTPaletteFactory method createToolsCategory.

protected PaletteContainer createToolsCategory(PaletteRoot root) {
    PaletteDrawer drawer = new PaletteDrawer("Tools");
    root.add(drawer);
    return drawer;
}
Also used : PaletteDrawer(org.eclipse.gef.palette.PaletteDrawer)

Example 12 with PaletteDrawer

use of org.eclipse.gef.palette.PaletteDrawer in project dbeaver by serge-rider.

the class ERDGraphicalViewer method acquireContainer.

private void acquireContainer(DBPDataSourceContainer container) {
    container.acquire(editor);
    container.getRegistry().addDataSourceListener(this);
    PaletteRoot paletteRoot = editor.getPaletteRoot();
    PaletteDrawer dsDrawer = new PaletteDrawer(container.getName(), DBeaverIcons.getImageDescriptor(container.getDriver().getIcon()));
    dsDrawer.setDescription(container.getDescription());
    dsDrawer.setId(container.getId());
    paletteRoot.add(dsDrawer);
}
Also used : PaletteRoot(org.eclipse.gef.palette.PaletteRoot) PaletteDrawer(org.eclipse.gef.palette.PaletteDrawer)

Example 13 with PaletteDrawer

use of org.eclipse.gef.palette.PaletteDrawer in project cubrid-manager by CUBRID.

the class PaletteViewerCreator method createPaletteRoot.

/**
	 * Create palette for ER canvas
	 * 
	 * @return
	 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public PaletteRoot createPaletteRoot(ERSchema erSchema) {
    paletteRoot = new PaletteRoot();
    paletteRoot.setLabel("");
    paletteRoot.setSmallIcon(null);
    paletteRoot.setLargeIcon(null);
    PaletteGroup controls = new PaletteGroup("Controls");
    paletteRoot.add(controls);
    ToolEntry tool = new SelectionToolEntry();
    controls.add(tool);
    paletteRoot.setDefaultEntry(tool);
    controls.add(new MarqueeToolEntry());
    PaletteDrawer drawer = new PaletteDrawer("New Component", null);
    List entries = new ArrayList();
    ConnectionCreationToolEntry connection = getConnectionEntry();
    CombinedTemplateCreationEntry tableEntry = getTableEntry(erSchema);
    entries.add(connection);
    entries.add(tableEntry);
    drawer.addAll(entries);
    paletteRoot.add(drawer);
    return paletteRoot;
}
Also used : PaletteRoot(org.eclipse.gef.palette.PaletteRoot) SelectionToolEntry(org.eclipse.gef.palette.SelectionToolEntry) PaletteDrawer(org.eclipse.gef.palette.PaletteDrawer) ArrayList(java.util.ArrayList) ConnectionCreationToolEntry(org.eclipse.gef.palette.ConnectionCreationToolEntry) ArrayList(java.util.ArrayList) List(java.util.List) MarqueeToolEntry(org.eclipse.gef.palette.MarqueeToolEntry) ToolEntry(org.eclipse.gef.palette.ToolEntry) SelectionToolEntry(org.eclipse.gef.palette.SelectionToolEntry) ConnectionCreationToolEntry(org.eclipse.gef.palette.ConnectionCreationToolEntry) PaletteGroup(org.eclipse.gef.palette.PaletteGroup) CombinedTemplateCreationEntry(org.eclipse.gef.palette.CombinedTemplateCreationEntry) MarqueeToolEntry(org.eclipse.gef.palette.MarqueeToolEntry)

Example 14 with PaletteDrawer

use of org.eclipse.gef.palette.PaletteDrawer in project dbeaver by serge-rider.

the class ERDGraphicalViewer method releaseContainer.

private void releaseContainer(DBPDataSourceContainer container) {
    PaletteDrawer drawer = getContainerPaletteDrawer(container);
    if (drawer != null) {
        editor.getPaletteRoot().remove(drawer);
    }
    container.getRegistry().removeDataSourceListener(this);
    container.release(editor);
}
Also used : PaletteDrawer(org.eclipse.gef.palette.PaletteDrawer)

Example 15 with PaletteDrawer

use of org.eclipse.gef.palette.PaletteDrawer in project tdi-studio-se by Talend.

the class TalendPaletteViewer method addRecentlyUsedComponent.

public void addRecentlyUsedComponent(IComponent component) {
    EComponentType componentType = component.getComponentType();
    if (componentType == EComponentType.JOBLET_INPUT_OUTPUT || componentType == EComponentType.JOBLET_TRIGGER) {
        return;
    }
    if (recentlyUsedEditPart != null) {
        List children = recentlyUsedEditPart.getChildren();
        int insertIndex = 0;
        boolean alreadyExist = false;
        if (children != null) {
            for (; insertIndex < children.size(); insertIndex++) {
                TalendEntryEditPart entryEditPart = (TalendEntryEditPart) children.get(insertIndex);
                CombinedTemplateCreationEntry entryModule = (CombinedTemplateCreationEntry) entryEditPart.getModel();
                int compareResult = entryModule.getLabel().compareTo(component.getName());
                if (0 == compareResult) {
                    alreadyExist = true;
                    break;
                }
            // if (0 < compareResult) {
            // break;
            // }
            }
        }
        // if already exist, remove first
        if (alreadyExist) {
            if (0 == insertIndex) {
                return;
            }
            TalendEntryEditPart entryEditPart = (TalendEntryEditPart) children.get(insertIndex);
            CombinedTemplateCreationEntry entryModule = (CombinedTemplateCreationEntry) entryEditPart.getModel();
            removeRecentlyUsedComponent(entryModule);
        }
        // if (!alreadyExist) {
        TalendCombinedTemplateCreationEntry newRecently = TalendEditorPaletteFactory.createEntryFrom(component);
        newRecently.setTimestemp(new Date());
        newRecently.setParent(recentlyUsedEditPart.getDrawer());
        EditPart child = recentlyUsedEditPart.createChild(newRecently);
        PaletteDrawer paletteDrawer = recentlyUsedEditPart.getDrawer();
        if (paletteDrawer != null) {
            // paletteDrawer.add(insertIndex, newRecently);
            paletteDrawer.add(0, newRecently);
        }
        // reobtain
        children = recentlyUsedEditPart.getChildren();
        if (children != null) {
            int size = children.size();
            final int recentlyUsedSize = PaletteSettingsPreferencePage.getPaletteRencentlyUsedListSize();
            if (recentlyUsedSize < size) {
                TalendEntryEditPart entryEditPart = (TalendEntryEditPart) children.get(recentlyUsedSize);
                CombinedTemplateCreationEntry entryModule = (CombinedTemplateCreationEntry) entryEditPart.getModel();
                removeRecentlyUsedComponent(entryModule);
            }
        }
        // needn't use this, or will cause problem
        // recentlyUsedEditPart.addChild(child, insertIndex);
        // }
        refreshRecentlyUsedComponentToReference();
    }
}
Also used : EditPart(org.eclipse.gef.EditPart) PaletteDrawer(org.eclipse.gef.palette.PaletteDrawer) List(java.util.List) ArrayList(java.util.ArrayList) CombinedTemplateCreationEntry(org.eclipse.gef.palette.CombinedTemplateCreationEntry) EComponentType(org.talend.core.model.components.EComponentType) Date(java.util.Date)

Aggregations

PaletteDrawer (org.eclipse.gef.palette.PaletteDrawer)28 CombinedTemplateCreationEntry (org.eclipse.gef.palette.CombinedTemplateCreationEntry)10 ArrayList (java.util.ArrayList)9 List (java.util.List)6 PaletteRoot (org.eclipse.gef.palette.PaletteRoot)6 TalendPaletteDrawer (org.talend.designer.core.ui.editor.palette.TalendPaletteDrawer)6 SelectionToolEntry (org.eclipse.gef.palette.SelectionToolEntry)4 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)4 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)4 Iterator (java.util.Iterator)3 DBSEntity (org.jkiss.dbeaver.model.struct.DBSEntity)3 IComponent (org.talend.core.model.components.IComponent)3 Node (org.talend.designer.core.ui.editor.nodes.Node)3 TalendCombinedTemplateCreationEntry (org.talend.designer.core.ui.editor.palette.TalendCombinedTemplateCreationEntry)3 HashMap (java.util.HashMap)2 Hashtable (java.util.Hashtable)2 LinkedList (java.util.LinkedList)2 TreeMap (java.util.TreeMap)2 EditPart (org.eclipse.gef.EditPart)2 ConnectionCreationToolEntry (org.eclipse.gef.palette.ConnectionCreationToolEntry)2