Search in sources :

Example 66 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.

the class CubridMenuProvider method buildDatabaseMenu.

/**
	 * Construct database related actions
	 *
	 * @param manager the parent IMenuManager
	 * @param node the ICubridNode object
	 */
private void buildDatabaseMenu(IMenuManager manager, ICubridNode node) {
    if (LoginDatabaseAction.isSupportedNode(node)) {
        addActionToManager(manager, getAction(LoginDatabaseAction.ID));
    }
    if (LogoutDatabaseAction.isSupportedNode(node)) {
        addActionToManager(manager, getAction(LogoutDatabaseAction.ID));
    }
    manager.add(new Separator());
    addActionToManager(manager, getAction(EditDatabaseLoginAction.ID));
    addActionToManager(manager, getAction(ConnectionUrlExportAction.ID));
    manager.add(new Separator());
    addActionToManager(manager, getAction(DatabaseQueryNewAction.ID));
    manager.add(new Separator());
    addActionToManager(manager, getAction(ShowDatabaseDashboardAction.ID));
    manager.add(new Separator());
    ActionManager.addActionToManager(manager, SchemaCompareWizardAction.ID);
    ActionManager.addActionToManager(manager, DataCompareWizardAction.ID);
    //		manager.add(new Separator());
    //		addActionToManager(manager, getAction(OpenSchemaEditorAction.ID));
    manager.add(new Separator());
    addActionToManager(manager, getAction(ExportERwinAction.ID));
    addActionToManager(manager, getAction(ImportERwinAction.ID));
    manager.add(new Separator());
    CubridDatabase database = (CubridDatabase) node;
    if (database.isDistributorDb()) {
        buildReplicationMenu(manager);
        manager.add(new Separator());
    }
    // Export & Import Actions
    manager.add(new Separator());
    addActionToManager(manager, getAction(ExportWizardAction.ID));
    addActionToManager(manager, getAction(ImportWizardAction.ID));
    manager.add(new Separator());
    addActionToManager(manager, getAction(ExportTableDefinitionAction.ID));
    // Install Schema Comment
    addActionToManager(manager, getAction(SchemaCommentInstallAction.ID));
    manager.add(new Separator());
    //		manager.add(new Separator());
    //		addActionToManager(manager, getAction(RunSQLFileAction.ID));
    // Database Management Actions
    manager.add(new Separator());
    IMenuManager dbManMenu = new MenuManager(Messages.dbManMenu, CubridManagerUIPlugin.getImageDescriptor("icons/navigator/database_man.png"), null);
    manager.add(dbManMenu);
    if (StartDatabaseAction.isSupportedNode(node)) {
        addActionToManager(manager, getAction(StartDatabaseAction.ID));
    }
    if (StopDatabaseAction.isSupportedNode(node)) {
        addActionToManager(manager, getAction(StopDatabaseAction.ID));
    }
    addActionToManager(dbManMenu, getAction(LoadDatabaseAction.ID));
    addActionToManager(dbManMenu, getAction(UnloadDatabaseAction.ID));
    dbManMenu.add(new Separator());
    addActionToManager(dbManMenu, getAction(OptimizeAction.ID));
    addActionToManager(dbManMenu, getAction(CompactDatabaseAction.ID));
    addActionToManager(dbManMenu, getAction(CheckDatabaseAction.ID));
    dbManMenu.add(new Separator());
    addActionToManager(dbManMenu, getAction(CopyDatabaseAction.ID));
    addActionToManager(dbManMenu, getAction(RenameDatabaseAction.ID));
    dbManMenu.add(new Separator());
    addActionToManager(dbManMenu, getAction(BackupDatabaseAction.ID));
    addActionToManager(dbManMenu, getAction(RestoreDatabaseAction.ID));
    dbManMenu.add(new Separator());
    addActionToManager(dbManMenu, getAction(DeleteDatabaseAction.ID));
    IMenuManager dbInfoMenu = new MenuManager(Messages.dbInfoMenu, CubridManagerUIPlugin.getImageDescriptor("icons/navigator/database_info.png"), null);
    manager.add(dbInfoMenu);
    addActionToManager(dbInfoMenu, getAction(LockInfoAction.ID));
    addActionToManager(dbInfoMenu, getAction(TransactionInfoAction.ID));
    if (CompatibleUtil.isSupportPlanAndParamDump(database.getServer().getServerInfo())) {
        dbInfoMenu.add(new Separator());
        addActionToManager(dbInfoMenu, getAction(PlanDumpAction.ID));
        addActionToManager(dbInfoMenu, getAction(ParamDumpAction.ID));
    }
    dbInfoMenu.add(new Separator());
    addActionToManager(dbInfoMenu, getAction(OIDNavigatorAction.ID));
    manager.add(new Separator());
    addActionToManager(manager, getAction(PropertyAction.ID));
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) Separator(org.eclipse.jface.action.Separator)

Example 67 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.

the class BusinessAssignmentComposite method createPopupMenu.

private void createPopupMenu() {
    //$NON-NLS-1$
    MenuManager menuMgr = new MenuManager("#PopUp");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager mgr) {
            BusinessAssignment businessAssignment = getBusinessAssignment(tableViewer.getSelection());
            if (businessAssignment != null) {
                repositoryNode = createRepositoryNode(businessAssignment);
                if (repositoryNode != null) {
                    List<ITreeContextualAction> contextualsActions = ActionsHelper.getRepositoryContextualsActions();
                    for (ITreeContextualAction action : contextualsActions) {
                        if (action.isReadAction() || action.isEditAction() || action.isPropertiesAction()) {
                            action.init(null, new StructuredSelection(repositoryNode));
                            if (action.isVisible()) {
                                ((AContextualAction) action).setAvoidUnloadResources(true);
                                mgr.add(action);
                            }
                        }
                    }
                    if (ProjectManager.getInstance().isInCurrentMainProject(repositoryNode)) {
                        CorePlugin.getDefault().getDiagramModelService().addDeleteAssignmentAction(mgr, tableViewer.getSelection());
                    }
                }
            }
        }
    });
    Menu menu = menuMgr.createContextMenu(tableViewer.getControl());
    tableViewer.getControl().setMenu(menu);
}
Also used : BusinessAssignment(org.talend.designer.business.model.business.BusinessAssignment) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) List(java.util.List) IMenuManager(org.eclipse.jface.action.IMenuManager) ITreeContextualAction(org.talend.commons.ui.swt.actions.ITreeContextualAction) Menu(org.eclipse.swt.widgets.Menu) IMenuListener(org.eclipse.jface.action.IMenuListener)

Example 68 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.

the class HeapHistogramPage method createContextMenu.

/**
     * Creates the context menu.
     * 
     * @param actionBars The action bars
     */
private void createContextMenu(IActionBars actionBars) {
    final OpenDeclarationAction openAction = OpenDeclarationAction.createOpenDeclarationAction(actionBars);
    final CopyAction copyAction = CopyAction.createCopyAction(actionBars);
    configureColumnsAction = new ConfigureColumnsAction(this);
    heapViewer.addSelectionChangedListener(openAction);
    heapViewer.getControl().addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
            heapViewer.removeSelectionChangedListener(copyAction);
        }

        @Override
        public void focusGained(FocusEvent e) {
            heapViewer.addSelectionChangedListener(copyAction);
        }
    });
    heapViewer.addOpenListener(new IOpenListener() {

        @Override
        public void open(OpenEvent event) {
            openAction.run();
        }
    });
    //$NON-NLS-1$
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            manager.add(openAction);
            manager.add(copyAction);
            manager.add(new Separator());
            manager.add(configureColumnsAction);
        }
    });
    Menu menu = menuMgr.createContextMenu(heapViewer.getControl());
    heapViewer.getControl().setMenu(menu);
}
Also used : OpenDeclarationAction(org.talend.designer.runtime.visualization.internal.actions.OpenDeclarationAction) CopyAction(org.talend.designer.runtime.visualization.internal.actions.CopyAction) FocusEvent(org.eclipse.swt.events.FocusEvent) IMenuListener(org.eclipse.jface.action.IMenuListener) IOpenListener(org.eclipse.jface.viewers.IOpenListener) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) ConfigureColumnsAction(org.talend.designer.runtime.visualization.internal.actions.ConfigureColumnsAction) FocusListener(org.eclipse.swt.events.FocusListener) Separator(org.eclipse.jface.action.Separator) OpenEvent(org.eclipse.jface.viewers.OpenEvent)

Example 69 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.

the class AbstractJvmPropertySection method deactivateSection.

/**
     * Deactivates the section.
     */
protected void deactivateSection() {
    isSectionActivated = false;
    if (pageBook.isDisposed() || messagePage.isDisposed() || messageLabel.isDisposed()) {
        return;
    }
    // remove tool bar actions
    IToolBarManager toolBarManager = getToolBarManager();
    if (toolBarManager != null) {
        removeToolBarActions(toolBarManager);
        toolBarManager.update(false);
        updateActionBars();
    }
    // remove local menus
    IMenuManager menuManager = getMenuManager();
    if (menuManager != null) {
        menuManager.remove(preferencesAction.getId());
        removeLocalMenus(menuManager);
        menuManager.update(false);
        updateActionBars();
    }
    // clear status line
    clearStatusLine();
}
Also used : IToolBarManager(org.eclipse.jface.action.IToolBarManager) IMenuManager(org.eclipse.jface.action.IMenuManager)

Example 70 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project tdi-studio-se by Talend.

the class NewActionProvider method fillContextMenu.

/**
     * Adds a submenu to the given menu with the name "New Component".
     */
public void fillContextMenu(IMenuManager menu) {
    for (IContributionItem item : menu.getItems()) {
        if (item == null || item.getId() == null) {
            continue;
        }
        if (item.getId().equals("export") || item.getId().equals("import")) {
            //$NON-NLS-1$ //$NON-NLS-2$
            menu.remove(item);
        }
    }
    // append the submenu after the GROUP_NEW group.
    if (ComponentDesigenerPlugin.getDefault().isUsed()) {
        //$NON-NLS-1$
        IMenuManager submenu = new MenuManager(Messages.getString("NewActionProvider.New"), NEW_MENU_NAME);
        submenu.add(newProjectAction);
        menu.insertAfter(ICommonMenuConstants.GROUP_NEW, submenu);
    }
}
Also used : IContributionItem(org.eclipse.jface.action.IContributionItem) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager)

Aggregations

IMenuManager (org.eclipse.jface.action.IMenuManager)88 MenuManager (org.eclipse.jface.action.MenuManager)72 IMenuListener (org.eclipse.jface.action.IMenuListener)48 Menu (org.eclipse.swt.widgets.Menu)43 Separator (org.eclipse.jface.action.Separator)31 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)16 IAction (org.eclipse.jface.action.IAction)9 TreeViewer (org.eclipse.jface.viewers.TreeViewer)9 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)8 GridData (org.eclipse.swt.layout.GridData)8 Action (org.eclipse.jface.action.Action)7 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)7 Composite (org.eclipse.swt.widgets.Composite)7 GridLayout (org.eclipse.swt.layout.GridLayout)6 List (java.util.List)5 ICoolBarManager (org.eclipse.jface.action.ICoolBarManager)5 FocusEvent (org.eclipse.swt.events.FocusEvent)5 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)4 IContributionItem (org.eclipse.jface.action.IContributionItem)4 Point (org.eclipse.swt.graphics.Point)4