Search in sources :

Example 1 with UserRefactoringInfo

use of org.erlide.wrangler.refactoring.backend.UserRefactoringInfo 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)

Example 2 with UserRefactoringInfo

use of org.erlide.wrangler.refactoring.backend.UserRefactoringInfo 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)

Aggregations

HashMap (java.util.HashMap)2 IContributionItem (org.eclipse.jface.action.IContributionItem)2 CommandContributionItem (org.eclipse.ui.menus.CommandContributionItem)2 CommandContributionItemParameter (org.eclipse.ui.menus.CommandContributionItemParameter)2 UserRefactoringInfo (org.erlide.wrangler.refactoring.backend.UserRefactoringInfo)2