Search in sources :

Example 6 with ConnectionCreationToolEntry

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);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) Composite(org.eclipse.swt.widgets.Composite) SQLException(java.sql.SQLException) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ConnectionCreationToolEntry(org.eclipse.gef.palette.ConnectionCreationToolEntry) PartInitException(org.eclipse.ui.PartInitException) CombinedTemplateCreationEntry(org.eclipse.gef.palette.CombinedTemplateCreationEntry) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 7 with ConnectionCreationToolEntry

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;
}
Also used : ConnectionCreationToolEntry(org.eclipse.gef.palette.ConnectionCreationToolEntry)

Example 8 with ConnectionCreationToolEntry

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;
}
Also used : PaletteRoot(org.eclipse.gef.palette.PaletteRoot) SelectionToolEntry(org.eclipse.gef.palette.SelectionToolEntry) PaletteDrawer(org.eclipse.gef.palette.PaletteDrawer) ArrayList(java.util.ArrayList) ConnectionCreationToolEntry(org.eclipse.gef.palette.ConnectionCreationToolEntry) ArrayList(java.util.ArrayList) List(java.util.List) MarqueeToolEntry(org.eclipse.gef.palette.MarqueeToolEntry) ToolEntry(org.eclipse.gef.palette.ToolEntry) SelectionToolEntry(org.eclipse.gef.palette.SelectionToolEntry) ConnectionCreationToolEntry(org.eclipse.gef.palette.ConnectionCreationToolEntry) PaletteGroup(org.eclipse.gef.palette.PaletteGroup) CombinedTemplateCreationEntry(org.eclipse.gef.palette.CombinedTemplateCreationEntry) MarqueeToolEntry(org.eclipse.gef.palette.MarqueeToolEntry)

Example 9 with ConnectionCreationToolEntry

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;
}
Also used : ExtConnectionCreationToolEntry(com.archimatetool.editor.diagram.tools.ExtConnectionCreationToolEntry) ConnectionCreationToolEntry(org.eclipse.gef.palette.ConnectionCreationToolEntry) PaletteEntry(org.eclipse.gef.palette.PaletteEntry) PaletteGroup(org.eclipse.gef.palette.PaletteGroup) PaletteContainer(org.eclipse.gef.palette.PaletteContainer)

Example 10 with ConnectionCreationToolEntry

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;
}
Also used : ExtConnectionCreationToolEntry(com.archimatetool.editor.diagram.tools.ExtConnectionCreationToolEntry) ExtConnectionCreationToolEntry(com.archimatetool.editor.diagram.tools.ExtConnectionCreationToolEntry) ConnectionCreationToolEntry(org.eclipse.gef.palette.ConnectionCreationToolEntry)

Aggregations

ConnectionCreationToolEntry (org.eclipse.gef.palette.ConnectionCreationToolEntry)10 PaletteGroup (org.eclipse.gef.palette.PaletteGroup)5 ExtConnectionCreationToolEntry (com.archimatetool.editor.diagram.tools.ExtConnectionCreationToolEntry)4 ToolEntry (org.eclipse.gef.palette.ToolEntry)4 ArrayList (java.util.ArrayList)2 CombinedTemplateCreationEntry (org.eclipse.gef.palette.CombinedTemplateCreationEntry)2 PaletteContainer (org.eclipse.gef.palette.PaletteContainer)2 PanningSelectionToolEntry (org.eclipse.gef.palette.PanningSelectionToolEntry)2 SelectionToolEntry (org.eclipse.gef.palette.SelectionToolEntry)2 FormatPainterToolEntry (com.archimatetool.editor.diagram.tools.FormatPainterToolEntry)1 MagicConnectionModelFactory (com.archimatetool.editor.diagram.tools.MagicConnectionModelFactory)1 SQLException (java.sql.SQLException)1 List (java.util.List)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 EClass (org.eclipse.emf.ecore.EClass)1 MarqueeToolEntry (org.eclipse.gef.palette.MarqueeToolEntry)1 PaletteDrawer (org.eclipse.gef.palette.PaletteDrawer)1 PaletteEntry (org.eclipse.gef.palette.PaletteEntry)1 PaletteRoot (org.eclipse.gef.palette.PaletteRoot)1 PaletteToolbar (org.eclipse.gef.palette.PaletteToolbar)1