Revision c7d830cc
Added by Cherian Mathew about 9 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonLinkHelper.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
13 | 13 |
import org.eclipse.jface.viewers.IStructuredSelection; |
14 | 14 |
import org.eclipse.jface.viewers.StructuredSelection; |
15 | 15 |
import org.eclipse.ui.IEditorInput; |
16 |
import org.eclipse.ui.IEditorPart; |
|
17 | 16 |
import org.eclipse.ui.IWorkbenchPage; |
18 | 17 |
import org.eclipse.ui.navigator.ILinkHelper; |
19 | 18 |
|
... | ... | |
33 | 32 |
|
34 | 33 |
/** Constant <code>ID="eu.etaxonomy.taxeditor.navigation.taxon"{trunked}</code> */ |
35 | 34 |
public static final String ID = "eu.etaxonomy.taxeditor.navigation.taxonlinkhelper"; //$NON-NLS-1$ |
36 |
|
|
35 |
|
|
37 | 36 |
/* (non-Javadoc) |
38 | 37 |
* @see org.eclipse.ui.navigator.ILinkHelper#activateEditor(org.eclipse.ui.IWorkbenchPage, org.eclipse.jface.viewers.IStructuredSelection) |
39 | 38 |
*/ |
40 | 39 |
/** {@inheritDoc} */ |
41 |
public void activateEditor(IWorkbenchPage page, |
|
40 |
@Override |
|
41 |
public void activateEditor(IWorkbenchPage page, |
|
42 | 42 |
IStructuredSelection selection) { |
43 | 43 |
try { |
44 | 44 |
if (selection == null || selection.isEmpty()) { |
45 | 45 |
return; |
46 | 46 |
} |
47 |
if (selection.getFirstElement() instanceof TaxonNode) { |
|
48 |
TaxonNode taxonNode = (TaxonNode) selection.getFirstElement(); |
|
49 |
TaxonEditorInput taxonEditorInput; |
|
50 |
|
|
51 |
taxonEditorInput = TaxonEditorInput.NewInstance(taxonNode.getUuid()); |
|
52 |
|
|
53 |
IEditorPart editor = null; |
|
54 |
if ((editor = page.findEditor(taxonEditorInput)) != null) { |
|
55 |
page.bringToTop(editor); |
|
56 |
} |
|
57 |
} |
|
47 |
// if (selection.getFirstElement() instanceof TaxonNode) {
|
|
48 |
// TaxonNode taxonNode = (TaxonNode) selection.getFirstElement();
|
|
49 |
// TaxonEditorInput taxonEditorInput;
|
|
50 |
// |
|
51 |
// taxonEditorInput = TaxonEditorInput.NewInstance(taxonNode.getUuid());
|
|
52 |
// |
|
53 |
// IEditorPart editor = null;
|
|
54 |
// if ((editor = page.findEditor(taxonEditorInput)) != null) {
|
|
55 |
// page.bringToTop(editor);
|
|
56 |
// }
|
|
57 |
// }
|
|
58 | 58 |
} catch (Exception e) { |
59 | 59 |
MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage()); |
60 | 60 |
} |
... | ... | |
64 | 64 |
* @see org.eclipse.ui.navigator.ILinkHelper#findSelection(org.eclipse.ui.IEditorInput) |
65 | 65 |
*/ |
66 | 66 |
/** {@inheritDoc} */ |
67 |
public IStructuredSelection findSelection(IEditorInput editorInput) { |
|
67 |
@Override |
|
68 |
public IStructuredSelection findSelection(IEditorInput editorInput) { |
|
68 | 69 |
if (editorInput instanceof TaxonEditorInput) { |
69 | 70 |
TaxonNode taxonNode = ((TaxonEditorInput) editorInput).getTaxonNode(); |
70 | 71 |
if (taxonNode != null) { |
Also available in: Unified diff
CdmModelCacher : added recursive search in super classes
CdmTransientEntityCacher : corrected caching
EntityCacherDebugResult : new debug result object
CdmEntitySession, ICdmEntitySession, MockCdmEntitySession : added debug method
CdmEntitySessionInput : new super class for editor input objects
TaxonEditorInput : refactored and made sub class of CdmEntitySessionInput
DeleteNodeOperation : using new uuid service methods
TaxonNameEditor : removed unnecessary service call to retrieve taxon
TaxonLinkHelper : removed unnecessary second call to initialise input
AbstractCdmViewPart : now implements ISessionEnabled