use of org.talend.designer.core.ui.editor.palette.TalendPaletteDrawer in project tdi-studio-se by Talend.
the class AbstractTalendEditor method selectPaletteEntry.
private boolean selectPaletteEntry(String componentName, PaletteViewer paletteViewer, List entries) {
for (Object entry : entries) {
if (entry instanceof PaletteContainer) {
PaletteContainer container = (PaletteContainer) entry;
if (selectPaletteEntry(componentName, paletteViewer, container.getChildren())) {
return true;
}
} else if (entry instanceof TalendPaletteDrawer) {
TalendPaletteDrawer drawer = (TalendPaletteDrawer) entry;
if (selectPaletteEntry(componentName, paletteViewer, drawer.getChildren())) {
return true;
}
} else if (entry instanceof ToolEntry) {
ToolEntry paletteEntry = (ToolEntry) entry;
if (paletteEntry.getLabel().equals(componentName)) {
EditPart part = getToolEntryEditPart(paletteViewer, paletteEntry);
expandPaletteDrawer(paletteViewer, paletteEntry);
// paletteViewer.setSelection(new StructuredSelection(part));
// paletteViewer.setFocus(part);
paletteViewer.select(part);
paletteViewer.reveal(part);
paletteViewer.setActiveTool(paletteEntry);
return true;
}
}
}
return false;
}
use of org.talend.designer.core.ui.editor.palette.TalendPaletteDrawer 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);
}
}
use of org.talend.designer.core.ui.editor.palette.TalendPaletteDrawer in project tdi-studio-se by Talend.
the class TalendEditorPaletteFactory method createComponentDrawer.
private static PaletteDrawer createComponentDrawer(Hashtable<String, PaletteDrawer> ht, String familyToCreate) {
int index = familyToCreate.lastIndexOf(FAMILY_HIER_SEPARATOR);
String family;
PaletteDrawer parentPaletteDrawer = null;
if (index > -1) {
family = familyToCreate.substring(index + 1);
String parentFamily = familyToCreate.substring(0, index);
parentPaletteDrawer = ht.get(parentFamily);
if (parentPaletteDrawer == null) {
parentPaletteDrawer = createComponentDrawer(ht, parentFamily);
}
} else {
family = familyToCreate;
}
final PaletteDrawer paletteDrawer = new TalendPaletteDrawer(family);
paletteDrawer.setInitialState(loadFamilyState(familyToCreate));
if (parentPaletteDrawer == null) {
palette.add(paletteDrawer);
} else {
parentPaletteDrawer.add(paletteDrawer);
}
ht.put(familyToCreate, paletteDrawer);
return paletteDrawer;
}
Aggregations