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

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

Introduction

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

Prototype

@Override
    public void add(IContributionItem item) 

Source Link

Usage

From source file:com.github.haixing_hu.swt.action.ActionUtils.java

License:Open Source License

public static void addActions(ContributionManager cm, IActionManager am, String[] actionIds) {
    for (final String id : actionIds) {
        if ((id == null) || (id.length() == 0)) {
            continue;
        }/*w w  w .j av  a2  s  .c o m*/
        if (Separator.ID.equals(id)) {
            cm.add(new Separator());
        } else if (Fill.ID.equals(id)) {
            cm.add(new Fill());
        } else {
            final IAction action = am.get(id);
            if (action == null) {
                LOGGER.error("Unknown action: {}", id);
            } else {
                cm.add(action);
            }
        }
    }
}

From source file:org.dawb.workbench.ui.editors.CSVDataEditor.java

License:Open Source License

private void createActions(final ContributionManager toolMan) {

    final Action refresh = new Action("Refresh", IAction.AS_PUSH_BUTTON) {
        @Override// w w w  . ja  v a  2s.c  o  m
        public void run() {
            update();
        }
    };
    refresh.setImageDescriptor(Activator.getImageDescriptor("icons/reset.gif"));
    toolMan.add(refresh);

    toolMan.add(new Separator(getClass().getName() + "Sep1"));

    final Action exportCsv = new Action("Export current plotted data to csv file", IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            CSVUtils.createCSV(EclipseUtils.getIFile(getEditorInput()), data, "_plot");
        }
    };
    exportCsv.setImageDescriptor(Activator.getImageDescriptor("icons/page_white_excel.png"));
    toolMan.add(exportCsv);

    toolMan.add(new Separator(getClass().getName() + "Sep1"));

    final Action format = new Action("Preferences...", IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    "uk.ac.diamond.scisoft.analysis.rcp.preferencePage", null, null);
            if (pref != null)
                pref.open();
        }
    };
    format.setImageDescriptor(Activator.getImageDescriptor("icons/application_view_list.png"));
    toolMan.add(format);
}

From source file:uk.ac.diamond.scisoft.analysis.rcp.editors.DataEditor.java

License:Apache License

private void createActions(final ContributionManager toolMan) {

    final Action exportCsv = new Action("Export current plotted data to csv file", IAction.AS_PUSH_BUTTON) {
        @Override//from   w ww. j  a va 2 s .c  om
        public void run() {
            CSVUtils.createCSV(EclipseUtils.getIFile(getEditorInput()), data, "_plot");
        }
    };
    exportCsv.setImageDescriptor(AnalysisRCPActivator.getImageDescriptor("icons/page_white_excel.png"));
    toolMan.add(exportCsv);

    toolMan.add(new Separator(getClass().getName() + "Sep1"));

    final Action format = new Action("Preferences...", IAction.AS_PUSH_BUTTON) {
        @Override
        public void run() {
            PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    "uk.ac.diamond.scisoft.analysis.rcp.preferencePage", null, null);
            if (pref != null)
                pref.open();
        }
    };
    format.setImageDescriptor(Activator.getImageDescriptor("icons/application_view_list.png"));
    toolMan.add(format);
}