Revision d00b84de
Added by Patrick Plitzner over 10 years ago
- added icons for derivate views
- enhanced DerivateViewEditorInput handling
.gitattributes | ||
---|---|---|
10 | 10 |
eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif -text |
11 | 11 |
eu.etaxonomy.taxeditor.application/icons/256color_48x48.ico -text |
12 | 12 |
eu.etaxonomy.taxeditor.application/icons/edit_16x16.gif -text |
13 |
eu.etaxonomy.taxeditor.application/icons/specimen_derivate-16x16-32.gif -text
|
|
13 |
eu.etaxonomy.taxeditor.application/icons/specimen_derivate-16x16-32.png -text
|
|
14 | 14 |
eu.etaxonomy.taxeditor.application/p2.inf -text |
15 | 15 |
eu.etaxonomy.taxeditor.application/plugin.properties -text |
16 | 16 |
eu.etaxonomy.taxeditor.application/plugin.xml -text |
... | ... | |
335 | 335 |
eu.etaxonomy.taxeditor.editor/build.properties -text |
336 | 336 |
eu.etaxonomy.taxeditor.editor/icons/address-book-new.png -text |
337 | 337 |
eu.etaxonomy.taxeditor.editor/icons/camera-photo.png -text |
338 |
eu.etaxonomy.taxeditor.editor/icons/derivate_view-16x16-32.png -text |
|
338 | 339 |
eu.etaxonomy.taxeditor.editor/icons/edit_16x16.gif -text |
339 | 340 |
eu.etaxonomy.taxeditor.editor/icons/emblem-photos.png -text |
340 | 341 |
eu.etaxonomy.taxeditor.editor/icons/leaf_detail.png -text |
... | ... | |
948 | 949 |
eu.etaxonomy.taxeditor.store/icons/alt_window_16.gif -text |
949 | 950 |
eu.etaxonomy.taxeditor.store/icons/alt_window_32.gif -text |
950 | 951 |
eu.etaxonomy.taxeditor.store/icons/applications-office.png -text |
951 |
eu.etaxonomy.taxeditor.store/icons/artwork_derivate-16x16-32.gif -text |
|
952 | 952 |
eu.etaxonomy.taxeditor.store/icons/artwork_derivate-16x16-32.png -text |
953 | 953 |
eu.etaxonomy.taxeditor.store/icons/autonym_no_bg.gif -text |
954 | 954 |
eu.etaxonomy.taxeditor.store/icons/back.gif -text |
... | ... | |
973 | 973 |
eu.etaxonomy.taxeditor.store/icons/debug.gif -text |
974 | 974 |
eu.etaxonomy.taxeditor.store/icons/delete.gif -text |
975 | 975 |
eu.etaxonomy.taxeditor.store/icons/delete_edit.gif -text |
976 |
eu.etaxonomy.taxeditor.store/icons/dna_derivate-16x16-32.gif -text |
|
976 |
eu.etaxonomy.taxeditor.store/icons/derivate_search_view-16x16-32.png -text |
|
977 |
eu.etaxonomy.taxeditor.store/icons/dna_derivate-16x16-32.png -text |
|
977 | 978 |
eu.etaxonomy.taxeditor.store/icons/eclipse.gif -text |
978 | 979 |
eu.etaxonomy.taxeditor.store/icons/edit_16x16.gif -text |
979 | 980 |
eu.etaxonomy.taxeditor.store/icons/edit_16x16.ico -text |
... | ... | |
981 | 982 |
eu.etaxonomy.taxeditor.store/icons/error_co.gif -text |
982 | 983 |
eu.etaxonomy.taxeditor.store/icons/expandAll.jpg -text |
983 | 984 |
eu.etaxonomy.taxeditor.store/icons/export.gif -text |
984 |
eu.etaxonomy.taxeditor.store/icons/fieldunit-16x16-32.gif -text
|
|
985 |
eu.etaxonomy.taxeditor.store/icons/fieldunit-16x16-32.png -text
|
|
985 | 986 |
eu.etaxonomy.taxeditor.store/icons/file_obj.gif -text |
986 | 987 |
eu.etaxonomy.taxeditor.store/icons/filter.gif -text |
987 | 988 |
eu.etaxonomy.taxeditor.store/icons/flat.gif -text |
... | ... | |
1051 | 1052 |
eu.etaxonomy.taxeditor.store/icons/settings.gif -text |
1052 | 1053 |
eu.etaxonomy.taxeditor.store/icons/smartmode_co.gif -text |
1053 | 1054 |
eu.etaxonomy.taxeditor.store/icons/sort.gif -text |
1054 |
eu.etaxonomy.taxeditor.store/icons/specimen_derivate-16x16-32.gif -text
|
|
1055 |
eu.etaxonomy.taxeditor.store/icons/specimen_scan_derivate-16x16-32.gif -text
|
|
1055 |
eu.etaxonomy.taxeditor.store/icons/specimen_derivate-16x16-32.png -text
|
|
1056 |
eu.etaxonomy.taxeditor.store/icons/specimen_scan_derivate-16x16-32.png -text
|
|
1056 | 1057 |
eu.etaxonomy.taxeditor.store/icons/step_done.gif -text |
1057 | 1058 |
eu.etaxonomy.taxeditor.store/icons/swap.gif -text |
1058 | 1059 |
eu.etaxonomy.taxeditor.store/icons/swap2.gif -text |
... | ... | |
1066 | 1067 |
eu.etaxonomy.taxeditor.store/icons/thin_close_view.gif -text |
1067 | 1068 |
eu.etaxonomy.taxeditor.store/icons/thin_max_view.gif -text |
1068 | 1069 |
eu.etaxonomy.taxeditor.store/icons/thin_restore_view.GIF -text |
1069 |
eu.etaxonomy.taxeditor.store/icons/tissue_sample-16x16-32.gif -text
|
|
1070 |
eu.etaxonomy.taxeditor.store/icons/tissue_sample-16x16-32.png -text
|
|
1070 | 1071 |
eu.etaxonomy.taxeditor.store/icons/trash.gif -text |
1071 | 1072 |
eu.etaxonomy.taxeditor.store/icons/tree_icon_small.jpg -text |
1072 | 1073 |
eu.etaxonomy.taxeditor.store/icons/undo.gif -text |
eu.etaxonomy.taxeditor.application/plugin.xml | ||
---|---|---|
38 | 38 |
</perspective> |
39 | 39 |
<perspective |
40 | 40 |
class="eu.etaxonomy.taxeditor.perspective.DerivatePerspective" |
41 |
icon="icons/specimen_derivate-16x16-32.gif"
|
|
41 |
icon="icons/specimen_derivate-16x16-32.png"
|
|
42 | 42 |
id="eu.etaxonomy.taxeditor.application.perspective.derivates" |
43 | 43 |
name="Derivates"> |
44 | 44 |
</perspective> |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/transientServices/TransientOccurenceService.java | ||
---|---|---|
857 | 857 |
return units; |
858 | 858 |
} |
859 | 859 |
|
860 |
/* (non-Javadoc) |
|
861 |
* @see eu.etaxonomy.cdm.api.service.IOccurrenceService#getFieldUnits(eu.etaxonomy.cdm.model.occurrence.DerivedUnit) |
|
862 |
*/ |
|
863 |
@Override |
|
864 |
public Collection<FieldUnit> getFieldUnits(DerivedUnit derivedUnit) { |
|
865 |
return defaultService.getFieldUnits(derivedUnit); |
|
866 |
} |
|
867 |
|
|
860 | 868 |
} |
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
61 | 61 |
<editor |
62 | 62 |
class="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView" |
63 | 63 |
default="false" |
64 |
icon="icons/derivate_view-16x16-32.png" |
|
64 | 65 |
id="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView" |
65 | 66 |
name="Derivate View"> |
66 | 67 |
</editor> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java | ||
---|---|---|
26 | 26 |
import org.eclipse.ui.PartInitException; |
27 | 27 |
import org.eclipse.ui.handlers.HandlerUtil; |
28 | 28 |
|
29 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
29 | 30 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
30 | 31 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit; |
31 | 32 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
... | ... | |
353 | 354 |
if(specimen.isInstanceOf(FieldUnit.class)){ |
354 | 355 |
return (FieldUnit) specimen; |
355 | 356 |
} |
356 |
else if(specimen.isInstanceOf(DerivedUnit.class) && ((DerivedUnit) specimen).getOriginals()!=null){
|
|
357 |
else if(specimen instanceof DerivedUnit && ((DerivedUnit) specimen).getOriginals()!=null){
|
|
357 | 358 |
for(SpecimenOrObservationBase original:((DerivedUnit) specimen).getOriginals()){ |
358 | 359 |
if(original.isInstanceOf(FieldUnit.class)){ |
359 | 360 |
return (FieldUnit) original; |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenDerivateViewHandler.java | ||
---|---|---|
8 | 8 |
import org.eclipse.ui.PartInitException; |
9 | 9 |
import org.eclipse.ui.handlers.HandlerUtil; |
10 | 10 |
|
11 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit; |
|
12 | 11 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
13 | 12 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
14 | 13 |
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput; |
... | ... | |
25 | 24 |
if(currentSelection instanceof IStructuredSelection){ |
26 | 25 |
Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement(); |
27 | 26 |
if(selectedElement instanceof SpecimenOrObservationBase<?>){ |
28 |
FieldUnit fieldUnit = EditorUtil.getFieldUnit((SpecimenOrObservationBase<?>) selectedElement); |
|
29 |
if(fieldUnit==null){ |
|
30 |
AbstractUtility.errorDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open DerivateView. The derivate hierarchy is corrupted!"); |
|
31 |
return null; |
|
32 |
} |
|
33 |
DerivateViewEditorInput input = new DerivateViewEditorInput(fieldUnit); |
|
27 |
|
|
28 |
DerivateViewEditorInput input = new DerivateViewEditorInput((SpecimenOrObservationBase<?>) selectedElement); |
|
34 | 29 |
try { |
35 | 30 |
EditorUtil.open(input); |
36 | 31 |
} catch (PartInitException e) { |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateContentProvider.java | ||
---|---|---|
28 | 28 |
|
29 | 29 |
@Override |
30 | 30 |
public Object[] getElements(Object inputElement) { |
31 |
FieldUnit fieldUnit = null;
|
|
31 |
SpecimenOrObservationBase<?> specimen = null;
|
|
32 | 32 |
if(inputElement instanceof DerivateViewEditorInput){ |
33 |
fieldUnit = ((DerivateViewEditorInput) inputElement).getFieldUnit();
|
|
33 |
inputElement = ((DerivateViewEditorInput) inputElement).getDerivate();
|
|
34 | 34 |
} |
35 |
|
|
35 | 36 |
// return the parent FieldUnit if element is a DerivedUnit |
36 |
else if(inputElement instanceof DerivedUnit){
|
|
37 |
fieldUnit = EditorUtil.getFieldUnit((DerivedUnit)inputElement);
|
|
37 |
if(inputElement instanceof DerivedUnit){ |
|
38 |
specimen = EditorUtil.getFieldUnit((DerivedUnit)inputElement);
|
|
38 | 39 |
} |
39 | 40 |
else if(inputElement instanceof FieldUnit){ |
40 |
fieldUnit = (FieldUnit) inputElement; |
|
41 |
// fieldUnit.getTitleCache(); |
|
41 |
specimen = (FieldUnit) inputElement; |
|
42 | 42 |
} |
43 |
if(fieldUnit!=null){
|
|
44 |
return Collections.singleton(fieldUnit).toArray();
|
|
43 |
if(specimen!=null){
|
|
44 |
return Collections.singleton(specimen).toArray();
|
|
45 | 45 |
} |
46 | 46 |
else { |
47 | 47 |
return Collections.EMPTY_LIST.toArray(); |
... | ... | |
51 | 51 |
@Override |
52 | 52 |
public Object[] getChildren(Object parentElement) { |
53 | 53 |
if(parentElement instanceof DerivateViewEditorInput){ |
54 |
parentElement = ((DerivateViewEditorInput) parentElement).getFieldUnit();
|
|
54 |
parentElement = ((DerivateViewEditorInput) parentElement).getDerivate();
|
|
55 | 55 |
} |
56 |
|
|
56 | 57 |
if(parentElement instanceof SpecimenOrObservationBase){ |
57 | 58 |
return getDerivates((SpecimenOrObservationBase) parentElement).toArray(); |
58 | 59 |
} |
... | ... | |
62 | 63 |
@Override |
63 | 64 |
public Object getParent(Object element) { |
64 | 65 |
if(element instanceof DerivateViewEditorInput){ |
65 |
element = ((DerivateViewEditorInput) element).getFieldUnit();
|
|
66 |
element = ((DerivateViewEditorInput) element).getDerivate();
|
|
66 | 67 |
} |
67 |
if(element instanceof DerivedUnit){ |
|
68 |
|
|
69 |
if(element instanceof FieldUnit){ |
|
70 |
return element; |
|
71 |
} |
|
72 |
else if(element instanceof DerivedUnit){ |
|
68 | 73 |
DerivedUnit derivedUnit = (DerivedUnit)element; |
69 | 74 |
return derivedUnit.getOriginalUnit(); |
70 | 75 |
} |
... | ... | |
74 | 79 |
@Override |
75 | 80 |
public boolean hasChildren(Object element) { |
76 | 81 |
if(element instanceof DerivateViewEditorInput){ |
77 |
element = ((DerivateViewEditorInput) element).getFieldUnit();
|
|
82 |
element = ((DerivateViewEditorInput) element).getDerivate();
|
|
78 | 83 |
} |
84 |
|
|
79 | 85 |
if(element instanceof SpecimenOrObservationBase){ |
80 | 86 |
SpecimenOrObservationBase specimenOrObservation = (SpecimenOrObservationBase)element; |
81 | 87 |
for(DerivationEvent event:(Set<DerivationEvent>)specimenOrObservation.getDerivationEvents()){ |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java | ||
---|---|---|
19 | 19 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
20 | 20 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
21 | 21 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit; |
22 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|
22 | 23 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
23 | 24 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider; |
24 | 25 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
... | ... | |
67 | 68 |
IEditorInput editorInput = getEditorInput(); |
68 | 69 |
viewer.setInput(editorInput); |
69 | 70 |
if(editorInput instanceof DerivateViewEditorInput){ |
71 |
SpecimenOrObservationBase<?> specimen = ((DerivateViewEditorInput) editorInput).getDerivate(); |
|
70 | 72 |
FieldUnit fieldUnit = ((DerivateViewEditorInput) editorInput).getFieldUnit(); |
71 | 73 |
setPartName(fieldUnit.toString()); |
72 |
viewer.setSelection(new StructuredSelection(fieldUnit));
|
|
74 |
viewer.setSelection(new StructuredSelection(specimen));
|
|
73 | 75 |
} |
74 | 76 |
} |
75 | 77 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.taxeditor.editor.view.derivate; |
11 | 11 |
|
12 |
import java.util.Collection; |
|
13 |
|
|
12 | 14 |
import org.eclipse.jface.resource.ImageDescriptor; |
13 | 15 |
import org.eclipse.ui.IEditorInput; |
14 | 16 |
import org.eclipse.ui.IPersistableElement; |
15 | 17 |
|
18 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
|
16 | 19 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit; |
20 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|
21 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
22 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
17 | 23 |
|
18 | 24 |
/** |
25 |
* Editor input for the {@link DerivateView} which holds the currently selected derivate for which |
|
26 |
* the derivate hierarchy should be shown in the DerivateView.<br> |
|
27 |
* It also holds a {@link FieldUnit} which is the root of the hierarchy. (both may be the same object) |
|
19 | 28 |
* @author pplitzner |
20 | 29 |
* @date 25.11.2013 |
21 | 30 |
* |
22 | 31 |
*/ |
23 | 32 |
public class DerivateViewEditorInput implements IEditorInput { |
24 | 33 |
|
25 |
private final FieldUnit fieldUnit; |
|
34 |
/** |
|
35 |
* The selected derivate |
|
36 |
*/ |
|
37 |
private final SpecimenOrObservationBase<?> derivate; |
|
38 |
/** |
|
39 |
* The root of the hierarchy (may be the same object as the derivate) |
|
40 |
*/ |
|
41 |
private FieldUnit fieldUnit; |
|
26 | 42 |
|
27 |
public DerivateViewEditorInput(FieldUnit fieldUnit) { |
|
28 |
//TODO: add current selection to constructor to highlight it in DerivateView |
|
43 |
/** |
|
44 |
* Creates an editor input for the {@link DerivateView} with the currently selected derivate and the |
|
45 |
* corresponding {@link FieldUnit} (both may be the same object). |
|
46 |
* @param derivate the derivate for which the derivate hierarchy should be shown |
|
47 |
* @param fieldUnit the root of the hierarchy |
|
48 |
*/ |
|
49 |
public DerivateViewEditorInput(SpecimenOrObservationBase<?> derivate) { |
|
29 | 50 |
super(); |
30 |
this.fieldUnit = fieldUnit; |
|
51 |
this.derivate = derivate; |
|
52 |
if(derivate instanceof FieldUnit){ |
|
53 |
this.fieldUnit = (FieldUnit) derivate; |
|
54 |
} |
|
55 |
else if(derivate instanceof DerivedUnit){ |
|
56 |
Collection<FieldUnit> fieldUnits = CdmStore.getCurrentApplicationConfiguration().getOccurrenceService().getFieldUnits((DerivedUnit) derivate); |
|
57 |
if(!fieldUnits.isEmpty()){ |
|
58 |
// TODO think about handling multiple parent FieldUnits |
|
59 |
this.fieldUnit = fieldUnits.iterator().next(); |
|
60 |
} |
|
61 |
} |
|
62 |
if(fieldUnit==null){ |
|
63 |
AbstractUtility.errorDialog("Failed initializing editor", DerivateViewEditorInput.class, "No FieldUnit found!"); |
|
64 |
} |
|
31 | 65 |
} |
32 | 66 |
|
33 | 67 |
/* (non-Javadoc) |
... | ... | |
61 | 95 |
*/ |
62 | 96 |
@Override |
63 | 97 |
public String getName() { |
64 |
return fieldUnit.toString();
|
|
98 |
return derivate.toString();
|
|
65 | 99 |
} |
66 | 100 |
|
67 | 101 |
/* (non-Javadoc) |
... | ... | |
77 | 111 |
*/ |
78 | 112 |
@Override |
79 | 113 |
public String getToolTipText() { |
80 |
return fieldUnit.toString(); |
|
114 |
return derivate.toString(); |
|
115 |
} |
|
116 |
|
|
117 |
|
|
118 |
/** |
|
119 |
* @return the specimen |
|
120 |
*/ |
|
121 |
public SpecimenOrObservationBase<?> getDerivate() { |
|
122 |
return derivate; |
|
81 | 123 |
} |
82 | 124 |
|
83 | 125 |
/** |
eu.etaxonomy.taxeditor.store/plugin.xml | ||
---|---|---|
229 | 229 |
</view> |
230 | 230 |
<view |
231 | 231 |
class="eu.etaxonomy.taxeditor.ui.campanula.derivatesearch.DerivateSearchView" |
232 |
icon="icons/derivate_search_view-16x16-32.png" |
|
232 | 233 |
id="eu.etaxonomy.taxeditor.ui.campanula.derivatesearch.DerivateSearchView" |
233 | 234 |
name="Derivate Search" |
234 | 235 |
restorable="true"> |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ImageResources.java | ||
---|---|---|
319 | 319 |
registerImage(registry, LOCK_OPEN_ICON, |
320 | 320 |
"lock_open.png"); |
321 | 321 |
registerImage(registry, DNA_SAMPLE_DERIVATE, |
322 |
"dna_derivate-16x16-32.gif");
|
|
322 |
"dna_derivate-16x16-32.png");
|
|
323 | 323 |
registerImage(registry, FIELD_UNIT, |
324 |
"fieldunit-16x16-32.gif");
|
|
324 |
"fieldunit-16x16-32.png");
|
|
325 | 325 |
registerImage(registry, SPECIMEN_DERIVATE, |
326 |
"specimen_derivate-16x16-32.gif");
|
|
326 |
"specimen_derivate-16x16-32.png");
|
|
327 | 327 |
registerImage(registry, ARTWORK_DERIVATE, |
328 | 328 |
"artwork_derivate-16x16-32.png"); |
329 | 329 |
registerImage(registry, SPECIMEN_SCAN_DERIVATE, |
330 |
"specimen_scan_derivate-16x16-32.gif");
|
|
330 |
"specimen_scan_derivate-16x16-32.png");
|
|
331 | 331 |
registerImage(registry, LIVING_PLANT_PHOTO_DERIVATE, |
332 |
"specimen_scan_derivate-16x16-32.gif");
|
|
332 |
"specimen_scan_derivate-16x16-32.png");
|
|
333 | 333 |
registerImage(registry, TISSUE_SAMPLE_DERIVATE, |
334 |
"tissue_sample-16x16-32.gif");
|
|
334 |
"tissue_sample-16x16-32.png");
|
|
335 | 335 |
} |
336 | 336 |
|
337 | 337 |
private void registerImage(ImageRegistry registry, String key, |
Also available in: Unified diff