Search in sources :

Example 1 with DiagramLayoutAction

use of org.jkiss.dbeaver.erd.ui.action.DiagramLayoutAction 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 DiagramLayoutAction

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

the class ERDEditorContextMenuProvider method buildContextMenu.

/**
 * @see ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager)
 */
@Override
public void buildContextMenu(IMenuManager menu) {
    if (editor.isLoaded()) {
        ISelection selection = editor.getGraphicalViewer().getSelection();
        if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
            editor.fillPartContextMenu(menu, (IStructuredSelection) selection);
        }
        menu.add(new Separator());
        editor.fillAttributeVisibilityMenu(menu);
        menu.add(new DiagramLayoutAction(editor));
        menu.add(new Separator());
        menu.add(new Separator(GEFActionConstants.GROUP_UNDO));
        menu.add(new Separator(GEFActionConstants.GROUP_COPY));
        // menu.add(ActionUtils.makeCommandContribution(editor.getSite(), IWorkbenchCommandConstants.EDIT_COPY));
        menu.add(new Separator(GEFActionConstants.GROUP_PRINT));
        menu.add(new Separator(GEFActionConstants.GROUP_EDIT));
        menu.add(new Separator(GEFActionConstants.GROUP_VIEW));
        menu.add(new Separator(GEFActionConstants.GROUP_FIND));
        menu.add(new Separator(GEFActionConstants.GROUP_REST));
        menu.add(new Separator(GEFActionConstants.GROUP_SAVE));
        menu.add(new Separator());
        menu.add(new GroupMarker(NavigatorCommands.GROUP_TOOLS));
        menu.add(new GroupMarker(NavigatorCommands.GROUP_NAVIGATOR_ADDITIONS));
        menu.add(new GroupMarker(NavigatorCommands.GROUP_NAVIGATOR_ADDITIONS_END));
        menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
        menu.add(new GroupMarker(IActionConstants.MB_ADDITIONS_END));
    }
}
Also used : DiagramLayoutAction(org.jkiss.dbeaver.erd.ui.action.DiagramLayoutAction) ISelection(org.eclipse.jface.viewers.ISelection) GroupMarker(org.eclipse.jface.action.GroupMarker) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Separator(org.eclipse.jface.action.Separator)

Example 3 with DiagramLayoutAction

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

the class ERDEditorContextMenuProvider method buildContextMenu.

/**
 * @see ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager)
 */
@Override
public void buildContextMenu(IMenuManager menu) {
    if (editor.isLoaded()) {
        ISelection selection = editor.getGraphicalViewer().getSelection();
        if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
            editor.fillPartContextMenu(menu, (IStructuredSelection) selection);
        }
        menu.add(new Separator());
        editor.fillAttributeVisibilityMenu(menu);
        menu.add(new DiagramLayoutAction(editor));
        menu.add(new Separator());
        menu.add(new Separator(GEFActionConstants.GROUP_UNDO));
        menu.add(new Separator(GEFActionConstants.GROUP_COPY));
        // menu.add(ActionUtils.makeCommandContribution(editor.getSite(), IWorkbenchCommandConstants.EDIT_COPY));
        menu.add(new Separator(GEFActionConstants.GROUP_PRINT));
        menu.add(new Separator(GEFActionConstants.GROUP_EDIT));
        menu.add(new Separator(GEFActionConstants.GROUP_VIEW));
        menu.add(new Separator(GEFActionConstants.GROUP_FIND));
        menu.add(new Separator(GEFActionConstants.GROUP_REST));
        menu.add(new Separator(GEFActionConstants.GROUP_SAVE));
        menu.add(new Separator());
        menu.add(new GroupMarker(NavigatorCommands.GROUP_TOOLS));
        menu.add(new GroupMarker(NavigatorCommands.GROUP_NAVIGATOR_ADDITIONS));
        menu.add(new GroupMarker(NavigatorCommands.GROUP_NAVIGATOR_ADDITIONS_END));
        menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
        menu.add(new GroupMarker(IActionConstants.MB_ADDITIONS_END));
    }
}
Also used : DiagramLayoutAction(org.jkiss.dbeaver.erd.ui.action.DiagramLayoutAction) ISelection(org.eclipse.jface.viewers.ISelection) GroupMarker(org.eclipse.jface.action.GroupMarker) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Separator(org.eclipse.jface.action.Separator)

Example 4 with DiagramLayoutAction

use of org.jkiss.dbeaver.erd.ui.action.DiagramLayoutAction 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

DiagramLayoutAction (org.jkiss.dbeaver.erd.ui.action.DiagramLayoutAction)4 ZoomManager (org.eclipse.gef.editparts.ZoomManager)2 GroupMarker (org.eclipse.jface.action.GroupMarker)2 Separator (org.eclipse.jface.action.Separator)2 ISelection (org.eclipse.jface.viewers.ISelection)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)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