Search in sources :

Example 31 with CommandContributionItemParameter

use of org.eclipse.ui.menus.CommandContributionItemParameter 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

CommandContributionItemParameter (org.eclipse.ui.menus.CommandContributionItemParameter)31 CommandContributionItem (org.eclipse.ui.menus.CommandContributionItem)30 HashMap (java.util.HashMap)9 IContributionItem (org.eclipse.jface.action.IContributionItem)4 ResultSetPanelDescriptor (org.jkiss.dbeaver.ui.controls.resultset.panel.ResultSetPanelDescriptor)4 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 IDialogConstants (org.eclipse.jface.dialogs.IDialogConstants)2 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)2 IFindReplaceTarget (org.eclipse.jface.text.IFindReplaceTarget)2