Revision 5c823b08
Added by Patrick Plitzner about 8 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java | ||
---|---|---|
15 | 15 |
import org.eclipse.core.commands.operations.IUndoContext; |
16 | 16 |
import org.eclipse.core.commands.operations.UndoContext; |
17 | 17 |
import org.eclipse.jface.viewers.StructuredSelection; |
18 |
import org.eclipse.jface.wizard.WizardDialog; |
|
18 | 19 |
import org.eclipse.swt.widgets.Display; |
19 | 20 |
import org.eclipse.swt.widgets.Shell; |
20 | 21 |
import org.eclipse.ui.IEditorPart; |
21 | 22 |
import org.eclipse.ui.IEditorReference; |
22 | 23 |
import org.eclipse.ui.IWorkbenchWindow; |
23 | 24 |
import org.eclipse.ui.PartInitException; |
25 |
import org.eclipse.ui.PlatformUI; |
|
24 | 26 |
import org.eclipse.ui.navigator.CommonViewer; |
25 | 27 |
|
26 | 28 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
27 | 29 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
28 | 30 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
31 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
29 | 32 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
30 | 33 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
31 | 34 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
... | ... | |
37 | 40 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
38 | 41 |
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin; |
39 | 42 |
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator; |
43 |
import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard; |
|
40 | 44 |
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; |
41 | 45 |
|
42 | 46 |
/** |
... | ... | |
57 | 61 |
public static void openEditor(ICdmBase selectedObject){ |
58 | 62 |
UUID entityUuid = selectedObject.getUuid(); |
59 | 63 |
try { |
60 |
if(selectedObject instanceof TaxonNode){ |
|
64 |
if(selectedObject instanceof Classification){ |
|
65 |
NewClassificationWizard classificationWizard = new NewClassificationWizard(); |
|
66 |
classificationWizard.init(null, null); |
|
67 |
classificationWizard.setEntity((Classification) selectedObject); |
|
68 |
WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), classificationWizard); |
|
69 |
dialog.open(); |
|
70 |
} |
|
71 |
else if(selectedObject instanceof TaxonNode){ |
|
61 | 72 |
EditorUtil.openTaxonNode(entityUuid); |
62 | 73 |
}else if(selectedObject instanceof TaxonBase){ |
63 | 74 |
EditorUtil.openTaxonBase(entityUuid); |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java | ||
---|---|---|
25 | 25 |
import org.eclipse.core.runtime.IAdaptable; |
26 | 26 |
import org.eclipse.core.runtime.IProgressMonitor; |
27 | 27 |
import org.eclipse.jface.viewers.DoubleClickEvent; |
28 |
import org.eclipse.jface.viewers.ISelection; |
|
28 | 29 |
import org.eclipse.jface.viewers.IStructuredSelection; |
29 | 30 |
import org.eclipse.jface.viewers.TreePath; |
30 | 31 |
import org.eclipse.ui.IMemento; |
... | ... | |
40 | 41 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
41 | 42 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
42 | 43 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
44 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
|
43 | 45 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
44 | 46 |
import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator; |
45 | 47 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
... | ... | |
452 | 454 |
/** {@inheritDoc} */ |
453 | 455 |
@Override |
454 | 456 |
protected void handleDoubleClick(DoubleClickEvent event) { |
455 |
if(event.getSelection() instanceof IStructuredSelection){ |
|
456 |
Object selectedObject = ((IStructuredSelection) event.getSelection()).getFirstElement(); |
|
457 |
CdmViewerChooser chooser = new CdmViewerChooser(getSite().getShell()); |
|
458 |
chooser.chooseViewer(selectedObject); |
|
459 |
} |
|
457 |
ISelection selection = event.getSelection(); |
|
458 |
if(selection instanceof IStructuredSelection){ |
|
459 |
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
|
460 |
if(firstElement instanceof ICdmBase){ |
|
461 |
NavigationUtil.openEditor((ICdmBase) firstElement); |
|
462 |
} |
|
463 |
} |
|
460 | 464 |
// If the double click is passed up to the super-class it will |
461 | 465 |
// expand/collapse trees. |
462 | 466 |
// We do not want that |
Also available in: Unified diff
Remove CdmViewerChooser from double-click functionality of taxon
navigator