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

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

Introduction

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

Prototype

@Override
    public void add(IAction action) 

Source Link

Usage

From source file:ar.com.fluxit.jqa.wizard.page.LayersDefinitionWizardPage.java

License:Open Source License

private void createLayersGroup(SashForm sash) {
    final Group layersGroup = new Group(sash, SWT.NONE);
    final GridLayout layersGroupGridLayout = new GridLayout();
    layersGroupGridLayout.verticalSpacing = -1;
    layersGroup.setLayout(layersGroupGridLayout);
    layersGroup.setText("Layers");
    ViewForm viewForm = new ViewForm(layersGroup, SWT.FLAT | SWT.BORDER);
    viewForm.setLayout(layersGroupGridLayout);
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    ToolBar toolBar = toolBarManager.createControl(viewForm);
    toolBar.setBackground(layersGroup.getBackground());
    viewForm.setTopLeft(toolBar);//from  ww  w  . j  a v a 2  s .  c  om
    viewForm.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    TableViewer layersTable = new TableViewer(layersGroup,
            SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    layersTable.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
    layersTable.setContentProvider(ArrayContentProvider.getInstance());
    layersTable.setInput(getWizard().getLayers());
    layersTable.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            Layer layer = (Layer) element;
            String result = layer.getName();
            if (!layer.getPackages().isEmpty()) {
                result += " (" + layer.getPackages().size() + ")";
            }
            return result;
        }
    });
    layersTable.setCellEditors(new CellEditor[] { new TextCellEditor(layersTable.getTable()) });
    layersTable.setCellModifier(new LayerCellModifier(layersTable));
    layersTable.setColumnProperties(new String[] { "layer" });
    toolBarManager.add(new NewLayerAction(getWizard().getLayers(), layersTable));
    final EditLayerAction editLayerAction = new EditLayerAction(layersTable);
    editLayerAction.setEnabled(false);
    toolBarManager.add(editLayerAction);
    final RemoveLayerAction removeLayerAction = new RemoveLayerAction(getWizard().getLayers(), layersTable,
            targetPackagesTable, getContainer());
    removeLayerAction.setEnabled(false);
    toolBarManager.add(removeLayerAction);
    toolBarManager.update(true);
    layersTable.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent paramSelectionChangedEvent) {
            layerSelectionChanged(paramSelectionChangedEvent.getSelection(), editLayerAction,
                    removeLayerAction);
        }
    });
    layersTable.addDropSupport(DND.DROP_MOVE, getTransferTypes(), new LayersListTableDropListener(layersTable,
            targetPackagesTable, getDragViewerHolder(), getDragInputHolder(), getContainer()));
}

From source file:at.medevit.elexis.inbox.ui.part.InboxView.java

License:Open Source License

private void addFilterActions(ToolBarManager menuManager) {
    InboxElementUiExtension extension = new InboxElementUiExtension();
    List<IInboxElementUiProvider> providers = extension.getProviders();
    for (IInboxElementUiProvider iInboxElementUiProvider : providers) {
        ViewerFilter extensionFilter = iInboxElementUiProvider.getFilter();
        if (extensionFilter != null) {
            InboxFilterAction action = new InboxFilterAction(viewer, extensionFilter,
                    iInboxElementUiProvider.getFilterImage());
            menuManager.add(action);
        }/*w w w  .  ja  v  a 2  s .c  om*/
    }
    menuManager.update(true);
}

From source file:ca.uvic.cs.tagsea.ui.views.cloudsee.CloudSeeView.java

License:Open Source License

private void makeToolBar(GridData gridData) {
    ToolBar toolBar = new ToolBar(composite, SWT.HORIZONTAL);
    toolBar.setLayoutData(gridData);/*from  ww  w.  jav a 2 s  . c  om*/

    ToolBarManager toolBarManager = new ToolBarManager(toolBar);
    toolBarManager.add(refreshAction);
    toolBarManager.add(backAction);
    toolBarManager.add(forwardAction);
    toolBarManager.update(true);

    forwardAction.setEnabled(false);
    backAction.setEnabled(false);
}

From source file:ca.uvic.cs.tagsea.ui.views.FilterComposite.java

License:Open Source License

/**
 * Creates the textbox and clear button which is tied to the given
 * TreeViewer.  Also adds listeners to the textbox so that when the 
 * enter or down arrow key is pressed the tree view gets focus.
 * The tree filter is also added to the tree viewer.
 * @param treeViewer/*from   ww  w.  ja v  a  2  s .  c  o  m*/
 */
public void createTextFilterControl(TreeViewer treeViewer) {
    this.treeViewer = treeViewer;

    treeViewer.addFilter(treeFilter);
    this.text = new Text(this, SWT.SINGLE | SWT.BORDER);
    text.setText(INITIAL_TEXT);
    text.setToolTipText("Tags Filter");
    GridData data = new GridData(SWT.LEFT, SWT.FILL, false, false);
    data.widthHint = 80;
    text.setLayoutData(data);
    text.pack();
    originalTextColor = text.getForeground();

    // create the clear text button
    this.clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {
        public void run() {
            text.setText("");
            text.setFocus();
        }
    };
    clearTextAction.setToolTipText("Clear the filter text");
    final ImageDescriptor clearDescriptor = TagSEAPlugin.getDefault().getTagseaImages()
            .getDescriptor(ITagseaImages.IMG_CLEAR);
    final ImageDescriptor clearDescriptorDisabled = TagSEAPlugin.getDefault().getTagseaImages()
            .getDescriptor(ITagseaImages.IMG_CLEAR_DISABLED);
    clearTextAction.setImageDescriptor(clearDescriptor);
    clearTextAction.setDisabledImageDescriptor(clearDescriptorDisabled);
    ToolBar toolBar = new ToolBar(this, SWT.FLAT | SWT.HORIZONTAL);
    ToolBarManager manager = new ToolBarManager(toolBar);
    manager.add(clearTextAction);
    manager.update(false);

    Label spacer = new Label(this, SWT.NONE);
    data = new GridData(SWT.LEFT, SWT.FILL, false, false);
    data.widthHint = 8;
    spacer.setLayoutData(data);

    // add the textbox listeners
    text.addModifyListener(this);
    text.addKeyListener(this);
    text.addFocusListener(this);
}

From source file:ca.uvic.cs.tagsea.ui.views.TagsComposite.java

License:Open Source License

private void createScanToolBar(Composite parent) {
    ToolBar toolbar = new ToolBar(parent, SWT.FLAT | SWT.LEFT);
    GridData data = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
    toolbar.setLayoutData(data);/*from   www .ja va 2 s  . co m*/

    ToolBarManager manager = new ToolBarManager(toolbar);

    scanForTagsAction = new Action("Refresh tag database...",
            TagSEAPlugin.getImageDescriptor("/icons/synch.gif")) {
        public void run() {
            new RefreshTagsAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow()).run();
        }
    };

    manager.add(scanForTagsAction);
    manager.update(false);
    toolbar.setToolTipText("Refresh tag database...");
}

From source file:ch.elexis.ApplicationActionBarAdvisor.java

License:Open Source License

protected void fillCoolBar(ICoolBarManager coolBar) {
    ToolBarManager tbm = new ToolBarManager();

    tbm.add(GlobalActions.homeAction);
    tbm.add(GlobalActions.resetPerspectiveAction);

    tbm.add(new Separator());
    tbm.add(GlobalActions.printEtikette);
    tbm.add(GlobalActions.printVersionedEtikette);
    tbm.add(GlobalActions.printAdresse);

    coolBar.add(tbm);/*from ww w  . j a  va2 s.c  om*/
    if (Hub.localCfg.get(PreferenceConstants.SHOWTOOLBARITEMS, Boolean.toString(true))
            .equalsIgnoreCase(Boolean.toString(true))) {
        ToolBarManager tb2 = new ToolBarManager();
        // ci.getToolBarManager().add(new Separator());
        for (IAction action : openPerspectiveActions) {
            if (action != null) {
                tb2.add(action);
            }
        }
        coolBar.add(tb2);
    }

}

From source file:ch.elexis.core.application.advisors.ApplicationActionBarAdvisor.java

License:Open Source License

protected void fillCoolBar(ICoolBarManager coolBar) {
    ToolBarManager tbm = new ToolBarManager();

    tbm.add(GlobalActions.homeAction);
    tbm.add(GlobalActions.resetPerspectiveAction);

    tbm.add(new Separator());
    tbm.add(GlobalActions.printEtikette);
    tbm.add(GlobalActions.printVersionedEtikette);
    tbm.add(GlobalActions.printAdresse);

    coolBar.add(tbm);// w ww .j a  v a2  s  .c  om
    if (CoreHub.localCfg.get(Preferences.SHOWTOOLBARITEMS, Boolean.toString(true))
            .equalsIgnoreCase(Boolean.toString(true))) {
        ToolBarManager tb2 = new ToolBarManager();

        List<IAction> l = new ArrayList<>();
        for (IAction action : openPerspectiveActions) {
            if (action != null) {
                l.add(action);
            }
        }
        Collections.sort(l, new Comparator<IAction>() {
            @Override
            public int compare(IAction o1, IAction o2) {
                if (o1.getToolTipText() != null && o2.getToolTipText() != null) {
                    return o1.getToolTipText().compareTo(o2.getToolTipText());
                }
                return o1.getToolTipText() != null ? 1 : -1;
            }
        });

        // ci.getToolBarManager().add(new Separator());
        for (IAction action : l) {
            tb2.add(action);
        }
        coolBar.add(tb2);
    }

}

From source file:ch.elexis.core.ui.dialogs.SelectFallDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite ret = new Composite(parent, SWT.None);
    ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    GridLayout gl_ret = new GridLayout(1, false);
    gl_ret.marginWidth = 0;//from w ww  .j  a  v a 2  s. com
    gl_ret.marginHeight = 0;
    ret.setLayout(gl_ret);

    list = new List(ret, SWT.BORDER);
    list.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));

    reloadFaelleList();

    ToolBarManager tbManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.WRAP);
    tbManager.add(GlobalActions.neuerFallAction);
    tbManager.createControl(ret);

    ElexisEventDispatcher.getInstance().addListeners(updateFallListener);

    return ret;
}

From source file:ch.elexis.core.ui.dialogs.SelectFallNoObligationDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    Composite areaComposite = new Composite(composite, SWT.NONE);
    areaComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));

    areaComposite.setLayout(new FormLayout());

    Label lbl = new Label(areaComposite, SWT.NONE);
    lbl.setText("Fall erstellen");

    ToolBarManager tbManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.WRAP);
    tbManager.add(GlobalActions.neuerFallAction);
    ToolBar toolbar = tbManager.createControl(areaComposite);

    FormData fd = new FormData();
    fd.top = new FormAttachment(0, 5);
    fd.left = new FormAttachment(0, 5);
    lbl.setLayoutData(fd);/*from   ww  w  .j ava 2s.  co  m*/

    fd = new FormData();
    fd.top = new FormAttachment(0, 5);
    fd.left = new FormAttachment(30, 5);
    toolbar.setLayoutData(fd);

    lbl = new Label(areaComposite, SWT.NONE);
    lbl.setText("Fall auswhlen");

    noOblFallCombo = new ComboViewer(areaComposite);

    noOblFallCombo.setContentProvider(new ArrayContentProvider());

    noOblFallCombo.setInput(getNoObligationFaelle());
    noOblFallCombo.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            return ((Fall) element).getLabel();
        }
    });

    if (lastSelectedFall != null)
        noOblFallCombo.setSelection(new StructuredSelection(lastSelectedFall));

    ElexisEventDispatcher.getInstance()
            .addListeners(new UpdateFallComboListener(noOblFallCombo, Fall.class, 0xff));

    fd = new FormData();
    fd.top = new FormAttachment(toolbar, 5);
    fd.left = new FormAttachment(0, 5);
    lbl.setLayoutData(fd);

    fd = new FormData();
    fd.top = new FormAttachment(toolbar, 5);
    fd.left = new FormAttachment(30, 5);
    fd.right = new FormAttachment(100, -5);
    noOblFallCombo.getControl().setLayoutData(fd);

    return areaComposite;
}

From source file:ch.hsr.ifs.cutelauncher.ui.CuteCompareResultDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    ViewForm pane = new ViewForm(composite, SWT.BORDER | SWT.FLAT);
    Control control = createCompareViewer(pane);
    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    data.widthHint = convertWidthInCharsToPixels(120);
    data.heightHint = convertHeightInCharsToPixels(13);
    pane.setLayoutData(data);/*from  ww  w . j  a v a2  s.  c  om*/
    ToolBar tb = new ToolBar(pane, SWT.BORDER | SWT.FLAT);
    ToolBarManager tbm = new ToolBarManager(tb);
    ShowWhiteSpaceAction action = new ShowWhiteSpaceAction(compareViewer);
    tbm.add(action);
    tbm.update(true);
    ;
    pane.setTopRight(tb);

    pane.setContent(control);
    GridData gd = new GridData(GridData.FILL_BOTH);
    control.setLayoutData(gd);
    return composite;
}