Revision b0ce5b17
Added by Patrick Plitzner over 10 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java | ||
---|---|---|
2 | 2 |
// $Id$ |
3 | 3 |
/** |
4 | 4 |
* Copyright (C) 2007 EDIT |
5 |
* European Distributed Institute of Taxonomy
|
|
5 |
* European Distributed Institute of Taxonomy |
|
6 | 6 |
* http://www.e-taxonomy.eu |
7 |
*
|
|
7 |
* |
|
8 | 8 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
9 | 9 |
* See LICENSE.TXT at the top of this package for the full license terms. |
10 | 10 |
*/ |
... | ... | |
41 | 41 |
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
42 | 42 |
*/ |
43 | 43 |
/** {@inheritDoc} */ |
44 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
45 |
|
|
44 |
@Override |
|
45 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
46 |
|
|
46 | 47 |
ISelection selection = HandlerUtil.getCurrentSelection(event); |
47 |
|
|
48 |
|
|
48 | 49 |
if(selection instanceof StructuredSelection){ |
49 | 50 |
final StructuredSelection structuredSelection = (StructuredSelection) selection; |
50 |
|
|
51 |
|
|
51 | 52 |
if(structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof Classification){ |
52 | 53 |
Classification classification = (Classification) structuredSelection.getFirstElement(); |
53 |
|
|
54 |
|
|
54 | 55 |
NewClassificationWizard classificationWizard = new NewClassificationWizard(); |
55 | 56 |
classificationWizard.init(null, null); |
56 | 57 |
classificationWizard.setEntity(classification); |
57 | 58 |
WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), classificationWizard); |
58 | 59 |
dialog.open(); |
59 |
|
|
60 |
|
|
60 | 61 |
} |
61 | 62 |
else{ |
62 | 63 |
|
63 | 64 |
Job job = new Job("Opening editor") { |
64 |
|
|
65 |
|
|
65 | 66 |
@Override |
66 | 67 |
protected IStatus run(IProgressMonitor monitor) { |
67 | 68 |
for(final Object selectedObject : structuredSelection.toArray()){ |
68 |
|
|
69 |
|
|
69 | 70 |
Display.getDefault().asyncExec(new Runnable(){ |
70 |
|
|
71 |
public void run() { |
|
71 |
|
|
72 |
@Override |
|
73 |
public void run() { |
|
72 | 74 |
NavigationUtil.openEditor(selectedObject); |
73 | 75 |
} |
74 |
|
|
76 |
|
|
75 | 77 |
}); |
76 | 78 |
} |
77 | 79 |
return Status.OK_STATUS; |
78 | 80 |
} |
79 | 81 |
}; |
80 |
|
|
82 |
|
|
81 | 83 |
job.schedule(); |
82 | 84 |
} |
83 | 85 |
} |
84 |
|
|
86 |
|
|
85 | 87 |
return null; |
86 | 88 |
} |
87 | 89 |
} |
Also available in: Unified diff
merged trunk into branch