Search in sources :

Example 36 with CommandContributionItem

use of org.eclipse.ui.menus.CommandContributionItem in project erlide_eclipse by erlang.

the class UserRefacContribution method getContributionItems.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected IContributionItem[] getContributionItems() {
    final List<UserRefactoringInfo> refacs = UserRefactoringsManager.getInstance().getElementary();
    final IContributionItem[] items = new IContributionItem[refacs.size()];
    int i = 0;
    for (final UserRefactoringInfo info : refacs) {
        final CommandContributionItemParameter param = new CommandContributionItemParameter(PlatformUI.getWorkbench(), info.getCallback(), "org.erlide.wrangler.refactoring.gen_refac", CommandContributionItem.STYLE_PUSH);
        param.label = info.getLabel();
        param.parameters = new HashMap();
        param.parameters.put("org.erlide.wrangler.refactoring.gen_refac.callback", info.getCallback());
        param.parameters.put("org.erlide.wrangler.refactoring.gen_refac.name", info.getLabel());
        items[i] = new CommandContributionItem(param);
        i++;
    }
    return items;
}
Also used : HashMap(java.util.HashMap) IContributionItem(org.eclipse.jface.action.IContributionItem) CommandContributionItemParameter(org.eclipse.ui.menus.CommandContributionItemParameter) CommandContributionItem(org.eclipse.ui.menus.CommandContributionItem) UserRefactoringInfo(org.erlide.wrangler.refactoring.backend.UserRefactoringInfo)

Example 37 with CommandContributionItem

use of org.eclipse.ui.menus.CommandContributionItem in project erlide_eclipse by erlang.

the class UserMyRefacContribution method getContributionItems.

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected IContributionItem[] getContributionItems() {
    final List<UserRefactoringInfo> refacs = UserRefactoringsManager.getInstance().getMyElementary();
    if (refacs.isEmpty()) {
        final CommandContributionItemParameter param = new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "org.erlide.wrangler.refactoring.empty", CommandContributionItem.STYLE_PUSH);
        param.label = "<Empty>";
        final CommandContributionItem item = new CommandContributionItem(param);
        return new IContributionItem[] { item };
    }
    final IContributionItem[] items = new IContributionItem[refacs.size()];
    int i = 0;
    for (final UserRefactoringInfo info : refacs) {
        final CommandContributionItemParameter param = new CommandContributionItemParameter(PlatformUI.getWorkbench(), info.getCallback(), "org.erlide.wrangler.refactoring.gen_refac", CommandContributionItem.STYLE_PUSH);
        param.label = info.getLabel();
        param.parameters = new HashMap();
        param.parameters.put("org.erlide.wrangler.refactoring.gen_refac.callback", info.getCallback());
        param.parameters.put("org.erlide.wrangler.refactoring.gen_refac.name", info.getLabel());
        items[i] = new CommandContributionItem(param);
        i++;
    }
    return items;
}
Also used : HashMap(java.util.HashMap) IContributionItem(org.eclipse.jface.action.IContributionItem) CommandContributionItemParameter(org.eclipse.ui.menus.CommandContributionItemParameter) CommandContributionItem(org.eclipse.ui.menus.CommandContributionItem) UserRefactoringInfo(org.erlide.wrangler.refactoring.backend.UserRefactoringInfo)

Aggregations

CommandContributionItem (org.eclipse.ui.menus.CommandContributionItem)37 CommandContributionItemParameter (org.eclipse.ui.menus.CommandContributionItemParameter)30 IContributionItem (org.eclipse.jface.action.IContributionItem)11 HashMap (java.util.HashMap)8 ParameterizedCommand (org.eclipse.core.commands.ParameterizedCommand)4 ResultSetPanelDescriptor (org.jkiss.dbeaver.ui.controls.resultset.panel.ResultSetPanelDescriptor)4 ArrayList (java.util.ArrayList)3 DataTransferNodeDescriptor (org.jkiss.dbeaver.tools.transfer.registry.DataTransferNodeDescriptor)3 DataTransferProcessorDescriptor (org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 DecimalFormat (java.text.DecimalFormat)2 java.util (java.util)2 List (java.util.List)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 IAdaptable (org.eclipse.core.runtime.IAdaptable)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 org.eclipse.jface.action (org.eclipse.jface.action)2 MenuManager (org.eclipse.jface.action.MenuManager)2