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

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

Introduction

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

Prototype

void add(IContributionItem item);

Source Link

Document

Adds a contribution item to this manager.

Usage

From source file:org.bundlemaker.core.ui.view.stage.actions.AddModeActionGroup.java

License:Open Source License

public void fill(IContributionManager menuManager) {
    menuManager.add(_autoAddModeAction);
    menuManager.add(_autoAddChildrenModeAction);
    menuManager.add(_dontAutoAddModeAction);

}

From source file:org.compiere.mfg_scm.eclipse.db.editors.MultiPageEditorContributor.java

License:Apache License

public void contributeToMenu(IMenuManager imenumanager) {
    IContributionManager icontributionmanager = new MenuManager("Editor &Menu");
    imenumanager.prependToGroup("additions", (IContributionItem) icontributionmanager);
    icontributionmanager.add(sampleAction);
    return;/*ww  w  . ja  v  a 2s  .co m*/
}

From source file:org.dawb.passerelle.editors.EdnaActorActions.java

License:Open Source License

public static void createOutputActions(final IContributionManager toolMan) {

    toolMan.add(addXPath);
    toolMan.add(deleteXPath);//  ww  w.  j a v a  2  s . co m
    toolMan.add(new Separator(EdnaActorActions.class.getName() + ".output.sep3"));
    toolMan.add(revertOutput);

}

From source file:org.dawb.passerelle.editors.EdnaActorActions.java

License:Open Source License

public static void createInputActions(final IContributionManager toolMan) {

    final CheckableActionGroup group = new CheckableActionGroup();
    showVars.setChecked(true);/*  w ww. j  av a2  s .  com*/
    group.add(showVars);
    toolMan.add(showVars);

    group.add(showSubstitution);
    toolMan.add(showSubstitution);

    toolMan.add(new Separator(EdnaActorActions.class.getName() + ".input.sep1"));
    toolMan.add(revertInput);

    toolMan.add(new Separator(EdnaActorActions.class.getName() + ".input.sep2"));

}

From source file:org.dawb.tango.extensions.editors.actions.SharedMemoryActions.java

License:Open Source License

public static void createActions(final IContributionManager man) {

    man.add(sharedMemory);
    man.add(new Separator(SharedMemoryActions.class.getName() + ".sep0"));
    man.add(monitoring);/* w w w.j  av a 2s . co m*/
    man.add(new Separator(SharedMemoryActions.class.getName() + ".sep1"));
    man.add(history);
    man.add(chunk);
    man.add(new Separator(SharedMemoryActions.class.getName() + ".sep2"));
    man.add(oneD);
    man.add(twoD);
    man.add(new Separator(SharedMemoryActions.class.getName() + ".sep3"));
    man.add(sharedPrefs);
    man.add(tangoPrefs);

    final boolean isImage = Activator.getDefault().getPreferenceStore().getBoolean(SharedConstants.IMAGE_MODE);
    if (isImage) {
        twoD.setChecked(true);
    } else {
        oneD.setChecked(true);
    }

    final boolean isHist = Activator.getDefault().getPreferenceStore().getBoolean(SharedConstants.HISTORY_MODE);
    if (isHist) {
        history.setChecked(true);
    } else {
        chunk.setChecked(true);
    }
}

From source file:org.dawnsci.breadcrumb.navigation.views.AbstractTableDelegate.java

License:Open Source License

public void createActions(IContributionManager man, IContributionManager menuMan) {

    man.add(new Separator("search.group." + tableId));
    menuMan.add(new Separator("search.group." + tableId));

    final List<Action> searchActions = new ArrayList<Action>(7);
    actions.put("search.group." + tableId, searchActions);

    final CheckableActionGroup grp = new CheckableActionGroup();

    // Login, log out, sweep.
    Action nonSearch = new Action("No search", IAction.AS_CHECK_BOX) {
        public void run() {
            Activator.getDefault().getPreferenceStore().setValue(NavigationConstants.SEARCH_TYPE,
                    NavigationConstants.NONE);
            clearSearch();/*w ww .  j a  v a 2s . co m*/
            searchText.setToolTipText("No searching required");
            GridUtils.setVisible(searchComposite, false);
            contents.layout();
        }
    };
    nonSearch.setImageDescriptor(Activator.getImageDescriptor("icons/magnifier--minus.png"));
    grp.add(nonSearch);
    searchActions.add(nonSearch);
    nonSearch.setId("search.group.nonSearch." + tableId);

    Action searchWildcard = new Action("Search using wildcard", IAction.AS_CHECK_BOX) {
        public void run() {
            Activator.getDefault().getPreferenceStore().setValue(NavigationConstants.SEARCH_TYPE,
                    NavigationConstants.WILD);
            clearSearch();
            searchText.setToolTipText("Wildcard search on name, matches any containing text.");
            GridUtils.setVisible(searchComposite, true);
            GridUtils.setVisible(executeButton, false);
            contents.layout();
        }
    };
    searchWildcard.setImageDescriptor(Activator.getImageDescriptor("icons/magnifier--arrow.png"));
    grp.add(searchWildcard);
    searchActions.add(searchWildcard);
    searchWildcard.setId("search.group.wildCard." + tableId);

    Action searchJexl = new Action("Search using query", IAction.AS_CHECK_BOX) {
        public void run() {
            Activator.getDefault().getPreferenceStore().setValue(NavigationConstants.SEARCH_TYPE,
                    NavigationConstants.QUERY);
            clearSearch();
            searchText.setToolTipText("Write a query of variables: " + firstColumn.getVariableNames()
                    + " e.g. 'complete>99 and auto eq true'");
            GridUtils.setVisible(searchComposite, true);
            GridUtils.setVisible(executeButton, true);
            contents.layout();

            List<String> searches = getPreviousSearches();
            searchText.setItems(searches.toArray(new String[searches.size()]));
        }
    };
    searchJexl.setImageDescriptor(Activator.getImageDescriptor("icons/magnifier--pencil.png"));
    grp.add(searchJexl);
    searchActions.add(searchJexl);
    searchJexl.setId("search.group.jexl." + tableId);

    if (NavigationConstants.NONE
            .equals(Activator.getDefault().getPreferenceStore().getString(NavigationConstants.SEARCH_TYPE))) {
        GridUtils.setVisible(searchComposite, false);
        nonSearch.setChecked(true);
    } else {
        GridUtils.setVisible(searchComposite, true);
        searchJexl.setChecked(NavigationConstants.QUERY.equals(
                Activator.getDefault().getPreferenceStore().getString(NavigationConstants.SEARCH_TYPE)));
        searchWildcard.setChecked(NavigationConstants.WILD.equals(
                Activator.getDefault().getPreferenceStore().getString(NavigationConstants.SEARCH_TYPE)));
    }

    man.add(new Separator("export.group" + tableId));
    menuMan.add(new Separator("export.group" + tableId));
    Action export = new ExportTableAction(tableViewer, firstColumn.allValues().length);
    export.setId("export.group.action" + tableId);
    actions.put("export.group" + tableId, Arrays.asList(export));

}

From source file:org.dawnsci.commandserver.ui.view.ConsumerView.java

License:Open Source License

private void createActions() {
    final IContributionManager man = getViewSite().getActionBars().getToolBarManager();

    final Action refresh = new Action("Refresh",
            Activator.getDefault().getImageDescriptor("icons/arrow-circle-double-135.png")) {
        public void run() {
            viewer.refresh();// w w  w.  j  a v  a  2 s. c  o m
        }
    };

    man.add(refresh);

    final Action stop = new Action("Stop consumer",
            Activator.getDefault().getImageDescriptor("icons/terminate.png")) {
        public void run() {

            if (viewer.getSelection() == null || viewer.getSelection().isEmpty())
                return;

            ConsumerBean bean = (ConsumerBean) ((IStructuredSelection) viewer.getSelection()).getFirstElement();

            boolean ok = MessageDialog.openConfirm(getSite().getShell(), "Confirm Stop",
                    "If you stop this consumer it will have to be restarted by an administrator.\n\n"
                            + "Are you sure that you want to do this?\n\n"
                            + "(NOTE: Long running jobs can be terminated without stopping the consumer!)");
            if (!ok)
                return;

            boolean notify = MessageDialog.openQuestion(getSite().getShell(), "Warn Users",
                    "Would you like to warn users before stopping the consumer?\n\n"
                            + "If you say yes, a popup will open on users clients to warn about the imminent stop.");
            if (notify) {

                final AdministratorMessage msg = new AdministratorMessage();
                msg.setTitle("'" + bean.getName() + "' will shutdown.");
                msg.setMessage("'" + bean.getName() + "' is about to shutdown.\n\n"
                        + "Any runs corrently running may loose progress notification,\n"
                        + "however they should complete.\n\n"
                        + "Runs yet to be started will be picked up when\n" + "'" + bean.getName()
                        + "' restarts.");
                try {
                    JSONUtils.sendTopic(msg, Constants.ADMIN_MESSAGE_TOPIC, getUri());
                } catch (Exception e) {
                    logger.error("Cannot notify of shutdown!", e);
                }
            }

            bean.setStatus(ConsumerStatus.REQUEST_TERMINATE);
            bean.setMessage("Requesting a termination of " + bean.getName());
            try {
                JSONUtils.sendTopic(bean, Constants.TERMINATE_CONSUMER_TOPIC, getUri());
            } catch (Exception e) {
                logger.error("Cannot terminate consumer " + bean.getName(), e);
            }

        }
    };

    man.add(stop);

    final MenuManager menuMan = new MenuManager();
    menuMan.add(refresh);
    menuMan.add(stop);

    viewer.getControl().setMenu(menuMan.createContextMenu(viewer.getControl()));

}

From source file:org.dawnsci.commandserver.ui.view.StatusQueueView.java

License:Open Source License

private void createActions() {

    final IContributionManager toolMan = getViewSite().getActionBars().getToolBarManager();
    final MenuManager menuMan = new MenuManager();

    final Action openResults = new Action("Open results for selected run",
            Activator.getDefault().getImageDescriptor("icons/results.png")) {
        public void run() {
            openResults(getSelection());
        }//from  ww  w  . j av a 2  s  .co m
    };

    toolMan.add(openResults);
    menuMan.add(openResults);
    toolMan.add(new Separator());
    menuMan.add(new Separator());

    this.kill = new Action("Terminate job", Activator.getDefault().getImageDescriptor("icons/terminate.png")) {
        public void run() {

            final StatusBean bean = getSelection();
            if (bean == null)
                return;

            if (bean.getStatus().isFinal()) {
                MessageDialog.openInformation(getViewSite().getShell(), "Run '" + bean.getName() + "' inactive",
                        "Run '" + bean.getName() + "' is inactive and cannot be terminated.");
                return;
            }
            try {

                final DateFormat format = DateFormat.getDateTimeInstance();
                boolean ok = MessageDialog.openQuestion(getViewSite().getShell(),
                        "Confirm terminate " + bean.getName(),
                        "Are you sure you want to terminate " + bean.getName() + " submitted on "
                                + format.format(new Date(bean.getSubmissionTime())) + "?");

                if (!ok)
                    return;

                bean.setStatus(org.dawnsci.commandserver.core.beans.Status.REQUEST_TERMINATE);
                bean.setMessage("Requesting a termination of " + bean.getName());
                JSONUtils.sendTopic(bean, getTopicName(), getUri());

            } catch (Exception e) {
                ErrorDialog.openError(getViewSite().getShell(), "Cannot terminate " + bean.getName(),
                        "Cannot terminate " + bean.getName()
                                + "\n\nPlease contact your support representative.",
                        new Status(IStatus.ERROR, "org.dawnsci.commandserver.ui", e.getMessage()));
            }
        }
    };
    toolMan.add(kill);
    menuMan.add(kill);

    final Action rerun = new Action("Rerun", Activator.getDefault().getImageDescriptor("icons/rerun.png")) {
        public void run() {
            rerunSelection();
        }
    };
    toolMan.add(rerun);
    menuMan.add(rerun);

    toolMan.add(new Separator());
    menuMan.add(new Separator());

    final Action showAll = new Action("Show all reruns", IAction.AS_CHECK_BOX) {
        public void run() {
            showEntireQueue = isChecked();
            viewer.refresh();
        }
    };
    showAll.setImageDescriptor(Activator.getDefault().getImageDescriptor("icons/spectacle-lorgnette.png"));

    toolMan.add(showAll);
    menuMan.add(showAll);

    toolMan.add(new Separator());
    menuMan.add(new Separator());

    final Action refresh = new Action("Refresh",
            Activator.getDefault().getImageDescriptor("icons/arrow-circle-double-135.png")) {
        public void run() {
            reconnect();
        }
    };

    toolMan.add(refresh);
    menuMan.add(refresh);

    final Action configure = new Action("Configure...",
            Activator.getDefault().getImageDescriptor("icons/document--pencil.png")) {
        public void run() {
            PropertiesDialog dialog = new PropertiesDialog(getSite().getShell(), idProperties);

            int ok = dialog.open();
            if (ok == PropertiesDialog.OK) {
                idProperties.clear();
                idProperties.putAll(dialog.getProps());
                reconnect();
            }
        }
    };

    toolMan.add(configure);
    menuMan.add(configure);

    viewer.getControl().setMenu(menuMan.createContextMenu(viewer.getControl()));
}

From source file:org.dawnsci.conversion.ui.pages.AbstractDatasetChoosePage.java

License:Open Source License

private void createActions(IContributionManager toolMan) {

    final Action tickNone = new Action("Select None", Activator.getImageDescriptor("icons/unticked.gif")) {
        public void run() {
            checkboxTableViewer.setAllChecked(false);
        }/*from   w ww  . jav  a 2 s.  c  om*/
    };
    toolMan.add(tickNone);

    final Action tickAll1D = new Action("Select All 1D Data",
            Activator.getImageDescriptor("icons/ticked.png")) {
        public void run() {
            setAll1DChecked();
        }
    };
    toolMan.add(tickAll1D);

}

From source file:org.dawnsci.conversion.ui.pages.H5From1DConvertPage.java

License:Open Source License

private void createActions(IContributionManager toolMan) {

    final Action tickNone = new Action("Select None", Activator.getImageDescriptor("icons/unticked.gif")) {
        public void run() {
            checkboxTableViewer.setAllChecked(false);
        }//from w w  w.j  a va  2  s.  c o m
    };
    toolMan.add(tickNone);

    final Action tickAll1D = new Action("Select All 1D Data",
            Activator.getImageDescriptor("icons/ticked.png")) {
        public void run() {
            setAll1DChecked();
        }
    };
    toolMan.add(tickAll1D);
}