Revision b0ce5b17
Added by Patrick Plitzner over 10 years ago
.gitattributes | ||
---|---|---|
148 | 148 |
eu.etaxonomy.taxeditor.cdmlib/lib/batik-util-1.7.jar -text |
149 | 149 |
eu.etaxonomy.taxeditor.cdmlib/lib/batik-xml-1.7.jar -text |
150 | 150 |
eu.etaxonomy.taxeditor.cdmlib/lib/c3p0-0.9.2.jar -text |
151 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-commons-3.2.0-SNAPSHOT.jar -text |
|
152 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-ext-3.2.0-SNAPSHOT-sources.jar -text |
|
153 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-ext-3.2.0-SNAPSHOT.jar -text |
|
154 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-io-3.2.0-SNAPSHOT-sources.jar -text |
|
155 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-io-3.2.0-SNAPSHOT.jar -text |
|
156 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-model-3.2.0-SNAPSHOT-sources.jar -text |
|
157 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-model-3.2.0-SNAPSHOT.jar -text |
|
158 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT-sources.jar -text |
|
159 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT-tests.jar -text |
|
160 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-persistence-3.2.0-SNAPSHOT.jar -text |
|
161 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-print-3.2.0-SNAPSHOT-sources.jar -text |
|
162 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-print-3.2.0-SNAPSHOT.jar -text |
|
163 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-remote-3.2.0-SNAPSHOT-sources.jar -text |
|
164 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-remote-3.2.0-SNAPSHOT.jar -text |
|
165 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-services-3.2.0-SNAPSHOT-sources.jar -text |
|
166 |
eu.etaxonomy.taxeditor.cdmlib/lib/cdmlib-services-3.2.0-SNAPSHOT.jar -text |
|
167 | 151 |
eu.etaxonomy.taxeditor.cdmlib/lib/cglib-nodep-2.2.2.jar -text |
168 | 152 |
eu.etaxonomy.taxeditor.cdmlib/lib/com.springsource.org.aopalliance-1.0.0.jar -text |
169 | 153 |
eu.etaxonomy.taxeditor.cdmlib/lib/com.springsource.org.apache.commons.logging-1.1.1.jar -text |
... | ... | |
211 | 195 |
eu.etaxonomy.taxeditor.cdmlib/lib/httpclient-4.2.3.jar -text |
212 | 196 |
eu.etaxonomy.taxeditor.cdmlib/lib/httpcore-4.2.4.jar -text |
213 | 197 |
eu.etaxonomy.taxeditor.cdmlib/lib/icu4j-2.6.1.jar -text |
198 |
eu.etaxonomy.taxeditor.cdmlib/lib/identificationKeyAPI-1.0-SNAPSHOT-sources.jar -text |
|
214 | 199 |
eu.etaxonomy.taxeditor.cdmlib/lib/identificationKeyAPI-1.0-SNAPSHOT.jar -text |
215 | 200 |
eu.etaxonomy.taxeditor.cdmlib/lib/itextpdf-5.4.0.jar -text |
216 | 201 |
eu.etaxonomy.taxeditor.cdmlib/lib/jackson-core-asl-1.8.8.jar -text |
... | ... | |
256 | 241 |
eu.etaxonomy.taxeditor.cdmlib/lib/odfdom-java-0.8.7.jar -text |
257 | 242 |
eu.etaxonomy.taxeditor.cdmlib/lib/ognl-2.6.9.jar -text |
258 | 243 |
eu.etaxonomy.taxeditor.cdmlib/lib/opencsv-2.3.jar -text |
244 |
eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.equinox.common-3.6.0.v20110523.jar -text |
|
245 |
eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar -text |
|
259 | 246 |
eu.etaxonomy.taxeditor.cdmlib/lib/org.osgi.core-1.0.0.jar -text |
260 | 247 |
eu.etaxonomy.taxeditor.cdmlib/lib/org.springframework.aop-3.2.2.RELEASE.jar -text |
261 | 248 |
eu.etaxonomy.taxeditor.cdmlib/lib/org.springframework.aspects-3.2.2.RELEASE.jar -text |
... | ... | |
1298 | 1285 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/SelectionArbitrator.java -text |
1299 | 1286 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextActionElement.java -text |
1300 | 1287 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java -text |
1288 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement2.java -text |
|
1301 | 1289 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TimePeriodElement.java -text |
1302 | 1290 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ToggleableTextElement.java -text |
1303 | 1291 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/UriWithLabelElement.java -text |
... | ... | |
1341 | 1329 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java -text |
1342 | 1330 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailSection.java -text |
1343 | 1331 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeWizardPage.java -text |
1332 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ReferenceEntityDetailElement.java -text |
|
1344 | 1333 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ReferencedEntityDetailSection.java -text |
1345 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/RefereneEntityDetailElement.java -text |
|
1346 | 1334 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DerivedUnitElement.java -text |
1347 | 1335 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescribedSpecimenSection.java -text |
1348 | 1336 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailElement.java -text |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.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 |
*/ |
... | ... | |
32 | 32 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
33 | 33 |
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor; |
34 | 34 |
import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer; |
35 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
35 | 36 |
import eu.etaxonomy.taxeditor.model.DataChangeBridge; |
36 | 37 |
import eu.etaxonomy.taxeditor.model.IDataChangeBehavior; |
37 | 38 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider; |
... | ... | |
39 | 40 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
40 | 41 |
|
41 | 42 |
/** |
42 |
*
|
|
43 |
* |
|
43 | 44 |
* Generates the tabbed editor with <code>TaxonNameEditor</code> on top and tabs |
44 | 45 |
* for "Descriptions", "Concepts", "Geography", etc. |
45 |
*
|
|
46 |
* |
|
46 | 47 |
* @author p.ciardelli |
47 | 48 |
* @author n.hoffmann |
48 | 49 |
* @created 15.05.2008 |
... | ... | |
83 | 84 |
|
84 | 85 |
/* |
85 | 86 |
* (non-Javadoc) |
86 |
*
|
|
87 |
* |
|
87 | 88 |
* @see org.eclipse.ui.forms.editor.FormEditor#addPages() |
88 | 89 |
*/ |
89 | 90 |
/** {@inheritDoc} */ |
... | ... | |
107 | 108 |
// EditorUtil.showPropertySheet(); |
108 | 109 |
|
109 | 110 |
} catch (PartInitException e) { |
110 |
EditorUtil.error(getClass(), e);
|
|
111 |
AbstractUtility.error(getClass(), e);
|
|
111 | 112 |
} |
112 | 113 |
} |
113 | 114 |
|
... | ... | |
121 | 122 |
} |
122 | 123 |
monitor.worked(1); |
123 | 124 |
|
124 |
for (IEditorPart editorPage : getPages()) { |
|
125 |
if (editorPage instanceof TaxonNameEditor) { |
|
126 |
if (((TaxonNameEditor) editorPage).checkForEmptyNames()) { |
|
127 |
MessageDialog |
|
128 |
.openWarning( |
|
129 |
EditorUtil.getShell(), |
|
130 |
"No Name Specified", |
|
131 |
"An attempt was made to save a taxon or synonym with " |
|
132 |
+ "an empty name. Operation was cancelled."); |
|
133 |
return; |
|
134 |
} |
|
135 |
} |
|
136 |
|
|
137 |
editorPage.doSave(monitor); |
|
138 |
monitor.worked(1); |
|
139 |
} |
|
125 |
for (IEditorPart editorPage : getPages()) { |
|
126 |
if (editorPage instanceof TaxonNameEditor) { |
|
127 |
if (((TaxonNameEditor) editorPage).checkForEmptyNames()) { |
|
128 |
MessageDialog.openWarning(AbstractUtility.getShell(), "No Name Specified", |
|
129 |
"An attempt was made to save a taxon or synonym with " |
|
130 |
+ "an empty name. Operation was cancelled."); |
|
131 |
return; |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
135 |
editorPage.doSave(monitor); |
|
136 |
monitor.worked(1); |
|
137 |
} |
|
140 | 138 |
|
141 | 139 |
// commit the conversation and start a new transaction immediately |
142 | 140 |
conversation.commit(true); |
143 | 141 |
monitor.worked(1); |
144 | 142 |
|
145 |
this.setDirty(false); |
|
146 |
monitor.worked(1); |
|
147 |
} catch (Exception e) { |
|
148 |
setFocus(); |
|
149 |
EditorUtil |
|
150 |
.errorDialog( |
|
151 |
"An error occurred while saving", |
|
152 |
getClass(), |
|
153 |
"An error occurred while saving the editor. Please close and reopen the taxon again.", |
|
154 |
e); |
|
155 |
disableEditor(true); |
|
156 |
} finally { |
|
157 |
monitor.done(); |
|
158 |
} |
|
143 |
this.setDirty(false); |
|
144 |
monitor.worked(1); |
|
145 |
} catch (Exception e) { |
|
146 |
setFocus(); |
|
147 |
AbstractUtility.errorDialog("An error occurred while saving", getClass(), |
|
148 |
"An error occurred while saving the editor. Please close and reopen the taxon again.", e); |
|
149 |
disableEditor(true); |
|
150 |
} finally { |
|
151 |
monitor.done(); |
|
152 |
} |
|
159 | 153 |
} |
160 | 154 |
|
161 | 155 |
private void disableEditor(boolean isOnError) { |
... | ... | |
163 | 157 |
if(isOnError){ |
164 | 158 |
editorPage.setOnError(); |
165 | 159 |
}else { |
166 |
editorPage.setDisabled();
|
|
160 |
editorPage.setDisabled(); |
|
167 | 161 |
} |
168 | 162 |
} |
169 | 163 |
conversation.unregisterForDataStoreChanges(this); |
... | ... | |
178 | 172 |
|
179 | 173 |
/* |
180 | 174 |
* (non-Javadoc) |
181 |
*
|
|
175 |
* |
|
182 | 176 |
* @see org.eclipse.ui.part.MultiPageEditorPart#isDirty() |
183 | 177 |
*/ |
184 | 178 |
/** |
185 | 179 |
* <p> |
186 | 180 |
* isDirty |
187 | 181 |
* </p> |
188 |
*
|
|
182 |
* |
|
189 | 183 |
* @return a boolean. |
190 | 184 |
*/ |
191 |
public boolean isDirty() { |
|
185 |
@Override |
|
186 |
public boolean isDirty() { |
|
192 | 187 |
return dirty; |
193 | 188 |
} |
194 | 189 |
|
195 | 190 |
/* |
196 | 191 |
* (non-Javadoc) |
197 |
*
|
|
192 |
* |
|
198 | 193 |
* @see org.eclipse.ui.forms.editor.FormEditor#editorDirtyStateChanged() |
199 | 194 |
*/ |
200 | 195 |
/** {@inheritDoc} */ |
... | ... | |
206 | 201 |
|
207 | 202 |
/** |
208 | 203 |
* {@inheritDoc} |
209 |
*
|
|
204 |
* |
|
210 | 205 |
* Checks whether nested editors are calling |
211 | 206 |
* <code>firePropertyChange(PROP_DIRTY)</code> to signal an edit has taken |
212 | 207 |
* place before passing property change along to |
... | ... | |
214 | 209 |
*/ |
215 | 210 |
/* |
216 | 211 |
* (non-Javadoc) |
217 |
*
|
|
212 |
* |
|
218 | 213 |
* @see org.eclipse.ui.part.MultiPageEditorPart#handlePropertyChange(int) |
219 | 214 |
*/ |
220 |
protected void handlePropertyChange(int propertyId) { |
|
215 |
@Override |
|
216 |
protected void handlePropertyChange(int propertyId) { |
|
221 | 217 |
if (propertyId == PROP_DIRTY) { |
222 | 218 |
setDirty(true); |
223 | 219 |
} |
... | ... | |
240 | 236 |
public void init(IEditorSite site, IEditorInput input) |
241 | 237 |
throws PartInitException { |
242 | 238 |
|
243 |
if (!(input instanceof TaxonEditorInput)) |
|
244 |
throw new PartInitException(
|
|
239 |
if (!(input instanceof TaxonEditorInput)) {
|
|
240 |
throw new PartInitException(
|
|
245 | 241 |
"Invalid Input: Must be TaxonEditorInput"); |
242 |
} |
|
246 | 243 |
|
247 | 244 |
this.input = (TaxonEditorInput) input; |
248 | 245 |
|
... | ... | |
289 | 286 |
setPartName(partName); |
290 | 287 |
} |
291 | 288 |
|
292 |
/**
|
|
293 |
* {@inheritDoc}
|
|
294 |
*
|
|
295 |
* Editor pages call this in their postOperation to notify the
|
|
296 |
* MultiPageTaxonEditor of unsaved changes
|
|
297 |
*/
|
|
298 |
public void changed(Object element) {
|
|
299 |
// setDirty(true);
|
|
300 |
dirty = true;
|
|
301 |
super.editorDirtyStateChanged();
|
|
302 |
if (element instanceof TaxonBase) {
|
|
303 |
TaxonNameEditor page = (TaxonNameEditor) getPage(Page.NAME);
|
|
304 |
AbstractGroupedContainer container = page
|
|
305 |
.getContainer((TaxonBase) element);
|
|
306 |
if (container != null) {
|
|
307 |
container.refresh();
|
|
308 |
}
|
|
309 |
}
|
|
310 |
}
|
|
289 |
/**
|
|
290 |
* {@inheritDoc}
|
|
291 |
*
|
|
292 |
* Editor pages call this in their postOperation to notify the
|
|
293 |
* MultiPageTaxonEditor of unsaved changes
|
|
294 |
*/
|
|
295 |
@Override
|
|
296 |
public void changed(Object element) {
|
|
297 |
// setDirty(true);
|
|
298 |
dirty = true;
|
|
299 |
super.editorDirtyStateChanged();
|
|
300 |
if (element instanceof TaxonBase) {
|
|
301 |
TaxonNameEditor page = (TaxonNameEditor) getPage(Page.NAME);
|
|
302 |
AbstractGroupedContainer container = page.getContainer((TaxonBase) element);
|
|
303 |
if (container != null) {
|
|
304 |
container.refresh();
|
|
305 |
}
|
|
306 |
}
|
|
307 |
}
|
|
311 | 308 |
|
312 | 309 |
/** |
313 | 310 |
* The accepted taxon that is the input for this editor |
314 |
*
|
|
311 |
* |
|
315 | 312 |
* @return the accepted taxon |
316 | 313 |
*/ |
317 | 314 |
public Taxon getTaxon() { |
... | ... | |
320 | 317 |
|
321 | 318 |
/* |
322 | 319 |
* (non-Javadoc) |
323 |
*
|
|
320 |
* |
|
324 | 321 |
* @see |
325 | 322 |
* eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder |
326 | 323 |
* () |
... | ... | |
329 | 326 |
* <p> |
330 | 327 |
* getConversationHolder |
331 | 328 |
* </p> |
332 |
*
|
|
329 |
* |
|
333 | 330 |
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} |
334 | 331 |
* object. |
335 | 332 |
*/ |
336 |
public ConversationHolder getConversationHolder() { |
|
333 |
@Override |
|
334 |
public ConversationHolder getConversationHolder() { |
|
337 | 335 |
return conversation; |
338 | 336 |
} |
339 | 337 |
|
... | ... | |
341 | 339 |
* <p> |
342 | 340 |
* setConversationHolder |
343 | 341 |
* </p> |
344 |
*
|
|
342 |
* |
|
345 | 343 |
* @param conversation |
346 | 344 |
* a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} |
347 | 345 |
* object. |
... | ... | |
354 | 352 |
* <p> |
355 | 353 |
* Getter for the field <code>undoContext</code>. |
356 | 354 |
* </p> |
357 |
*
|
|
355 |
* |
|
358 | 356 |
* @return a {@link org.eclipse.core.commands.operations.IUndoContext} |
359 | 357 |
* object. |
360 | 358 |
*/ |
... | ... | |
366 | 364 |
* <p> |
367 | 365 |
* Setter for the field <code>undoContext</code>. |
368 | 366 |
* </p> |
369 |
*
|
|
367 |
* |
|
370 | 368 |
* @param undoContext |
371 | 369 |
* a {@link org.eclipse.core.commands.operations.IUndoContext} |
372 | 370 |
* object. |
... | ... | |
385 | 383 |
getActiveEditor().setFocus(); |
386 | 384 |
} |
387 | 385 |
|
388 |
/* |
|
389 |
* (non-Javadoc) |
|
390 |
* |
|
391 |
* @see |
|
392 |
* eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu |
|
393 |
* .etaxonomy.cdm.persistence.hibernate.CdmCrudEvent) |
|
394 |
*/ |
|
395 |
/** {@inheritDoc} */ |
|
396 |
public void update(CdmDataChangeMap events) { |
|
397 |
if (dataChangeBehavior == null) { |
|
398 |
dataChangeBehavior = new MultiPageTaxonEditorDataChangeBehaviour( |
|
399 |
this); |
|
400 |
} |
|
401 |
|
|
402 |
DataChangeBridge.handleDataChange(events, dataChangeBehavior); |
|
403 |
} |
|
404 |
|
|
405 |
/* |
|
406 |
* (non-Javadoc) |
|
407 |
* |
|
408 |
* @see |
|
409 |
* eu.etaxonomy.taxeditor.store.operations.IPostOperationEnabled#postOperation |
|
410 |
* () |
|
411 |
*/ |
|
412 |
/** {@inheritDoc} */ |
|
413 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
|
414 |
setDirty(true); |
|
415 |
|
|
416 |
for (IEditorPart editor : this.getPages()) { |
|
417 |
if (editor instanceof IPostOperationEnabled) { |
|
418 |
((IPostOperationEnabled) editor) |
|
419 |
.postOperation(objectAffectedByOperation); |
|
420 |
} else { |
|
421 |
EditorUtil.warn(getClass(), |
|
422 |
"postOperation not enabled for editor " + editor); |
|
423 |
} |
|
424 |
} |
|
425 |
EditorUtil |
|
426 |
.warn(getClass(), |
|
427 |
"postOperation called on MultiPageTaxonEditor. Can you make it more specific?"); |
|
428 |
|
|
429 |
return false; |
|
430 |
} |
|
386 |
/* |
|
387 |
* (non-Javadoc) |
|
388 |
* |
|
389 |
* @see |
|
390 |
* eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu |
|
391 |
* .etaxonomy.cdm.persistence.hibernate.CdmCrudEvent) |
|
392 |
*/ |
|
393 |
/** {@inheritDoc} */ |
|
394 |
@Override |
|
395 |
public void update(CdmDataChangeMap events) { |
|
396 |
if (dataChangeBehavior == null) { |
|
397 |
dataChangeBehavior = new MultiPageTaxonEditorDataChangeBehaviour(this); |
|
398 |
} |
|
399 |
|
|
400 |
DataChangeBridge.handleDataChange(events, dataChangeBehavior); |
|
401 |
} |
|
402 |
|
|
403 |
/* |
|
404 |
* (non-Javadoc) |
|
405 |
* |
|
406 |
* @see |
|
407 |
* eu.etaxonomy.taxeditor.store.operations.IPostOperationEnabled#postOperation |
|
408 |
* () |
|
409 |
*/ |
|
410 |
/** {@inheritDoc} */ |
|
411 |
@Override |
|
412 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
|
413 |
setDirty(true); |
|
414 |
|
|
415 |
for (IEditorPart editor : this.getPages()) { |
|
416 |
if (editor instanceof IPostOperationEnabled) { |
|
417 |
((IPostOperationEnabled) editor).postOperation(objectAffectedByOperation); |
|
418 |
} else { |
|
419 |
AbstractUtility.warn(getClass(), "postOperation not enabled for editor " + editor); |
|
420 |
} |
|
421 |
} |
|
422 |
AbstractUtility.warn(getClass(), "postOperation called on MultiPageTaxonEditor. Can you make it more specific?"); |
|
423 |
|
|
424 |
return false; |
|
425 |
} |
|
431 | 426 |
|
432 | 427 |
/** |
433 | 428 |
* Returns an <code>IEditorPart</code> implementation by type |
434 |
*
|
|
429 |
* |
|
435 | 430 |
* @param page |
436 | 431 |
* the page type |
437 | 432 |
* @return a {@link eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage} |
... | ... | |
449 | 444 |
/** |
450 | 445 |
* Return a list of <code>AbstractTaxonEditor</code>s registered with this |
451 | 446 |
* <code>MultiPageTaxonEditor</code>. |
452 |
*
|
|
447 |
* |
|
453 | 448 |
* @return a {@link java.util.List} object. |
454 | 449 |
*/ |
455 | 450 |
public List<IMultiPageTaxonEditorPage> getPages() { |
... | ... | |
463 | 458 |
|
464 | 459 |
/** |
465 | 460 |
* Refreshes a certain page of the MultipageTaxonEditor |
466 |
*
|
|
461 |
* |
|
467 | 462 |
* @param page |
468 | 463 |
* a {@link eu.etaxonomy.taxeditor.editor.Page} object. |
469 | 464 |
* @return a boolean. |
... | ... | |
475 | 470 |
/** |
476 | 471 |
* Refreshes a certain page of the MultipageTaxonEditor and sets focus to |
477 | 472 |
* that page |
478 |
*
|
|
473 |
* |
|
479 | 474 |
* @param page |
480 | 475 |
* a {@link eu.etaxonomy.taxeditor.editor.Page} object. |
481 | 476 |
* @param focus |
... | ... | |
491 | 486 |
* <p> |
492 | 487 |
* onComplete |
493 | 488 |
* </p> |
494 |
*
|
|
489 |
* |
|
495 | 490 |
* @return a boolean. |
496 | 491 |
*/ |
497 |
public boolean onComplete() { |
|
492 |
@Override |
|
493 |
public boolean onComplete() { |
|
498 | 494 |
return false; |
499 | 495 |
} |
500 | 496 |
|
501 |
/** |
|
502 |
* Reloads the data for this |
|
503 |
*/ |
|
504 |
public void reload() { |
|
505 |
if (isDirty()) { |
|
506 |
EditorUtil |
|
507 |
.warningDialog( |
|
508 |
"Editor has unsaved data", |
|
509 |
getClass(), |
|
510 |
"This editor can not be " |
|
511 |
+ "refreshed because it contains unsaved data. Refreshing " |
|
512 |
+ "this editor would discard the changes. Please save this editor, " |
|
513 |
+ "close and reopen it manually in order to get the latest content"); |
|
514 |
} else { |
|
515 |
TaxonEditorInput input = (TaxonEditorInput) getEditorInput(); |
|
516 |
|
|
517 |
UUID uuid = input.getTaxonNode().getUuid(); |
|
518 |
|
|
519 |
conversation.clear(); |
|
520 |
|
|
521 |
try { |
|
522 |
TaxonEditorInput newInput = TaxonEditorInput.NewInstance(uuid); |
|
523 |
setInput(newInput); |
|
524 |
for (IMultiPageTaxonEditorPage editorPart : getPages()) { |
|
525 |
editorPart.redraw(); |
|
526 |
} |
|
527 |
} catch (Exception e) { |
|
528 |
EditorUtil.errorDialog("Error refreshing editor", getClass(), |
|
529 |
"Could not refresh this editor", e); |
|
530 |
} |
|
531 |
} |
|
532 |
} |
|
533 |
|
|
497 |
/** |
|
498 |
* Reloads the data for this |
|
499 |
*/ |
|
500 |
public void reload() { |
|
501 |
if (isDirty()) { |
|
502 |
AbstractUtility.warningDialog("Editor has unsaved data", getClass(), "This editor can not be " |
|
503 |
+ "refreshed because it contains unsaved data. Refreshing " |
|
504 |
+ "this editor would discard the changes. Please save this editor, " |
|
505 |
+ "close and reopen it manually in order to get the latest content"); |
|
506 |
} else { |
|
507 |
TaxonEditorInput input = (TaxonEditorInput) getEditorInput(); |
|
508 |
|
|
509 |
UUID uuid = input.getTaxonNode().getUuid(); |
|
510 |
|
|
511 |
conversation.clear(); |
|
512 |
|
|
513 |
try { |
|
514 |
TaxonEditorInput newInput = TaxonEditorInput.NewInstance(uuid); |
|
515 |
setInput(newInput); |
|
516 |
for (IMultiPageTaxonEditorPage editorPart : getPages()) { |
|
517 |
editorPart.redraw(); |
|
518 |
} |
|
519 |
} catch (Exception e) { |
|
520 |
AbstractUtility.errorDialog("Error refreshing editor", getClass(), "Could not refresh this editor", e); |
|
521 |
} |
|
522 |
} |
|
523 |
} |
|
524 |
|
|
534 | 525 |
@Override |
535 | 526 |
public String toString() { |
536 | 527 |
return String.format("%s[%s]", this.getClass().getSimpleName(), getEditorInput()); |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2011 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 |
*/ |
... | ... | |
19 | 19 |
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDropAdapter; |
20 | 20 |
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer; |
21 | 21 |
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart; |
22 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
|
23 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; |
|
24 | 22 |
|
25 | 23 |
|
26 | 24 |
/** |
27 |
* The Class create a speific Use View to keep the taxonomic view clean |
|
28 |
* @author a.theys
|
|
25 |
* The Class create a specific Use View to keep the taxonomic view clean
|
|
26 |
* @author a.theys |
|
29 | 27 |
* @created mar 13, 2012 |
30 | 28 |
* @version 1.0 |
31 | 29 |
*/ |
32 |
public class UsesViewPart extends DescriptiveViewPart implements IPartContentHasDetails, IPartContentHasSupplementalData {
|
|
30 |
public class UsesViewPart extends DescriptiveViewPart { |
|
33 | 31 |
|
34 | 32 |
/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.uses"</code> */ |
35 | 33 |
public static final String ID = "eu.etaxonomy.taxeditor.editor.view.uses"; |
36 | 34 |
/** {@inheritDoc} */ |
37 | 35 |
@Override |
38 | 36 |
public void createViewer(Composite parent) { |
39 |
|
|
37 |
|
|
40 | 38 |
viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL |
41 | 39 |
| SWT.V_SCROLL | SWT.FULL_SELECTION)); |
42 | 40 |
viewer.setContentProvider(new UsesContentProvider(featureNodeContainerCache)); |
43 | 41 |
viewer.setLabelProvider(new UsesLabelProvider()); |
44 | 42 |
viewer.setAutoExpandLevel(2); |
45 |
|
|
46 |
|
|
47 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
48 | 46 |
Transfer[] transfers = new Transfer[] { DescriptionElementTransfer.getInstance() }; |
49 | 47 |
viewer.addDragSupport(dndOperations, transfers, new DescriptionElementDragListener( |
50 | 48 |
this)); |
51 | 49 |
viewer.addDropSupport(dndOperations, transfers, |
52 | 50 |
new DescriptionElementDropAdapter(viewer)); |
53 |
|
|
51 |
|
|
54 | 52 |
// Propagate selection from viewer |
55 | 53 |
getSite().setSelectionProvider(viewer); |
56 |
|
|
57 |
showAllElementsAction = new ToggleDescriptionAction(false);
|
|
54 |
|
|
55 |
showAllElementsAction = new ToggleDescriptionAction(false); |
|
58 | 56 |
hideAllElementsAction = new ToggleDescriptionAction(true); |
59 |
|
|
57 |
|
|
60 | 58 |
// Add context menu to tree |
61 | 59 |
createMenu(); |
62 |
|
|
60 |
|
|
63 | 61 |
createToolbar(); |
64 | 62 |
|
65 | 63 |
} |
66 |
|
|
64 |
|
|
67 | 65 |
/** {@inheritDoc} */ |
68 | 66 |
@Override |
69 | 67 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
70 | 68 |
viewer.refresh(); |
71 | 69 |
return super.postOperation(objectAffectedByOperation); |
72 | 70 |
} |
73 |
|
|
71 |
|
|
74 | 72 |
|
75 | 73 |
|
76 | 74 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.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 |
*/ |
... | ... | |
37 | 37 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
38 | 38 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
39 | 39 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
40 |
import eu.etaxonomy.taxeditor.editor.OpenEditorConfiguration; |
|
41 | 40 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; |
42 | 41 |
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin; |
43 | 42 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
... | ... | |
53 | 52 |
*/ |
54 | 53 |
public class NavigationUtil extends AbstractUtility{ |
55 | 54 |
private static IUndoContext defaultUndoContext; |
56 |
|
|
55 |
|
|
57 | 56 |
/** |
58 | 57 |
* <p>executeEditHandler</p> |
59 | 58 |
*/ |
60 | 59 |
public static void executeEditHandler(){ |
61 | 60 |
|
62 | 61 |
String commandId = "eu.etaxonomy.taxeditor.navigation.command.editSelection"; |
63 |
|
|
64 |
IHandlerService handlerService = (IHandlerService) NavigationUtil.getService(IHandlerService.class);
|
|
62 |
|
|
63 |
IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
|
|
65 | 64 |
try { |
66 | 65 |
handlerService.executeCommand(commandId, null); |
67 | 66 |
} catch (ExecutionException e) { |
68 |
NavigationUtil.error(NavigationUtil.class, e);
|
|
67 |
AbstractUtility.error(NavigationUtil.class, e);
|
|
69 | 68 |
} catch (NotDefinedException e) { |
70 |
NavigationUtil.error(NavigationUtil.class, e);
|
|
69 |
AbstractUtility.error(NavigationUtil.class, e);
|
|
71 | 70 |
} catch (NotEnabledException e) { |
72 |
NavigationUtil.error(NavigationUtil.class, e);
|
|
71 |
AbstractUtility.error(NavigationUtil.class, e);
|
|
73 | 72 |
} catch (NotHandledException e) { |
74 |
NavigationUtil.error(NavigationUtil.class, e);
|
|
73 |
AbstractUtility.error(NavigationUtil.class, e);
|
|
75 | 74 |
} |
76 | 75 |
} |
77 |
|
|
76 |
|
|
78 | 77 |
/** |
79 | 78 |
* <p>openEditor</p> |
80 | 79 |
* |
81 | 80 |
* @param selectedObject a {@link eu.etaxonomy.cdm.model.common.CdmBase} object. |
82 | 81 |
*/ |
83 | 82 |
public static void openEditor(ICdmBase selectedObject){ |
84 |
UUID entityUuid = selectedObject.getUuid();
|
|
85 |
try {
|
|
83 |
UUID entityUuid = selectedObject.getUuid(); |
|
84 |
try { |
|
86 | 85 |
if(selectedObject instanceof TaxonNode){ |
87 | 86 |
EditorUtil.openTaxonNode(entityUuid); |
88 | 87 |
}else if(selectedObject instanceof TaxonBase){ |
... | ... | |
96 | 95 |
warningDialog("Unsupported Type", NavigationUtil.class, "No editor exists for the current selection: " + selectedObject); |
97 | 96 |
} |
98 | 97 |
} catch (PartInitException e) { |
99 |
NavigationUtil.error(NavigationUtil.class, "Error opening the editor", e);
|
|
98 |
AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e);
|
|
100 | 99 |
} catch (Exception e) { |
101 |
EditorUtil.warningDialog("Could not create Taxon", NavigationUtil.class, e.getMessage());
|
|
100 |
AbstractUtility.warningDialog("Could not create Taxon", NavigationUtil.class, e.getMessage());
|
|
102 | 101 |
} |
103 | 102 |
} |
104 |
|
|
103 |
|
|
105 | 104 |
public static void openEditor(Object selectedObject){ |
106 | 105 |
if (selectedObject instanceof UuidAndTitleCache){ |
107 | 106 |
Class type = ((UuidAndTitleCache) selectedObject).getType(); |
... | ... | |
109 | 108 |
try { |
110 | 109 |
EditorUtil.openTaxonBase(((UuidAndTitleCache) selectedObject).getUuid()); |
111 | 110 |
} catch (PartInitException e) { |
112 |
NavigationUtil.error(NavigationUtil.class, "Error opening the editor", e);
|
|
111 |
AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e);
|
|
113 | 112 |
} |
114 | 113 |
} |
115 | 114 |
}else if(selectedObject instanceof ICdmBase){ |
116 |
openEditor((ICdmBase) selectedObject);
|
|
115 |
openEditor((ICdmBase) selectedObject); |
|
117 | 116 |
}else{ |
118 |
NavigationUtil.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject));
|
|
117 |
AbstractUtility.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject));
|
|
119 | 118 |
} |
120 | 119 |
} |
121 |
|
|
120 |
|
|
122 | 121 |
/** |
123 | 122 |
* <p>openEmpty</p> |
124 | 123 |
* |
... | ... | |
128 | 127 |
try { |
129 | 128 |
EditorUtil.openEmpty(parentNodeUuid); |
130 | 129 |
} catch (PartInitException e) { |
131 |
NavigationUtil.error(NavigationUtil.class, "Error opening the editor", e);
|
|
130 |
AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e);
|
|
132 | 131 |
} |
133 | 132 |
} |
134 |
|
|
133 |
|
|
135 | 134 |
/** |
136 | 135 |
* <p>getShell</p> |
137 | 136 |
* |
... | ... | |
150 | 149 |
return TaxeditorNavigationPlugin.getDefault().getWorkbench(). |
151 | 150 |
getActiveWorkbenchWindow(); |
152 | 151 |
} |
153 |
|
|
152 |
|
|
154 | 153 |
/** |
155 | 154 |
* <p>getWorkbenchUndoContext</p> |
156 | 155 |
* |
... | ... | |
169 | 168 |
public static IUndoContext getUndoContext() { |
170 | 169 |
// FIXME this has to be more specific. Every widget has to have its own undo context |
171 | 170 |
// return IOperationHistory.GLOBAL_UNDO_CONTEXT; |
172 |
|
|
173 |
// Plug-ins that wish their operations to be undoable from workbench views
|
|
174 |
// such as the Navigator or Package Explorer should assign the workbench
|
|
175 |
// undo context to their operations.
|
|
171 |
|
|
172 |
// Plug-ins that wish their operations to be undoable from workbench views |
|
173 |
// such as the Navigator or Package Explorer should assign the workbench |
|
174 |
// undo context to their operations. |
|
176 | 175 |
if (defaultUndoContext == null) { |
177 | 176 |
defaultUndoContext = new UndoContext(); |
178 | 177 |
} |
... | ... | |
186 | 185 |
* @return a boolean. |
187 | 186 |
*/ |
188 | 187 |
public static boolean isDirty(TaxonNode taxonNode){ |
189 |
|
|
188 |
|
|
190 | 189 |
for (IEditorReference reference : getActivePage().getEditorReferences()) { |
191 |
|
|
190 |
|
|
192 | 191 |
try { |
193 | 192 |
if (reference.getEditorInput() instanceof TaxonEditorInput) { |
194 | 193 |
TaxonEditorInput editorInput = (TaxonEditorInput) reference.getEditorInput(); |
... | ... | |
197 | 196 |
} |
198 | 197 |
} |
199 | 198 |
} catch (PartInitException e) { |
200 |
NavigationUtil.error(NavigationUtil.class, e.getMessage(), e);
|
|
199 |
AbstractUtility.error(NavigationUtil.class, e.getMessage(), e);
|
|
201 | 200 |
throw new RuntimeException(e); |
202 | 201 |
} |
203 |
|
|
202 |
|
|
204 | 203 |
} |
205 | 204 |
return false; |
206 | 205 |
} |
... | ... | |
214 | 213 |
public static void selectInNavigator(final Object element, final Object parentElement) { |
215 | 214 |
Display.getDefault().asyncExec(new Runnable(){ |
216 | 215 |
|
217 |
public void run() { |
|
216 |
@Override |
|
217 |
public void run() { |
|
218 | 218 |
TaxonNavigator navigator = showNavigator(); |
219 | 219 |
|
220 | 220 |
if (navigator != null) { |
... | ... | |
223 | 223 |
if (parentElement != null) { |
224 | 224 |
viewer.setExpandedState(parentElement, true); |
225 | 225 |
} |
226 |
viewer.setSelection(new StructuredSelection((TaxonNode) element));
|
|
226 |
viewer.setSelection(new StructuredSelection(element)); |
|
227 | 227 |
} |
228 | 228 |
} |
229 | 229 |
} |
230 |
|
|
230 |
|
|
231 | 231 |
}); |
232 | 232 |
} |
233 | 233 |
|
... | ... | |
239 | 239 |
public static void openSearch(Object selection) { |
240 | 240 |
if(selection instanceof Taxon){ |
241 | 241 |
Taxon taxon = (Taxon) selection; |
242 |
|
|
242 |
|
|
243 | 243 |
handleOpeningOfMultipleTaxonNodes(taxon.getTaxonNodes()); |
244 |
|
|
244 |
|
|
245 | 245 |
}else if(selection instanceof Synonym){ |
246 | 246 |
Synonym synonym = (Synonym) selection; |
247 |
|
|
247 |
|
|
248 | 248 |
handleOpeningOfMultipleTaxa(synonym.getAcceptedTaxa()); |
249 |
|
|
249 |
|
|
250 | 250 |
}else{ |
251 | 251 |
warningDialog("Not implemented yet", NavigationUtil.class, "You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment."); |
252 | 252 |
} |
253 |
|
|
253 |
|
|
254 | 254 |
} |
255 | 255 |
|
256 | 256 |
private static void handleOpeningOfMultipleTaxa(Set<Taxon> acceptedTaxa) { |
... | ... | |
271 | 271 |
*/ |
272 | 272 |
private static void handleOpeningOfMultipleTaxonNodes( |
273 | 273 |
Set<TaxonNode> taxonNodes) { |
274 |
|
|
274 |
|
|
275 | 275 |
if(taxonNodes.size() == 1){ |
276 | 276 |
openEditor(taxonNodes.iterator().next()); |
277 | 277 |
}else if(taxonNodes.size() > 1){ |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
18 | 18 |
import java.util.Set; |
19 | 19 |
import java.util.UUID; |
20 | 20 |
|
21 |
import org.eclipse.core.commands.Command; |
|
22 |
import org.eclipse.core.commands.common.NotDefinedException; |
|
23 | 21 |
import org.eclipse.core.runtime.IAdaptable; |
24 | 22 |
import org.eclipse.core.runtime.IProgressMonitor; |
25 | 23 |
import org.eclipse.jface.viewers.DoubleClickEvent; |
... | ... | |
27 | 25 |
import org.eclipse.ui.IMemento; |
28 | 26 |
import org.eclipse.ui.IViewSite; |
29 | 27 |
import org.eclipse.ui.PartInitException; |
30 |
import org.eclipse.ui.commands.ICommandService; |
|
31 |
import org.eclipse.ui.handlers.IHandlerService; |
|
32 | 28 |
import org.eclipse.ui.navigator.CommonNavigator; |
33 | 29 |
|
34 | 30 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
... | ... | |
45 | 41 |
|
46 | 42 |
/** |
47 | 43 |
* Taxonomic tree implementation using Common Navigator Framework. |
48 |
*
|
|
44 |
* |
|
49 | 45 |
* @author p.ciardelli |
50 | 46 |
* @author n.hoffmann |
51 | 47 |
* @created 02.06.2009 |
... | ... | |
60 | 56 |
*/ |
61 | 57 |
public static final String ID = "eu.etaxonomy.taxeditor.navigation.navigator"; //$NON-NLS-1$ |
62 | 58 |
|
63 |
/** |
|
64 |
* Constant |
|
65 |
* <code>OPEN_COMMAND_ID="eu.etaxonomy.taxeditor.navigation.comma"{trunked}</code> |
|
66 |
*/ |
|
67 |
public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.navigation.command.editSelection"; |
|
68 |
|
|
69 | 59 |
private static final String TREE_PATH = "treepath"; |
70 | 60 |
|
71 | 61 |
private static final String TREE_PATHS = "treepaths"; |
... | ... | |
78 | 68 |
|
79 | 69 |
/* |
80 | 70 |
* (non-Javadoc) |
81 |
*
|
|
71 |
* |
|
82 | 72 |
* @see org.eclipse.ui.navigator.CommonNavigator#getInitialInput() |
83 | 73 |
*/ |
84 | 74 |
/** {@inheritDoc} */ |
... | ... | |
120 | 110 |
*/ |
121 | 111 |
public void refresh() { |
122 | 112 |
if(getConversationHolder() != null){ |
123 |
getConversationHolder().bind();
|
|
113 |
getConversationHolder().bind(); |
|
124 | 114 |
} |
125 | 115 |
getCommonViewer().refresh(); |
126 | 116 |
} |
... | ... | |
136 | 126 |
* <p> |
137 | 127 |
* restore |
138 | 128 |
* </p> |
139 |
*
|
|
129 |
* |
|
140 | 130 |
* @param memento |
141 | 131 |
* a {@link org.eclipse.ui.IMemento} object. |
142 | 132 |
* @param monitor |
... | ... | |
203 | 193 |
|
204 | 194 |
List<CdmBase> pathList = new ArrayList<CdmBase>(); |
205 | 195 |
|
206 |
if (string.length() == 0) |
|
207 |
return null; |
|
196 |
if (string.length() == 0) { |
|
197 |
return null; |
|
198 |
} |
|
208 | 199 |
|
209 | 200 |
for (String uuid : string.split(" ")) { |
210 | 201 |
CdmBase cdmBaseObject = CdmStore.getService( |
... | ... | |
216 | 207 |
IClassificationService.class).load( |
217 | 208 |
UUID.fromString(uuid)); |
218 | 209 |
|
219 |
if (cdmBaseObject == null) |
|
220 |
return null; |
|
210 |
if (cdmBaseObject == null) { |
|
211 |
return null; |
|
212 |
} |
|
221 | 213 |
} |
222 | 214 |
pathList.add(cdmBaseObject); |
223 | 215 |
} |
... | ... | |
234 | 226 |
* <p> |
235 | 227 |
* saveTreeState |
236 | 228 |
* </p> |
237 |
*
|
|
229 |
* |
|
238 | 230 |
* @param memento |
239 | 231 |
* a {@link org.eclipse.ui.IMemento} object. |
240 | 232 |
* @param progressMonitor |
... | ... | |
274 | 266 |
|
275 | 267 |
/* |
276 | 268 |
* (non-Javadoc) |
277 |
*
|
|
269 |
* |
|
278 | 270 |
* @see |
279 | 271 |
* eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder |
280 | 272 |
* () |
... | ... | |
283 | 275 |
* <p> |
284 | 276 |
* getConversationHolder |
285 | 277 |
* </p> |
286 |
*
|
|
278 |
* |
|
287 | 279 |
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} |
288 | 280 |
* object. |
289 | 281 |
*/ |
... | ... | |
294 | 286 |
|
295 | 287 |
/* |
296 | 288 |
* (non-Javadoc) |
297 |
*
|
|
289 |
* |
|
298 | 290 |
* @see |
299 | 291 |
* eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update |
300 | 292 |
* (eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap) |
... | ... | |
320 | 312 |
|
321 | 313 |
/* |
322 | 314 |
* (non-Javadoc) |
323 |
*
|
|
315 |
* |
|
324 | 316 |
* @see org.eclipse.ui.part.WorkbenchPart#dispose() |
325 | 317 |
*/ |
326 | 318 |
/** {@inheritDoc} */ |
... | ... | |
335 | 327 |
|
336 | 328 |
/* |
337 | 329 |
* (non-Javadoc) |
338 |
*
|
|
330 |
* |
|
339 | 331 |
* @see org.eclipse.ui.navigator.CommonNavigator#setFocus() |
340 | 332 |
*/ |
341 | 333 |
/** {@inheritDoc} */ |
... | ... | |
350 | 342 |
|
351 | 343 |
/* |
352 | 344 |
* (non-Javadoc) |
353 |
*
|
|
345 |
* |
|
354 | 346 |
* @see |
355 | 347 |
* eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation |
356 | 348 |
* (eu.etaxonomy.cdm.model.common.CdmBase) |
... | ... | |
366 | 358 |
* <p> |
367 | 359 |
* save |
368 | 360 |
* </p> |
369 |
*
|
|
361 |
* |
|
370 | 362 |
* @param memento |
371 | 363 |
* a {@link org.eclipse.ui.IMemento} object. |
372 | 364 |
* @param monitor |
... | ... | |
383 | 375 |
/** {@inheritDoc} */ |
384 | 376 |
@Override |
385 | 377 |
protected void handleDoubleClick(DoubleClickEvent anEvent) { |
386 |
|
|
387 |
ICommandService commandService = (ICommandService) getSite() |
|
388 |
.getService(ICommandService.class); |
|
389 |
|
|
390 |
Command command = commandService.getCommand(OPEN_COMMAND_ID); |
|
391 |
if (command.isEnabled()) { |
|
392 |
IHandlerService handlerService = (IHandlerService) getSite() |
|
393 |
.getService(IHandlerService.class); |
|
394 |
try { |
|
395 |
handlerService.executeCommand(OPEN_COMMAND_ID, null); |
|
396 |
} catch (NotDefinedException e) { |
|
397 |
throw new RuntimeException("Could not find open command: " |
|
398 |
+ OPEN_COMMAND_ID); |
|
399 |
} catch (Exception e) { |
|
400 |
NavigationUtil |
|
401 |
.error(getClass(), |
|
402 |
"An exception occured while trying to open a selection", |
|
403 |
e); |
|
404 |
} |
|
405 |
} |
|
378 |
NavigationUtil.executeEditHandler(); |
|
406 | 379 |
// If the double click is passed up to the super-class it will |
407 | 380 |
// expand/collapse trees. |
408 | 381 |
// We do not want that |
... | ... | |
413 | 386 |
* <p> |
414 | 387 |
* onComplete |
415 | 388 |
* </p> |
416 |
*
|
|
389 |
* |
|
417 | 390 |
* @return a boolean. |
418 | 391 |
*/ |
419 | 392 |
@Override |
... | ... | |
423 | 396 |
|
424 | 397 |
/* |
425 | 398 |
* (non-Javadoc) |
426 |
*
|
|
399 |
* |
|
427 | 400 |
* @see org.eclipse.ui.part.WorkbenchPart#showBusy(boolean) |
428 | 401 |
*/ |
429 | 402 |
/** {@inheritDoc} */ |
... | ... | |
450 | 423 |
if(o instanceof LoginManager){ |
451 | 424 |
refresh(); |
452 | 425 |
} |
453 |
|
|
426 |
|
|
454 | 427 |
} |
455 | 428 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java | ||
---|---|---|
2 | 2 |
// $Id$ |
3 | 3 |
/** |
4 | 4 |
* Copyright (C) 2007 EDIT |
5 |
* European Distributed Institute of Taxonomy
|
|
5 |
* European Distributed Institute of Taxonomy |
|
6 | 6 |
* http://www.e-taxonomy.eu |
7 |
*
|
|
7 |
* |
|
8 | 8 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
9 | 9 |
* See LICENSE.TXT at the top of this package for the full license terms. |
10 | 10 |
*/ |
... | ... | |
41 | 41 |
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
42 | 42 |
*/ |
43 | 43 |
/** {@inheritDoc} */ |
44 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
45 |
|
|
44 |
@Override |
|
45 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
46 |
|
|
46 | 47 |
ISelection selection = HandlerUtil.getCurrentSelection(event); |
47 |
|
|
48 |
|
|
48 | 49 |
if(selection instanceof StructuredSelection){ |
49 | 50 |
final StructuredSelection structuredSelection = (StructuredSelection) selection; |
50 |
|
|
51 |
|
|
51 | 52 |
if(structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof Classification){ |
52 | 53 |
Classification classification = (Classification) structuredSelection.getFirstElement(); |
53 |
|
|
54 |
|
|
54 | 55 |
NewClassificationWizard classificationWizard = new NewClassificationWizard(); |
55 | 56 |
classificationWizard.init(null, null); |
56 | 57 |
classificationWizard.setEntity(classification); |
57 | 58 |
WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), classificationWizard); |
58 | 59 |
dialog.open(); |
59 |
|
|
60 |
|
|
60 | 61 |
} |
61 | 62 |
else{ |
62 | 63 |
|
63 | 64 |
Job job = new Job("Opening editor") { |
64 |
|
|
65 |
|
|
65 | 66 |
@Override |
66 | 67 |
protected IStatus run(IProgressMonitor monitor) { |
67 | 68 |
for(final Object selectedObject : structuredSelection.toArray()){ |
68 |
|
|
69 |
|
|
69 | 70 |
Display.getDefault().asyncExec(new Runnable(){ |
70 |
|
|
71 |
public void run() { |
|
71 |
|
|
72 |
@Override |
|
73 |
public void run() { |
|
72 | 74 |
NavigationUtil.openEditor(selectedObject); |
73 | 75 |
} |
74 |
|
|
76 |
|
|
75 | 77 |
}); |
76 | 78 |
} |
77 | 79 |
return Status.OK_STATUS; |
78 | 80 |
} |
79 | 81 |
}; |
80 |
|
|
82 |
|
|
81 | 83 |
job.schedule(); |
82 | 84 |
} |
83 | 85 |
} |
84 |
|
|
86 |
|
|
85 | 87 |
return null; |
86 | 88 |
} |
87 | 89 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.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 |
*/ |
... | ... | |
41 | 41 |
import eu.etaxonomy.cdm.model.common.UuidAndTitleCache; |
42 | 42 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
43 | 43 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
44 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
44 | 45 |
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter; |
45 | 46 |
import eu.etaxonomy.taxeditor.model.IContextListener; |
46 | 47 |
import eu.etaxonomy.taxeditor.navigation.NavigationUtil; |
... | ... | |
56 | 57 |
* @version 1.0 |
57 | 58 |
*/ |
58 | 59 |
public class SearchResultView extends ViewPart implements IConversationEnabled{ |
59 |
|
|
60 |
|
|
60 | 61 |
private static Object[] EMPTY = new Object[0]; |
61 |
|
|
62 |
|
|
62 | 63 |
private class ContextListener extends ContextListenerAdapter{ |
63 | 64 |
/* (non-Javadoc) |
64 | 65 |
* @see eu.etaxonomy.taxeditor.model.IContextListener#contextStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor) |
... | ... | |
66 | 67 |
@Override |
67 | 68 |
public void contextStop(IMemento memento, IProgressMonitor monitor) { |
68 | 69 |
monitor.subTask("Getting rid of search results"); |
69 |
NavigationUtil.hideView(SearchResultView.this);
|
|
70 |
AbstractUtility.hideView(SearchResultView.this);
|
|
70 | 71 |
} |
71 | 72 |
} |
72 |
|
|
73 |
|
|
73 | 74 |
/** Constant <code>ID="eu.etaxonomy.taxeditor.navigation.searc"{trunked}</code> */ |
74 |
public static final String ID =
|
|
75 |
public static final String ID = |
|
75 | 76 |
"eu.etaxonomy.taxeditor.navigation.search.searchResultView"; //$NON-NLS-1$ |
76 | 77 |
|
77 | 78 |
private TableViewer resultViewer; |
... | ... | |
85 | 86 |
private Text status; |
86 | 87 |
|
87 | 88 |
private SearchJob searchJob; |
88 |
|
|
89 |
|
|
89 | 90 |
private IContextListener contextListener; |
90 |
|
|
91 |
|
|
91 | 92 |
/* (non-Javadoc) |
92 | 93 |
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) |
93 | 94 |
*/ |
94 | 95 |
/** {@inheritDoc} */ |
95 | 96 |
@Override |
96 | 97 |
public void createPartControl(Composite parent) { |
97 |
|
|
98 |
|
|
98 | 99 |
conversation = CdmStore.createConversation(); |
99 | 100 |
contextListener = new ContextListener(); |
100 | 101 |
CdmStore.getContextManager().addContextListener(contextListener); |
101 |
|
|
102 |
|
|
102 | 103 |
GridLayout layout = new GridLayout(); |
103 | 104 |
layout.marginWidth = 0; |
104 | 105 |
layout.marginHeight = 0; |
105 |
|
|
106 |
|
|
106 | 107 |
parent.setLayout(layout); |
107 |
|
|
108 |
|
|
108 | 109 |
Composite infoComposite = createInfoComposite(parent); |
109 | 110 |
infoComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); |
110 |
|
|
111 |
|
|
111 | 112 |
resultViewer = new TableViewer(parent, SWT.NONE); |
112 | 113 |
resultViewer.setContentProvider(new ArrayContentProvider()); |
113 | 114 |
resultViewer.setLabelProvider(new SearchResultLabelProvider()); |
114 | 115 |
resultViewer.addDoubleClickListener(new IDoubleClickListener() { |
115 |
public void doubleClick(DoubleClickEvent event) { |
|
116 |
@Override |
|
117 |
public void doubleClick(DoubleClickEvent event) { |
|
116 | 118 |
NavigationUtil.executeEditHandler(); |
117 | 119 |
} |
118 | 120 |
}); |
119 |
|
|
121 |
|
|
120 | 122 |
resultViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
121 |
|
|
123 |
|
|
122 | 124 |
getSite().setSelectionProvider(resultViewer); |
123 |
|
|
125 |
|
|
124 | 126 |
// register context menu |
125 | 127 |
MenuManager menuMgr = new MenuManager(); |
126 | 128 |
menuMgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); |
... | ... | |
128 | 130 |
|
129 | 131 |
Control control = resultViewer.getControl(); |
130 | 132 |
Menu menu = menuMgr.createContextMenu(control); |
131 |
control.setMenu(menu);
|
|
133 |
control.setMenu(menu); |
|
132 | 134 |
} |
133 |
|
|
135 |
|
|
134 | 136 |
private Composite createInfoComposite(Composite parent){ |
135 | 137 |
Composite composite = new Composite(parent, SWT.NULL); |
136 |
|
|
138 |
|
|
137 | 139 |
composite.setLayout(new GridLayout(2, false)); |
138 |
|
|
140 |
|
|
139 | 141 |
Label searchStringLabel = new Label(composite, SWT.NULL); |
140 | 142 |
searchStringLabel.setText("Search String:"); |
141 |
|
|
143 |
|
|
142 | 144 |
searchString = new Text(composite, SWT.NULL); |
143 | 145 |
searchString.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
144 | 146 |
searchString.setEditable(false); |
145 | 147 |
// searchString.setText(" "); |
146 |
|
|
148 |
|
|
147 | 149 |
Label configurationDescriptionLabel = new Label(composite, SWT.NULL); |
148 | 150 |
configurationDescriptionLabel.setText("Search for:"); |
149 |
|
|
151 |
|
|
150 | 152 |
configurationLabel = new Text(composite, SWT.WRAP); |
151 | 153 |
configurationLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
152 | 154 |
configurationLabel.setEditable(false); |
153 |
|
|
155 |
|
|
154 | 156 |
Label statusLabel = new Label(composite, SWT.NULL); |
155 | 157 |
statusLabel.setText("Status:"); |
156 |
|
|
158 |
|
|
157 | 159 |
status = new Text(composite, SWT.NULL); |
158 | 160 |
status.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); |
159 | 161 |
status.setEditable(false); |
160 |
|
|
162 |
|
|
161 | 163 |
return composite; |
162 | 164 |
} |
163 |
|
|
165 |
|
|
164 | 166 |
/** |
165 | 167 |
* <p>performSearch</p> |
166 | 168 |
* |
... | ... | |
168 | 170 |
*/ |
169 | 171 |
public void performSearch(IFindTaxaAndNamesConfigurator configurator){ |
170 | 172 |
setPartName("Search: '" + configurator.getTitleSearchString() + "'"); |
171 |
|
|
173 |
|
|
172 | 174 |
searchString.setText(configurator.getTitleSearchString()); |
173 |
|
|
175 |
|
|
174 | 176 |
List<String> includedEntities = new ArrayList<String>(); |
175 |
if(configurator.isDoTaxa()) |
|
176 |
includedEntities.add(SearchOption.TAXON.getLabel()); |
|
177 |
if(configurator.isDoSynonyms()) |
|
178 |
includedEntities.add(SearchOption.SYNONYM.getLabel()); |
|
179 |
if(configurator.isDoNamesWithoutTaxa()) |
|
180 |
includedEntities.add(SearchOption.NAME.getLabel()); |
|
177 |
if(configurator.isDoTaxa()) { |
|
178 |
includedEntities.add(SearchOption.TAXON.getLabel()); |
|
179 |
} |
|
180 |
if(configurator.isDoSynonyms()) { |
|
181 |
includedEntities.add(SearchOption.SYNONYM.getLabel()); |
|
182 |
} |
|
183 |
if(configurator.isDoNamesWithoutTaxa()) { |
|
184 |
includedEntities.add(SearchOption.NAME.getLabel()); |
|
185 |
} |
|
181 | 186 |
if(configurator.isDoTaxaByCommonNames()){ |
182 | 187 |
includedEntities.add(SearchOption.COMMON_NAME.getLabel()); |
183 | 188 |
} |
184 |
|
|
189 |
|
|
185 | 190 |
String includedEntitiesString = ""; |
186 | 191 |
for (int i = 0; i < includedEntities.size(); i++){ |
187 | 192 |
includedEntitiesString += includedEntities.get(i); |
... | ... | |
189 | 194 |
includedEntitiesString += ", "; |
190 | 195 |
} |
191 | 196 |
} |
192 |
|
|
197 |
|
|
193 | 198 |
configurationLabel.setText(includedEntitiesString); |
194 |
|
|
199 |
|
|
195 | 200 |
status.setText("Searching..."); |
196 |
|
|
201 |
|
|
197 | 202 |
searchJob = new SearchJob(Display.getCurrent(), configurator); |
198 | 203 |
searchJob.schedule(); |
199 |
|
|
204 |
|
|
200 | 205 |
} |
201 |
|
|
206 |
|
|
202 | 207 |
/** |
203 | 208 |
* <p>displaySearchResult</p> |
204 | 209 |
* |
... | ... | |
206 | 211 |
*/ |
207 | 212 |
protected void displaySearchResult(List<UuidAndTitleCache<TaxonBase>> result) { |
208 | 213 |
if(result.size() > 0){ |
209 |
resultViewer.setInput(result);
|
|
214 |
resultViewer.setInput(result); |
|
210 | 215 |
status.setText(result.size() + " entities found"); |
211 | 216 |
}else{ |
212 |
resultViewer.setInput(EMPTY);
|
|
217 |
resultViewer.setInput(EMPTY); |
|
213 | 218 |
status.setText("Search returned no results"); |
214 | 219 |
} |
215 | 220 |
} |
... | ... | |
234 | 239 |
* |
235 | 240 |
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. |
236 | 241 |
*/ |
237 |
public ConversationHolder getConversationHolder() { |
|
242 |
@Override |
|
243 |
public ConversationHolder getConversationHolder() { |
|
238 | 244 |
return this.conversation; |
239 | 245 |
} |
240 | 246 |
|
... | ... | |
242 | 248 |
* @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap) |
Also available in: Unified diff
merged trunk into branch