Revision 41e2f693
Added by Cherian Mathew over 9 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/DeleteTermBaseOperation.java | ||
---|---|---|
27 | 27 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
28 | 28 |
import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor; |
29 | 29 |
import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput; |
30 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
30 | 31 |
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; |
31 | 32 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
32 | 33 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
69 | 70 |
if (termBase instanceof TermVocabulary) { |
70 | 71 |
if (((TermVocabulary)termBase).getCreatedBy() == null) { |
71 | 72 |
IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "This is a CDM system vocabulary"); |
72 |
StoreUtil.warningDialog("Cannot delete vocabulary", termBase, status);
|
|
73 |
MessagingUtils.warningDialog("Cannot delete vocabulary", termBase, status);
|
|
73 | 74 |
return status; |
74 | 75 |
} |
75 | 76 |
|
76 | 77 |
if (!((TermVocabulary)termBase).getTerms().isEmpty()) { |
77 | 78 |
IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "Delete all terms from this vocaulary before deleting the vocabulary."); |
78 |
StoreUtil.warningDialog("Vocabulary not empty", termBase, status);
|
|
79 |
MessagingUtils.warningDialog("Vocabulary not empty", termBase, status);
|
|
79 | 80 |
return status; |
80 | 81 |
} |
81 | 82 |
|
... | ... | |
93 | 94 |
|
94 | 95 |
if (((DefinedTermBase)termBase).getCreatedBy() == null) { |
95 | 96 |
IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "This is a CDM system defined term"); |
96 |
StoreUtil.warningDialog("Cannot delete defined term", termBase, status);
|
|
97 |
MessagingUtils.warningDialog("Cannot delete defined term", termBase, status);
|
|
97 | 98 |
return status; |
98 | 99 |
} |
99 | 100 |
if(!definedTermBase.getIncludes().isEmpty()){ |
100 | 101 |
IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "This term includes other terms. Please delete the included terms before deleting this term."); |
101 |
StoreUtil.warningDialog("Term has included terms", termBase, status);
|
|
102 |
MessagingUtils.warningDialog("Term has included terms", termBase, status);
|
|
102 | 103 |
return status; |
103 | 104 |
} |
104 | 105 |
|
Also available in: Unified diff
Moved all logging and dialog functionality to the new class MessagingUtils.
Refactoring code to adapt to above change.
Added new custom error dialog - CdmErrorDialog
Added runtime exception handling to the ApplicationWorkbenchAdvisor by adding a custom status handler