2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.editor
;
11 import java
.util
.Collection
;
12 import java
.util
.HashSet
;
13 import java
.util
.List
;
14 import java
.util
.UUID
;
16 import org
.eclipse
.core
.commands
.ExecutionEvent
;
17 import org
.eclipse
.core
.commands
.operations
.IOperationHistory
;
18 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
19 import org
.eclipse
.e4
.ui
.model
.application
.MApplication
;
20 import org
.eclipse
.e4
.ui
.model
.application
.ui
.basic
.MPart
;
21 import org
.eclipse
.e4
.ui
.model
.application
.ui
.basic
.MPartStack
;
22 import org
.eclipse
.e4
.ui
.workbench
.modeling
.EModelService
;
23 import org
.eclipse
.e4
.ui
.workbench
.modeling
.EPartService
;
24 import org
.eclipse
.e4
.ui
.workbench
.modeling
.EPartService
.PartState
;
25 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
26 import org
.eclipse
.jface
.viewers
.ISelection
;
27 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
28 import org
.eclipse
.jface
.viewers
.TreeNode
;
29 import org
.eclipse
.swt
.widgets
.Shell
;
30 import org
.eclipse
.ui
.IEditorPart
;
31 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
33 import eu
.etaxonomy
.cdm
.hibernate
.HibernateProxyHelper
;
34 import eu
.etaxonomy
.cdm
.model
.description
.DescriptiveDataSet
;
35 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnit
;
36 import eu
.etaxonomy
.cdm
.model
.occurrence
.FieldUnit
;
37 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
38 import eu
.etaxonomy
.cdm
.model
.taxon
.ITaxonTreeNode
;
39 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
40 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
41 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
42 import eu
.etaxonomy
.cdm
.persistence
.dto
.TaxonNodeDto
;
43 import eu
.etaxonomy
.cdm
.persistence
.dto
.UuidAndTitleCache
;
44 import eu
.etaxonomy
.taxeditor
.bulkeditor
.e4
.BulkEditor
;
45 import eu
.etaxonomy
.taxeditor
.bulkeditor
.input
.TaxonBulkEditorInput
;
46 import eu
.etaxonomy
.taxeditor
.editor
.descriptiveDataSet
.DescriptiveDataSetEditor
;
47 import eu
.etaxonomy
.taxeditor
.editor
.descriptiveDataSet
.matrix
.CharacterMatrixPart
;
48 import eu
.etaxonomy
.taxeditor
.editor
.e4
.TaxonEditorInput
;
49 import eu
.etaxonomy
.taxeditor
.editor
.group
.authority
.CdmAuthorityEditorInput
;
50 import eu
.etaxonomy
.taxeditor
.editor
.group
.authority
.e4
.CdmAuthorityEditorE4
;
51 import eu
.etaxonomy
.taxeditor
.editor
.internal
.TaxeditorEditorPlugin
;
52 import eu
.etaxonomy
.taxeditor
.editor
.l10n
.Messages
;
53 import eu
.etaxonomy
.taxeditor
.editor
.name
.e4
.TaxonNameEditor
;
54 import eu
.etaxonomy
.taxeditor
.editor
.view
.checklist
.e4
.DistributionEditorPart
;
55 import eu
.etaxonomy
.taxeditor
.editor
.view
.derivate
.DerivateView
;
56 import eu
.etaxonomy
.taxeditor
.editor
.view
.derivate
.DerivateViewEditorInput
;
57 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
58 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
59 import eu
.etaxonomy
.taxeditor
.security
.RequiredPermissions
;
60 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
61 import eu
.etaxonomy
.taxeditor
.workbench
.WorkbenchUtility
;
62 import eu
.etaxonomy
.taxeditor
.workbench
.part
.IE4SavablePart
;
65 * Utility for the editor package
70 public class EditorUtil
extends AbstractUtility
{
72 private static final String NAME_EDITOR_ID
= "eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditor";
74 private static boolean factsVisible
= true;
76 private static boolean mediaVisible
= true;
78 public static void openDescriptiveDataSetEditor(UUID descriptiveDataSetUuid
, EModelService modelService
, EPartService partService
, MApplication application
){
79 Collection
<MPart
> parts
= partService
.getParts();
80 for (MPart part
: parts
) {
81 if(part
.getObject() instanceof DescriptiveDataSetEditor
82 && ((DescriptiveDataSetEditor
) part
.getObject()).getDescriptiveDataSet().getUuid().equals(descriptiveDataSetUuid
)){
83 partService
.showPart(part
, PartState
.ACTIVATE
);
87 String partId
= AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVEDATASET_DESCRIPTIVEDATASETEDITOR
;
88 MPart part
= showPart(partId
, modelService
, partService
, application
);
89 DescriptiveDataSetEditor editor
= (DescriptiveDataSetEditor
) part
.getObject();
90 editor
.init(descriptiveDataSetUuid
);
93 public static void openCharacterMatrix(UUID descriptiveDataSetUuid
, EModelService modelService
, EPartService partService
, MApplication application
){
94 Collection
<MPart
> parts
= partService
.getParts();
95 for (MPart part
: parts
) {
96 if(part
.getObject() instanceof CharacterMatrixPart
97 && ((CharacterMatrixPart
) part
.getObject()).getDescriptiveDataSet().getUuid().equals(descriptiveDataSetUuid
)){
98 partService
.showPart(part
, PartState
.ACTIVATE
);
102 String partId
= AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_DESCRIPTIVEDATASET_MATRIX_CHARACTERMATRIXPART
;
103 MPart part
= showPart(partId
, modelService
, partService
, application
);
104 CharacterMatrixPart editor
= (CharacterMatrixPart
) part
.getObject();
105 editor
.init(descriptiveDataSetUuid
, true);
108 public static void openDistributionEditor(List
<UuidAndTitleCache
<ITaxonTreeNode
>> parentTaxonUuidList
, EModelService modelService
, EPartService partService
, MApplication application
){
109 String partId
= AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CHECKLIST_E4_DISTRIBUTIONEDITORPART
;
110 checkAndCloseFactsAndMediaParts(partService
);
111 MPart part
= showPart(partId
, modelService
, partService
, application
);
112 DistributionEditorPart editor
= (DistributionEditorPart
) part
.getObject();
113 editor
.init(parentTaxonUuidList
);
116 public static void checkAndCloseFactsAndMediaParts(EPartService partService
) {
117 String partIdFactualData
= AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_FACTUALDATAPARTE4
;
118 String partIdMedia
= AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_E4_MEDIAVIEWPARTE4
;
119 MPart part1
= partService
.findPart(AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_FACTUALDATAPARTE4
);
120 if (factsVisible
|| (part1
!=null && part1
.getWidget() != null && partService
.isPartVisible(part1
))){
123 factsVisible
= false;
125 part1
= partService
.findPart(AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_E4_MEDIAVIEWPARTE4
);
126 if (mediaVisible
|| (part1
!=null && part1
.getWidget() != null && partService
.isPartVisible(part1
))){
129 mediaVisible
= false;
131 closePart(partIdMedia
, partService
);
132 closePart(partIdFactualData
, partService
);
136 public static void openSpecimenEditor(DerivateViewEditorInput input
, EModelService modelService
, EPartService partService
, MApplication application
){
137 String partId
= AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW
;
138 MPart part
= showPart(partId
, modelService
, partService
, application
);
139 DerivateView derivateView
= (DerivateView
) part
.getObject();
140 derivateView
.init(input
);
143 public static void openRightsEditor(CdmAuthorityEditorInput input
, EModelService modelService
, EPartService partService
, MApplication application
){
144 Collection
<MPart
> parts
= partService
.getParts();
145 for (MPart part
: parts
) {
146 if(part
.getObject() instanceof CdmAuthorityEditorE4
147 && ((CdmAuthorityEditorE4
) part
.getObject()).getInput().getGroup().equals(input
.getGroup())){
148 partService
.showPart(part
, PartState
.ACTIVATE
);
152 String partId
= AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_GROUP_AUTHORITY_E4_CDMAUTHORITYEDITORE4
;
153 MPart part
= showPart(partId
, modelService
, partService
, application
);
154 CdmAuthorityEditorE4 authorityView
= (CdmAuthorityEditorE4
) part
.getObject();
155 authorityView
.init(input
);
158 public static MPart
showPart(String partId
, EModelService modelService
, EPartService partService
, MApplication application
){
159 MPart part
= partService
.findPart(partId
);
160 if(part
==null || modelService
.getPartDescriptor(partId
).isAllowMultiple()){
161 part
= partService
.createPart(partId
);
163 MPartStack editorAreaPartStack
= WorkbenchUtility
.getEditorAreaPartStack(application
, modelService
);
164 if(editorAreaPartStack
!=null){
165 editorAreaPartStack
.getChildren().add(part
);
168 return partService
.showPart(part
, PartState
.ACTIVATE
);
172 public static MPart
showPart(String partId
, EModelService modelService
, EPartService partService
){
173 MPart part
= partService
.findPart(partId
);
174 if(part
==null || modelService
.getPartDescriptor(partId
).isAllowMultiple()){
175 part
= partService
.createPart(partId
);
176 partService
.activate(part
);
178 partService
.activate(part
);
184 public static void openTaxonNodeE4(UUID taxonNodeUuid
, EModelService modelService
, EPartService partService
, MApplication application
) {
185 TaxonEditorInput input
= TaxonEditorInput
.NewInstance(taxonNodeUuid
);
186 openTaxonEditor_internal(input
, modelService
, partService
, application
);
189 public static void openTaxonBaseE4(UUID taxonBaseUuid
, EModelService modelService
, EPartService partService
, MApplication application
) {
190 TaxonEditorInput input
= TaxonEditorInput
.NewInstanceFromTaxonBase(taxonBaseUuid
);
191 openTaxonEditor_internal(input
, modelService
, partService
, application
);
194 // public static void openTaxonBaseE4(UUID taxonBaseUuid) {
195 // //FIXME E4 this can probably be removed when fully migrated
196 // TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstanceFromTaxonBase(taxonBaseUuid);
198 // EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
199 // EModelService modelService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EModelService.class);
200 // openNameEditor_internal(input, modelService, partService, null);
203 private static void openTaxonEditor_internal(TaxonEditorInput input
, EModelService modelService
, EPartService partService
, MApplication application
) {
204 TaxonBase
<?
> taxonBase
= input
.getTaxon();
205 TaxonNode node
= input
.getTaxonNode();
209 boolean hasPermission
= false;
210 // if (node != null){
211 hasPermission
= CdmStore
.currentAuthentiationHasPermission(node
, RequiredPermissions
.TAXON_EDIT
);
213 // if (!hasPermission){
214 // MessagingUtils.warningDialog(Messages.EditorUtil_MISSING_PERMISSION, TaxonEditorInputE4.class, Messages.EditorUtil_MISSING_PERMISSION_MESSAGE);
217 if (taxonBase
.isOrphaned()) {
218 if(taxonBase
.isInstanceOf(Synonym
.class)){
219 MessagingUtils
.warningDialog(Messages
.EditorUtil_ORPHAN_ACCEPTED_TAXON
, TaxonEditorInput
.class, Messages
.EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE
);
223 MessagingUtils
.warningDialog(Messages
.EditorUtil_ORPHAN_TAXON
, TaxonEditorInput
.class, Messages
.EditorUtil_ORPHAN_TAXON_MESSAGE
);
228 Collection
<MPart
> parts
= partService
.getParts();
229 //check if part is already opened
230 MPart alreadyOpenInOtherClassification
= null;
231 for (MPart part
: parts
) {
232 if(part
.getObject() instanceof TaxonNameEditor
233 && ((TaxonNameEditor
) part
.getObject()).getTaxon()!=null
234 && ((TaxonNameEditor
) part
.getObject()).getTaxon().getUuid().equals(input
.getTaxon().getUuid())){
236 UUID inputNode
= input
.getTaxonNode().getUuid();
237 UUID editorNode
= ((TaxonNameEditor
) part
.getObject()).getTaxonNode().getUuid();
238 if (!inputNode
.equals(editorNode
)){
239 alreadyOpenInOtherClassification
= part
;
241 ((TaxonNameEditor
) part
.getObject()).init(input
);
242 partService
.activate(part
, true);
247 if (alreadyOpenInOtherClassification
!= null){
248 boolean doSave
= forceUserSaveE4Editor(((TaxonNameEditor
) alreadyOpenInOtherClassification
.getObject()), getShell());
250 input
= TaxonEditorInput
.NewInstance(input
.getTaxonNode().getUuid());
251 partService
.hidePart(alreadyOpenInOtherClassification
);
257 MPart part
= showPart(NAME_EDITOR_ID
, modelService
, partService
, application
);
259 TaxonNameEditor editor
= (TaxonNameEditor
) part
.getObject();
260 // editor.setDisabled();
262 // editor.setEnabled();
265 showFacts(modelService
, partService
);
266 factsVisible
= false;
270 showMedia(modelService
, partService
);
271 mediaVisible
= false;
275 public static void showMedia(EModelService modelService
, EPartService partService
) {
276 String partIdFactualData
= AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_E4_MEDIAVIEWPARTE4
;
277 showPart(partIdFactualData
, modelService
, partService
);
280 public static void showFacts(EModelService modelService
, EPartService partService
) {
281 String partIdFactualData
= AppModelId
.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_FACTUALDATAPARTE4
;
282 showPart(partIdFactualData
, modelService
, partService
);
285 public static Collection
<MPart
> checkForChanges(UUID taxonUUID
, EPartService partService
){
286 Collection
<MPart
> parts
= partService
.getParts();
287 Collection
<MPart
> dirtyParts
= new HashSet();
288 //check if part is already opened
289 boolean isDirty
= false;
290 for (MPart part
: parts
) {
291 if(part
.getObject() instanceof TaxonNameEditor
292 && ((TaxonNameEditor
) part
.getObject()).getTaxon()!=null
293 && ((TaxonNameEditor
) part
.getObject()).getTaxon().getUuid().equals(taxonUUID
)){
295 dirtyParts
.add(part
);
299 }else if (taxonUUID
== null){
301 dirtyParts
.add(part
);
308 public static Collection
<IE4SavablePart
> checkForTaxonChanges(UUID taxonUUID
, EPartService partService
){
309 Collection
<MPart
> parts
= partService
.getParts();
310 Collection
<IE4SavablePart
> dirtyParts
= new HashSet
<>();
311 //check if part is already opened
312 for (MPart part
: parts
) {
313 if(part
.getObject() instanceof TaxonNameEditor
314 && ((TaxonNameEditor
) part
.getObject()).getTaxon()!=null
315 && ((TaxonNameEditor
) part
.getObject()).getTaxon().getUuid().equals(taxonUUID
)){
317 dirtyParts
.add((IE4SavablePart
) part
);
321 }else if (taxonUUID
== null){
322 if (part
.isDirty() && (part
.getObject() instanceof TaxonNameEditor
|| (part
.getObject() instanceof BulkEditor
&& ((BulkEditor
)part
.getObject()).getEditorInput() instanceof TaxonBulkEditorInput
))){
323 dirtyParts
.add((IE4SavablePart
) part
.getObject());
331 * An uninitialized taxon is one that hasn't been saved yet. As such, it
332 * should appear in neither the list of recent names nor in the taxonomic
335 * @param parentNodeUuid
336 * a {@link java.util.UUID} object.
338 public static void openEmptyE4(UUID parentNodeUuid
) {
339 TaxonEditorInput input
= TaxonEditorInput
340 .NewEmptyInstance(parentNodeUuid
);
341 EPartService partService
= TaxeditorEditorPlugin
.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService
.class);
342 MPart part
= partService
.createPart(NAME_EDITOR_ID
);
343 part
= partService
.showPart(part
, PartState
.ACTIVATE
);
344 TaxonNameEditor editor
= (TaxonNameEditor
) part
.getObject();
353 * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
356 public static IUndoContext
getUndoContext() {
357 return IOperationHistory
.GLOBAL_UNDO_CONTEXT
;
360 public static boolean isFactsVisible() {
364 public static void setFactsVisible(boolean factsVisible
) {
365 EditorUtil
.factsVisible
= factsVisible
;
368 public static boolean isMediaVisible() {
372 public static void setMediaVisible(boolean mediaVisible
) {
373 EditorUtil
.mediaVisible
= mediaVisible
;
382 * a {@link org.eclipse.ui.IEditorPart} object.
384 * a {@link org.eclipse.swt.widgets.Shell} object.
387 public static boolean forceUserSave(IEditorPart editor
, Shell shell
) {
388 if (editor
.isDirty()) {
390 boolean doSave
= MessageDialog
391 .openConfirm(shell
, Messages
.EditorUtil_COMFIRM_SAVE
,
392 Messages
.EditorUtil_CONFIRM_SAVE_MESSAGE
);
398 editor
.doSave(AbstractUtility
.getMonitor());
403 public static boolean forceUserSaveE4Editor(IE4SavablePart editor
, Shell shell
) {
404 if (editor
.isDirty()) {
406 boolean doSave
= MessageDialog
407 .openConfirm(shell
, Messages
.EditorUtil_COMFIRM_SAVE
,
408 Messages
.EditorUtil_CONFIRM_SAVE_MESSAGE
);
414 editor
.save(AbstractUtility
.getMonitor());
425 * a {@link org.eclipse.core.commands.ExecutionEvent} object.
426 * @return a {@link org.eclipse.jface.viewers.IStructuredSelection} object.
428 public static IStructuredSelection
getSelection(ExecutionEvent event
) {
429 IEditorPart activeEditor
= HandlerUtil
.getActiveEditor(event
);
431 return (IStructuredSelection
) activeEditor
.getSite()
432 .getSelectionProvider().getSelection();
440 * @return a {@link java.lang.String} object.
442 public static String
getPluginId() {
443 return TaxeditorEditorPlugin
.PLUGIN_ID
;
447 * Iterates recursively over all originals having the given specimen as a derivate.
448 * The first {@link DerivedUnit} with no more originals or the first {@link FieldUnit} is returned
449 * @param specimen the start element for which the originals are iterated recursively
450 * @return either a FieldUnit or a the topmost DerivedUnit (which can be itself)
452 public static SpecimenOrObservationBase
<?
> getTopMostDerivate(SpecimenOrObservationBase
<?
> specimen
){
456 if(specimen
.isInstanceOf(FieldUnit
.class)){
459 else if(specimen
.isInstanceOf(DerivedUnit
.class)){
460 DerivedUnit derivedUnit
= HibernateProxyHelper
.deproxy(specimen
, DerivedUnit
.class);
461 if(derivedUnit
.getOriginals()!=null
462 && !(derivedUnit
.getOriginals().isEmpty())){
463 for(SpecimenOrObservationBase
<?
> original
:((DerivedUnit
) specimen
).getOriginals()){
464 return getTopMostDerivate(original
);
472 * If the current selection is a single {@link TreeNode} it will be returned.
473 * @param selection the selection to check
474 * @return the selected TreeNode or <code>null</code> if no TreeNode selected
476 public static TreeNode
getTreeNodeOfSelection(ISelection selection
){
477 if(selection
instanceof IStructuredSelection
478 && ((IStructuredSelection
) selection
).size()==1
479 && ((IStructuredSelection
) selection
).getFirstElement() instanceof TreeNode
){
480 return (TreeNode
) ((IStructuredSelection
) selection
).getFirstElement();
486 public static void closeObsoleteEditor(TaxonNodeDto taxonNode
, EPartService partService
){
487 String treeIndex
= taxonNode
.getTreeIndex();
488 Collection
<MPart
> parts
= partService
.getParts();
489 for (MPart part
: parts
) {
490 Object object
= part
.getObject();
491 if(object
instanceof TaxonNameEditor
){
492 TaxonNameEditor taxonEditor
= (TaxonNameEditor
)object
;
493 TaxonNode node
= taxonEditor
.getEditorInput().getTaxonNode();
494 if (node
.treeIndex()!= null){
495 if(node
.treeIndex().startsWith(treeIndex
)){
497 forceUserSaveE4Editor(taxonEditor
, getShell());
499 partService
.hidePart(part
);
502 logger
.debug("The taxonnode of taxon " + node
.getTaxon().getTitleCache() + " uuid: " + node
.getUuid() + " has no treeindex");;
508 public static void closeObsoleteEditorWithChildren(TaxonNodeDto taxonNode
, EPartService partService
){
509 String treeIndex
= taxonNode
.getTreeIndex();
510 Collection
<MPart
> parts
= partService
.getParts();
511 for (MPart part
: parts
) {
512 Object object
= part
.getObject();
513 if(object
instanceof TaxonNameEditor
){
514 TaxonNameEditor taxonEditor
= (TaxonNameEditor
)object
;
515 TaxonNode node
= taxonEditor
.getEditorInput().getTaxonNode();
516 if (node
.treeIndex()!= null){
517 if(node
.treeIndex().startsWith(treeIndex
)){
519 forceUserSaveE4Editor(taxonEditor
, getShell());
521 partService
.hidePart(part
);
524 logger
.debug("The taxonnode of taxon " + node
.getTaxon().getTitleCache() + " uuid: " + node
.getUuid() + " has no treeindex");;
530 public static void closeObsoleteDescriptiveDatasetEditor(UUID datasetUuid
, EPartService partService
){
532 Collection
<MPart
> parts
= partService
.getParts();
533 for (MPart part
: parts
) {
534 Object object
= part
.getObject();
535 if(object
instanceof DescriptiveDataSetEditor
){
536 DescriptiveDataSetEditor editor
= (DescriptiveDataSetEditor
)object
;
537 DescriptiveDataSet descDataSet
= editor
.getDescriptiveDataSet();
538 if(descDataSet
.getUuid().equals(datasetUuid
)){
540 forceUserSaveE4Editor(editor
, getShell());
542 partService
.hidePart(part
);
549 public static void closePart(String partID
, EPartService partService
){
551 Collection
<MPart
> parts
= partService
.getParts();
552 for (MPart part
: parts
) {
553 String elementId
= part
.getElementId();
554 if (elementId
.equals(partID
)){
555 partService
.hidePart(part
);
560 public static void updateEditor(TaxonNode taxonNode
, TaxonNameEditor editor
){
561 String treeIndex
= taxonNode
.treeIndex();
562 TaxonNode node
= editor
.getEditorInput().getTaxonNode();
563 if(node
.treeIndex().equals(treeIndex
)){
564 TaxonEditorInput input
= TaxonEditorInput
.NewInstance(node
.getUuid());