import java.util.Map;
import java.util.Map.Entry;
+import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
private Object input;
private Map<Entry<Class<?>, String>, ICdmViewer> nameViewerMap;
+ private ExecutionEvent executionEvent;
public CdmViewerChooser(Shell parentShell) {
this(parentShell, SWT.RESIZE | SWT.ON_TOP, true, false, false, false, false, "Open in ...",
/**
* Opens a popup dialog with all possible viewers for the given input.
* @param input the input for which the viewers are listed
+ * @param event the {@link ExecutionEvent} if invoked via command/handler
*/
- public void chooseViewer(Object input){
+ public void chooseViewer(Object input, ExecutionEvent event){
this.input = input;
+ this.executionEvent = event;
this.nameViewerMap = new HashMap<Entry<Class<?>, String>, ICdmViewer>();
IExtensionRegistry reg = Platform.getExtensionRegistry();
if(nameViewerMap.size()==1){
Entry<Class<?>, String> next = nameViewerMap.keySet().iterator().next();
ICdmViewer cdmViewer = nameViewerMap.get(next);
- cdmViewer.show(input, next.getKey());
+ cdmViewer.show(input, next.getKey(), event);
}
else{
if(nameViewerMap.isEmpty()){
if(nameViewerMap.containsKey(firstElement)){
Entry<Class<?>, String> entry = (Entry<Class<?>, String>)firstElement;
ICdmViewer cdmViewer = nameViewerMap.get(entry);
- cdmViewer.show(input, entry.getKey());
+ cdmViewer.show(input, entry.getKey(), this.executionEvent);
this.close();
}
}