Revision e382ff8f
Added by Patrick Plitzner almost 9 years ago
- added context menu entry for editing classifications
- used generic extension point for cdmViewer in navigation project (#4865)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerChooser.java | ||
---|---|---|
13 | 13 |
import java.util.Map; |
14 | 14 |
import java.util.Map.Entry; |
15 | 15 |
|
16 |
import org.eclipse.core.commands.ExecutionEvent; |
|
16 | 17 |
import org.eclipse.core.runtime.CoreException; |
17 | 18 |
import org.eclipse.core.runtime.IConfigurationElement; |
18 | 19 |
import org.eclipse.core.runtime.IExtensionRegistry; |
... | ... | |
50 | 51 |
|
51 | 52 |
private Object input; |
52 | 53 |
private Map<Entry<Class<?>, String>, ICdmViewer> nameViewerMap; |
54 |
private ExecutionEvent executionEvent; |
|
53 | 55 |
|
54 | 56 |
public CdmViewerChooser(Shell parentShell) { |
55 | 57 |
this(parentShell, SWT.RESIZE | SWT.ON_TOP, true, false, false, false, false, "Open in ...", |
... | ... | |
66 | 68 |
/** |
67 | 69 |
* Opens a popup dialog with all possible viewers for the given input. |
68 | 70 |
* @param input the input for which the viewers are listed |
71 |
* @param event the {@link ExecutionEvent} if invoked via command/handler |
|
69 | 72 |
*/ |
70 |
public void chooseViewer(Object input){ |
|
73 |
public void chooseViewer(Object input, ExecutionEvent event){
|
|
71 | 74 |
this.input = input; |
75 |
this.executionEvent = event; |
|
72 | 76 |
this.nameViewerMap = new HashMap<Entry<Class<?>, String>, ICdmViewer>(); |
73 | 77 |
|
74 | 78 |
IExtensionRegistry reg = Platform.getExtensionRegistry(); |
... | ... | |
95 | 99 |
if(nameViewerMap.size()==1){ |
96 | 100 |
Entry<Class<?>, String> next = nameViewerMap.keySet().iterator().next(); |
97 | 101 |
ICdmViewer cdmViewer = nameViewerMap.get(next); |
98 |
cdmViewer.show(input, next.getKey()); |
|
102 |
cdmViewer.show(input, next.getKey(), event);
|
|
99 | 103 |
} |
100 | 104 |
else{ |
101 | 105 |
if(nameViewerMap.isEmpty()){ |
... | ... | |
129 | 133 |
if(nameViewerMap.containsKey(firstElement)){ |
130 | 134 |
Entry<Class<?>, String> entry = (Entry<Class<?>, String>)firstElement; |
131 | 135 |
ICdmViewer cdmViewer = nameViewerMap.get(entry); |
132 |
cdmViewer.show(input, entry.getKey()); |
|
136 |
cdmViewer.show(input, entry.getKey(), this.executionEvent);
|
|
133 | 137 |
this.close(); |
134 | 138 |
} |
135 | 139 |
} |
Also available in: Unified diff