Search in sources :

Example 1 with DiagramToggleGridAction

use of org.jkiss.dbeaver.erd.ui.action.DiagramToggleGridAction in project dbeaver by serge-rider.

the class ERDEditorPart method fillDefaultEditorContributions.

protected void fillDefaultEditorContributions(IContributionManager toolBarManager) {
    ZoomManager zoomManager = rootPart.getZoomManager();
    String[] zoomStrings = new String[] { ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH };
    // Init zoom combo with dummy part service
    // to prevent zoom disable on part change - as it is standalone zoom control, not global one
    zoomCombo = new ZoomComboContributionItem(new IPartService() {

        @Override
        public void addPartListener(IPartListener listener) {
        }

        @Override
        public void addPartListener(IPartListener2 listener) {
        }

        @Override
        public IWorkbenchPart getActivePart() {
            return ERDEditorPart.this;
        }

        @Override
        public IWorkbenchPartReference getActivePartReference() {
            return null;
        }

        @Override
        public void removePartListener(IPartListener listener) {
        }

        @Override
        public void removePartListener(IPartListener2 listener) {
        }
    }, zoomStrings);
    zoomCombo.setZoomManager(zoomManager);
    toolBarManager.add(zoomCombo);
    // toolBarManager.add(new UndoAction(ERDEditorPart.this));
    // toolBarManager.add(new RedoAction(ERDEditorPart.this));
    // toolBarManager.add(new PrintAction(ERDEditorPart.this));
    ZoomInAction zoomInAction = new ZoomInAction(zoomManager);
    zoomInAction.setImageDescriptor(DBeaverIcons.getImageDescriptor(UIIcon.ZOOM_IN));
    ZoomOutAction zoomOutAction = new ZoomOutAction(zoomManager);
    zoomOutAction.setImageDescriptor(DBeaverIcons.getImageDescriptor(UIIcon.ZOOM_OUT));
    toolBarManager.add(zoomInAction);
    toolBarManager.add(zoomOutAction);
    toolBarManager.add(new Separator());
    // toolBarManager.add(createAttributeVisibilityMenu());
    toolBarManager.add(new DiagramLayoutAction(ERDEditorPart.this));
    toolBarManager.add(new DiagramToggleGridAction());
    toolBarManager.add(new DiagramRefreshAction(ERDEditorPart.this));
    toolBarManager.add(new Separator());
    {
        toolBarManager.add(ActionUtils.makeCommandContribution(getSite(), IWorkbenchCommandConstants.FILE_PRINT, ERDUIMessages.erd_editor_control_action_print_diagram, UIIcon.PRINT));
        toolBarManager.add(ActionUtils.makeCommandContribution(getSite(), IWorkbenchCommandConstants.FILE_SAVE_AS, ERDUIMessages.erd_editor_control_action_save_external_format, UIIcon.PICTURE_SAVE));
        toolBarManager.add(ActionUtils.makeCommandContribution(getSite(), IWorkbenchCommandConstants.FILE_SAVE, null, UIIcon.SAVE));
    }
    toolBarManager.add(new Separator());
    {
        Action configAction = new Action(ERDUIMessages.erd_editor_control_action_configuration) {

            @Override
            public void run() {
                UIUtils.showPreferencesFor(getSite().getShell(), ERDEditorPart.this, ERDPreferencePage.PAGE_ID);
            }
        };
        configAction.setImageDescriptor(DBeaverIcons.getImageDescriptor(UIIcon.CONFIGURATION));
        toolBarManager.add(configAction);
    }
}
Also used : DiagramLayoutAction(org.jkiss.dbeaver.erd.ui.action.DiagramLayoutAction) SetPartColorAction(org.jkiss.dbeaver.erd.ui.editor.tools.SetPartColorAction) DiagramRefreshAction(org.jkiss.dbeaver.erd.ui.action.DiagramRefreshAction) SetPartSettingsAction(org.jkiss.dbeaver.erd.ui.editor.tools.SetPartSettingsAction) DiagramToggleGridAction(org.jkiss.dbeaver.erd.ui.action.DiagramToggleGridAction) ResetPartColorAction(org.jkiss.dbeaver.erd.ui.editor.tools.ResetPartColorAction) ChangeZOrderAction(org.jkiss.dbeaver.erd.ui.editor.tools.ChangeZOrderAction) DiagramToggleGridAction(org.jkiss.dbeaver.erd.ui.action.DiagramToggleGridAction) DiagramRefreshAction(org.jkiss.dbeaver.erd.ui.action.DiagramRefreshAction) ZoomManager(org.eclipse.gef.editparts.ZoomManager) DiagramLayoutAction(org.jkiss.dbeaver.erd.ui.action.DiagramLayoutAction)

Example 2 with DiagramToggleGridAction

use of org.jkiss.dbeaver.erd.ui.action.DiagramToggleGridAction in project dbeaver by dbeaver.

the class ERDEditorPart method fillDefaultEditorContributions.

protected void fillDefaultEditorContributions(IContributionManager toolBarManager) {
    ZoomManager zoomManager = rootPart.getZoomManager();
    String[] zoomStrings = new String[] { ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH };
    // Init zoom combo with dummy part service
    // to prevent zoom disable on part change - as it is standalone zoom control, not global one
    zoomCombo = new ZoomComboContributionItem(new IPartService() {

        @Override
        public void addPartListener(IPartListener listener) {
        }

        @Override
        public void addPartListener(IPartListener2 listener) {
        }

        @Override
        public IWorkbenchPart getActivePart() {
            return ERDEditorPart.this;
        }

        @Override
        public IWorkbenchPartReference getActivePartReference() {
            return null;
        }

        @Override
        public void removePartListener(IPartListener listener) {
        }

        @Override
        public void removePartListener(IPartListener2 listener) {
        }
    }, zoomStrings);
    zoomCombo.setZoomManager(zoomManager);
    toolBarManager.add(zoomCombo);
    // toolBarManager.add(new UndoAction(ERDEditorPart.this));
    // toolBarManager.add(new RedoAction(ERDEditorPart.this));
    // toolBarManager.add(new PrintAction(ERDEditorPart.this));
    ZoomInAction zoomInAction = new ZoomInAction(zoomManager);
    zoomInAction.setImageDescriptor(DBeaverIcons.getImageDescriptor(UIIcon.ZOOM_IN));
    ZoomOutAction zoomOutAction = new ZoomOutAction(zoomManager);
    zoomOutAction.setImageDescriptor(DBeaverIcons.getImageDescriptor(UIIcon.ZOOM_OUT));
    toolBarManager.add(zoomInAction);
    toolBarManager.add(zoomOutAction);
    toolBarManager.add(new Separator());
    // toolBarManager.add(createAttributeVisibilityMenu());
    toolBarManager.add(new DiagramLayoutAction(ERDEditorPart.this));
    toolBarManager.add(new DiagramToggleGridAction());
    toolBarManager.add(new DiagramRefreshAction(ERDEditorPart.this));
    toolBarManager.add(new Separator());
    {
        toolBarManager.add(ActionUtils.makeCommandContribution(getSite(), IWorkbenchCommandConstants.FILE_PRINT, ERDUIMessages.erd_editor_control_action_print_diagram, UIIcon.PRINT));
        toolBarManager.add(ActionUtils.makeCommandContribution(getSite(), IWorkbenchCommandConstants.FILE_SAVE_AS, ERDUIMessages.erd_editor_control_action_save_external_format, UIIcon.PICTURE_SAVE));
        toolBarManager.add(ActionUtils.makeCommandContribution(getSite(), IWorkbenchCommandConstants.FILE_SAVE, null, UIIcon.SAVE));
    }
    toolBarManager.add(new Separator());
    {
        Action configAction = new Action(ERDUIMessages.erd_editor_control_action_configuration) {

            @Override
            public void run() {
                UIUtils.showPreferencesFor(getSite().getShell(), ERDEditorPart.this, ERDPreferencePage.PAGE_ID);
            }
        };
        configAction.setImageDescriptor(DBeaverIcons.getImageDescriptor(UIIcon.CONFIGURATION));
        toolBarManager.add(configAction);
    }
}
Also used : DiagramLayoutAction(org.jkiss.dbeaver.erd.ui.action.DiagramLayoutAction) SetPartColorAction(org.jkiss.dbeaver.erd.ui.editor.tools.SetPartColorAction) DiagramRefreshAction(org.jkiss.dbeaver.erd.ui.action.DiagramRefreshAction) SetPartSettingsAction(org.jkiss.dbeaver.erd.ui.editor.tools.SetPartSettingsAction) DiagramToggleGridAction(org.jkiss.dbeaver.erd.ui.action.DiagramToggleGridAction) ResetPartColorAction(org.jkiss.dbeaver.erd.ui.editor.tools.ResetPartColorAction) ChangeZOrderAction(org.jkiss.dbeaver.erd.ui.editor.tools.ChangeZOrderAction) DiagramToggleGridAction(org.jkiss.dbeaver.erd.ui.action.DiagramToggleGridAction) DiagramRefreshAction(org.jkiss.dbeaver.erd.ui.action.DiagramRefreshAction) ZoomManager(org.eclipse.gef.editparts.ZoomManager) DiagramLayoutAction(org.jkiss.dbeaver.erd.ui.action.DiagramLayoutAction)

Aggregations

ZoomManager (org.eclipse.gef.editparts.ZoomManager)2 DiagramLayoutAction (org.jkiss.dbeaver.erd.ui.action.DiagramLayoutAction)2 DiagramRefreshAction (org.jkiss.dbeaver.erd.ui.action.DiagramRefreshAction)2 DiagramToggleGridAction (org.jkiss.dbeaver.erd.ui.action.DiagramToggleGridAction)2 ChangeZOrderAction (org.jkiss.dbeaver.erd.ui.editor.tools.ChangeZOrderAction)2 ResetPartColorAction (org.jkiss.dbeaver.erd.ui.editor.tools.ResetPartColorAction)2 SetPartColorAction (org.jkiss.dbeaver.erd.ui.editor.tools.SetPartColorAction)2 SetPartSettingsAction (org.jkiss.dbeaver.erd.ui.editor.tools.SetPartSettingsAction)2