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.nokia.tools.carbide.ct.confml.ui.editors.ConfMLMultiPageEditorPartContributor.java

License:Open Source License

public void contributeToToolBar(IToolBarManager manager) {
    manager.add(new Separator());
    //      manager.add(sampleAction);
}

From source file:com.nokia.tools.s60.editor.menus.EditorActionBarContributor.java

License:Open Source License

protected void contributeToParentCoolBar() {
    if (!coolBarItems.isEmpty()) {
        return;/*w  w w  .  ja v  a2 s  .c  o m*/
    }
    // Create zooming items
    String[] zoomStrings = new String[] { ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH };
    zoom = new CustomZoomComboContributionItem(getPage(), zoomStrings);
    IToolBarManager zoomToolBar = contributeToolBarToCoolBar(zoom);
    zoomToolBar.add(new Separator());
    zoomToolBar.add(getAction(GEFActionConstants.ZOOM_IN));
    zoomToolBar.add(getAction(GEFActionConstants.ZOOM_OUT));

    IToolBarManager modelToolBar = contributeToolBarToCoolBar(new ThemeModelDropDownAction());

    // Resolution tools
    ResolutionComboContributionItem resolution = new ResolutionComboContributionItem();
    IToolBarManager resolutionToolBar = contributeToolBarToCoolBar(resolution);
    resolutionToolBar.add(new Separator());
    Action orientationAction = resolution.getOrientationAction();
    resolutionToolBar.add(orientationAction);

    items = new ComboContributionItem[] { resolution };
    toolBars = new IToolBarManager[] { modelToolBar };

    IToolBarManager playToolbar = contributeToolBarToCoolBar(getAction(PlayAllAction.ID));
    playToolbar.add(getAction(PlaySelectionAction.ID));
    playToolbar.add(getAction(PausePlayingAction.ID));
    playToolbar.add(getAction(StopPlayingAction.ID));
    playToolbar.add(new Separator());
    playToolbar.add(getAction(SetPlayingSpeedAction.ID));
}

From source file:com.nokia.tools.s60.editor.menus.EditorActionBarContributor.java

License:Open Source License

private void contributeEmbeddedActions() {
    if (embeddedActionAdded) {
        return;/*w  ww.  ja va2 s .c om*/
    }
    // Alignment and sizing tools
    AlignmentToolsDropDownAction alignmentToolsDropDownAction = new AlignmentToolsDropDownAction(
            getActionRegistry());
    IToolBarManager alignmentToolBar = contributeToolBarToCoolBar(alignmentToolsDropDownAction);
    alignmentToolBar.add(new Separator());
    alignmentToolBar.add(getAction(GEFActionConstants.MATCH_WIDTH));
    alignmentToolBar.add(getAction(GEFActionConstants.MATCH_HEIGHT));

    embeddedActionAdded = true;

    parentCoolBarManager.update(true);
    viewMenu.update(true);
}

From source file:com.nokia.tools.s60.editor.Series60ContentOutlinePage.java

License:Open Source License

@Override
protected void configureOutlineViewer() {
    super.configureOutlineViewer();
    containmentLayoutAction = new Action() {
        public void run() {
            viewId = ID_CONTAINMENT;//from w w w  . ja v  a2s.  com
            showPage();
        }
    };
    categoryLayoutAction = new Action() {
        public void run() {
            viewId = ID_CATEGORY;
            showPage();
        }
    };
    ImageDescriptor ed1 = S60WorkspacePlugin.getIconImageDescriptor("containment_layout.gif", true);
    ImageDescriptor dd1 = S60WorkspacePlugin.getIconImageDescriptor("containment_layout.gif", false);
    ImageDescriptor ed2 = S60WorkspacePlugin.getIconImageDescriptor("category_layout.gif", true);
    ImageDescriptor dd2 = S60WorkspacePlugin.getIconImageDescriptor("category_layout.gif", false);

    containmentLayoutAction.setToolTipText(Messages.ContainmentAction_tooltip);
    containmentLayoutAction.setImageDescriptor(ed1);
    containmentLayoutAction.setHoverImageDescriptor(ed1);
    containmentLayoutAction.setDisabledImageDescriptor(dd1);
    categoryLayoutAction.setToolTipText(Messages.CategoryAction_tooltip);
    categoryLayoutAction.setImageDescriptor(ed2);
    categoryLayoutAction.setHoverImageDescriptor(ed2);
    categoryLayoutAction.setDisabledImageDescriptor(dd2);
    IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
    tbm.add(containmentLayoutAction);
    tbm.add(categoryLayoutAction);
}

From source file:com.nokia.tools.s60.editor.ui.views.ActiveLayersPage.java

License:Open Source License

private void fillLocalToolBar(IToolBarManager manager) {

    moveDownAction = new ChangeOrderAction(this, DOWN, false);
    moveDownAction.listenSelection();/*  w  w w .  ja v  a2 s.  c  o  m*/
    actionsToDispose.add(moveDownAction);

    moveUpAction = new ChangeOrderAction(this, UP, false);
    moveUpAction.listenSelection();
    actionsToDispose.add(moveUpAction);

    /* delete action */
    deleteAction = new DeleteSelectedAction(this, null, false);
    deleteAction.listenSelection();
    actionsToDispose.add(deleteAction);

    // effects dropdown combo
    layersViewAddEffectDropDown = new AddEffectDropDown(this);
    layersViewAddEffectDropDown.setEnabled(!(image instanceof IAnimatedImage));

    /* add layers action */
    addLayerAction = new AddLayerAction(image, this, true);
    addLayerAction.listenSelection();
    actionsToDispose.add(addLayerAction);

    /* add */
    manager.add(addLayerAction);
    manager.add(layersViewAddEffectDropDown);

    manager.add(new Separator());
    manager.add(moveUpAction);
    manager.add(moveDownAction);

    manager.add(new Separator());
    manager.add(deleteAction);

    /* hook to global action handlers */
    IActionBars bars = getSite().getActionBars();

    bars.setGlobalActionHandler(addLayerAction.getId(), addLayerAction);
    bars.setGlobalActionHandler(deleteAction.getId(), deleteAction);
    bars.setGlobalActionHandler(moveDownAction.getId(), moveDownAction);
    bars.setGlobalActionHandler(moveUpAction.getId(), moveUpAction);

    BaseLayerAction action = new AddBgLayerAction(image, this, true);
    actionsToDispose.add(action);
    action.listenSelection();
    bars.setGlobalActionHandler(action.getId(), action);

    action = new RenameLayerAction(image, this, true);
    actionsToDispose.add(action);
    action.listenSelection();
    bars.setGlobalActionHandler(action.getId(), action);

    action = new ClearLayerAction(image, this, true);
    actionsToDispose.add(action);
    action.listenSelection();
    bars.setGlobalActionHandler(action.getId(), action);

    CopyImageAction copy = new CopyImageAction(treeViewer, null);
    copy.listenSelection();
    actionsToDispose.add(copy);
    bars.setGlobalActionHandler(CopyImageAction.ID, copy);

    PasteImageAction paste = new PasteImageAction(treeViewer, getCommandStack(), null);
    paste.listenSelection();
    actionsToDispose.add(paste);
    bars.setGlobalActionHandler(PasteImageAction.ID, paste);

    bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);

}

From source file:com.nokia.tools.s60.editor.ui.views.ComponentStoreView.java

License:Open Source License

private void contributeActions(IActionBars actionBars) {

    IToolBarManager mngr = actionBars.getToolBarManager();
    Action customize = new Action(Messages.cstore_customizeAction) {
        @Override/*from   w  ww  . j a  v  a 2  s.  co m*/
        public void run() {

            String linkAddress = "com.nokia.tools.s60.preferences.ComponentStorePrefPage";

            PreferencesUtil.createPreferenceDialogOn(Display.getCurrent().getActiveShell(), linkAddress,
                    new String[] { linkAddress }, null).open();
            try {
                runWhat = 1;
                getViewSite().getWorkbenchWindow().getWorkbench().getProgressService()
                        .busyCursorWhile(ComponentStoreView.this);
            } catch (Exception e) {
            }
        }
    };
    customize.setToolTipText(Messages.cstore_customizeAction);
    customize.setText(Messages.cstore_customizeAction);
    customize.setDescription(Messages.cstore_customizeAction);
    customize.setImageDescriptor(S60WorkspacePlugin.getImageDescriptor("icons/configs.gif"));
    mngr.add(customize);

}

From source file:com.nokia.tools.s60.editor.ui.views.LayersPage.java

License:Open Source License

private void contributeToActionBars() {
    IActionBars bars = getSite().getActionBars();
    IToolBarManager manager = bars.getToolBarManager();

    /* add global handlers */
    for (IAction a : globalHandlers) {
        if (a instanceof AbstractAction) {
            ((AbstractAction) a).dispose();
        }//  w w  w.ja  va2  s  .c  o  m
    }
    globalHandlers.clear();

    /* global handlers */

    _setGlobalHandler(bars, new CopyImageAction(treeViewer, null));
    _setGlobalHandler(bars, new PasteImageAction(treeViewer, getCommandStack(), null));

    _setGlobalHandler(bars, new EditImageInSVGEditorAction(treeViewer, getCommandStack()));
    _setGlobalHandler(bars, new EditImageInSVGEditorAction(treeViewer, getCommandStack()));
    _setGlobalHandler(bars, new EditImageInBitmapEditorAction(treeViewer, getCommandStack()));
    _setGlobalHandler(bars, new ConvertAndEditSVGInBitmapEditorAction(treeViewer, getCommandStack()));
    _setGlobalHandler(bars, new EditInSystemEditorAction(treeViewer, getCommandStack()));
    _setGlobalHandler(bars, new EditMaskAction(treeViewer, getCommandStack()));
    _setGlobalHandler(bars, new EditMaskAction2(treeViewer, getCommandStack()));
    _setGlobalHandler(bars,
            new SetStretchModeAction(treeViewer, getCommandStack(), IMediaConstants.STRETCHMODE_STRETCH));
    _setGlobalHandler(bars,
            new SetStretchModeAction(treeViewer, getCommandStack(), IMediaConstants.STRETCHMODE_ASPECT));

    /* set undo/redo handlers from parent editor */
    ActionRegistry registry = (ActionRegistry) owningEditor.getAdapter(ActionRegistry.class);
    bars.setGlobalActionHandler(ActionFactory.UNDO.getId(), registry.getAction(ActionFactory.UNDO.getId()));
    bars.setGlobalActionHandler(ActionFactory.REDO.getId(), registry.getAction(ActionFactory.REDO.getId()));

    /* fill toolbar */
    manager.add(bars.getGlobalActionHandler(CopyImageAction.ID));

    manager.add(bars.getGlobalActionHandler(PasteImageAction.ID));

    manager.add(new Separator());

    animateAction = new OpenGraphicsEditorAction(null, treeViewer);
    manager.add(animateAction);

    dropdownAction = new ExternalToolsDropdownAction(treeViewer, getCommandStack());
    manager.add(dropdownAction);

    toggleColorModeAction = new ToggleColorModeAction(ToggleColorModeAction.MODE_COMMON);
    manager.add(new Separator());
    manager.add(toggleColorModeAction);

    // 'clear whole element' action
    clearAction = new ClearImageEditorAction(treeViewer, getCommandStack());
    clearAction.setToolTipText(Messages.LayersPage_clearTitle);
    manager.add(new Separator());
    manager.add(clearAction);

    bars.setGlobalActionHandler(ClearImageEditorAction.ID, clearAction);
    bars.setGlobalActionHandler(OpenGraphicsEditorAction.ID, animateAction);

    bars.updateActionBars();
}

From source file:com.nokia.tools.s60.views.ColorsViewPage.java

License:Open Source License

private void initializeIconViewActions() {
    IActionBars bars = getSite().getActionBars();
    IToolBarManager tbm = bars.getToolBarManager();

    tbm.removeAll();/*  w  w  w . j av a2 s  . c  o  m*/

    tbm.add(new AddNewColorGroupAction());
}

From source file:com.nokia.tools.s60.views.ColorViewPage.java

License:Open Source License

/**
 * Create toolbar./*from  w ww .jav  a  2  s  .  c o  m*/
 */
private void createToolbar() {
    IToolBarManager mgr = getSite().getActionBars().getToolBarManager();
    mgr.add(switchLayoutAction);

}

From source file:com.nokia.tools.s60.views.GalleryPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {

    composite = new Composite(parent, SWT.NONE);

    composite.setLayout(new FillLayout());

    scroll = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.grabExcessVerticalSpace = true;
    data.verticalAlignment = SWT.FILL;//from w w w  . j a v  a  2s  .c o m
    scroll.setLayoutData(data);
    scroll.setLayout(new FillLayout());
    scroll.addListener(SWT.Resize, new Listener() {
        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
         */
        public void handleEvent(Event event) {

            updateLayout();
            if (overview != null && !overview.isDisposed()) {
                for (Control child : overview.getChildren()) {
                    Control canvas = ((Composite) child).getChildren()[0];
                    Thumbnail thumbnail = (Thumbnail) canvas.getData();
                    thumbnail.setDirty(true);
                }
            }
        }
    });

    // activeScreens = new GalleryScreenContributionItem(this);
    GalleryLayoutAction layoutAction = new GalleryLayoutAction(this);
    GalleryModeAction modeAction = new GalleryModeAction(this);
    dropDownAction = new GalleryDropDownAction(this);
    IActionBars actionBars = getSite().getActionBars();
    IToolBarManager toolBar = actionBars.getToolBarManager();
    // toolBar.add(activeScreens);
    // toolBar.add(new Separator());
    toolBar.add(dropDownAction);
    toolBar.add(modeAction);
    toolBar.add(new Separator());
    toolBar.add(layoutAction);

}