Revision 972ecc88
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/EditPolytomousKeyNodesHandler.java | ||
---|---|---|
12 | 12 |
import org.eclipse.core.commands.AbstractHandler; |
13 | 13 |
import org.eclipse.core.commands.ExecutionEvent; |
14 | 14 |
import org.eclipse.core.commands.ExecutionException; |
15 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
16 |
import org.eclipse.core.runtime.IStatus; |
|
17 |
import org.eclipse.core.runtime.Status; |
|
18 |
import org.eclipse.core.runtime.jobs.Job; |
|
19 |
import org.eclipse.jface.viewers.ISelection; |
|
20 |
import org.eclipse.jface.viewers.StructuredSelection; |
|
21 |
import org.eclipse.swt.widgets.Display; |
|
22 |
|
|
23 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
|
24 |
import eu.etaxonomy.taxeditor.navigation.NavigationUtil; |
|
25 |
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart; |
|
26 |
import eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingEditPolytomousKeyNodesHandlerE4; |
|
27 | 15 |
|
28 | 16 |
/** |
29 | 17 |
* @author n.hoffmann |
... | ... | |
37 | 25 |
*/ |
38 | 26 |
@Override |
39 | 27 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
40 |
PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false); |
|
41 |
|
|
42 |
ISelection selection = view.getSite().getSelectionProvider().getSelection(); |
|
43 |
if(selection instanceof StructuredSelection){ |
|
44 |
|
|
45 |
final StructuredSelection structuredSelection = (StructuredSelection) selection; |
|
46 |
|
|
47 |
Job job = new Job(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS){ |
|
48 |
|
|
49 |
@Override |
|
50 |
protected IStatus run(IProgressMonitor monitor) { |
|
51 |
monitor.beginTask(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS, structuredSelection.size()); |
|
52 |
|
|
53 |
for(final Object selectedObject : structuredSelection.toArray()){ |
|
54 |
if(selectedObject instanceof PolytomousKey){ |
|
55 |
|
|
56 |
Display.getDefault().asyncExec(new Runnable(){ |
|
57 |
|
|
58 |
@Override |
|
59 |
public void run() { |
|
60 |
// NavigationUtil.openEditor((PolytomousKey) selectedObject, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); |
|
61 |
} |
|
62 |
|
|
63 |
}); |
|
64 |
monitor.worked(1); |
|
65 |
} |
|
66 |
} |
|
67 |
monitor.done(); |
|
68 |
return Status.OK_STATUS; |
|
69 |
} |
|
70 |
|
|
71 |
}; |
|
72 |
|
|
73 |
job.setPriority(Job.SHORT); |
|
74 |
job.schedule(); |
|
75 |
|
|
76 |
} |
|
28 |
// PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
|
|
29 |
// |
|
30 |
// ISelection selection = view.getSite().getSelectionProvider().getSelection();
|
|
31 |
// if(selection instanceof StructuredSelection){
|
|
32 |
// |
|
33 |
// final StructuredSelection structuredSelection = (StructuredSelection) selection;
|
|
34 |
// |
|
35 |
// Job job = new Job(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS){
|
|
36 |
// |
|
37 |
// @Override
|
|
38 |
// protected IStatus run(IProgressMonitor monitor) {
|
|
39 |
// monitor.beginTask(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS, structuredSelection.size());
|
|
40 |
// |
|
41 |
// for(final Object selectedObject : structuredSelection.toArray()){
|
|
42 |
// if(selectedObject instanceof PolytomousKey){
|
|
43 |
// |
|
44 |
// Display.getDefault().asyncExec(new Runnable(){
|
|
45 |
// |
|
46 |
// @Override
|
|
47 |
// public void run() {
|
|
48 |
//// NavigationUtil.openEditor((PolytomousKey) selectedObject, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
|
|
49 |
// }
|
|
50 |
// |
|
51 |
// });
|
|
52 |
// monitor.worked(1);
|
|
53 |
// }
|
|
54 |
// }
|
|
55 |
// monitor.done();
|
|
56 |
// return Status.OK_STATUS;
|
|
57 |
// }
|
|
58 |
// |
|
59 |
// };
|
|
60 |
// |
|
61 |
// job.setPriority(Job.SHORT);
|
|
62 |
// job.schedule();
|
|
63 |
// |
|
64 |
// }
|
|
77 | 65 |
return null; |
78 | 66 |
} |
79 | 67 |
|
Also available in: Unified diff
ref #6913 Remove org.eclipse.ui dependency from AbstractUtility