Search in sources :

Example 1 with PaletteRoot

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

the class AbstractTalendEditor method selectPaletteEntry.

public void selectPaletteEntry(String componentName) {
    PaletteViewer paletteViewer = getPaletteViewerProvider().getEditDomain().getPaletteViewer();
    if (paletteViewer == null) {
        return;
    }
    PaletteRoot root = getPaletteRoot();
    RootEditPart part = paletteViewer.getRootEditPart();
    if (part != null) {
        collapsePalette(part.getChildren());
    }
    if (root != null) {
        selectPaletteEntry(componentName, paletteViewer, root.getChildren());
    }
}
Also used : PaletteRoot(org.eclipse.gef.palette.PaletteRoot) TalendPaletteViewer(org.talend.designer.core.ui.editor.palette.TalendPaletteViewer) PaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer) RootEditPart(org.eclipse.gef.RootEditPart) ScalableFreeformRootEditPart(org.eclipse.gef.editparts.ScalableFreeformRootEditPart)

Example 2 with PaletteRoot

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

the class TalendEditorPaletteFactory method getAllNodeStructure.

public static PaletteRoot getAllNodeStructure(final IComponentsFactory compFac) {
    palette = new PaletteRoot();
    AbstractProcessProvider.loadComponentsFromProviders(getJobletObjectType(compFac.getComponentsHandler()));
    GenericProcessProvider.getInstance().loadComponentsFromProviders();
    createComponentsDrawer(compFac, true, 0);
    return palette;
}
Also used : PaletteRoot(org.eclipse.gef.palette.PaletteRoot)

Example 3 with PaletteRoot

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

the class TalendPaletteContextMenuProvider method buildContextMenu.

@SuppressWarnings("rawtypes")
@Override
public void buildContextMenu(IMenuManager menu) {
    super.buildContextMenu(menu);
    boolean hasSearchComponentAction = true;
    List editParts = getPaletteViewer().getSelectedEditParts();
    if (!editParts.isEmpty()) {
        PaletteEntry element = (PaletteEntry) ((EditPart) editParts.get(0)).getModel();
        if (editParts.size() > 1) {
            // search component only process one .
            hasSearchComponentAction = false;
        } else {
            // check the entry is component or folder
            if (element instanceof CombinedTemplateCreationEntry) {
                Object template = ((CombinedTemplateCreationEntry) element).getTemplate();
                if (template == null || !Node.class.equals(template)) {
                    hasSearchComponentAction = false;
                }
            } else {
                // not component entry
                hasSearchComponentAction = false;
            }
        }
        // don't work for camel.
        if (hasSearchComponentAction && isComponentsTypePalette(ComponentCategory.CATEGORY_4_CAMEL)) {
            hasSearchComponentAction = false;
        }
        // note
        //$NON-NLS-1$
        boolean note = element.getLabel().equals(Messages.getString("TalendEditorPaletteFactory.Note"));
        if (!note) {
            if (hasSearchComponentAction) {
                menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, new SearchComponentAction(getPaletteViewer()));
            }
            boolean showFavorAction = true;
            boolean showAddFavorAction = true;
            PaletteContainer pContainer = element.getParent();
            if (pContainer != null) {
                // Favorites Folder or components in Favorites Folder
                if ((pContainer instanceof PaletteRoot && TalendEditorPaletteFactory.FAVORITES.equals(element.getLabel())) || (pContainer.getParent() instanceof PaletteRoot && TalendEditorPaletteFactory.FAVORITES.equals(pContainer.getLabel()))) {
                    showAddFavorAction = false;
                }
            }
            // for INPUT/OUTPUT/TRIGGER, needn't to add to Favorites
            if (element instanceof CreationToolEntry) {
                Object obj = ((CreationToolEntry) element).getToolProperty(CreationTool.PROPERTY_CREATION_FACTORY);
                if (obj instanceof PaletteComponentFactory) {
                    IComponent component = ((PaletteComponentFactory) obj).getComponent();
                    EComponentType componentType = component.getComponentType();
                    if (componentType == EComponentType.JOBLET_INPUT_OUTPUT || componentType == EComponentType.JOBLET_TRIGGER) {
                        showFavorAction = false;
                    }
                }
            }
            if (showFavorAction) {
                // if (ShowFavoriteAction.state == true) {
                if (showAddFavorAction) {
                    menu.appendToGroup(GEFActionConstants.GROUP_COPY, new FavoriteComponentAction(getPaletteViewer()));
                } else {
                    menu.appendToGroup(GEFActionConstants.GROUP_COPY, new RemoveFavoriteComponentAction(getPaletteViewer()));
                }
            }
        }
    }
    menu.appendToGroup(GEFActionConstants.GROUP_COPY, new HiddenFloderAction(getPaletteViewer()));
    menu.appendToGroup(GEFActionConstants.GROUP_COPY, new DisplayFloderAction(getPaletteViewer()));
}
Also used : PaletteRoot(org.eclipse.gef.palette.PaletteRoot) PaletteComponentFactory(org.talend.designer.core.ui.editor.PaletteComponentFactory) IComponent(org.talend.core.model.components.IComponent) PaletteEntry(org.eclipse.gef.palette.PaletteEntry) PaletteContainer(org.eclipse.gef.palette.PaletteContainer) EComponentType(org.talend.core.model.components.EComponentType) CreationToolEntry(org.eclipse.gef.palette.CreationToolEntry) ArrayList(java.util.ArrayList) List(java.util.List) CombinedTemplateCreationEntry(org.eclipse.gef.palette.CombinedTemplateCreationEntry)

Example 4 with PaletteRoot

use of org.eclipse.gef.palette.PaletteRoot 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 5 with PaletteRoot

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

the class PaletteFactory method createPalette.

/**
	 * 
	 * Create palette component
	 * 
	 * @return paletteRoot
	 */
public static PaletteRoot createPalette() {
    PaletteRoot paletteRoot = new PaletteRoot();
    paletteRoot.addAll(createCategories(paletteRoot));
    return paletteRoot;
}
Also used : PaletteRoot(org.eclipse.gef.palette.PaletteRoot)

Aggregations

PaletteRoot (org.eclipse.gef.palette.PaletteRoot)20 PaletteDrawer (org.eclipse.gef.palette.PaletteDrawer)7 ArrayList (java.util.ArrayList)3 SelectionToolEntry (org.eclipse.gef.palette.SelectionToolEntry)3 List (java.util.List)2 TreeMap (java.util.TreeMap)2 CombinedTemplateCreationEntry (org.eclipse.gef.palette.CombinedTemplateCreationEntry)2 PaletteEntry (org.eclipse.gef.palette.PaletteEntry)2 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)1 RootEditPart (org.eclipse.gef.RootEditPart)1 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)1 ConnectionCreationToolEntry (org.eclipse.gef.palette.ConnectionCreationToolEntry)1 CreationToolEntry (org.eclipse.gef.palette.CreationToolEntry)1 MarqueeToolEntry (org.eclipse.gef.palette.MarqueeToolEntry)1 PaletteContainer (org.eclipse.gef.palette.PaletteContainer)1 PaletteGroup (org.eclipse.gef.palette.PaletteGroup)1 ToolEntry (org.eclipse.gef.palette.ToolEntry)1 PaletteViewer (org.eclipse.gef.ui.palette.PaletteViewer)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1