use of org.eclipse.gef.palette.ConnectionCreationToolEntry in project cubrid-manager by CUBRID.
the class ERSchemaToolBar method init.
/**
* Init items on the tool bar
*/
public void init() {
loginState = erSchemaEditor.getDatabase().isLogined();
selectDbItem = new ToolItem(this, SWT.SEPARATOR);
Composite comp = createSelectDbLabel();
selectDbItem.setControl(comp);
selectDbItem.setWidth(180);
//model change
ToolItem selectModelItem = new ToolItem(this, SWT.SEPARATOR);
Composite selectModelComp = createDropDownComp();
selectModelItem.setControl(selectModelComp);
selectModelItem.setWidth(100);
physicalLogicalModelViewsMenu = new PhysicalLogicalNavigatorMenu(this, erSchemaEditor, selectModelLabel);
new ToolItem(this, SWT.SEPARATOR | SWT.VERTICAL);
//physical/logical data type map item
physicalLogicalMapItem = new ToolItem(this, SWT.PUSH);
physicalLogicalMapItem.setImage(CommonUIPlugin.getImage("/icons/er/set_global_view_model.png"));
physicalLogicalMapItem.setToolTipText(Messages.btnNameSetPhysicalLogicalMap);
physicalLogicalMapItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
erSchemaEditor.openPhysicalLogicalMapDialog();
}
});
new ToolItem(this, SWT.SEPARATOR | SWT.VERTICAL);
// open erwin xml file
openItem = new ToolItem(this, SWT.PUSH);
openItem.setImage(CommonUIPlugin.getImage("/icons/queryeditor/file_open.png"));
openItem.setToolTipText(Messages.btnTipOpenFile);
openItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
erSchemaEditor.doOpen();
}
});
// save erwin xml file
saveItem = new ToolItem(this, SWT.PUSH);
saveItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/file_save.png"));
saveItem.setToolTipText(Messages.btnTipSaveFile);
saveItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
erSchemaEditor.doSave(new NullProgressMonitor());
}
});
// save as erwin xml file
saveAsItem = new ToolItem(this, SWT.PUSH);
saveAsItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/file_saveas.png"));
saveAsItem.setToolTipText(Messages.btnTipSaveAsFile);
saveAsItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
erSchemaEditor.doSaveAs();
}
});
new ToolItem(this, SWT.SEPARATOR | SWT.VERTICAL);
newTableItem = new ToolItem(this, SWT.PUSH);
newTableItem.setToolTipText(Messages.btnTipCreateTable);
final CombinedTemplateCreationEntry tableEntry = PaletteViewerCreator.getTableEntry(erSchemaEditor.getERSchema());
newTableItem.setImage(tableEntry.getSmallIcon().createImage());
newTableItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
erSchemaEditor.getEditDomain().setActiveTool(tableEntry.createTool());
}
});
connectLineItem = new ToolItem(this, SWT.PUSH);
connectLineItem.setToolTipText(Messages.btnTipConnection);
final ConnectionCreationToolEntry conn = PaletteViewerCreator.getConnectionEntry();
connectLineItem.setImage(conn.getSmallIcon().createImage());
connectLineItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
erSchemaEditor.getEditDomain().setActiveTool(conn.createTool());
}
});
new ToolItem(this, SWT.SEPARATOR | SWT.VERTICAL);
// Zoom In
zoomInItem = new ToolItem(this, SWT.PUSH);
zoomInItem.setImage(CommonUIPlugin.getImage("icons/action/zoom_in.png"));
zoomInItem.setToolTipText(Messages.actionZoomIn);
zoomInItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
erSchemaEditor.doZoomIn();
}
});
// Zoom Out
zoomOutItem = new ToolItem(this, SWT.PUSH);
zoomOutItem.setImage(CommonUIPlugin.getImage("icons/action/zoom_out.png"));
zoomOutItem.setToolTipText(Messages.actionZoomOut);
zoomOutItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
erSchemaEditor.doZoomOut();
}
});
new ToolItem(this, SWT.SEPARATOR | SWT.VERTICAL);
if (!erSchemaEditor.getDatabase().isVirtual()) {
// compare ddl sql
ddlCompareItem = new ToolItem(this, SWT.PUSH);
ddlCompareItem.setImage(CommonUIPlugin.getImage("icons/action/schema_compare_wizard.png"));
ddlCompareItem.setToolTipText(Messages.btnCompareDDL);
ddlCompareItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
erSchemaEditor.compareDDL2DB();
}
});
//sync comment to db
syncCommentItem = new ToolItem(this, SWT.PUSH);
syncCommentItem.setImage(CommonUIPlugin.getImage("icons/er/sync_comments_to_db.png"));
syncCommentItem.setToolTipText(Messages.btnTipSyncComments);
syncCommentItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
erSchemaEditor.syncComments();
}
});
}
//generate SQL for synchronizing comments to db
generateSyncCommentSQLItem = new ToolItem(this, SWT.PUSH);
generateSyncCommentSQLItem.setImage(CommonUIPlugin.getImage("icons/er/generate_sync_comments_sqls.png"));
generateSyncCommentSQLItem.setToolTipText(Messages.btnTipGenerateSyncCommentsSQL);
generateSyncCommentSQLItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
try {
erSchemaEditor.generateSyncCommentSQL();
} catch (PartInitException e) {
LOGGER.error(e.getMessage());
CommonUITool.openErrorBox(erSchemaEditor.getSite().getShell(), e.getMessage());
} catch (SQLException e) {
LOGGER.error(e.getMessage());
CommonUITool.openErrorBox(erSchemaEditor.getSite().getShell(), e.getMessage());
}
}
});
new ToolItem(this, SWT.SEPARATOR | SWT.VERTICAL);
// automatic layout
autoLayoutItem = new ToolItem(this, SWT.SEPARATOR);
Composite autoLayoutComp = createAutoLayoutComp();
autoLayoutItem.setControl(autoLayoutComp);
autoLayoutItem.setWidth(120);
new ToolItem(this, SWT.SEPARATOR | SWT.VERTICAL);
// search comp
searchItem = new ToolItem(this, SWT.SEPARATOR);
Composite searchcomp = createSearchComp();
searchItem.setControl(searchcomp);
searchItem.setWidth(150);
}
use of org.eclipse.gef.palette.ConnectionCreationToolEntry in project cubrid-manager by CUBRID.
the class PaletteViewerCreator method getConnectionEntry.
public static ConnectionCreationToolEntry getConnectionEntry() {
if (connectionEntry == null) {
connectionEntry = new ConnectionCreationToolEntry("Connection", Messages.btnTipConnection, null, AbstractUIPlugin.imageDescriptorFromPlugin(SchemaEditorUIPlugin.PLUGIN_ID, "icons/er/new_relationship.png"), AbstractUIPlugin.imageDescriptorFromPlugin(SchemaEditorUIPlugin.PLUGIN_ID, "icons/er/new_relationship.png"));
connectionEntry.setToolClass(ERConnectionCreationTool.class);
}
return connectionEntry;
}
use of org.eclipse.gef.palette.ConnectionCreationToolEntry 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.ConnectionCreationToolEntry in project archi by archimatetool.
the class SketchEditorPalette method createElementsGroup.
private PaletteContainer createElementsGroup() {
PaletteContainer group = new PaletteGroup(Messages.SketchEditorPalette_1);
add(group);
// Actor
PaletteEntry groupEntry = createCombinedTemplateCreationEntry(IArchimatePackage.eINSTANCE.getSketchModelActor(), Messages.SketchEditorPalette_2, Messages.SketchEditorPalette_3);
group.add(groupEntry);
// Group
groupEntry = createCombinedTemplateCreationEntry(IArchimatePackage.eINSTANCE.getDiagramModelGroup(), Messages.SketchEditorPalette_4, Messages.SketchEditorPalette_5);
group.add(groupEntry);
// Connections
ConnectionCreationToolEntry entry = createConnectionCreationToolEntry(IArchimatePackage.eINSTANCE.getDiagramModelConnection(), IDiagramModelConnection.LINE_SOLID, Messages.SketchEditorPalette_8, null, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_CONNECTION_PLAIN));
group.add(entry);
entry = createConnectionCreationToolEntry(IArchimatePackage.eINSTANCE.getDiagramModelConnection(), IDiagramModelConnection.ARROW_FILL_TARGET, Messages.SketchEditorPalette_9, null, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_CONNECTION_ARROW));
group.add(entry);
entry = createConnectionCreationToolEntry(IArchimatePackage.eINSTANCE.getDiagramModelConnection(), IDiagramModelConnection.ARROW_FILL_TARGET | IDiagramModelConnection.LINE_DASHED, Messages.SketchEditorPalette_10, null, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_CONNECTION_DASHED_ARROW));
group.add(entry);
entry = createConnectionCreationToolEntry(IArchimatePackage.eINSTANCE.getDiagramModelConnection(), IDiagramModelConnection.ARROW_FILL_TARGET | IDiagramModelConnection.LINE_DOTTED, Messages.SketchEditorPalette_11, null, IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_CONNECTION_DOTTED_ARROW));
group.add(entry);
return group;
}
use of org.eclipse.gef.palette.ConnectionCreationToolEntry in project archi by archimatetool.
the class CanvasEditorPalette method createConnectionCreationToolEntry.
private ConnectionCreationToolEntry createConnectionCreationToolEntry(EClass eClass, int type, String name, String description, ImageDescriptor icon) {
ConnectionCreationToolEntry entry = new ExtConnectionCreationToolEntry(name, description, new CanvasModelFactory(eClass, type), icon, icon);
// Ensure Tool gets deselected
entry.setToolProperty(AbstractTool.PROPERTY_UNLOAD_WHEN_FINISHED, true);
return entry;
}
Aggregations