Search in sources :

Example 26 with IToolBarManager

use of org.eclipse.jface.action.IToolBarManager in project linuxtools by eclipse.

the class ValgrindViewPart method createDynamicContent.

/**
 * Returns a refreshable view specific of a Valgrind tool.
 *
 * @param description     the content description
 * @param toolID          the Valgrind tool identifier
 * @return                the Valgrind tool view
 * @throws CoreException  the toolbar is disposed
 */
public IValgrindToolView createDynamicContent(String description, String toolID) throws CoreException {
    setContentDescription(description);
    // remove tool specific toolbar controls
    IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
    ToolBar tb = ((ToolBarManager) toolbar).getControl();
    if (tb == null || tb.isDisposed()) {
        // $NON-NLS-1$
        throw new CoreException(new Status(IStatus.ERROR, ValgrindUIPlugin.PLUGIN_ID, "Toolbar is disposed"));
    }
    if (dynamicActions != null) {
        for (ActionContributionItem item : dynamicActions) {
            toolbar.remove(item);
        }
    }
    // remove old view controls
    if (dynamicView != null) {
        dynamicView.dispose();
    }
    // remove old messages
    if (messages != null) {
        messagesViewer.getTreeViewer().setInput(null);
        messages = null;
    }
    for (Control child : dynamicViewHolder.getChildren()) {
        if (!child.isDisposed()) {
            child.dispose();
        }
    }
    if (toolID != null) {
        dynamicView = ValgrindUIPlugin.getDefault().getToolView(toolID);
        dynamicView.createPartControl(dynamicViewHolder);
        // create toolbar items
        IAction[] actions = dynamicView.getToolbarActions();
        if (actions != null) {
            dynamicActions = new ActionContributionItem[actions.length];
            for (int i = 0; i < actions.length; i++) {
                dynamicActions[i] = new ActionContributionItem(actions[i]);
                toolbar.appendToGroup(TOOLBAR_LOC_GROUP_ID, dynamicActions[i]);
            }
        }
    } else {
        dynamicView = null;
    }
    // remove old menu items
    IMenuManager menu = getViewSite().getActionBars().getMenuManager();
    menu.removeAll();
    // was content was created?
    hasDynamicContent = dynamicViewHolder.getChildren().length > 0;
    if (hasDynamicContent) {
        menu.add(showCoreAction);
        menu.add(showToolAction);
    }
    menu.update(true);
    toolbar.update(true);
    // Update to notify the workbench items have been changed
    getViewSite().getActionBars().updateActionBars();
    dynamicViewHolder.layout(true);
    return dynamicView;
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) Control(org.eclipse.swt.widgets.Control) CoreException(org.eclipse.core.runtime.CoreException) IAction(org.eclipse.jface.action.IAction) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBar(org.eclipse.swt.widgets.ToolBar) IMenuManager(org.eclipse.jface.action.IMenuManager) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager)

Example 27 with IToolBarManager

use of org.eclipse.jface.action.IToolBarManager in project bndtools by bndtools.

the class JPMBrowserView method createActions.

private void createActions() {
    backAction = new Action("Back", backImg) {

        @Override
        public void run() {
            browser.back();
        }
    };
    forwardAction = new Action("Forward", forwardImg) {

        @Override
        public void run() {
            browser.forward();
        }
    };
    IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
    tbm.add(backAction);
    tbm.add(forwardAction);
}
Also used : Action(org.eclipse.jface.action.Action) IToolBarManager(org.eclipse.jface.action.IToolBarManager)

Example 28 with IToolBarManager

use of org.eclipse.jface.action.IToolBarManager in project yamcs-studio by yamcs.

the class YamcsStudioActionBarAdvisor method fillCoolBar.

@Override
protected void fillCoolBar(ICoolBarManager coolbar) {
    IToolBarManager appToolBar = new ToolBarManager(coolbar.getStyle());
    coolbar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_APP));
    coolbar.add(new ToolBarContributionItem(appToolBar, IWorkbenchActionConstants.TOOLBAR_FILE));
    coolbar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    coolbar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR));
    fillAppToolBar(appToolBar);
    // Doesn't seem to work...
    coolbar.setLockLayout(true);
}
Also used : ToolBarContributionItem(org.eclipse.jface.action.ToolBarContributionItem) IToolBarManager(org.eclipse.jface.action.IToolBarManager) GroupMarker(org.eclipse.jface.action.GroupMarker) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager)

Example 29 with IToolBarManager

use of org.eclipse.jface.action.IToolBarManager in project translationstudio8 by heartsome.

the class MatchViewPart method createActions.

/**
	 * 创建视图工具栏的按钮。
	 */
private void createActions() {
    menuMgr = new MatchViewerBodyMenu(this);
    gridTable.setMenu(menuMgr.getBodyMenu());
    IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
    toolBarManager.add(menuMgr.editAction);
    toolBarManager.add(menuMgr.deleteAction);
    toolBarManager.add(menuMgr.acceptMatchAction);
    // toolBarManager.add(menuMgr.acceptMatchPureTextAction);
    menuMgr.updateActionState();
}
Also used : IToolBarManager(org.eclipse.jface.action.IToolBarManager)

Example 30 with IToolBarManager

use of org.eclipse.jface.action.IToolBarManager in project GT by Tencent.

the class SMAPSView method createLocalToolBar.

private void createLocalToolBar() {
    IActionBars bars = getViewSite().getActionBars();
    IToolBarManager manager = bars.getToolBarManager();
    manager.add(openLogAction);
}
Also used : IToolBarManager(org.eclipse.jface.action.IToolBarManager) IActionBars(org.eclipse.ui.IActionBars)

Aggregations

IToolBarManager (org.eclipse.jface.action.IToolBarManager)58 IActionBars (org.eclipse.ui.IActionBars)20 Action (org.eclipse.jface.action.Action)18 Separator (org.eclipse.jface.action.Separator)10 IMenuManager (org.eclipse.jface.action.IMenuManager)9 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)8 IAction (org.eclipse.jface.action.IAction)7 RecordAction (com.cubrid.cubridmanager.ui.monitoring.editor.internal.RecordAction)6 ToolBarManager (org.eclipse.jface.action.ToolBarManager)6 IContributionItem (org.eclipse.jface.action.IContributionItem)5 ToolBarContributionItem (org.eclipse.jface.action.ToolBarContributionItem)5 GridData (org.eclipse.swt.layout.GridData)5 MenuManager (org.eclipse.jface.action.MenuManager)4 ISelection (org.eclipse.jface.viewers.ISelection)4 DropDownAction (com.cubrid.common.ui.common.action.DropDownAction)3 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 TableLayout (org.eclipse.jface.viewers.TableLayout)3 Composite (org.eclipse.swt.widgets.Composite)3