Search in sources :

Example 6 with PaletteContainer

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

the class ERDGraphicalViewer method handleTableActivate.

public void handleTableActivate(DBSEntity table) {
    if (table.getDataSource() != null) {
        DBPDataSourceContainer container = table.getDataSource().getContainer();
        if (container != null) {
            synchronized (usedDataSources) {
                DataSourceInfo dataSourceInfo = usedDataSources.get(container);
                if (dataSourceInfo == null) {
                    dataSourceInfo = new DataSourceInfo();
                    usedDataSources.put(container, dataSourceInfo);
                    acquireContainer(container);
                }
                dataSourceInfo.tableCount++;
            }
        }
    }
    if (!loadContents) {
        final PaletteContainer drawer = getContainerPaletteDrawer(table.getDataSource().getContainer());
        if (drawer != null) {
            // Add entry (with right order)
            List children = drawer.getChildren();
            int index = 0;
            for (int i = 0, childrenSize = children.size(); i < childrenSize; i++) {
                Object child = children.get(i);
                if (child instanceof ToolEntryTable) {
                    if (((ToolEntryTable) child).table.getName().compareTo(table.getName()) > 0) {
                        index = i;
                        break;
                    }
                }
            }
            drawer.add(index, new ToolEntryTable(table));
        }
    }
}
Also used : PaletteContainer(org.eclipse.gef.palette.PaletteContainer)

Example 7 with PaletteContainer

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

the class TalendPaletteDrawer method setFiltered.

/**
     * Sets the filtered.
     * 
     * @param filtered the filtered to set
     */
@Override
public void setFiltered(boolean filtered) {
    this.filtered = filtered;
    PaletteContainer parentContainer = getParent();
    if (parentContainer instanceof IPaletteFilter) {
        ((IPaletteFilter) parentContainer).setFiltered(filtered);
    }
}
Also used : IPaletteFilter(org.talend.designer.core.IPaletteFilter) PaletteContainer(org.eclipse.gef.palette.PaletteContainer)

Example 8 with PaletteContainer

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

the class AbstractTalendEditor method expandPaletteDrawer.

/**
     * DOC hcw Comment method "expandPaletteDrawer".
     * 
     * @param paletteViewer
     * @param paletteEntry
     */
private void expandPaletteDrawer(PaletteViewer paletteViewer, ToolEntry paletteEntry) {
    List<TalendDrawerEditPart> parts = new ArrayList<TalendDrawerEditPart>();
    PaletteContainer parent = paletteEntry.getParent();
    while (parent != null) {
        if (parent instanceof TalendPaletteDrawer) {
            Object editpart = paletteViewer.getEditPartRegistry().get(parent);
            if (editpart instanceof TalendDrawerEditPart) {
                parts.add((TalendDrawerEditPart) editpart);
            }
        }
        parent = parent.getParent();
    }
    for (int i = parts.size() - 1; i >= 0; i--) {
        parts.get(i).setExpanded(true);
    }
}
Also used : TalendPaletteDrawer(org.talend.designer.core.ui.editor.palette.TalendPaletteDrawer) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) EventObject(java.util.EventObject) TalendDrawerEditPart(org.talend.designer.core.ui.editor.palette.TalendDrawerEditPart) PaletteContainer(org.eclipse.gef.palette.PaletteContainer) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

PaletteContainer (org.eclipse.gef.palette.PaletteContainer)8 ArrayList (java.util.ArrayList)2 EventObject (java.util.EventObject)2 PaletteEntry (org.eclipse.gef.palette.PaletteEntry)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 TalendDrawerEditPart (org.talend.designer.core.ui.editor.palette.TalendDrawerEditPart)2 TalendPaletteDrawer (org.talend.designer.core.ui.editor.palette.TalendPaletteDrawer)2 Iterator (java.util.Iterator)1 List (java.util.List)1 Point (org.eclipse.draw2d.geometry.Point)1 EditPart (org.eclipse.gef.EditPart)1 RootEditPart (org.eclipse.gef.RootEditPart)1 AbstractEditPart (org.eclipse.gef.editparts.AbstractEditPart)1 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)1 CombinedTemplateCreationEntry (org.eclipse.gef.palette.CombinedTemplateCreationEntry)1 CreationToolEntry (org.eclipse.gef.palette.CreationToolEntry)1 PaletteDrawer (org.eclipse.gef.palette.PaletteDrawer)1 PaletteRoot (org.eclipse.gef.palette.PaletteRoot)1 PaletteSeparator (org.eclipse.gef.palette.PaletteSeparator)1 ToolEntry (org.eclipse.gef.palette.ToolEntry)1