Revision 9ad85674
Added by Patrick Plitzner about 6 years ago
eu.etaxonomy.taxeditor.editor/fragment.e4xmi | ||
---|---|---|
104 | 104 |
</children> |
105 | 105 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_m00sEIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.factualData.moveDescriptionElement" label="%command.label.29" command="_QJzBcIG4EeehlNPrK_b5JA"/> |
106 | 106 |
<children xsi:type="menu:MenuSeparator" xmi:id="_nRINkIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.9"/> |
107 |
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_4KNqkIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.dynamicmenucontribution.0" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.CdmViewerContextMenuE4"/>
|
|
107 |
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_4KNqkIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.factual.dynamicmenucontribution.cdmViewer" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.CdmViewerContextMenuE4"/>
|
|
108 | 108 |
<children xsi:type="menu:MenuSeparator" xmi:id="_pOAxAIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.10"/> |
109 | 109 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_rLS9EIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.factualData.delete" label="%command.label.30" command="_AqgMcIG5EeehlNPrK_b5JA"/> |
110 | 110 |
</menus> |
111 | 111 |
</elements> |
112 |
<elements xsi:type="basic:PartDescriptor" xmi:id="_KJxRIIZ4EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4" label="%view.name.2" iconURI="" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4"> |
|
113 |
<handlers xmi:id="_fEoFAIZ5EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.DeleteConceptRelationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.DeleteConceptRelationHandlerE4" command="_Ob4xIIZ5EeeOc9DZcjNN7g"/> |
|
114 |
<handlers xmi:id="_VtwU4IZ8EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.CreateConceptRelationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.CreateConceptRelationHandlerE4" command="_2torwIZ7EeeOc9DZcjNN7g"/> |
|
115 |
<handlers xmi:id="_R3QgQIaDEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.handler.0" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.OpenRelatedConceptHandlerE4" command="_OKtWAIaDEeeOc9DZcjNN7g"/> |
|
116 |
<handlers xmi:id="_fs6ogIaDEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.OpenRelatedConceptInBulkEditorHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.OpenRelatedConceptInBulkEditorHandlerE4" command="_cMeq0IaHEeeOc9DZcjNN7g"/> |
|
117 |
<menus xsi:type="menu:PopupMenu" xmi:id="_KJxRJYZ4EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.conceptview"> |
|
118 |
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_MhPIsIaBEeeOc9DZcjNN7g" coreExpressionId="isCdmStoreConnected"/> |
|
119 |
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_dXzzUIZ4EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.dynamicmenucontribution.2" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.concept.e4.CreateConceptRelationMenuE4"/> |
|
120 |
<children xsi:type="menu:MenuSeparator" xmi:id="_Jt9pcIZ5EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.11"/> |
|
121 |
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_2SGGoIZ4EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.concept.dynamicmenucontribution.cdmViewer" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.CdmViewerContextMenuE4"/> |
|
122 |
<children xsi:type="menu:MenuSeparator" xmi:id="_lcXJgIaBEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.12"/> |
|
123 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_KT8rYIZ5EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel44" label="%command.label.44" command="_Ob4xIIZ5EeeOc9DZcjNN7g"/> |
|
124 |
</menus> |
|
125 |
</elements> |
|
112 | 126 |
</fragments> |
113 | 127 |
<fragments xsi:type="fragment:StringModelFragment" xmi:id="__mwtMDVpEee_b7RlBzTDRw" featurename="commands" parentElementId="xpath:/"> |
114 | 128 |
<elements xsi:type="commands:Command" xmi:id="_BjF3ADVqEee_b7RlBzTDRw" elementId="eu.etaxonomy.taxeditor.editor.command.specimeneditor.create_field_unit" commandName="%command.commandname.1"/> |
... | ... | |
136 | 150 |
<elements xsi:type="commands:Command" xmi:id="_QJzBcIG4EeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionElements" commandName="%command.name.12"/> |
137 | 151 |
<elements xsi:type="commands:Command" xmi:id="_AqgMcIG5EeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.delete" commandName="%command.name.48"/> |
138 | 152 |
<elements xsi:type="commands:Command" xmi:id="_8ccfgIHXEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.createDescriptionElement" commandName="%command.name.10"/> |
153 |
<elements xsi:type="commands:Command" xmi:id="_Ob4xIIZ5EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.view.concept.command.delete" commandName="%command.name.50"/> |
|
154 |
<elements xsi:type="commands:Command" xmi:id="_2torwIZ7EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.name.createConceptRelation" commandName="%command.name.32"/> |
|
155 |
<elements xsi:type="commands:Command" xmi:id="_OKtWAIaDEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.view.concept.command.open" commandName="%command.name.33"/> |
|
156 |
<elements xsi:type="commands:Command" xmi:id="_cMeq0IaHEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.openBulkEditorForTaxonRelationship" commandName="Open related concept in bulk editor"/> |
|
139 | 157 |
</fragments> |
140 | 158 |
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView"> |
141 | 159 |
<elements xsi:type="menu:HandledMenuItem" xmi:id="_tvph4EalEeeXMc6kSYO7Xg" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.characterEditor" label="Character Editor" command="_WPjpoDSnEeek0dKsFNy--Q"> |
... | ... | |
148 | 166 |
</elements> |
149 | 167 |
<elements xsi:type="menu:HandledMenuItem" xmi:id="_XBhycIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.factualData" label="%view.name" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/address-book-new.png" command="_WPjpoDSnEeek0dKsFNy--Q"> |
150 | 168 |
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_COD1EIZHEee-VvuRyq44pQ" coreExpressionId="isCdmStoreConnected"/> |
151 |
<parameters xmi:id="_XBhycYGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.mediaview" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4"/> |
|
169 |
<parameters xmi:id="_XBhycYGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.factualview" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4"/> |
|
170 |
</elements> |
|
171 |
<elements xsi:type="menu:HandledMenuItem" xmi:id="_5s52EIZ3EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.concept" label="%command.label.6" command="_WPjpoDSnEeek0dKsFNy--Q"> |
|
172 |
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_BIalYIZ4EeeOc9DZcjNN7g" coreExpressionId="isCdmStoreConnected"/> |
|
173 |
<parameters xmi:id="_80HvkIaAEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.conceptview" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4"/> |
|
152 | 174 |
</elements> |
153 |
</fragments> |
|
154 |
<fragments xsi:type="fragment:StringModelFragment" xmi:id="___fvgIHXEeehlNPrK_b5JA" featurename="handlers" parentElementId="xpath:/"> |
|
155 |
<elements xsi:type="commands:Handler" xmi:id="_GiwoMIHYEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.handler.0" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionElementHandler" command="_8ccfgIHXEeehlNPrK_b5JA"/> |
|
156 | 175 |
</fragments> |
157 | 176 |
</fragment:ModelFragments> |
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
88 | 88 |
name="%view.name.0" |
89 | 89 |
restorable="true"> |
90 | 90 |
</view> |
91 |
<view |
|
92 |
category="eu.etaxonomy.taxeditor.editor.category" |
|
93 |
class="eu.etaxonomy.taxeditor.editor.view.concept.ConceptViewPart" |
|
94 |
id="eu.etaxonomy.taxeditor.editor.view.concept" |
|
95 |
name="%view.name.2" |
|
96 |
restorable="true"> |
|
97 |
</view> |
|
98 | 91 |
<view |
99 | 92 |
category="eu.etaxonomy.taxeditor.editor.category" |
100 | 93 |
class="eu.etaxonomy.taxeditor.editor.view.concept.graph.ConceptGraphView" |
... | ... | |
277 | 270 |
name="eu.etaxonomy.taxeditor.editor.showViewMenu" |
278 | 271 |
visible="true"> |
279 | 272 |
</separator> |
280 |
<command |
|
281 |
commandId="org.eclipse.ui.views.showView" |
|
282 |
label="%command.label.6" |
|
283 |
style="push"> |
|
284 |
<parameter |
|
285 |
name="org.eclipse.ui.views.showView.viewId" |
|
286 |
value="eu.etaxonomy.taxeditor.editor.view.concept"> |
|
287 |
</parameter> |
|
288 |
<visibleWhen |
|
289 |
checkEnabled="true"> |
|
290 |
<reference |
|
291 |
definitionId="isCdmStoreConnected"> |
|
292 |
</reference> |
|
293 |
</visibleWhen> |
|
294 |
</command> |
|
295 | 273 |
<command |
296 | 274 |
commandId="org.eclipse.ui.views.showView" |
297 | 275 |
label="%command.label.7" |
... | ... | |
838 | 816 |
|
839 | 817 |
|
840 | 818 |
|
841 |
<menuContribution |
|
842 |
locationURI="popup:eu.etaxonomy.taxeditor.editor.view.concept"> |
|
843 |
<menu |
|
844 |
label="%menu.label.3"> |
|
845 |
<dynamic |
|
846 |
class="eu.etaxonomy.taxeditor.editor.view.concept.handler.CreateConceptRelationMenu" |
|
847 |
id="eu.etaxonomy.taxeditor.editor.view.concept.menus.new"> |
|
848 |
</dynamic> |
|
849 |
</menu> |
|
850 |
<dynamic |
|
851 |
class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu" |
|
852 |
id="eu.etaxonomy.taxeditor.view.context.CdmViewerContextMenu"> |
|
853 |
</dynamic> |
|
854 |
<separator |
|
855 |
name="eu.etaxonomy.taxeditor.editor.view.concept.menu.separator1" |
|
856 |
visible="true"> |
|
857 |
</separator> |
|
858 |
<command |
|
859 |
commandId="eu.etaxonomy.taxeditor.editor.view.concept.command.delete" |
|
860 |
label="%command.label.44" |
|
861 |
style="push"> |
|
862 |
</command> |
|
863 |
</menuContribution> |
|
864 | 819 |
<menuContribution |
865 | 820 |
allPopups="false" |
866 | 821 |
locationURI="popup:bulkeditor.editor?before=eu.etaxonomy.taxeditor.bulkeditor.separator1"> |
... | ... | |
996 | 951 |
</with> |
997 | 952 |
</enabledWhen> |
998 | 953 |
</handler> |
999 |
<handler |
|
1000 |
class="eu.etaxonomy.taxeditor.editor.view.concept.handler.DeleteConceptRelationHandler" |
|
1001 |
commandId="eu.etaxonomy.taxeditor.editor.view.concept.command.delete"> |
|
1002 |
<activeWhen> |
|
1003 |
<with |
|
1004 |
variable="activePartId"> |
|
1005 |
<equals |
|
1006 |
value="eu.etaxonomy.taxeditor.editor.view.concept"> |
|
1007 |
</equals> |
|
1008 |
</with> |
|
1009 |
</activeWhen> |
|
1010 |
</handler> |
|
1011 | 954 |
<handler |
1012 | 955 |
class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.ToggleShowOnlyIndividualAssociationsHandler" |
1013 | 956 |
commandId="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations"> |
... | ... | |
1343 | 1286 |
id="eu.etaxonomy.taxeditor.editor.view.concept.category" |
1344 | 1287 |
name="%category.name.6"> |
1345 | 1288 |
</category> |
1346 |
<command |
|
1347 |
categoryId="eu.etaxonomy.taxeditor.editor.view.concept.category" |
|
1348 |
defaultHandler="eu.etaxonomy.taxeditor.editor.view.concept.handler.CreateConceptRelationHandler" |
|
1349 |
id="eu.etaxonomy.taxeditor.editor.name.createConceptRelation" |
|
1350 |
name="%command.name.32"> |
|
1351 |
</command> |
|
1352 |
<command |
|
1353 |
categoryId="eu.etaxonomy.taxeditor.editor.view.concept.category" |
|
1354 |
defaultHandler="eu.etaxonomy.taxeditor.editor.view.concept.handler.OpenRelatedConceptHandler" |
|
1355 |
id="eu.etaxonomy.taxeditor.editor.view.concept.command.open" |
|
1356 |
name="%command.name.33"> |
|
1357 |
</command> |
|
1358 |
<command |
|
1359 |
categoryId="eu.etaxonomy.taxeditor.editor.view.concept.category" |
|
1360 |
defaultHandler="eu.etaxonomy.taxeditor.editor.view.concept.handler.DeleteConceptRelationHandler" |
|
1361 |
id="eu.etaxonomy.taxeditor.editor.view.concept.command.delete" |
|
1362 |
name="%command.name.51"> |
|
1363 |
</command> |
|
1364 | 1289 |
<category |
1365 | 1290 |
id="eu.etaxonomy.taxeditor.bulkeditor.group.category" |
1366 | 1291 |
name="%category.name.7"> |
... | ... | |
1434 | 1359 |
id="eu.etaxonomy.taxeditor.openSpecimenEditorForTypeSpecimen" |
1435 | 1360 |
name="%command.name.OPEN_EDITOR_FOR_TYPE_SPECIMEN"> |
1436 | 1361 |
</command> |
1437 |
<command |
|
1438 |
defaultHandler="eu.etaxonomy.taxeditor.editor.view.concept.handler.OpenRelatedConceptInBulkEditorHandler" |
|
1439 |
id="eu.etaxonomy.taxeditor.editor.openBulkEditorForTaxonRelationship" |
|
1440 |
name="Open bulk editor for taxon relationship"> |
|
1441 |
</command> |
|
1442 | 1362 |
|
1443 | 1363 |
</extension> |
1444 | 1364 |
<extension |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/ConceptViewPartE4.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.editor.view.concept.e4; |
|
11 |
|
|
12 |
import java.util.Map.Entry; |
|
13 |
|
|
14 |
import javax.annotation.PostConstruct; |
|
15 |
import javax.inject.Inject; |
|
16 |
import javax.inject.Named; |
|
17 |
|
|
18 |
import org.eclipse.e4.core.di.annotations.Optional; |
|
19 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
20 |
import org.eclipse.e4.ui.services.EMenuService; |
|
21 |
import org.eclipse.e4.ui.services.IServiceConstants; |
|
22 |
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; |
|
23 |
import org.eclipse.jface.viewers.ISelection; |
|
24 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
|
25 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
26 |
import org.eclipse.jface.viewers.ListViewer; |
|
27 |
import org.eclipse.jface.viewers.StructuredSelection; |
|
28 |
import org.eclipse.jface.viewers.ViewerSorter; |
|
29 |
import org.eclipse.swt.widgets.Composite; |
|
30 |
import org.eclipse.ui.IEditorInput; |
|
31 |
import org.eclipse.ui.IEditorPart; |
|
32 |
|
|
33 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
34 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
|
35 |
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; |
|
36 |
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; |
|
37 |
import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor; |
|
38 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
|
39 |
import eu.etaxonomy.taxeditor.editor.view.concept.ConceptContentProvider; |
|
40 |
import eu.etaxonomy.taxeditor.editor.view.concept.ConceptLabelProvider; |
|
41 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
42 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
|
43 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; |
|
44 |
import eu.etaxonomy.taxeditor.model.LineSelection; |
|
45 |
import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart; |
|
46 |
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4; |
|
47 |
import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart; |
|
48 |
|
|
49 |
/** |
|
50 |
* |
|
51 |
* @author pplitzner |
|
52 |
* @date 21.08.2017 |
|
53 |
* |
|
54 |
*/ |
|
55 |
public class ConceptViewPartE4 extends AbstractCdmEditorPartE4 |
|
56 |
implements IPartContentHasDetails, IPartContentHasSupplementalData{ |
|
57 |
|
|
58 |
private ISelectionChangedListener selectionChangedListener; |
|
59 |
|
|
60 |
@Inject |
|
61 |
private ESelectionService selService; |
|
62 |
|
|
63 |
@Inject |
|
64 |
@Optional |
|
65 |
public void selectionChanged( |
|
66 |
@Named(IServiceConstants.ACTIVE_SELECTION)Object selection, |
|
67 |
@Named(IServiceConstants.ACTIVE_PART)MPart activePart, |
|
68 |
MPart thisPart){ |
|
69 |
if(activePart==thisPart){ |
|
70 |
return; |
|
71 |
} |
|
72 |
|
|
73 |
Object partObject = createPartObject(activePart); |
|
74 |
|
|
75 |
if (partObject instanceof DetailsViewPart || partObject instanceof SupplementalDataViewPart) { |
|
76 |
// do not show empty page as these views are also used to edit the |
|
77 |
// description selected in this view |
|
78 |
return; |
|
79 |
} |
|
80 |
else if(partObject instanceof BulkEditor && selection instanceof LineSelection){ |
|
81 |
if(((LineSelection) selection).getFirstElement() instanceof Taxon){ |
|
82 |
showViewer((LineSelection) selection, activePart, viewer); |
|
83 |
} |
|
84 |
else{ |
|
85 |
showEmptyPage(); |
|
86 |
} |
|
87 |
return; |
|
88 |
} |
|
89 |
else if(partObject instanceof AbstractGraphKeyEditor){ |
|
90 |
showEmptyPage(); |
|
91 |
} |
|
92 |
else if(partObject instanceof MultiPageTaxonEditor){ |
|
93 |
IEditorInput input = ((IEditorPart) partObject).getEditorInput(); |
|
94 |
showViewer(new StructuredSelection(input), activePart, viewer); |
|
95 |
} |
|
96 |
else { |
|
97 |
showEmptyPage(); |
|
98 |
} |
|
99 |
|
|
100 |
} |
|
101 |
|
|
102 |
//FIXME E4 implement |
|
103 |
// @Override |
|
104 |
// protected String createPartTitle(Object selectedObject) { |
|
105 |
// if(selectedObject instanceof TaxonEditorInput){ |
|
106 |
// return super.createPartTitle(((TaxonEditorInput) selectedObject).getTaxon()); |
|
107 |
// } |
|
108 |
// return super.createPartTitle(selectedObject); |
|
109 |
// } |
|
110 |
|
|
111 |
@PostConstruct |
|
112 |
public void create(Composite parent, EMenuService menuService) { |
|
113 |
|
|
114 |
ConceptRelationViewer conceptViewer = new ConceptRelationViewer(parent); |
|
115 |
|
|
116 |
conceptViewer.setContentProvider(new ConceptContentProvider()); |
|
117 |
conceptViewer.setLabelProvider(new ConceptLabelProvider()); |
|
118 |
|
|
119 |
|
|
120 |
conceptViewer.setSorter(new ViewerSorter()); |
|
121 |
|
|
122 |
viewer = conceptViewer; |
|
123 |
|
|
124 |
// Propagate selection from viewer |
|
125 |
selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event))); |
|
126 |
viewer.addSelectionChangedListener(selectionChangedListener); |
|
127 |
|
|
128 |
//create context menu |
|
129 |
menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.conceptview"); |
|
130 |
|
|
131 |
} |
|
132 |
|
|
133 |
@Override |
|
134 |
public void changed(Object object) { |
|
135 |
getViewer().refresh(); |
|
136 |
super.changed(object); |
|
137 |
} |
|
138 |
|
|
139 |
private class ConceptRelationViewer extends ListViewer { |
|
140 |
|
|
141 |
public ConceptRelationViewer(Composite parent) { |
|
142 |
super(parent); |
|
143 |
} |
|
144 |
|
|
145 |
@Override |
|
146 |
public ISelection getSelection() { |
|
147 |
ISelection selection = super.getSelection(); |
|
148 |
if(selection instanceof IStructuredSelection && !selection.isEmpty()){ |
|
149 |
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
|
150 |
TaxonRelationship taxonRelationship = ((Entry<TaxonRelationship, Taxon>)firstElement).getKey(); |
|
151 |
return new StructuredSelection(taxonRelationship); |
|
152 |
|
|
153 |
} |
|
154 |
return selection; |
|
155 |
} |
|
156 |
|
|
157 |
@Override |
|
158 |
public void setSelection(ISelection selection) { |
|
159 |
super.setSelection(selection); |
|
160 |
} |
|
161 |
|
|
162 |
} |
|
163 |
|
|
164 |
@Override |
|
165 |
protected String getViewName() { |
|
166 |
return Messages.ConceptViewPart_VIEWER_NAME; |
|
167 |
} |
|
168 |
|
|
169 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/CreateConceptRelationMenuE4.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.editor.view.concept.e4; |
|
11 |
|
|
12 |
import java.util.List; |
|
13 |
|
|
14 |
import org.eclipse.e4.ui.di.AboutToShow; |
|
15 |
import org.eclipse.e4.ui.model.application.commands.MCommand; |
|
16 |
import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; |
|
17 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
|
18 |
import org.eclipse.e4.ui.model.application.ui.menu.MMenu; |
|
19 |
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; |
|
20 |
import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; |
|
21 |
|
|
22 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
|
23 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
24 |
|
|
25 |
/** |
|
26 |
* |
|
27 |
* @author pplitzner |
|
28 |
* @date 21.08.2017 |
|
29 |
* |
|
30 |
*/ |
|
31 |
public class CreateConceptRelationMenuE4 { |
|
32 |
|
|
33 |
public String commandName = "eu.etaxonomy.taxeditor.editor.name.createConceptRelation"; //$NON-NLS-1$ |
|
34 |
|
|
35 |
/** {@inheritDoc} */ |
|
36 |
@AboutToShow |
|
37 |
public void aboutToShow(List<MMenuElement> items) { |
|
38 |
|
|
39 |
MMenu menu = MMenuFactory.INSTANCE.createMenu(); |
|
40 |
menu.setLabel("New"); |
|
41 |
items.add(menu); |
|
42 |
|
|
43 |
for (final TaxonRelationshipType taxonRelationshipType : CdmStore.getTermManager().getPreferredTerms(TaxonRelationshipType.class)) { |
|
44 |
if (!taxonRelationshipType.equals(TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN())) { |
|
45 |
MHandledMenuItem menuItem = MMenuFactory.INSTANCE.createHandledMenuItem(); |
|
46 |
menuItem.setLabel(taxonRelationshipType.getTitleCache()); |
|
47 |
MCommand mCommand = MCommandsFactory.INSTANCE.createCommand(); |
|
48 |
mCommand.setElementId(commandName); |
|
49 |
mCommand.setCommandName("Create concept relation"); |
|
50 |
// set params |
|
51 |
menuItem.getTransientData().put(commandName + ".taxonRelationshipType.uuid", |
|
52 |
taxonRelationshipType.getUuid()); |
|
53 |
|
|
54 |
menuItem.setCommand(mCommand); |
|
55 |
menu.getChildren().add(menuItem); |
|
56 |
} |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/handler/CreateConceptRelationHandlerE4.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.editor.view.concept.e4.handler; |
|
11 |
|
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
import javax.inject.Named; |
|
15 |
|
|
16 |
import org.eclipse.core.commands.operations.IUndoContext; |
|
17 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
18 |
import org.eclipse.e4.core.di.annotations.Execute; |
|
19 |
import org.eclipse.e4.core.di.annotations.Optional; |
|
20 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
21 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
|
22 |
import org.eclipse.e4.ui.services.IServiceConstants; |
|
23 |
import org.eclipse.swt.widgets.Shell; |
|
24 |
|
|
25 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
|
26 |
import eu.etaxonomy.cdm.api.service.ITermService; |
|
27 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
|
28 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
29 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
|
30 |
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; |
|
31 |
import eu.etaxonomy.taxeditor.editor.Page; |
|
32 |
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; |
|
33 |
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4; |
|
34 |
import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation; |
|
35 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
36 |
import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer; |
|
37 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
|
38 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
39 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonBaseSelectionDialog; |
|
40 |
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility; |
|
41 |
|
|
42 |
/** |
|
43 |
* |
|
44 |
* @author pplitzner |
|
45 |
* @date 21.08.2017 |
|
46 |
* |
|
47 |
*/ |
|
48 |
public class CreateConceptRelationHandlerE4 { |
|
49 |
|
|
50 |
@Execute |
|
51 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
|
52 |
@Optional@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, |
|
53 |
MHandledMenuItem menuItem) { |
|
54 |
|
|
55 |
String commandId = menuItem.getCommand().getElementId(); |
|
56 |
UUID uuid = (UUID) menuItem.getTransientData().get(commandId+".taxonRelationshipType.uuid"); |
|
57 |
TaxonRelationshipType taxonRelationshipType = HibernateProxyHelper.deproxy(CdmStore.getService(ITermService.class).load(uuid), TaxonRelationshipType.class); |
|
58 |
TaxonNameEditor editor = null; |
|
59 |
|
|
60 |
|
|
61 |
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject(); |
|
62 |
|
|
63 |
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart()); |
|
64 |
if(e4WrappedPart instanceof MultiPageTaxonEditor){ |
|
65 |
editor = (TaxonNameEditor) ((MultiPageTaxonEditor) e4WrappedPart).getPage(Page.NAME); |
|
66 |
} |
|
67 |
|
|
68 |
IUndoContext undoContext = null; |
|
69 |
ConversationHolder conversationHolder = null; |
|
70 |
Taxon taxon = null; |
|
71 |
taxon = editor.getTaxon(); |
|
72 |
conversationHolder = editor.getConversationHolder(); |
|
73 |
undoContext = editor.getUndoContext(); |
|
74 |
|
|
75 |
//FIXME should this also be enabled for bulk editor |
|
76 |
// else if(activeEditor instanceof BulkEditor){ |
|
77 |
// BulkEditor bulkEditor = (BulkEditor)activeEditor; |
|
78 |
// ISelection selection = bulkEditor.getSelectionProvider().getSelection(); |
|
79 |
// taxon = (Taxon) ((IStructuredSelection)selection).getFirstElement(); |
|
80 |
// conversationHolder = bulkEditor.getConversationHolder(); |
|
81 |
// undoContext = bulkEditor.getUndoContext(); |
|
82 |
// } |
|
83 |
|
|
84 |
Taxon relatedConcept = TaxonBaseSelectionDialog.selectTaxon(shell, conversationHolder, taxon); |
|
85 |
|
|
86 |
|
|
87 |
if(relatedConcept == null){ |
|
88 |
return; |
|
89 |
} |
|
90 |
boolean isInverse = taxonRelationshipType.getInverseLabel().isEmpty()?false:true; |
|
91 |
TaxonRelationshipTypeInverseContainer typeInverseContainer =new TaxonRelationshipTypeInverseContainer(taxonRelationshipType, isInverse) ; |
|
92 |
|
|
93 |
|
|
94 |
AbstractPostOperation operation = new CreateConceptRelationOperation(menuItem.getLocalizedLabel(), |
|
95 |
undoContext, taxon, relatedConcept, typeInverseContainer, conceptView); |
|
96 |
AbstractUtility.executeOperation(operation); |
|
97 |
} |
|
98 |
|
|
99 |
@CanExecute |
|
100 |
public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
|
101 |
MHandledMenuItem menuItem){ |
|
102 |
boolean canExecute = false; |
|
103 |
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject(); |
|
104 |
|
|
105 |
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart()); |
|
106 |
canExecute = e4WrappedPart instanceof MultiPageTaxonEditor; |
|
107 |
menuItem.setVisible(canExecute); |
|
108 |
return canExecute; |
|
109 |
} |
|
110 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/handler/DeleteConceptRelationHandlerE4.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.editor.view.concept.e4.handler; |
|
11 |
|
|
12 |
import java.util.HashSet; |
|
13 |
import java.util.Set; |
|
14 |
|
|
15 |
import javax.inject.Named; |
|
16 |
|
|
17 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
18 |
import org.eclipse.e4.core.di.annotations.Execute; |
|
19 |
import org.eclipse.e4.core.di.annotations.Optional; |
|
20 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
21 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
|
22 |
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; |
|
23 |
import org.eclipse.e4.ui.services.IServiceConstants; |
|
24 |
import org.eclipse.jface.viewers.ISelection; |
|
25 |
|
|
26 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
|
27 |
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; |
|
28 |
import eu.etaxonomy.taxeditor.editor.Page; |
|
29 |
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; |
|
30 |
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4; |
|
31 |
import eu.etaxonomy.taxeditor.editor.view.concept.operation.DeleteConceptRelationOperation; |
|
32 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
33 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
|
34 |
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility; |
|
35 |
|
|
36 |
/** |
|
37 |
* |
|
38 |
* @author pplitzner |
|
39 |
* @date 21.08.2017 |
|
40 |
* |
|
41 |
*/ |
|
42 |
public class DeleteConceptRelationHandlerE4 { |
|
43 |
|
|
44 |
@Execute |
|
45 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
|
46 |
@Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object selection, MMenuItem menuItem) { |
|
47 |
|
|
48 |
TaxonNameEditor editor = null; |
|
49 |
|
|
50 |
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject(); |
|
51 |
|
|
52 |
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart()); |
|
53 |
if(e4WrappedPart instanceof MultiPageTaxonEditor){ |
|
54 |
editor = (TaxonNameEditor) ((MultiPageTaxonEditor) e4WrappedPart).getPage(Page.NAME); |
|
55 |
} |
|
56 |
|
|
57 |
Set<TaxonRelationship> relations = new HashSet<TaxonRelationship>(); |
|
58 |
|
|
59 |
|
|
60 |
// FIXME E4 multiple selection |
|
61 |
// while (iterator.hasNext()){ |
|
62 |
if(selection instanceof TaxonRelationship){ |
|
63 |
relations.add((TaxonRelationship) selection); |
|
64 |
} |
|
65 |
// } |
|
66 |
|
|
67 |
//editor should not be null because this is already checked in canExecute |
|
68 |
AbstractPostOperation operation = new DeleteConceptRelationOperation(menuItem.getLocalizedLabel(), |
|
69 |
editor.getUndoContext(), editor.getTaxon(), relations, conceptView); |
|
70 |
AbstractUtility.executeOperation(operation); |
|
71 |
} |
|
72 |
|
|
73 |
@CanExecute |
|
74 |
public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
|
75 |
MHandledMenuItem menuItem){ |
|
76 |
boolean canExecute = false; |
|
77 |
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject(); |
|
78 |
|
|
79 |
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart()); |
|
80 |
if(e4WrappedPart instanceof MultiPageTaxonEditor){ |
|
81 |
ISelection selection = conceptView.getViewer().getSelection(); |
|
82 |
canExecute = selection!=null && !selection.isEmpty(); |
|
83 |
menuItem.setVisible(canExecute); |
|
84 |
} |
|
85 |
return canExecute; |
|
86 |
} |
|
87 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/handler/OpenRelatedConceptHandlerE4.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.editor.view.concept.e4.handler; |
|
11 |
|
|
12 |
import javax.inject.Named; |
|
13 |
|
|
14 |
import org.eclipse.e4.core.di.annotations.Execute; |
|
15 |
import org.eclipse.e4.core.di.annotations.Optional; |
|
16 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
17 |
import org.eclipse.e4.ui.services.IServiceConstants; |
|
18 |
import org.eclipse.jface.viewers.ISelection; |
|
19 |
import org.eclipse.ui.PartInitException; |
|
20 |
|
|
21 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
22 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
23 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
|
24 |
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; |
|
25 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
|
26 |
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; |
|
27 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
|
28 |
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4; |
|
29 |
import eu.etaxonomy.taxeditor.model.LineSelection; |
|
30 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
31 |
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility; |
|
32 |
|
|
33 |
/** |
|
34 |
* |
|
35 |
* @author pplitzner |
|
36 |
* @date 21.08.2017 |
|
37 |
* |
|
38 |
*/ |
|
39 |
public class OpenRelatedConceptHandlerE4 { |
|
40 |
|
|
41 |
@Execute |
|
42 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, |
|
43 |
@Optional@Named(IServiceConstants.ACTIVE_SELECTION) TaxonRelationship taxonRelationship) { |
|
44 |
|
|
45 |
MultiPageTaxonEditor editor = null; |
|
46 |
BulkEditor bulkEditor = null; |
|
47 |
|
|
48 |
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject(); |
|
49 |
|
|
50 |
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart()); |
|
51 |
if(e4WrappedPart instanceof MultiPageTaxonEditor){ |
|
52 |
editor = (MultiPageTaxonEditor) e4WrappedPart; |
|
53 |
} |
|
54 |
else if(e4WrappedPart instanceof BulkEditor){ |
|
55 |
bulkEditor = (BulkEditor) e4WrappedPart; |
|
56 |
} |
|
57 |
TaxonBase<?> relatedTaxon = null; |
|
58 |
if(editor!=null){ |
|
59 |
relatedTaxon = getRelatedTaxon(taxonRelationship, editor.getTaxon()); |
|
60 |
} |
|
61 |
else if(bulkEditor!=null){ |
|
62 |
ISelection bulkSelection = bulkEditor.getSelectionProvider().getSelection(); |
|
63 |
if(bulkSelection instanceof LineSelection){ |
|
64 |
Object firstElement = ((LineSelection)bulkSelection).getFirstElement(); |
|
65 |
if(firstElement instanceof Taxon){ |
|
66 |
relatedTaxon = getRelatedTaxon(taxonRelationship, (Taxon) firstElement); |
|
67 |
} |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
if(relatedTaxon==null){ |
|
72 |
MessagingUtils.messageDialog(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN, getClass(), |
|
73 |
String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), null); |
|
74 |
} |
|
75 |
else{ |
|
76 |
openConcept(relatedTaxon); |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* @param relatedTaxon |
|
82 |
*/ |
|
83 |
protected void openConcept(TaxonBase<?> relatedTaxon) { |
|
84 |
try { |
|
85 |
EditorUtil.openTaxonBase(relatedTaxon.getUuid()); |
|
86 |
} catch (PartInitException e) { |
|
87 |
MessagingUtils.messageDialog(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN, getClass(), |
|
88 |
String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), e); |
|
89 |
} |
|
90 |
} |
|
91 |
|
|
92 |
private Taxon getRelatedTaxon(TaxonRelationship relationship, Taxon taxon){ |
|
93 |
if (relationship.getFromTaxon().equals(taxon)){ |
|
94 |
return relationship.getToTaxon(); |
|
95 |
} |
|
96 |
else if(relationship.getToTaxon().equals(taxon)){ |
|
97 |
return relationship.getFromTaxon(); |
|
98 |
} |
|
99 |
else{ |
|
100 |
return null; |
|
101 |
} |
|
102 |
} |
|
103 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/handler/OpenRelatedConceptInBulkEditorHandlerE4.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.editor.view.concept.e4.handler; |
|
2 |
|
|
3 |
import org.eclipse.ui.PartInitException; |
|
4 |
|
|
5 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
6 |
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil; |
|
7 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
8 |
|
|
9 |
public class OpenRelatedConceptInBulkEditorHandlerE4 extends OpenRelatedConceptHandlerE4{ |
|
10 |
/** |
|
11 |
* {@inheritDoc} |
|
12 |
*/ |
|
13 |
@Override |
|
14 |
protected void openConcept(TaxonBase<?> relatedTaxon) { |
|
15 |
try { |
|
16 |
BulkEditorUtil.openEditor(relatedTaxon); |
|
17 |
} catch (PartInitException e) { |
|
18 |
MessagingUtils.error(this.getClass(), "Bulk Editor could not be opened for "+relatedTaxon, e); |
|
19 |
} |
|
20 |
} |
|
21 |
} |
Also available in: Unified diff
ref #6911 Migrate concept view