use of org.eclipse.gef.palette.PaletteDrawer in project statecharts by Yakindu.
the class DefaultSCTPaletteFactory method createToolsCategory.
protected PaletteContainer createToolsCategory(PaletteRoot root) {
PaletteDrawer drawer = new PaletteDrawer("Tools");
root.add(drawer);
return drawer;
}
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);
}
use of org.eclipse.gef.palette.PaletteDrawer in project cubrid-manager by CUBRID.
the class PaletteViewerCreator method createPaletteRoot.
/**
* Create palette for ER canvas
*
* @return
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public PaletteRoot createPaletteRoot(ERSchema erSchema) {
paletteRoot = new PaletteRoot();
paletteRoot.setLabel("");
paletteRoot.setSmallIcon(null);
paletteRoot.setLargeIcon(null);
PaletteGroup controls = new PaletteGroup("Controls");
paletteRoot.add(controls);
ToolEntry tool = new SelectionToolEntry();
controls.add(tool);
paletteRoot.setDefaultEntry(tool);
controls.add(new MarqueeToolEntry());
PaletteDrawer drawer = new PaletteDrawer("New Component", null);
List entries = new ArrayList();
ConnectionCreationToolEntry connection = getConnectionEntry();
CombinedTemplateCreationEntry tableEntry = getTableEntry(erSchema);
entries.add(connection);
entries.add(tableEntry);
drawer.addAll(entries);
paletteRoot.add(drawer);
return paletteRoot;
}
use of org.eclipse.gef.palette.PaletteDrawer in project dbeaver by serge-rider.
the class ERDGraphicalViewer method releaseContainer.
private void releaseContainer(DBPDataSourceContainer container) {
PaletteDrawer drawer = getContainerPaletteDrawer(container);
if (drawer != null) {
editor.getPaletteRoot().remove(drawer);
}
container.getRegistry().removeDataSourceListener(this);
container.release(editor);
}
use of org.eclipse.gef.palette.PaletteDrawer in project tdi-studio-se by Talend.
the class TalendPaletteViewer method addRecentlyUsedComponent.
public void addRecentlyUsedComponent(IComponent component) {
EComponentType componentType = component.getComponentType();
if (componentType == EComponentType.JOBLET_INPUT_OUTPUT || componentType == EComponentType.JOBLET_TRIGGER) {
return;
}
if (recentlyUsedEditPart != null) {
List children = recentlyUsedEditPart.getChildren();
int insertIndex = 0;
boolean alreadyExist = false;
if (children != null) {
for (; insertIndex < children.size(); insertIndex++) {
TalendEntryEditPart entryEditPart = (TalendEntryEditPart) children.get(insertIndex);
CombinedTemplateCreationEntry entryModule = (CombinedTemplateCreationEntry) entryEditPart.getModel();
int compareResult = entryModule.getLabel().compareTo(component.getName());
if (0 == compareResult) {
alreadyExist = true;
break;
}
// if (0 < compareResult) {
// break;
// }
}
}
// if already exist, remove first
if (alreadyExist) {
if (0 == insertIndex) {
return;
}
TalendEntryEditPart entryEditPart = (TalendEntryEditPart) children.get(insertIndex);
CombinedTemplateCreationEntry entryModule = (CombinedTemplateCreationEntry) entryEditPart.getModel();
removeRecentlyUsedComponent(entryModule);
}
// if (!alreadyExist) {
TalendCombinedTemplateCreationEntry newRecently = TalendEditorPaletteFactory.createEntryFrom(component);
newRecently.setTimestemp(new Date());
newRecently.setParent(recentlyUsedEditPart.getDrawer());
EditPart child = recentlyUsedEditPart.createChild(newRecently);
PaletteDrawer paletteDrawer = recentlyUsedEditPart.getDrawer();
if (paletteDrawer != null) {
// paletteDrawer.add(insertIndex, newRecently);
paletteDrawer.add(0, newRecently);
}
// reobtain
children = recentlyUsedEditPart.getChildren();
if (children != null) {
int size = children.size();
final int recentlyUsedSize = PaletteSettingsPreferencePage.getPaletteRencentlyUsedListSize();
if (recentlyUsedSize < size) {
TalendEntryEditPart entryEditPart = (TalendEntryEditPart) children.get(recentlyUsedSize);
CombinedTemplateCreationEntry entryModule = (CombinedTemplateCreationEntry) entryEditPart.getModel();
removeRecentlyUsedComponent(entryModule);
}
}
// needn't use this, or will cause problem
// recentlyUsedEditPart.addChild(child, insertIndex);
// }
refreshRecentlyUsedComponentToReference();
}
}
Aggregations