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:de.clausthal.tu.ielf.resusdesigner.actions.LogicActionBarContributor.java

License:Open Source License

/**
 * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(IToolBarManager)
 *///from ww  w  . j a v a  2s  .  c o m
public void contributeToToolBar(IToolBarManager tbm) {
    tbm.add(getAction(ActionFactory.UNDO.getId()));
    tbm.add(getAction(ActionFactory.REDO.getId()));

    tbm.add(new Separator());

    tbm.add(new Separator());
    tbm.add(getAction(GEFActionConstants.ALIGN_LEFT));
    tbm.add(getAction(GEFActionConstants.ALIGN_CENTER));
    tbm.add(getAction(GEFActionConstants.ALIGN_RIGHT));
    tbm.add(new Separator());
    tbm.add(getAction(GEFActionConstants.ALIGN_TOP));
    tbm.add(getAction(GEFActionConstants.ALIGN_MIDDLE));
    tbm.add(getAction(GEFActionConstants.ALIGN_BOTTOM));

    tbm.add(new Separator());
    tbm.add(getAction(GEFActionConstants.MATCH_SIZE));
    tbm.add(getAction(GEFActionConstants.MATCH_WIDTH));
    tbm.add(getAction(GEFActionConstants.MATCH_HEIGHT));

    tbm.add(new Separator());
    String[] zoomStrings = new String[] { ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH };
    tbm.add(new ZoomComboContributionItem(getPage(), zoomStrings));
}

From source file:de.defmacro.dandelion.internal.ui.editor.LispEditorActionContributor.java

License:Open Source License

/**
 * @see EditorActionBarContributor#contributeToToolBar(IToolBarManager)
 *//*from   ww w . jav  a 2s . c  o  m*/
@Override
public void contributeToToolBar(final IToolBarManager toolBarManager) {
    toolBarManager.add(fEvalSelectionAction);
    toolBarManager.add(fEvalFileAction);
    toolBarManager.add(fEvalToplevelAction);
    toolBarManager.add(new Separator());
    toolBarManager.add(fMacroexpand);
    toolBarManager.add(fMacroexpand1);
}

From source file:de.defmacro.dandelion.internal.ui.views.listener.ListenerView.java

License:Open Source License

private void fillLocalToolBar(final IToolBarManager manager) {
    manager.add(fActionClear);
    manager.add(fActionSwitchPackage);//  ww w.j a  v  a2  s.  com
    manager.add(fActionHistory);
}

From source file:de.dfki.iui.mmds.sdk.editors.model.ProjectActionBarContributor.java

License:Creative Commons License

/**
 * This adds Separators for editor additions to the tool bar. <!--
 * begin-user-doc --> <!-- end-user-doc -->
 * /*ww  w.j  a v a2  s . c o m*/
 * @generated
 */
@Override
public void contributeToToolBar(IToolBarManager toolBarManager) {
    toolBarManager.add(new Separator("project-settings"));
    toolBarManager.add(new Separator("project-additions"));
}

From source file:de.enough.polish.plugin.eclipse.polishEditor.editor.PolishEditor.java

License:Open Source License

public void createPartControl(Composite parent) {

    // This one origins from JavaEditor and is a chain of 4 stores.
    IPreferenceStore preferenceStoreJava = this.getPreferenceStore();
    IPreferenceStore preferenceStorePolish = PolishEditorPlugin.getDefault().getPreferenceStore();

    preferenceStorePolish.addPropertyChangeListener(this.propertyChangeListener);

    IPreferenceStore[] preferenceStores = new IPreferenceStore[2];
    preferenceStores[0] = preferenceStoreJava;
    preferenceStores[1] = preferenceStorePolish;

    // We are forced to do this kludge because all private methods of suberclasses uses this one preferenceStore.
    // We do need write support so we give others this chainPreferenceStore and when we edit some values
    // we get our own store from the plugin. And thus hardwiring as unforgivable like all others.
    IPreferenceStore preferenceStore = new ChainedPreferenceStore(preferenceStores);

    // No need to get the ColorManager from somewhere else because there it is also simply instantiated.
    IColorManager colorManager = new JavaColorManager();

    PolishSourceViewerConfiguration polishSourceViewerConfiguration;
    polishSourceViewerConfiguration = new PolishSourceViewerConfiguration(colorManager, preferenceStore, this,
            IJavaPartitions.JAVA_PARTITIONING);
    setSourceViewerConfiguration(polishSourceViewerConfiguration);

    //        this.meposeProject = MeposePlugin.getDefault().getMeposeModelFromResource(((PolishSourceViewerConfiguration)getSourceViewerConfiguration()).getProject().getProject());
    MeposeModelManager meposeModelManager = MeposePlugin.getDefault().getMeposeModelManager();
    IProject project = getJavaProject().getProject();
    this.meposeModel = meposeModelManager.getModel(project);
    if (this.meposeModel == null) {
        meposeModelManager.addModel(project, new MeposeModel());
        this.meposeModel = meposeModelManager.getModel(project);
    }/*from   w  w w  .ja  v  a  2 s.com*/

    super.createPartControl(parent);

    // The SemanticHighlightingReconciler is a ReconcileListener which will be called at the editor start
    // and which will erase everything the normal reconciler has done so far.

    Field semanticManagerField;
    try {
        semanticManagerField = getClass().getSuperclass().getSuperclass().getDeclaredField("fSemanticManager");
        semanticManagerField.setAccessible(true);
        Object semanticManager = semanticManagerField.get(this);

        Field presenterField = semanticManager.getClass().getDeclaredField("fPresenter");
        presenterField.setAccessible(true);
        Object presenter = presenterField.get(semanticManager);

        Field presentationReconcilerField = presenter.getClass().getDeclaredField("fPresentationReconciler");
        presentationReconcilerField.setAccessible(true);
        Object presentationReconciler = presentationReconcilerField.get(presenter);

        Field damagersField = presentationReconciler.getClass().getSuperclass().getDeclaredField("fDamagers");
        Field repairersField = presentationReconciler.getClass().getSuperclass().getDeclaredField("fRepairers");
        damagersField.setAccessible(true);
        repairersField.setAccessible(true);
        Map damagers = (Map) damagersField.get(presentationReconciler);
        Map repairers = (Map) repairersField.get(presentationReconciler);

        RuleBasedScanner polishLineScanner = ((PolishSourceViewerConfiguration) getSourceViewerConfiguration())
                .getSinglelineCommentScanner();
        Map[] maps = new Map[] { damagers, repairers };
        for (int i = 0; i < maps.length; i++) {
            Map map = maps[i];
            Object damagerRepairer = map.get("__java_singleline_comment");
            Field scannerField = damagerRepairer.getClass().getDeclaredField("fScanner");
            scannerField.setAccessible(true);
            scannerField.set(damagerRepairer, polishLineScanner);
        }

    } catch (SecurityException exception) {
        // TODO rickyn handle SecurityException
        exception.printStackTrace();
    } catch (IllegalArgumentException exception) {
        // TODO rickyn handle IllegalArgumentException
        exception.printStackTrace();
    } catch (NoSuchFieldException exception) {
        // TODO rickyn handle NoSuchFieldException
        exception.printStackTrace();
    } catch (IllegalAccessException exception) {
        // TODO rickyn handle IllegalAccessException
        exception.printStackTrace();
    }

    IToolBarManager toolBarManager = getEditorSite().getActionBars().getToolBarManager();

    IContributionItem contributionItem = getDeviceDropdownChooserContributionItem();

    DeviceDropdownChooserContributionItem deviceDropdownChooserContributionItem;
    if (contributionItem == null) {
        deviceDropdownChooserContributionItem = new DeviceDropdownChooserContributionItem(getMeposeModel());
        toolBarManager.add(deviceDropdownChooserContributionItem);
    }
    getSite().getPage().addPartListener(new ChangeMeposeModelFocusListener());
    //        IWorkbench workbench = PlatformUI.getWorkbench();
    //        IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
    //        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
    //        activePage.addPartListener();
}

From source file:de.femodeling.e4.ui.progress.internal.ProgressView.java

License:Open Source License

private void initToolBar() {
    IActionBars bars = getViewSite().getActionBars();
    IToolBarManager tm = bars.getToolBarManager();
    tm.add(clearAllAction);
}

From source file:de.fhg.igd.mapviewer.view.MapView.java

License:Open Source License

/**
 * Configure menu and toolbar actions and register map view extensions
 *///w ww.jav  a 2  s.c  o  m
public void configureActions() {
    IActionBars bars = getViewSite().getActionBars();

    // tool-bar
    IToolBarManager toolBar = bars.getToolBarManager();
    toolBar.add(mapTools = new MapTools(mapKit));

    // menu
    IMenuManager menu = bars.getMenuManager();
    menu.add(new MapMenu());

    // extensions
    IConfigurationElement[] config = Platform.getExtensionRegistry()
            .getConfigurationElementsFor(MapViewExtension.class.getName());

    for (IConfigurationElement element : config) {
        if (element.getName().equals("extra")) { //$NON-NLS-1$
            try {
                MapViewExtension extra = (MapViewExtension) element.createExecutableExtension("class"); //$NON-NLS-1$
                extra.setMapView(this);
            } catch (Exception e) {
                log.warn("Error creating map view extension", e); //$NON-NLS-1$
            }
        }
    }

    // add map tips
    mapKit.addCustomPainter(mapTips);
}

From source file:de.fu_berlin.inf.dpp.ui.views.SarosView.java

License:Open Source License

protected void addToolBarItems(IToolBarManager toolBar) {
    toolBar.add(getAction(ChangeXMPPAccountAction.ACTION_ID));
    toolBar.add(getAction(NewContactAction.ACTION_ID));
    toolBar.add(getAction(OpenPreferencesAction.ACTION_ID));
    toolBar.add(new Separator());
    toolBar.add(getAction(FollowModeAction.ACTION_ID));
    toolBar.add(getAction(ConsistencyAction.ACTION_ID));
    toolBar.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    toolBar.add(getAction(LeaveSessionAction.ACTION_ID));
}

From source file:de.fu_berlin.inf.dpp.ui.views.VideoPlayerView.java

License:Open Source License

protected void createActionBar() {
    final IActionBars actionBars = getViewSite().getActionBars();
    final IToolBarManager toolBarManager = actionBars.getToolBarManager();

    toolBarManager.add(new ChangeSourceModeAction());
    toolBarManager.add(new StopVideoSessionAction());
    toolBarManager.add(new PauseVideoSessionAction());
}

From source file:de.gebit.integrity.eclipse.views.IntegrityTestRunnerView.java

License:Open Source License

private void fillLocalToolBar(IToolBarManager aManager) {
    // These are still in development...
    aManager.add(executeTestAction);
    aManager.add(executeDebugTestAction);
    aManager.add(shutdownAction);/* w w  w .  j ava2s.co m*/
    aManager.add(configureTestAction);
    aManager.add(new Separator());
    aManager.add(expandAllAction);
    aManager.add(collapseAllAction);
    aManager.add(scrollLockAction);
    aManager.add(new Separator());
    aManager.add(playAction);
    aManager.add(pauseAction);
    aManager.add(stepIntoAction);
    aManager.add(stepOverAction);
    aManager.add(new Separator());
    aManager.add(connectToTestRunnerAction);
}