Revision d43de9c0
Added by Katja Luther over 9 years ago
.gitattributes | ||
---|---|---|
431 | 431 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.java -text |
432 | 432 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteNameRelationOperation.java -text |
433 | 433 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java -text |
434 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonBaseOperation.java -text |
|
435 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java -text |
|
434 | 436 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/RemoveHomotypicalGroupBasionymOperation.java -text |
435 | 437 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/SwapSynonymAndAcceptedOperation.java -text |
436 | 438 |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptContentProvider.java -text |
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
335 | 335 |
<reference |
336 | 336 |
definitionId="isSynonym"> |
337 | 337 |
</reference> |
338 |
<!-- <reference |
|
339 |
definitionId="isAcceptedTaxon"> |
|
340 |
</reference>--> |
|
338 | 341 |
<reference |
339 | 342 |
definitionId="isMisapplication"> |
340 | 343 |
</reference> |
... | ... | |
742 | 745 |
<reference |
743 | 746 |
definitionId="isTaxonBase"> |
744 | 747 |
</reference> |
745 |
<not> |
|
748 |
<!--<not>
|
|
746 | 749 |
<reference |
747 | 750 |
definitionId="isAcceptedTaxon"> |
748 | 751 |
</reference> |
749 |
</not> |
|
752 |
</not>-->
|
|
750 | 753 |
</and> |
751 | 754 |
</activeWhen> |
752 | 755 |
</handler> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteTaxonBaseHandler.java | ||
---|---|---|
13 | 13 |
import org.eclipse.core.commands.ExecutionException; |
14 | 14 |
import org.eclipse.core.commands.IHandler; |
15 | 15 |
import org.eclipse.core.commands.common.NotDefinedException; |
16 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
17 |
import org.eclipse.swt.widgets.Display; |
|
18 |
import org.eclipse.ui.IWorkbenchPage; |
|
19 |
import org.eclipse.ui.PartInitException; |
|
20 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
16 | 21 |
|
22 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
17 | 23 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
18 | 24 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
19 | 25 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
26 |
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor; |
|
20 | 27 |
import eu.etaxonomy.taxeditor.editor.Page; |
21 | 28 |
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; |
22 | 29 |
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation; |
23 | 30 |
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteSynonymOperation; |
31 |
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteTaxonOperation; |
|
24 | 32 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
33 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
|
25 | 34 |
|
26 | 35 |
/** |
27 | 36 |
* <p>DeleteTaxonBaseHandler class.</p> |
... | ... | |
30 | 39 |
* @created 21.04.2009 |
31 | 40 |
* @version 1.0 |
32 | 41 |
*/ |
33 |
public class DeleteTaxonBaseHandler extends AbstractHandler implements IHandler { |
|
42 |
public class DeleteTaxonBaseHandler extends AbstractHandler implements IHandler, IPostOperationEnabled {
|
|
34 | 43 |
|
44 |
TaxonNameEditor editor; |
|
35 | 45 |
/* (non-Javadoc) |
36 | 46 |
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
37 | 47 |
*/ |
38 | 48 |
/** {@inheritDoc} */ |
39 | 49 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
40 |
TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME);
|
|
50 |
editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME); |
|
41 | 51 |
|
42 | 52 |
Object selectedElement = EditorUtil.getSelection(event).getFirstElement(); |
43 | 53 |
|
... | ... | |
71 | 81 |
operation = new DeleteMisapplicationOperation(commandName, editor.getUndoContext(), editor |
72 | 82 |
.getTaxon(), (Taxon) selectedElement, editor); |
73 | 83 |
} |
84 |
else if (selectedElement instanceof Taxon){ |
|
85 |
//TODO: how to get the actual classification |
|
86 |
if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Confirm Deletion", "Are you sure you want to delete the selected taxon?")){ |
|
87 |
return ; |
|
88 |
} |
|
89 |
IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); |
|
90 |
operation = new DeleteTaxonOperation(commandName, editor.getUndoContext(),(Taxon) selectedElement, null, activePage, this, editor); |
|
91 |
//editor.dispose(); |
|
92 |
|
|
93 |
} |
|
74 | 94 |
else { |
75 | 95 |
throw new IllegalArgumentException("Element has to be Synonym, Misapplication or Concept"); |
76 | 96 |
} |
77 | 97 |
|
78 | 98 |
EditorUtil.executeOperation(operation); |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
79 | 103 |
} |
80 | 104 |
|
105 |
@Override |
|
106 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
|
107 |
Display.getDefault().asyncExec(new Runnable(){ |
|
108 |
|
|
109 |
public void run() { |
|
110 |
EditorUtil.close(editor.getMultiPageTaxonEditor()); |
|
111 |
|
|
112 |
} |
|
113 |
|
|
114 |
}); |
|
115 |
|
|
116 |
|
|
117 |
return true; |
|
118 |
} |
|
119 |
|
|
120 |
@Override |
|
121 |
public boolean onComplete() { |
|
122 |
// TODO Auto-generated method stub |
|
123 |
return false; |
|
124 |
} |
|
125 |
|
|
126 |
|
|
81 | 127 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java | ||
---|---|---|
17 | 17 |
import org.eclipse.core.runtime.IProgressMonitor; |
18 | 18 |
import org.eclipse.core.runtime.IStatus; |
19 | 19 |
|
20 |
import eu.etaxonomy.cdm.api.application.CdmApplicationController; |
|
21 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
20 | 22 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
21 | 23 |
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType; |
22 | 24 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
23 | 25 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
24 | 26 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
27 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
25 | 28 |
|
26 | 29 |
/** |
27 | 30 |
* <p>DeleteSynonymOperation class.</p> |
... | ... | |
59 | 62 |
throws ExecutionException { |
60 | 63 |
|
61 | 64 |
// Store synonymRelationshipType for later undo operations |
62 |
synonymTypes = synonym.getRelationType(taxon); |
|
63 |
monitor.worked(20); |
|
64 |
|
|
65 |
// Remove synonym from taxon |
|
66 |
|
|
67 |
taxon.removeSynonym(synonym); |
|
68 |
// CdmStore.getTaxonService().deleteSynonymRelationships(synonym); |
|
69 |
// CdmStore.getTaxonService().delete(synonym); |
|
70 |
|
|
71 |
monitor.worked(40); |
|
65 |
synonymTypes = synonym.getRelationType(taxon); |
|
66 |
monitor.worked(20); |
|
67 |
|
|
68 |
// Remove synonym from taxon |
|
69 |
|
|
70 |
CdmApplicationController controller; |
|
71 |
|
|
72 |
controller = (CdmApplicationController) CdmStore.getCurrentApplicationConfiguration(); |
|
73 |
|
|
74 |
ITaxonService service = controller.getTaxonService(); |
|
75 |
service.deleteSynonym(synonym, null); |
|
76 |
|
|
77 |
// taxon.removeSynonym(synonym); |
|
78 |
// CdmStore.getTaxonService().deleteSynonymRelationships(synonym); |
|
79 |
// CdmStore.getTaxonService().delete(synonym); |
|
80 |
|
|
81 |
monitor.worked(40); |
|
72 | 82 |
|
73 |
// Redraw editor if exists |
|
74 |
return postExecute(null); |
|
83 |
// Redraw editor if exists |
|
84 |
|
|
85 |
return postExecute(null); |
|
75 | 86 |
} |
76 | 87 |
|
77 | 88 |
/* (non-Javadoc) |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonBaseOperation.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.editor.name.operation; |
|
2 |
|
|
3 |
import org.eclipse.core.commands.ExecutionException; |
|
4 |
import org.eclipse.core.commands.operations.IUndoContext; |
|
5 |
import org.eclipse.core.runtime.IAdaptable; |
|
6 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
7 |
import org.eclipse.core.runtime.IStatus; |
|
8 |
import org.eclipse.ui.IEditorInput; |
|
9 |
import org.eclipse.ui.IEditorReference; |
|
10 |
import org.eclipse.ui.IPerspectiveDescriptor; |
|
11 |
import org.eclipse.ui.IViewPart; |
|
12 |
import org.eclipse.ui.IWorkbenchPage; |
|
13 |
import org.eclipse.ui.PartInitException; |
|
14 |
|
|
15 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
|
16 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
17 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
18 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
|
19 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; |
|
20 |
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation; |
|
21 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
|
22 |
|
|
23 |
public class DeleteTaxonBaseOperation extends AbstractPersistentPostOperation { |
|
24 |
|
|
25 |
private IWorkbenchPage activePage; |
|
26 |
|
|
27 |
public DeleteTaxonBaseOperation(String label, IUndoContext undoContext, |
|
28 |
Taxon taxon, IWorkbenchPage activePage, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) { |
|
29 |
super(label, undoContext, postOperationEnabled, |
|
30 |
conversationEnabled); |
|
31 |
this.activePage = activePage; |
|
32 |
|
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
public IStatus execute(IProgressMonitor monitor, IAdaptable info) |
|
37 |
throws ExecutionException { |
|
38 |
// TODO Auto-generated method stub |
|
39 |
return null; |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
public IStatus redo(IProgressMonitor monitor, IAdaptable info) |
|
44 |
throws ExecutionException { |
|
45 |
// TODO Auto-generated method stub |
|
46 |
return null; |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public IStatus undo(IProgressMonitor monitor, IAdaptable info) |
|
51 |
throws ExecutionException { |
|
52 |
// TODO Auto-generated method stub |
|
53 |
return null; |
|
54 |
} |
|
55 |
|
|
56 |
protected void closeObsoleteEditor(Taxon taxon){ |
|
57 |
for (IEditorReference ref : activePage.getEditorReferences()) { |
|
58 |
|
|
59 |
IViewPart view = activePage.findView("eu.etaxonomy.taxeditor.navigation.navigator"); |
|
60 |
|
|
61 |
try { |
|
62 |
IEditorInput input = ref.getEditorInput(); |
|
63 |
if (input instanceof TaxonEditorInput) { |
|
64 |
TaxonNode node = ((TaxonEditorInput) input).getTaxonNode(); |
|
65 |
if (taxonNode.equals(node)) { |
|
66 |
activePage.closeEditor(ref.getEditor(false), false); |
|
67 |
} |
|
68 |
} |
|
69 |
} catch (PartInitException e) { |
|
70 |
continue; |
|
71 |
} |
|
72 |
} |
|
73 |
} |
|
74 |
} |
|
75 |
|
|
76 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.editor.name.operation; |
|
2 |
|
|
3 |
import java.util.Iterator; |
|
4 |
import java.util.Set; |
|
5 |
|
|
6 |
import org.eclipse.core.commands.ExecutionEvent; |
|
7 |
import org.eclipse.core.commands.ExecutionException; |
|
8 |
import org.eclipse.core.commands.operations.IUndoContext; |
|
9 |
import org.eclipse.core.runtime.IAdaptable; |
|
10 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
11 |
import org.eclipse.core.runtime.IStatus; |
|
12 |
import org.eclipse.core.runtime.Status; |
|
13 |
import org.eclipse.ui.IEditorInput; |
|
14 |
import org.eclipse.ui.IEditorReference; |
|
15 |
import org.eclipse.ui.IPerspectiveDescriptor; |
|
16 |
import org.eclipse.ui.IViewPart; |
|
17 |
import org.eclipse.ui.IViewReference; |
|
18 |
import org.eclipse.ui.IWorkbenchPage; |
|
19 |
import org.eclipse.ui.PartInitException; |
|
20 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
21 |
|
|
22 |
import eu.etaxonomy.cdm.api.application.CdmApplicationController; |
|
23 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
|
24 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
25 |
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; |
|
26 |
import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException; |
|
27 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
28 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
29 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
30 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
31 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; |
|
32 |
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation; |
|
33 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
|
34 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
35 |
|
|
36 |
public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{ |
|
37 |
//private Taxon taxon; |
|
38 |
private Classification classification; |
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
public DeleteTaxonOperation(String label, IUndoContext undoContext, |
|
44 |
Taxon taxon, Classification classification, IWorkbenchPage activePage, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) { |
|
45 |
super(label, undoContext, taxon, activePage, postOperationEnabled, conversationEnabled); |
|
46 |
this.taxon = taxon; |
|
47 |
|
|
48 |
Set<TaxonNode> nodes = taxon.getTaxonNodes(); |
|
49 |
if (nodes.size() == 1 && classification == null){ |
|
50 |
this.taxonNode = nodes.iterator().next(); |
|
51 |
} else if (classification != null){ |
|
52 |
Iterator<TaxonNode> iterator = nodes.iterator(); |
|
53 |
while (iterator.hasNext()){ |
|
54 |
TaxonNode node = iterator.next(); |
|
55 |
if (node.getClassification().equals(classification)){ |
|
56 |
this.taxonNode = node; |
|
57 |
} |
|
58 |
} |
|
59 |
} else{ |
|
60 |
//TODO |
|
61 |
} |
|
62 |
this.classification = classification; |
|
63 |
|
|
64 |
} |
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
@Override |
|
69 |
public IStatus execute(IProgressMonitor monitor, IAdaptable info) |
|
70 |
throws ExecutionException { |
|
71 |
|
|
72 |
monitor.worked(20); |
|
73 |
bind(); |
|
74 |
|
|
75 |
|
|
76 |
CdmApplicationController controller; |
|
77 |
|
|
78 |
controller = (CdmApplicationController) CdmStore.getCurrentApplicationConfiguration(); |
|
79 |
|
|
80 |
ITaxonService service = controller.getTaxonService(); |
|
81 |
try { |
|
82 |
|
|
83 |
service.deleteTaxon(taxon, new TaxonDeletionConfigurator(), classification); |
|
84 |
|
|
85 |
} catch (DataChangeNoRollbackException e) { |
|
86 |
// TODO Auto-generated catch block |
|
87 |
e.printStackTrace(); |
|
88 |
|
|
89 |
} |
|
90 |
|
|
91 |
//closeObsoleteEditor(taxon); |
|
92 |
monitor.worked(40); |
|
93 |
|
|
94 |
|
|
95 |
return postExecute(null); |
|
96 |
} |
|
97 |
|
|
98 |
@Override |
|
99 |
public IStatus redo(IProgressMonitor monitor, IAdaptable info) |
|
100 |
throws ExecutionException { |
|
101 |
// TODO Auto-generated method stub |
|
102 |
return null; |
|
103 |
} |
|
104 |
|
|
105 |
@Override |
|
106 |
public IStatus undo(IProgressMonitor monitor, IAdaptable info) |
|
107 |
throws ExecutionException { |
|
108 |
// TODO Auto-generated method stub |
|
109 |
return null; |
|
110 |
} |
|
111 |
|
|
112 |
|
|
113 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDataChangeBehavior.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy |
|
3 |
* European Distributed Institute of Taxonomy
|
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
* |
|
5 |
*
|
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
38 | 38 |
* @created 01.04.2009 |
39 | 39 |
* @version 1.0 |
40 | 40 |
*/ |
41 |
public class TaxonNavigatorDataChangeBehavior extends AbstractDataChangeBehaviour implements |
|
41 |
public class TaxonNavigatorDataChangeBehavior extends AbstractDataChangeBehaviour implements
|
|
42 | 42 |
IDataChangeBehavior { |
43 | 43 |
|
44 | 44 |
private TaxonNavigator source; |
45 | 45 |
|
46 | 46 |
private Set<CdmBase> staleObjects; |
47 |
|
|
47 |
|
|
48 | 48 |
/** |
49 | 49 |
* <p>Constructor for TaxonNavigatorDataChangeBehavior.</p> |
50 | 50 |
* |
... | ... | |
53 | 53 |
public TaxonNavigatorDataChangeBehavior(TaxonNavigator taxonNavigator) { |
54 | 54 |
source = taxonNavigator; |
55 | 55 |
} |
56 |
|
|
56 |
|
|
57 | 57 |
/* (non-Javadoc) |
58 | 58 |
* @see eu.etaxonomy.taxeditor.store.model.IDataChangeBehavior#isRelevant(java.lang.Object, eu.etaxonomy.cdm.persistence.hibernate.CdmCrudEvent) |
59 | 59 |
*/ |
... | ... | |
64 | 64 |
* @return a boolean. |
65 | 65 |
*/ |
66 | 66 |
public boolean isRelevant(CdmDataChangeMap events) { |
67 |
|
|
67 |
|
|
68 | 68 |
// TODO react only on insert/update/delete of taxon and synonym objects |
69 | 69 |
// and on update of name objects |
70 | 70 |
boolean relevant = false; |
71 | 71 |
staleObjects = new HashSet<CdmBase>(); |
72 |
|
|
72 |
|
|
73 | 73 |
for(CdmDataChangeEvent event : events.getAllEvents()){ |
74 | 74 |
EventType eventType = event.getEventType(); |
75 | 75 |
CdmBase eventEntity = event.getEntity(); |
76 |
|
|
76 |
|
|
77 | 77 |
// all tree node changes are relevant |
78 |
if((eventType == EventType.INSERT || eventType == EventType.DELETE || eventType == EventType.UPDATE) |
|
78 |
if((eventType == EventType.INSERT || eventType == EventType.DELETE || eventType == EventType.UPDATE)
|
|
79 | 79 |
&& event.getEntity() instanceof ITaxonTreeNode){ |
80 | 80 |
return true; |
81 | 81 |
} |
82 |
|
|
82 |
|
|
83 | 83 |
// name updates of the accepted taxon of open editors are relevant |
84 |
if(eventType == EventType.UPDATE){ |
|
84 |
if(eventType == EventType.UPDATE && event.getEntity() instanceof TaxonNameBase){
|
|
85 | 85 |
TaxonNameBase name = null; |
86 | 86 |
if(eventEntity instanceof TaxonNameBase){ |
87 | 87 |
name = (TaxonNameBase) eventEntity; |
... | ... | |
90 | 90 |
}else{ |
91 | 91 |
continue; |
92 | 92 |
} |
93 |
|
|
93 |
|
|
94 | 94 |
Set<IEditorPart> openEditors = NavigationUtil.getOpenEditors(); |
95 |
for(IEditorPart editor : openEditors){ |
|
96 |
|
|
95 |
/*for(IEditorPart editor : openEditors){
|
|
96 |
|
|
97 | 97 |
if(name.equals(((TaxonEditorInput) editor.getEditorInput()).getTaxon().getName())){ |
98 | 98 |
return true; |
99 | 99 |
} |
100 |
}*/ |
|
101 |
} |
|
102 |
if (eventType == EventType.DELETE){ |
|
103 |
return true; |
|
104 |
} |
|
105 |
|
|
106 |
if(eventType == EventType.UPDATE && event.getEntity() instanceof Taxon){ |
|
107 |
TaxonNameBase name = null; |
|
108 |
if(eventEntity instanceof Taxon){ |
|
109 |
name = ((Taxon) eventEntity).getName(); |
|
110 |
}else{ |
|
111 |
continue; |
|
100 | 112 |
} |
113 |
|
|
114 |
Set<IEditorPart> openEditors = NavigationUtil.getOpenEditors(); |
|
115 |
/*for(IEditorPart editor : openEditors){ |
|
116 |
|
|
117 |
if(name.equals(((TaxonEditorInput) editor.getEditorInput()).getTaxon().getName())){ |
|
118 |
return true; |
|
119 |
} |
|
120 |
}*/ |
|
101 | 121 |
} |
102 |
|
|
103 |
|
|
122 |
|
|
104 | 123 |
// if(eventType == EventType.UPDATE){ |
105 | 124 |
// relevant = true; |
106 | 125 |
// CdmBase entity = event.getEntity(); |
... | ... | |
111 | 130 |
// } |
112 | 131 |
// } |
113 | 132 |
} |
114 |
|
|
133 |
|
|
115 | 134 |
return false; |
116 |
|
|
135 |
|
|
117 | 136 |
// @deprecated |
118 | 137 |
// react on everything except load |
119 | 138 |
// if(events.sizeByEventType(EventType.INSERT) > 0){ |
... | ... | |
132 | 151 |
*/ |
133 | 152 |
/** {@inheritDoc} */ |
134 | 153 |
@Override |
135 |
public void reactOnDataChange(CdmDataChangeMap events) {
|
|
154 |
public void reactOnDataChange(CdmDataChangeMap events) {
|
|
136 | 155 |
if(isRelevant(events)){ |
137 | 156 |
|
138 | 157 |
final Display display = Display.getCurrent(); |
139 | 158 |
Job job = new Job("Updating Taxon Navigator") { |
140 |
|
|
159 |
|
|
141 | 160 |
@Override |
142 | 161 |
protected IStatus run(IProgressMonitor monitor) { |
143 | 162 |
monitor.beginTask("Updating Taxon Navigator", 3); |
144 | 163 |
monitor.worked(1); |
145 |
|
|
164 |
|
|
146 | 165 |
// clear the session completely |
147 | 166 |
monitor.subTask("Clearing Taxon Navigators session"); |
167 |
System.out.println("Clearing Taxon Navigators session"); |
|
148 | 168 |
display.asyncExec(new Runnable() { |
149 | 169 |
@Override |
150 |
public void run() {
|
|
170 |
public void run() {
|
|
151 | 171 |
source.getConversationHolder().clear(); |
152 | 172 |
} |
153 |
}); |
|
154 |
// FIXME completely clearing the session is a brute force approach. |
|
173 |
});
|
|
174 |
// FIXME completely clearing the session is a brute force approach.
|
|
155 | 175 |
// It would be much more elegant to clear only those elements that have been changed. |
156 | 176 |
// I could not get that to work but we should consider workin on this because we might |
157 | 177 |
// run into serious performance issues, especially when it comes to large trees |
... | ... | |
159 | 179 |
// at least, we moved this to a job so it can run in a background thred |
160 | 180 |
// seems to improve the situation but not sure if final solution |
161 | 181 |
monitor.worked(1); |
162 |
|
|
182 |
|
|
163 | 183 |
monitor.subTask("Refreshing viewer"); |
164 |
|
|
184 |
|
|
165 | 185 |
display.asyncExec(new Runnable() { |
166 | 186 |
@Override |
167 |
public void run() {
|
|
187 |
public void run() {
|
|
168 | 188 |
source.refresh(); |
169 | 189 |
} |
170 | 190 |
}); |
171 |
|
|
172 |
|
|
173 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
174 | 194 |
monitor.worked(1); |
175 | 195 |
monitor.done(); |
176 | 196 |
return Status.OK_STATUS; |
177 | 197 |
} |
178 | 198 |
}; |
179 |
|
|
199 |
|
|
180 | 200 |
job.setPriority(Job.SHORT); |
181 | 201 |
job.schedule(); |
182 |
|
|
202 |
|
|
183 | 203 |
} |
184 | 204 |
} |
185 | 205 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java | ||
---|---|---|
18 | 18 |
import org.eclipse.core.runtime.IProgressMonitor; |
19 | 19 |
import org.eclipse.core.runtime.IStatus; |
20 | 20 |
|
21 |
import eu.etaxonomy.cdm.api.application.CdmApplicationController; |
|
21 | 22 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
22 | 23 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
24 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
25 |
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; |
|
26 |
import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException; |
|
23 | 27 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
24 | 28 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
25 | 29 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
... | ... | |
70 | 74 |
monitor.worked(20); |
71 | 75 |
for (ITaxonTreeNode treeNode : treeNodes){ |
72 | 76 |
if(treeNode instanceof TaxonNode){ |
73 |
((TaxonNode) treeNode).delete(); |
|
77 |
//((TaxonNode) treeNode).delete(); |
|
78 |
CdmApplicationController controller; |
|
79 |
taxon = ((TaxonNode) treeNode).getTaxon(); |
|
80 |
controller = (CdmApplicationController) CdmStore.getCurrentApplicationConfiguration(); |
|
81 |
|
|
82 |
ITaxonService service = controller.getTaxonService(); |
|
83 |
try { |
|
84 |
|
|
85 |
service.deleteTaxon(taxon, new TaxonDeletionConfigurator(), ((TaxonNode) treeNode).getClassification()); |
|
86 |
|
|
87 |
} catch (DataChangeNoRollbackException e) { |
|
88 |
// TODO Auto-generated catch block |
|
89 |
e.printStackTrace(); |
|
90 |
|
|
91 |
} |
|
92 |
|
|
74 | 93 |
}else if(treeNode instanceof Classification){ |
75 | 94 |
Classification taxonomicTree = (Classification) treeNode; |
76 | 95 |
if(taxonomicTree.hasChildNodes()){ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPersistentPostOperation.java | ||
---|---|---|
93 | 93 |
protected IStatus postExecute(CdmBase objectAffectedByOperation) { |
94 | 94 |
Assert.isNotNull(conversationEnabled, "Operation has to have a valid conversation attached."); |
95 | 95 |
|
96 |
conversationEnabled.getConversationHolder().commit(true); |
|
97 |
|
|
96 |
|
|
97 |
if (!conversationEnabled.getConversationHolder().isClosed()){ |
|
98 |
conversationEnabled.getConversationHolder().commit(true); |
|
99 |
} |
|
98 | 100 |
IStatus status = super.postExecute(objectAffectedByOperation); |
99 | 101 |
|
100 | 102 |
return status; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java | ||
---|---|---|
33 | 33 |
/** |
34 | 34 |
* |
35 | 35 |
*/ |
36 |
private IPostOperationEnabled postOperationEnabled;
|
|
36 |
protected IPostOperationEnabled postOperationEnabled;
|
|
37 | 37 |
|
38 | 38 |
/** |
39 | 39 |
* A reference to the taxon the concrete operation is working on |
... | ... | |
150 | 150 |
public IPostOperationEnabled getPostOperationEnabled() { |
151 | 151 |
return postOperationEnabled; |
152 | 152 |
} |
153 |
|
|
154 |
|
|
153 | 155 |
} |
Also available in: Unified diff