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

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

Introduction

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

Prototype

void add(IAction action);

Source Link

Document

Adds an action as a contribution item to this manager.

Usage

From source file:com.foosbar.mailsnag.views.MessagesView.java

License:Open Source License

private void fillLocalToolBar(IToolBarManager manager) {
    manager.add(runServer);
    manager.add(stopServer);
}

From source file:com.generalrobotix.ui.view.GrxTextEditorView.java

License:Open Source License

public GrxTextEditorView(String name, GrxPluginManager manager_, GrxBaseViewPart vp, Composite parent) {
    super(name, manager_, vp, parent);
    GridLayout layout = new GridLayout(1, true);
    layout.marginHeight = 0;/*from www  . java 2s. com*/
    layout.marginWidth = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    composite_.setLayout(layout);

    area_ = new StyledText(composite_, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);

    area_.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (currentItem_ != null)
                currentItem_.setValue(area_.getText());
        }
    });

    area_.addFocusListener(new FocusListener() {
        public void focusGained(FocusEvent e) {
            if (currentItem_ == null)
                return;
            if (currentItem_.isModifiedExternally()) {
                boolean state = MessageDialog.openQuestion(getParent().getShell(),
                        MessageBundle.get("GrxTextEditorView.dialog.title.reload"), //$NON-NLS-1$
                        MessageBundle.get("GrxTextEditorView.dialog.message.reload")); //$NON-NLS-1$
                if (state) {
                    currentItem_.reload();
                    area_.setText(currentItem_.getValue());
                }
            }
        }

        public void focusLost(FocusEvent e) {
        }
    });

    area_.addListener(SWT.Paint, new Listener() {
        public void handleEvent(Event event) {
            setPositionLabel();
        }
    });

    area_.addListener(SWT.MouseDown, new Listener() {
        public void handleEvent(Event event) {
            setPositionLabel();
        }
    });

    area_.addListener(SWT.KeyDown, new Listener() {
        public void handleEvent(Event event) {
            setPositionLabel();
        }
    });

    status_ = new Label(composite_, SWT.BORDER);

    GridData textData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    area_.setLayoutData(textData);

    GridData statusData = new GridData(GridData.FILL_HORIZONTAL);
    statusData.verticalAlignment = SWT.END;
    status_.setLayoutData(statusData);

    IToolBarManager toolbar = vp.getViewSite().getActionBars().getToolBarManager();

    save_ = new Action() {
        public void run() {
            if (currentItem_ != null) {
                currentItem_.setValue(area_.getText());
                currentItem_.save();
                //save_.setEnabled(false);
            }
        }
    };
    save_.setToolTipText(MessageBundle.get("GrxTextEditorView.text.save")); //$NON-NLS-1$
    save_.setImageDescriptor(Activator.getDefault().getDescriptor("save_edit.png")); //$NON-NLS-1$
    toolbar.add(save_);

    saveAs_ = new Action() {
        public void run() {
            if (currentItem_ != null) {
                currentItem_.setValue(area_.getText());
                currentItem_.saveAs();
            }
        }
    };
    saveAs_.setToolTipText(MessageBundle.get("GrxTextEditorView.text.saveAs")); //$NON-NLS-1$
    saveAs_.setImageDescriptor(Activator.getDefault().getDescriptor("saveas_edit.png")); //$NON-NLS-1$
    toolbar.add(saveAs_);
    setScrollMinSize(SWT.DEFAULT, SWT.DEFAULT);

    setUp();
    manager_.registerItemChangeListener(this, GrxPythonScriptItem.class);
    updateEditerFont();
}

From source file:com.geofx.xmleditor.XMLEditorContributor.java

License:Open Source License

/**
 * /*from   w  ww .  j  av a2 s .c o  m*/
 * Contributes to the toolbar.
 * 
 * @see EditorActionBarContributor#contributeToToolBar
 */
public void contributeToToolBar(IToolBarManager tbm) {
    super.contributeToToolBar(tbm);
    tbm.add(new Separator());
}

From source file:com.github.jknack.antlr4ide.ui.railroad.RailroadView.java

License:Open Source License

private void createActions() {
    IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
    toolBarManager.add(exportAction);
    toolBarManager.add(linkWithEditorAction);
    selectionLinker.activate();/*ww  w .j  ava 2 s  . c  o m*/
}

From source file:com.github.picologger.eclipse.syslogcat.views.LogCatView.java

License:Apache License

/**
 * Place the actions in the ui.//ww  w  .jav a  2  s  .  c o m
 */
private void placeActions() {
    IActionBars actionBars = getViewSite().getActionBars();

    // first in the menu
    IMenuManager menuManager = actionBars.getMenuManager();
    menuManager.add(mCreateFilterAction);
    menuManager.add(mEditFilterAction);
    menuManager.add(mDeleteFilterAction);
    menuManager.add(new Separator());
    menuManager.add(mClearAction);
    menuManager.add(new Separator());
    menuManager.add(mExportAction);
    menuManager.add(gotoLineAction);

    // and then in the toolbar
    IToolBarManager toolBarManager = actionBars.getToolBarManager();
    for (CommonAction a : mLogLevelActions) {
        toolBarManager.add(a);
    }
    toolBarManager.add(new Separator());
    toolBarManager.add(mCreateFilterAction);
    toolBarManager.add(mEditFilterAction);
    toolBarManager.add(mDeleteFilterAction);
    toolBarManager.add(new Separator());
    toolBarManager.add(mClearAction);
}

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);//from   w w w.  ja  v  a  2  s . c  o m
    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);//ww w  .j  ava 2s  .  c o m
}

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

License:Open Source License

protected void configureViewToolBar(IToolBarManager manager) {
    manager.removeAll();//from ww w.  j a  v a  2  s  . com

    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.dev.util.ast.ASTExplorer.java

License:Open Source License

private void contributeViewToolItems(IToolBarManager manager) {
    manager.add(expandAllAction);
    manager.add(collapseAllAction);
}

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

License:Open Source License

protected void configureViewToolBar(IToolBarManager manager) {
    manager.removeAll();/*www.j  a va  2s.c o m*/

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

    manager.update(true);
}