Search in sources :

Example 6 with IPaletteItem

use of org.talend.core.ui.component.preference.provider.IPaletteItem in project tdi-studio-se by Talend.

the class PaletteSettingPage method retrieveAllEntry.

private void retrieveAllEntry(Set<IPaletteItem> list, IPaletteItem entry) {
    if (!(entry instanceof ComponentPaletteItem)) {
        IPaletteItem container = entry;
        for (Object element : container.getChildren()) {
            IPaletteItem en = (IPaletteItem) element;
            retrieveAllEntry(list, en);
        }
    } else {
        list.add(entry);
    }
}
Also used : ComponentPaletteItem(org.talend.repository.preference.palettesettings.ComponentPaletteItem) IPaletteItem(org.talend.core.ui.component.preference.provider.IPaletteItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 7 with IPaletteItem

use of org.talend.core.ui.component.preference.provider.IPaletteItem in project tdi-studio-se by Talend.

the class PaletteItemHelper method getFamilyItem.

/**
     * DOC nrousseau Comment method "getFamilyItem".
     * 
     * @param family
     * @param rootPaletteItem
     * @return
     */
private static IPaletteItem getFamilyItem(String family, IPaletteItem rootPaletteItem) {
    String curFolder = family.split(FAMILY_FOLDER_SEPARATOR)[0];
    IPaletteItem curFolderItem = null;
    for (IPaletteItem paletteItem : rootPaletteItem.getChildren()) {
        if (paletteItem instanceof FolderPaletteItem && paletteItem.getLabel().equals(curFolder)) {
            curFolderItem = paletteItem;
            break;
        }
    }
    if (curFolderItem == null) {
        curFolderItem = new FolderPaletteItem(curFolder, rootPaletteItem.getPaletteType());
        rootPaletteItem.getChildren().add(curFolderItem);
        curFolderItem.setParent(rootPaletteItem);
    }
    int index = family.indexOf(FAMILY_FOLDER_SEPARATOR);
    if (index < 0) {
        return curFolderItem;
    }
    return getFamilyItem(family.substring(index + 1, family.length()), curFolderItem);
}
Also used : IPaletteItem(org.talend.core.ui.component.preference.provider.IPaletteItem)

Aggregations

IPaletteItem (org.talend.core.ui.component.preference.provider.IPaletteItem)7 ComponentPaletteItem (org.talend.repository.preference.palettesettings.ComponentPaletteItem)3 IComponent (org.talend.core.model.components.IComponent)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 AssertionFailedException (org.eclipse.core.runtime.AssertionFailedException)1 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerSorter (org.eclipse.jface.viewers.ViewerSorter)1 GridData (org.eclipse.swt.layout.GridData)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 TalendPaletteLabelProvider (org.talend.core.ui.component.preference.provider.TalendPaletteLabelProvider)1 TalendPaletteTreeProvider (org.talend.core.ui.component.preference.provider.TalendPaletteTreeProvider)1