Revision 11329ecc
Added by Katja Luther about 9 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java | ||
---|---|---|
21 | 21 |
import org.eclipse.ui.IEditorPart; |
22 | 22 |
import org.eclipse.ui.IViewPart; |
23 | 23 |
import org.eclipse.ui.IViewReference; |
24 |
import org.eclipse.ui.PlatformUI; |
|
24 | 25 |
import org.eclipse.ui.handlers.HandlerUtil; |
25 | 26 |
import org.eclipse.ui.texteditor.IDocumentProvider; |
26 | 27 |
import org.eclipse.ui.IWorkbenchPage; |
... | ... | |
33 | 34 |
import eu.etaxonomy.cdm.api.service.IReferenceService; |
34 | 35 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
35 | 36 |
import eu.etaxonomy.cdm.api.service.IUserService; |
37 |
import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator; |
|
36 | 38 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
37 | 39 |
import eu.etaxonomy.cdm.model.common.Group; |
38 | 40 |
import eu.etaxonomy.cdm.model.common.User; |
... | ... | |
56 | 58 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
57 | 59 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
58 | 60 |
|
61 |
|
|
59 | 62 |
/** |
60 | 63 |
* @author n.hoffmann |
61 | 64 |
* @created Mar 11, 2011 |
... | ... | |
87 | 90 |
IStructuredSelection structuredSelection = (IStructuredSelection) selection; |
88 | 91 |
|
89 | 92 |
IEntityPersistenceService persistenceService = (IEntityPersistenceService) input; |
93 |
IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() |
|
94 |
.findView("eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects"); |
|
95 |
if (part != null){ |
|
96 |
((ReferencingObjectsView)part).dispose(); |
|
97 |
} |
|
90 | 98 |
|
91 | 99 |
for(Object object : structuredSelection.toList()){ |
92 | 100 |
|
... | ... | |
116 | 124 |
result = service.delete((User) object); |
117 | 125 |
} else if (object instanceof TaxonNameBase){ |
118 | 126 |
INameService service = controller.getNameService(); |
119 |
service.load(((TaxonNameBase) object).getUuid()); |
|
120 |
result = service.delete((TaxonNameBase)object); |
|
127 |
TaxonNameBase name = service.load(((TaxonNameBase) object).getUuid()); |
|
128 |
NameDeletionConfigurator config = new NameDeletionConfigurator(); |
|
129 |
|
|
130 |
result = service.delete(name, config); |
|
121 | 131 |
} else if (object instanceof TaxonBase){ |
122 | 132 |
ITaxonService service = controller.getTaxonService(); |
123 | 133 |
service.load(((TaxonBase) object).getUuid()); |
... | ... | |
134 | 144 |
} catch (Exception e){ |
135 | 145 |
MessagingUtils.messageDialog("Exception occured. Could not delete", getClass(), e.getMessage(), null); |
136 | 146 |
} |
137 |
if (result.isError() || !result.getExceptions().isEmpty()){ |
|
147 |
if (result.isError() || result.isAbort()|| !result.getExceptions().isEmpty()){
|
|
138 | 148 |
if (!result.getExceptions().isEmpty()) { |
139 | 149 |
MessagingUtils.messageDialog("Could not delete", getClass(), result.getExceptions().get(0).getMessage(), null); |
140 | 150 |
}else{ |
... | ... | |
144 | 154 |
} |
145 | 155 |
if (result.isOk() && result.getExceptions().isEmpty()){ |
146 | 156 |
((BulkEditor) editor).removeAnnotatedLine(annotation); |
157 |
|
|
147 | 158 |
|
148 | 159 |
} |
160 |
if (part != null){ |
|
161 |
((ReferencingObjectsView)part).refresh(); |
|
162 |
} |
|
163 |
part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() |
|
164 |
.findView("eu.etaxonomy.taxeditor.editor.view.descriptive"); |
|
165 |
if (part != null){ |
|
166 |
//((DescriptiveViewPart)part).dispose(); |
|
167 |
} |
|
149 | 168 |
} |
150 | 169 |
} |
151 | 170 |
}else{ |
Also available in: Unified diff
factual data for bulkeditor, improving referencing objects view, make delete in bulkeditor visible for synonyms