Source:
protected Command getCustomCommand(Request request) { final Map<DropStrategy, List<Command>> matchingStrategies = findStrategies(request); if (matchingStrategies.size() == 1) { DropStrategy ds = matchingStrategies.keySet().iterator().next(); if(ds instanceof TransactionalDropStrategy){ return matchingStrategies.values().iterator().next().get(0); } } if (matchingStrategies.size() > 1) { boolean useDefault = true; if (request.getExtendedData().containsKey(EVENT_DETAIL)) { int eventDetailValue = (Integer) request.getExtendedData().get(EVENT_DETAIL); if ((eventDetailValue & DND.DROP_COPY) != 0) { useDefault = false; } } Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); DefaultActionHandler handler = new DefaultActionHandler() { public void defaultActionSelected(Command defaultCommand) { DropStrategy defaultStrategy = findStrategy(matchingStrategies, defaultCommand); if (defaultStrategy != null) { DropStrategyManager.instance.setDefaultDropStrategy(matchingStrategies.keySet(), defaultStrategy); } } public String getLabel() { return "Change the default strategy"; } }; ArrayList<Command> proposalCommands = new ArrayList<Command>(); for(List<Command> cs: matchingStrategies.values()){ for(Command c : cs){ if(c!=null){ proposalCommands.add(c); } } } Activator.log.info("proposalCommands"+proposalCommands.size());; SelectAndExecuteCommand command = new SelectAndExecuteCommand("Select drop", shell, new LinkedList<Command>(proposalCommands), handler); return new ICommandProxy(command); } return null; }

Target:
protected Command getCustomCommand(Request request) { final Map<DropStrategy, List<Command>> matchingStrategies = findStrategies(request); if (matchingStrategies.size() == 1) { DropStrategy ds = matchingStrategies.keySet().iterator().next(); if(ds instanceof TransactionalDropStrategy){ return matchingStrategies.get(ds).get(0); } else if(ds instanceof TransactionalCommandsDropStrategy){ return null; } } if (matchingStrategies.size() > 1) { boolean useDefault = true; if (request.getExtendedData().containsKey(EVENT_DETAIL)) { int eventDetailValue = (Integer) request.getExtendedData().get(EVENT_DETAIL); if ((eventDetailValue & DND.DROP_COPY) != 0) { useDefault = false; } } if (useDefault) { DropStrategy defaultStrategy = DropStrategyManager.instance.getDefaultDropStrategy(matchingStrategies.keySet()); if (defaultStrategy != null ) { if(defaultStrategy instanceof TransactionalDropStrategy){ return matchingStrategies.get(defaultStrategy).iterator().next(); } else if(defaultStrategy instanceof TransactionalCommandsDropStrategy){ return null; } } } Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); DefaultActionHandler handler = new DefaultActionHandler() { public void defaultActionSelected(Command defaultCommand) { DropStrategy defaultStrategy = findStrategy(matchingStrategies, defaultCommand); if (defaultStrategy != null) { DropStrategyManager.instance.setDefaultDropStrategy(matchingStrategies.keySet(), defaultStrategy); } } public String getLabel() { return "Change the default strategy"; } }; ArrayList<Command> proposalCommands = new ArrayList<Command>(); for(List<Command> cs: matchingStrategies.values()){ for(Command c : cs){ if(c!=null){ proposalCommands.add(c); } } } Activator.log.info("proposalCommands"+proposalCommands.size());; SelectAndExecuteCommand command = new SelectAndExecuteCommand("Select drop", shell, new LinkedList<Command>(proposalCommands), handler); return new ICommandProxy(command); } return null; }