Search in sources :

Example 1 with PaletteDrawer

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

the class TalendPaletteViewer method removeFavoritesComponent.

public void removeFavoritesComponent(CombinedTemplateCreationEntry component) {
    if (favoritesEditPart != null) {
        TalendEditorPaletteFactory.deleteFavoriteFromPreference(component.getLabel());
        List children = favoritesEditPart.getChildren();
        if (children != null) {
            for (Object obj : children) {
                TalendEntryEditPart entryEditPart = (TalendEntryEditPart) obj;
                CombinedTemplateCreationEntry entryModule = (CombinedTemplateCreationEntry) entryEditPart.getModel();
                if (entryModule.getLabel().equals(component.getLabel())) {
                    PaletteDrawer paletteDrawer = favoritesEditPart.getDrawer();
                    if (paletteDrawer != null) {
                        paletteDrawer.remove(entryModule);
                    }
                    // favoritesEditPart.removeChild(entryEditPart);
                    break;
                }
            }
        }
    }
}
Also used : PaletteDrawer(org.eclipse.gef.palette.PaletteDrawer) List(java.util.List) ArrayList(java.util.ArrayList) CombinedTemplateCreationEntry(org.eclipse.gef.palette.CombinedTemplateCreationEntry)

Example 2 with PaletteDrawer

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

the class TalendPaletteViewer method removeRecentlyUsedComponent.

public void removeRecentlyUsedComponent(CombinedTemplateCreationEntry component) {
    if (recentlyUsedEditPart != null) {
        List children = recentlyUsedEditPart.getChildren();
        if (children != null) {
            for (Object obj : children) {
                TalendEntryEditPart entryEditPart = (TalendEntryEditPart) obj;
                CombinedTemplateCreationEntry entryModule = (CombinedTemplateCreationEntry) entryEditPart.getModel();
                if (entryModule.getLabel().equals(component.getLabel())) {
                    PaletteDrawer paletteDrawer = recentlyUsedEditPart.getDrawer();
                    if (paletteDrawer != null) {
                        paletteDrawer.remove(entryModule);
                    }
                    // favoritesEditPart.removeChild(entryEditPart);
                    break;
                }
            }
        }
    }
}
Also used : PaletteDrawer(org.eclipse.gef.palette.PaletteDrawer) List(java.util.List) ArrayList(java.util.ArrayList) CombinedTemplateCreationEntry(org.eclipse.gef.palette.CombinedTemplateCreationEntry)

Example 3 with PaletteDrawer

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

the class BusinessPaletteFactory method createbusiness1Group.

/**
     * @generated
     */
private PaletteContainer createbusiness1Group() {
    //$NON-NLS-1$
    PaletteContainer paletteContainer = new PaletteDrawer("business");
    paletteContainer.add(createDecision1CreationTool());
    paletteContainer.add(createAction2CreationTool());
    paletteContainer.add(createTerminal3CreationTool());
    paletteContainer.add(createData4CreationTool());
    paletteContainer.add(createDocument5CreationTool());
    paletteContainer.add(createInput6CreationTool());
    paletteContainer.add(createList7CreationTool());
    paletteContainer.add(createDatabase8CreationTool());
    paletteContainer.add(createActor9CreationTool());
    paletteContainer.add(createEllipse10CreationTool());
    paletteContainer.add(createGear11CreationTool());
    paletteContainer.add(new PaletteSeparator());
    paletteContainer.add(createRelationship13CreationTool());
    paletteContainer.add(createDirectionalRelationship14CreationTool());
    paletteContainer.add(createBidirectionalRelationship15CreationTool());
    return paletteContainer;
}
Also used : PaletteSeparator(org.eclipse.gef.palette.PaletteSeparator) PaletteDrawer(org.eclipse.gef.palette.PaletteDrawer) PaletteContainer(org.eclipse.gef.palette.PaletteContainer)

Example 4 with PaletteDrawer

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

the class ERDGraphicalViewer method setContents.

@Override
public void setContents(EditPart editpart) {
    loadContents = true;
    try {
        super.setContents(editpart);
        // Reset palette contents
        if (editpart instanceof DiagramPart) {
            List<DBSEntity> tables = new ArrayList<>();
            for (Object child : editpart.getChildren()) {
                if (child instanceof EntityPart) {
                    tables.add(((EntityPart) child).getTable().getObject());
                }
            }
            Collections.sort(tables, DBUtils.<DBSEntity>nameComparator());
            Map<PaletteDrawer, List<ToolEntryTable>> toolMap = new LinkedHashMap<>();
            for (DBSEntity table : tables) {
                DBPDataSourceContainer container = table.getDataSource().getContainer();
                PaletteDrawer drawer = getContainerPaletteDrawer(container);
                if (drawer != null) {
                    List<ToolEntryTable> tools = toolMap.get(drawer);
                    if (tools == null) {
                        tools = new ArrayList<>(tables.size());
                        toolMap.put(drawer, tools);
                    }
                    tools.add(new ToolEntryTable(table));
                }
            }
            for (Map.Entry<PaletteDrawer, List<ToolEntryTable>> entry : toolMap.entrySet()) {
                entry.getKey().setChildren(entry.getValue());
            }
        //editor.getPaletteContents().setChildren(tools);
        }
    } finally {
        loadContents = false;
    }
}
Also used : PaletteDrawer(org.eclipse.gef.palette.PaletteDrawer) DBSEntity(org.jkiss.dbeaver.model.struct.DBSEntity) EntityPart(org.jkiss.dbeaver.ext.erd.part.EntityPart) DiagramPart(org.jkiss.dbeaver.ext.erd.part.DiagramPart)

Example 5 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)

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