Example usage for org.eclipse.jface.action IToolBarManager update

List of usage examples for org.eclipse.jface.action IToolBarManager update

Introduction

In this page you can find the example usage for org.eclipse.jface.action IToolBarManager update.

Prototype

void update(boolean force);

Source Link

Document

Updates this manager's underlying widget(s) with any changes which have been made to it or its items.

Usage

From source file:com.drgarbage.bytecodevisualizer.view.OperandStackViewPage.java

License:Apache License

private void configureToolBar() {

    IActionBars bars = getSite().getActionBars();
    IToolBarManager tbm = bars.getToolBarManager();

    showTreeViewAction = new Action() {
        public void run() {
            activateView(OperandStackView_ID.TREE_VIEW);
        }/*  w  w  w .  j  a v  a  2s.  co  m*/
    };
    showTreeViewAction.setImageDescriptor(CoreImg.bytecodeViewIcon_16x16);
    tbm.add(showTreeViewAction);
    showTreeViewAction.setText(BytecodeVisualizerMessages.TreeViewAction_Text);
    showTreeViewAction.setToolTipText(BytecodeVisualizerMessages.TreeViewAction_Text);
    showTreeViewAction.setChecked(true);

    showBasicBlockViewAction = new Action() {
        public void run() {
            activateView(OperandStackView_ID.BASICBKLOCK_VIEW);
        }
    };
    showBasicBlockViewAction.setImageDescriptor(CoreImg.basicblockViewIcon_16x16);
    tbm.add(showBasicBlockViewAction);
    showBasicBlockViewAction.setText(BytecodeVisualizerMessages.BasicViewAction_Text);
    showBasicBlockViewAction.setToolTipText(BytecodeVisualizerMessages.BasicViewAction_Text);
    showBasicBlockViewAction.setChecked(false);

    showInstructioneListViewAction = new Action() {
        public void run() {
            activateView(OperandStackView_ID.INSTR_LIST_VIEW);
        }
    };
    showInstructioneListViewAction.setImageDescriptor(CoreImg.bytecode_listview_16x16);
    showInstructioneListViewAction.setText(BytecodeVisualizerMessages.InstructionListView_Text);
    showInstructioneListViewAction.setToolTipText(BytecodeVisualizerMessages.InstructionListView_Text);
    tbm.add(showInstructioneListViewAction);
    showInstructioneListViewAction.setChecked(false);

    enableActions(false);

    showAnalyseReportAction = new Action() {
        public void run() {
            OperandStackReportDialog analyseReport = new OperandStackReportDialog();
            analyseReport.setText(OperandStackAnalysis.executeAll(operandStack, methodInput));
            analyseReport.open();
        }
    };

    showAnalyseReportAction.setImageDescriptor(
            PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FILE));
    showAnalyseReportAction.setText(BytecodeVisualizerMessages.OpenOpstackAnalyseAction_Text);
    showAnalyseReportAction.setToolTipText(BytecodeVisualizerMessages.OpenOpstackAnalyseAction_Tooltip);

    tbm.add(new Separator());
    tbm.add(showAnalyseReportAction);

    tbm.update(true);

    /* menu */
    final IMenuManager imb = bars.getMenuManager();

    /* submenu */
    MenuManager subMenuViewLayout = new MenuManager(BytecodeVisualizerMessages.subMenuViewLayout_Text, null);
    final MenuManager subMenuShowColumn = new MenuManager(BytecodeVisualizerMessages.subMenuShowColumn_Text,
            null);
    final MenuManager subMenuFormat = new MenuManager(BytecodeVisualizerMessages.subMenuFormat_Text, null);

    imb.add(subMenuViewLayout);
    imb.add(subMenuShowColumn);
    imb.add(subMenuFormat);
    imb.add(new Separator());
    imb.add(showAnalyseReportAction);

    subMenuViewLayout.add(showTreeViewAction);
    subMenuViewLayout.add(showBasicBlockViewAction);
    subMenuViewLayout.add(showInstructioneListViewAction);

    showOSBeforeColumnAction = new Action() {
        public void run() {
            if (column3.getWidth() == 0) {
                column3.setWidth(100);
                column3.setResizable(true);
                setChecked(true);
            } else {
                column3.setWidth(0);
                column3.setResizable(false);
                setChecked(false);
            }
            subMenuShowColumn.update(true);
        }
    };
    showOSBeforeColumnAction.setText(BytecodeVisualizerMessages.OpstackBeforeColumnName);

    showOSAfterColumnAction = new Action() {
        public void run() {
            if (column4.getWidth() == 0) {
                column4.setWidth(100);
                column4.setResizable(true);
                setChecked(true);
            } else {
                column4.setWidth(0);
                column4.setResizable(false);
                setChecked(false);
            }
            subMenuShowColumn.update(true);
        }
    };
    showOSAfterColumnAction.setText(BytecodeVisualizerMessages.OpstackAfterColumnName);

    showOSDepthColumnAction = new Action() {
        public void run() {
            if (column5.getWidth() == 0) {
                column5.setWidth(40);
                column5.setResizable(true);
                setChecked(true);
            } else {
                column5.setWidth(0);
                column5.setResizable(false);
                setChecked(false);
            }
            subMenuShowColumn.update(true);
        }
    };
    showOSDepthColumnAction.setText(BytecodeVisualizerMessages.OpstackDepthColumnName);

    showDescriptionColumnAction = new Action() {
        public void run() {
            if (column6.getWidth() == 0) {
                column6.setWidth(100);
                column6.setResizable(true);
                setChecked(true);
            } else {
                column6.setWidth(0);
                column6.setResizable(false);
                setChecked(false);
            }
            subMenuShowColumn.update(true);
        }
    };
    showDescriptionColumnAction.setText(BytecodeVisualizerMessages.OpstackDescriptionColumnName);

    showOSBeforeColumnAction.setChecked(true);
    showOSAfterColumnAction.setChecked(true);
    showOSDepthColumnAction.setChecked(true);

    subMenuShowColumn.add(showOSBeforeColumnAction);
    subMenuShowColumn.add(showOSAfterColumnAction);
    subMenuShowColumn.add(showOSDepthColumnAction);
    subMenuShowColumn.add(showDescriptionColumnAction);

    displaySimpleAction = new Action() {
        public void run() {
            opstackRepresenationFormat = OpstackRepresenation.SIMPLE;
            activateDisplayFormat(OperandStackDisplayFormat_ID.DISPLAY_SIMPLE);
            subMenuFormat.update(true);
        }

        public String getText() {
            return BytecodeVisualizerMessages.DisplayFormatSIMPLE;
        }
    };
    displaySimpleAction.setChecked(true);

    displayAllAction = new Action() {
        public void run() {
            opstackRepresenationFormat = OpstackRepresenation.ALL;
            activateDisplayFormat(OperandStackDisplayFormat_ID.DISPLAY_ALL);
            subMenuFormat.update(true);
        }

        public String getText() {
            return BytecodeVisualizerMessages.DisplayFormatALL;
        }
    };
    displayAllAction.setChecked(false);

    displayValuesAction = new Action() {
        public void run() {
            opstackRepresenationFormat = OpstackRepresenation.VALUES;
            activateDisplayFormat(OperandStackDisplayFormat_ID.DISPLAY_VALUES);
            subMenuFormat.update(true);
        }

        public String getText() {
            return BytecodeVisualizerMessages.DisplayFormatVALUES;
        }
    };
    displayValuesAction.setChecked(false);

    displayTypesAction = new Action() {
        public void run() {
            opstackRepresenationFormat = OpstackRepresenation.TYPES;
            activateDisplayFormat(OperandStackDisplayFormat_ID.DISPLAY_TYPES);
            subMenuFormat.update(true);
        }

        public String getText() {
            return BytecodeVisualizerMessages.DisplayFormatTYPES;
        }
    };
    displayTypesAction.setChecked(false);

    subMenuFormat.add(displaySimpleAction);
    subMenuFormat.add(displayTypesAction);
    subMenuFormat.add(displayValuesAction);
    subMenuFormat.add(displayAllAction);

}

From source file:com.elphel.vdt.ui.views.DesignFlowView.java

License:Open Source License

private void fillLocalToolBar(IToolBarManager manager) { // On Horizontal bar
    /**+               manager.add(launchAction); */
    if (launchActions != null) {
        for (Action action : launchActions) {
            manager.add(action); // No Separator??
        }/*from w  w w  . j  a v  a  2s. c  o  m*/
    }
    //       System.out.println("fillLocalToolBar(), launchActions="+launchActions);

    //        manager.add(launchAction);  // test
    //      manager.add(new Separator());
    //      drillDownAdapter.addNavigationActions(manager);
    manager.add(new Separator("toolbar-separator"));
    manager.add(toggleLinkedTools);
    manager.add(toggleSaveTools);
    manager.add(toggleStopTools);
    manager.add(new Separator());
    manager.add(showInstallationPropertiesAction);
    manager.add(showPackagePropertiesToolbarAction);
    manager.add(showProjectPropertiesToolbarAction);
    manager.add(showPropertiesAction);
    manager.update(false); // (force) - added new, but removed project, tool and clear/change menu for Icarus (kept the same number of items) Need to update higher menu
    getViewSite().getActionBars().updateActionBars();
}

From source file:com.github.sdbg.debug.ui.internal.objectinspector.ObjectInspectorView.java

License:Open Source License

protected void configureToolBar(IToolBarManager manager) {
    manager.add(HistoryAction.createForwardAction(historyList));
    manager.add(HistoryAction.createBackAction(historyList));
    manager.add(new Separator());
    manager.add(printItAction);/* w  w  w.ja va  2 s  .c  om*/
    manager.add(inspectItAction);

    manager.update(true);
}

From source file:com.github.sdbg.debug.ui.internal.view.BreakpointsView.java

License:Open Source License

@Override
protected void configureToolBar(IToolBarManager manager) {
    removeAllBreakpointsAction = new RemoveAllBreakpointsAction();

    manager.add(removeAllBreakpointsAction);
    manager.update(true);
}

From source file:com.github.sdbg.debug.ui.internal.view.DebuggerView.java

License:Open Source License

protected void configureViewToolBar(IToolBarManager manager) {
    manager.removeAll();//from  w w w .  ja  v a 2  s.c o m

    manager.add(showBreakpointsAction);
    manager.add(showInspectorAction);
    manager.add(showExpressionsAction);
    manager.add(new Separator());
    manager.add(new ToggleLogicalStructureAction(variablesView));
    manager.add(new ToggleUseSourceMapsAction(this));

    manager.update(true);
}

From source file:com.google.dart.tools.debug.ui.internal.view.DebuggerView.java

License:Open Source License

protected void configureViewToolBar(IToolBarManager manager) {
    manager.removeAll();//from  www  .  ja va2 s  . c  o  m

    manager.add(showBreakpointsAction);
    manager.add(new ShowExpressionsAction());
    manager.add(new Separator());
    manager.add(new ToggleLogicalStructureAction(variablesView));

    manager.update(true);
}

From source file:com.google.dart.tools.deploy.ApplicationActionBarAdvisor.java

License:Open Source License

/**
 * Update the pin action's tool bar//from www.j a  va2s . c  om
 */
void updatePinActionToolbar() {

    ICoolBarManager coolBarManager = getActionBarConfigurer().getCoolBarManager();
    IContributionItem cbItem = coolBarManager.find(IWorkbenchActionConstants.TOOLBAR_NAVIGATE);
    if (!(cbItem instanceof IToolBarContributionItem)) {
        // This should not happen
        IDEWorkbenchPlugin.log("Navigation toolbar contribution item is missing"); //$NON-NLS-1$
        return;
    }
    IToolBarContributionItem toolBarItem = (IToolBarContributionItem) cbItem;
    IToolBarManager toolBarManager = toolBarItem.getToolBarManager();
    if (toolBarManager == null) {
        // error if this happens, navigation toolbar assumed to always exist
        IDEWorkbenchPlugin.log("Navigate toolbar is missing"); //$NON-NLS-1$
        return;
    }

    toolBarManager.update(false);
    toolBarItem.update(ICoolBarManager.SIZE);
}

From source file:com.google.dart.tools.search.ui.text.AbstractTextSearchViewPage.java

License:Open Source License

private void createViewer(Composite parent, int layout) {
    if ((layout & FLAG_LAYOUT_FLAT) != 0) {
        TableViewer viewer = createTableViewer(parent);
        fViewer = viewer;//ww  w  .j a v a  2 s.c o  m
        configureTableViewer(viewer);
    } else if ((layout & FLAG_LAYOUT_TREE) != 0) {
        TreeViewer viewer = createTreeViewer(parent);
        fViewer = viewer;
        configureTreeViewer(viewer);
        fCollapseAllAction.setViewer(viewer);
        fExpandAllAction.setViewer(viewer);
    }

    fCopyToClipboardAction.setViewer(fViewer);
    fSelectAllAction.setViewer(fViewer);

    IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
    tbm.removeAll();
    SearchView.createToolBarGroups(tbm);
    fillToolbar(tbm);
    tbm.update(false);

    new OpenAndLinkWithEditorHelper(fViewer) {

        @Override
        protected void activate(ISelection selection) {
            final int currentMode = OpenStrategy.getOpenMethod();
            try {
                OpenStrategy.setOpenMethod(OpenStrategy.DOUBLE_CLICK);
                handleOpen(new OpenEvent(fViewer, selection));
            } finally {
                OpenStrategy.setOpenMethod(currentMode);
            }
        }

        @Override
        protected void linkToEditor(ISelection selection) {
            // not supported by this part
        }

        @Override
        protected void open(ISelection selection, boolean activate) {
            handleOpen(new OpenEvent(fViewer, selection));
        }

    };

    fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            fCurrentMatchIndex = -1;
        }
    });

    fViewer.addSelectionChangedListener(fViewerAdapter);

    Menu menu = fMenu.createContextMenu(fViewer.getControl());
    fViewer.getControl().setMenu(menu);

    updateLayoutActions();
    getViewPart().updateLabel();
}

From source file:com.google.dart.tools.ui.internal.libraryview.LibraryExplorerActionGroup.java

License:Open Source License

private void fillToolBar(IToolBarManager toolBar) {
    toolBar.add(collapseAllAction);
    toolBar.add(toggleLinkingAction);
    toolBar.update(true);
}

From source file:com.google.dart.tools.ui.internal.typehierarchy.TypeHierarchyViewPart.java

License:Open Source License

@Override
public void createPartControl(Composite container) {
    fPagebook = new PageBook(container, SWT.NONE);
    // page 1 of page book (no hierarchy label)
    {//from   ww w. j  a  v  a2 s.  c om
        fNoHierarchyShownLabel = new Label(fPagebook, SWT.TOP | SWT.LEFT | SWT.WRAP);
        fNoHierarchyShownLabel.setText(TypeHierarchyMessages.TypeHierarchyViewPart_empty);
    }
    // page 2 of page book (viewers)
    {
        fTypeMethodsSplitter = new SashForm(fPagebook, SWT.VERTICAL);
        fTypeMethodsSplitter.setVisible(false);

        fTypeViewerViewForm = new ViewForm(fTypeMethodsSplitter, SWT.NONE);

        Control typeViewerControl = createTypeViewerControl(fTypeViewerViewForm);
        fTypeViewerViewForm.setContent(typeViewerControl);

        fMethodViewerViewForm = new ViewForm(fTypeMethodsSplitter, SWT.NONE);
        fTypeMethodsSplitter.setWeights(new int[] { 65, 35 });

        Control methodViewerPart = createMethodViewerControl(fMethodViewerViewForm);
        fMethodViewerViewForm.setContent(methodViewerPart);
    }

    fPagebook.showPage(fNoHierarchyShownLabel);

    // fill the tool bar
    IToolBarManager toolbarManager = getViewSite().getActionBars().getToolBarManager();
    methodsViewer.contributeToToolBar(toolbarManager);
    toolbarManager.update(true);

    if (fMemento != null) {
        restoreState(fMemento);
    }

    fOpenAction = new OpenAction(getSite());
}