Project

General

Profile

« Previous | Next » 

Revision e6a01da7

Added by Alex Theys over 11 years ago

AT: committing latest changes to the Tax Editor after a first round of Code review

View differences:

.gitattributes
343 343
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java -text
344 344
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInputDataChangeBehaviour.java -text
345 345
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInputFactory.java -text
346
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/UseObjectManager.java -text
346 347
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/ViewerConfiguration.java -text
347 348
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditNewTaxonHandler.java -text
348 349
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenParentHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/UseObjectManager.java
1
package eu.etaxonomy.taxeditor.editor;
2

  
3
import java.net.URI;
4
import java.net.URISyntaxException;
5
import java.util.UUID;
6

  
7
import org.eclipse.core.runtime.IProgressMonitor;
8
import org.eclipse.ui.IMemento;
9

  
10
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
11
import eu.etaxonomy.cdm.api.service.ITermService;
12
import eu.etaxonomy.cdm.api.service.IVocabularyService;
13
import eu.etaxonomy.cdm.model.common.MarkerType;
14
import eu.etaxonomy.cdm.model.common.TermVocabulary;
15
import eu.etaxonomy.cdm.model.description.Feature;
16
import eu.etaxonomy.cdm.model.description.Modifier;
17
import eu.etaxonomy.cdm.model.description.State;
18
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
19
import eu.etaxonomy.taxeditor.store.CdmStore;
20
import eu.etaxonomy.taxeditor.store.StoreUtil;
21

  
22
public class UseObjectManager extends ContextListenerAdapter{
23
	@Override
24
	public void contextRefresh(IProgressMonitor monitor) {
25
		monitor.subTask("Refreshing the Uses View");
26
		StoreUtil.warn(getClass(), "Refreshing Uses View warn");
27
		setupNecessaryItems(monitor);
28
	}
29
	
30
	
31
	@Override
32
	public void contextStart(IMemento memento, IProgressMonitor monitor) {
33
		monitor.subTask("Starting the Uses View");
34
		StoreUtil.warn(getClass(), "Starting Uses View warn");
35
		setupNecessaryItems(monitor);
36
	}
37
	
38
	private void setupNecessaryItems(IProgressMonitor monitor) {
39
		MarkerType existingMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
40
		TermVocabulary<State> stateVocabulary =  (TermVocabulary<State>) CdmStore.getService(IVocabularyService.class).find(UUID.fromString("67430d7c-fd43-4e9d-af5e-d0dca3f74931"));
41
		Feature featureUseRecord = (Feature) CdmStore.getService(ITermService.class).find(UUID.fromString("8125a59d-b4d5-4485-89ea-67306297b599"));
42
		TermVocabulary<Modifier> countryVocabulary =  (TermVocabulary<Modifier>) CdmStore.getService(IVocabularyService.class).find(UUID.fromString("116c51f1-e63a-46f7-a258-e1149a42868b"));
43
		TermVocabulary<Modifier> plantPartVocabulary =  (TermVocabulary<Modifier>) CdmStore.getService(IVocabularyService.class).find(UUID.fromString("369914fe-d54b-4063-99ce-abc81d30ad35"));
44
		TermVocabulary<Modifier> humanGroupVocabulary =  (TermVocabulary<Modifier>) CdmStore.getService(IVocabularyService.class).find(UUID.fromString("ca46cea5-bdf7-438d-9cd8-e2793d2178dc"));
45
		ConversationHolder conversation = CdmStore.createConversation();
46
		if (existingMarkertype == null) {
47
			existingMarkertype = MarkerType.NewInstance("use", "use", null);
48
			existingMarkertype.setUuid( UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
49
			TermVocabulary<MarkerType> markerTypeVocabulary = (TermVocabulary<MarkerType>)CdmStore.getService(IVocabularyService.class).find((UUID.fromString("19dffff7-e142-429c-a420-5d28e4ebe305")));
50
			markerTypeVocabulary.addTerm(existingMarkertype);
51
			CdmStore.getService(IVocabularyService.class).saveOrUpdate(markerTypeVocabulary);
52
			conversation.commit(true);
53
		}
54
		if (stateVocabulary == null) {
55
			monitor.subTask("stateVocabulary empty");
56
			URI termSourceUri = null;
57
			try {
58
				termSourceUri = new URI("eu.etaxonomy.cdm.model.description.State");
59
			} catch (URISyntaxException e) {
60
				e.printStackTrace();
61
			}
62
			stateVocabulary = TermVocabulary.NewInstance("Use Category", "Use Category", null, termSourceUri);
63
			stateVocabulary.setUuid(UUID.fromString("67430d7c-fd43-4e9d-af5e-d0dca3f74931"));
64
			State newDummyState = State.NewInstance("Dummy Use Cat", "Dummy Use Cat", null);
65
			State newDummySubCat = State.NewInstance("Dummy Use Sub Cat", "Dummy Use Sub Cat", null);
66
			newDummyState.addIncludes(newDummySubCat);
67
			stateVocabulary.addTerm(newDummyState);
68
			CdmStore.getService(IVocabularyService.class).saveOrUpdate(stateVocabulary);
69
			conversation.commit(true);
70
		}
71
		if (countryVocabulary == null) {
72
			monitor.subTask("countryVocabulary empty");
73
			URI termSourceUri = null;
74
			try {
75
				termSourceUri = new URI("eu.etaxonomy.cdm.model.description.Modifier");
76
			} catch (URISyntaxException e) {
77
				e.printStackTrace();
78
			}
79
			countryVocabulary = TermVocabulary.NewInstance("Country", "Country", null, termSourceUri);
80
			countryVocabulary.setUuid(UUID.fromString("116c51f1-e63a-46f7-a258-e1149a42868b"));
81
			
82
			Modifier newDummyModifier = Modifier.NewInstance("Dummy Country", "Dummy Country", null);
83
			countryVocabulary.addTerm(newDummyModifier);
84
			CdmStore.getService(IVocabularyService.class).saveOrUpdate(countryVocabulary);
85
			conversation.commit(true);
86
		}
87
		if (plantPartVocabulary == null) {
88
			monitor.subTask("plantPartVocabulary empty");
89
			URI termSourceUri = null;
90
			try {
91
				termSourceUri = new URI("eu.etaxonomy.cdm.model.description.Modifier");
92
			} catch (URISyntaxException e) {
93
				e.printStackTrace();
94
			}
95
			plantPartVocabulary = TermVocabulary.NewInstance("Plant Part", "Plant Part", null, termSourceUri);
96
			plantPartVocabulary.setUuid(UUID.fromString("369914fe-d54b-4063-99ce-abc81d30ad35"));
97
			Modifier newDummyModifier = Modifier.NewInstance("Dummy Plant Part", "Dummy Plant Part", null);
98
			plantPartVocabulary.addTerm(newDummyModifier);
99
			CdmStore.getService(IVocabularyService.class).saveOrUpdate(plantPartVocabulary);
100
			conversation.commit(true);
101
		}
102
		if (humanGroupVocabulary == null) {
103
			monitor.subTask("humanGroupVocabulary empty");
104
			URI termSourceUri = null;
105
			try {
106
				termSourceUri = new URI("eu.etaxonomy.cdm.model.description.Modifier");
107
			} catch (URISyntaxException e) {
108
				e.printStackTrace();
109
			}
110
			humanGroupVocabulary = TermVocabulary.NewInstance("Human Group", "Human Group", null, termSourceUri);
111
			humanGroupVocabulary.setUuid(UUID.fromString("ca46cea5-bdf7-438d-9cd8-e2793d2178dc"));
112
			Modifier newDummyModifier = Modifier.NewInstance("Dummy Human Group", "Dummy Human Group", null);
113
			Modifier newSubDummyModifier = Modifier.NewInstance("Dummy Ethnic Group", "Dummy Ethnic Group", null);
114
			newDummyModifier.addIncludes(newSubDummyModifier);
115
			humanGroupVocabulary.addTerm(newDummyModifier);
116
			CdmStore.getService(IVocabularyService.class).saveOrUpdate(humanGroupVocabulary);
117
			conversation.commit(true);
118
		}
119
		if(featureUseRecord == null) {
120
			featureUseRecord = Feature.NewInstance("Use Record", "Use Record", null);
121
			featureUseRecord.setUuid(UUID.fromString("8125a59d-b4d5-4485-89ea-67306297b599"));
122
			featureUseRecord.setSupportsCategoricalData(true);
123
			TermVocabulary<Feature> featureVocabulary = (TermVocabulary<Feature>)CdmStore.getService(IVocabularyService.class).find((UUID.fromString("b187d555-f06f-4d65-9e53-da7c93f8eaa8")));
124
			featureVocabulary.addTerm(featureUseRecord);
125
			CdmStore.getService(IVocabularyService.class).saveOrUpdate(featureVocabulary);
126
			conversation.commit(true);
127
			
128
		}
129
			
130
		
131
		conversation.close();	
132
	}
133
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/internal/TaxeditorEditorPlugin.java
5 5
import org.osgi.framework.BundleContext;
6 6

  
7 7
import eu.etaxonomy.taxeditor.editor.EditorStateManager;
8
import eu.etaxonomy.taxeditor.editor.UseObjectManager;
8 9
import eu.etaxonomy.taxeditor.store.CdmStore;
9 10

  
10 11
/**
......
40 41
		super.start(context);
41 42
		
42 43
		EditorStateManager stateManager = new EditorStateManager();
44
		UseObjectManager useManager = new UseObjectManager();
43 45
		CdmStore.getContextManager().addContextListener(stateManager);
46
		CdmStore.getContextManager().addContextListener(useManager);
44 47
		
45 48
		plugin = this;
46 49
		logger.trace("Plugin started: " + this.getBundle().getSymbolicName());
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java
29 29
import org.eclipse.ui.IMemento;
30 30
import org.eclipse.ui.IWorkbenchActionConstants;
31 31
import org.eclipse.ui.IWorkbenchPart;
32
import org.springframework.transaction.PlatformTransactionManager;
33
import org.springframework.transaction.TransactionStatus;
34
import org.springframework.transaction.support.DefaultTransactionDefinition;
35 32

  
33
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
34
import eu.etaxonomy.cdm.api.service.ITermService;
35
import eu.etaxonomy.cdm.api.service.IVocabularyService;
36 36
import eu.etaxonomy.cdm.model.common.CdmBase;
37
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
38 37
import eu.etaxonomy.cdm.model.common.MarkerType;
39 38
import eu.etaxonomy.cdm.model.common.TermVocabulary;
40
import eu.etaxonomy.cdm.model.common.VocabularyEnum;
41 39
import eu.etaxonomy.cdm.model.description.DescriptionBase;
42 40
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
43 41
import eu.etaxonomy.cdm.model.description.Feature;
44 42
import eu.etaxonomy.cdm.model.description.Modifier;
45 43
import eu.etaxonomy.cdm.model.description.State;
46 44
import eu.etaxonomy.cdm.model.description.TaxonDescription;
47
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
48
import eu.etaxonomy.cdm.api.service.IDescriptionService;
49
import eu.etaxonomy.cdm.api.service.IMarkerService;
50
import eu.etaxonomy.cdm.api.service.ITermService;
51
import eu.etaxonomy.cdm.api.service.IVocabularyService;
52 45
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
53 46
import eu.etaxonomy.taxeditor.editor.EditorUtil;
54 47
import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
55
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
56
import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;
57 48
import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;
58
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDragListener;
59
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDropAdapter;
60 49
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer;
61
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveContentProvider;
62
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveLabelProvider;
63
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewerSorter;
64 50
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
65 51
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
66 52
import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
......
68 54
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
69 55
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
70 56
import eu.etaxonomy.taxeditor.model.ImageResources;
71
import eu.etaxonomy.taxeditor.newWizard.NewInstitutionWizard;
72
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
73 57
import eu.etaxonomy.taxeditor.store.CdmStore;
74 58
import eu.etaxonomy.taxeditor.store.StoreUtil;
75 59
import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
......
83 67
 * @version 1.0
84 68
 */
85 69
public class UsesViewPart extends AbstractCdmEditorViewPart implements IPartContentHasDetails, IPartContentHasSupplementalData {
70

  
86 71
	
87
	
88
	private class ContextListener extends ContextListenerAdapter{
89
		/* (non-Javadoc)
90
		 * @see eu.etaxonomy.taxeditor.model.IContextListener#contextStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
91
		 */
92
		
93
		@Override
94
		public void contextRefresh(IProgressMonitor monitor) {
95
			monitor.subTask("Refreshing the Uses View");
96
			StoreUtil.warn(getClass(), "Refreshing Uses View warn");
97
			setupNecessaryItems(monitor);
98
		}
99
		
100
		
101
		@Override
102
		public void contextStart(IMemento memento, IProgressMonitor monitor) {
103
			monitor.subTask("Starting the Uses View");
104
			StoreUtil.warn(getClass(), "Starting Uses View warn");
105
			setupNecessaryItems(monitor);
106
			
107
			
108
		}
109
		
110
		private void setupNecessaryItems(IProgressMonitor monitor) {
111
			MarkerType existingMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
112
			TermVocabulary<State> stateVocabulary =  (TermVocabulary<State>) CdmStore.getService(IVocabularyService.class).find(UUID.fromString("67430d7c-fd43-4e9d-af5e-d0dca3f74931"));
113
			Feature featureUseRecord = (Feature) CdmStore.getService(ITermService.class).find(UUID.fromString("8125a59d-b4d5-4485-89ea-67306297b599"));
114
			TermVocabulary<Modifier> countryVocabulary =  (TermVocabulary<Modifier>) CdmStore.getService(IVocabularyService.class).find(UUID.fromString("116c51f1-e63a-46f7-a258-e1149a42868b"));
115
			TermVocabulary<Modifier> plantPartVocabulary =  (TermVocabulary<Modifier>) CdmStore.getService(IVocabularyService.class).find(UUID.fromString("369914fe-d54b-4063-99ce-abc81d30ad35"));
116
			TermVocabulary<Modifier> humanGroupVocabulary =  (TermVocabulary<Modifier>) CdmStore.getService(IVocabularyService.class).find(UUID.fromString("ca46cea5-bdf7-438d-9cd8-e2793d2178dc"));
117
			ConversationHolder conversation = CdmStore.createConversation();
118
			if (existingMarkertype == null) {
119
				existingMarkertype = MarkerType.NewInstance("use", "use", null);
120
				existingMarkertype.setUuid( UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
121
				TermVocabulary<MarkerType> markerTypeVocabulary = (TermVocabulary<MarkerType>)CdmStore.getService(IVocabularyService.class).find((UUID.fromString("19dffff7-e142-429c-a420-5d28e4ebe305")));
122
				markerTypeVocabulary.addTerm(existingMarkertype);
123
				CdmStore.getService(IVocabularyService.class).saveOrUpdate(markerTypeVocabulary);
124
				conversation.commit(true);
125
			}
126
			if (stateVocabulary == null) {
127
				monitor.subTask("stateVocabulary empty");
128
				URI termSourceUri = null;
129
				try {
130
					termSourceUri = new URI("eu.etaxonomy.cdm.model.description.State");
131
				} catch (URISyntaxException e) {
132
					e.printStackTrace();
133
				}
134
				stateVocabulary = TermVocabulary.NewInstance("Use Category", "Use Category", null, termSourceUri);
135
				stateVocabulary.setUuid(UUID.fromString("67430d7c-fd43-4e9d-af5e-d0dca3f74931"));
136
				State newDummyState = State.NewInstance("Dummy Use Cat", "Dummy Use Cat", null);
137
				State newDummySubCat = State.NewInstance("Dummy Use Sub Cat", "Dummy Use Sub Cat", null);
138
				newDummyState.addIncludes(newDummySubCat);
139
				stateVocabulary.addTerm(newDummyState);
140
				CdmStore.getService(IVocabularyService.class).saveOrUpdate(stateVocabulary);
141
				conversation.commit(true);
142
			}
143
			if (countryVocabulary == null) {
144
				monitor.subTask("countryVocabulary empty");
145
				URI termSourceUri = null;
146
				try {
147
					termSourceUri = new URI("eu.etaxonomy.cdm.model.description.Modifier");
148
				} catch (URISyntaxException e) {
149
					e.printStackTrace();
150
				}
151
				countryVocabulary = TermVocabulary.NewInstance("Country", "Country", null, termSourceUri);
152
				countryVocabulary.setUuid(UUID.fromString("116c51f1-e63a-46f7-a258-e1149a42868b"));
153
				
154
				Modifier newDummyModifier = Modifier.NewInstance("Dummy Country", "Dummy Country", null);
155
				countryVocabulary.addTerm(newDummyModifier);
156
				CdmStore.getService(IVocabularyService.class).saveOrUpdate(countryVocabulary);
157
				conversation.commit(true);
158
			}
159
			if (plantPartVocabulary == null) {
160
				monitor.subTask("plantPartVocabulary empty");
161
				URI termSourceUri = null;
162
				try {
163
					termSourceUri = new URI("eu.etaxonomy.cdm.model.description.Modifier");
164
				} catch (URISyntaxException e) {
165
					e.printStackTrace();
166
				}
167
				plantPartVocabulary = TermVocabulary.NewInstance("Plant Part", "Plant Part", null, termSourceUri);
168
				plantPartVocabulary.setUuid(UUID.fromString("369914fe-d54b-4063-99ce-abc81d30ad35"));
169
				Modifier newDummyModifier = Modifier.NewInstance("Dummy Plant Part", "Dummy Plant Part", null);
170
				plantPartVocabulary.addTerm(newDummyModifier);
171
				CdmStore.getService(IVocabularyService.class).saveOrUpdate(plantPartVocabulary);
172
				conversation.commit(true);
173
			}
174
			if (humanGroupVocabulary == null) {
175
				monitor.subTask("humanGroupVocabulary empty");
176
				URI termSourceUri = null;
177
				try {
178
					termSourceUri = new URI("eu.etaxonomy.cdm.model.description.Modifier");
179
				} catch (URISyntaxException e) {
180
					e.printStackTrace();
181
				}
182
				humanGroupVocabulary = TermVocabulary.NewInstance("Human Group", "Human Group", null, termSourceUri);
183
				humanGroupVocabulary.setUuid(UUID.fromString("ca46cea5-bdf7-438d-9cd8-e2793d2178dc"));
184
				Modifier newDummyModifier = Modifier.NewInstance("Dummy Human Group", "Dummy Human Group", null);
185
				Modifier newSubDummyModifier = Modifier.NewInstance("Dummy Ethnic Group", "Dummy Ethnic Group", null);
186
				newDummyModifier.addIncludes(newSubDummyModifier);
187
				humanGroupVocabulary.addTerm(newDummyModifier);
188
				CdmStore.getService(IVocabularyService.class).saveOrUpdate(humanGroupVocabulary);
189
				conversation.commit(true);
190
			}
191
			if(featureUseRecord == null) {
192
				featureUseRecord = Feature.NewInstance("Use Record", "Use Record", null);
193
				featureUseRecord.setUuid(UUID.fromString("8125a59d-b4d5-4485-89ea-67306297b599"));
194
				featureUseRecord.setSupportsCategoricalData(true);
195
				TermVocabulary<Feature> featureVocabulary = (TermVocabulary<Feature>)CdmStore.getService(IVocabularyService.class).find((UUID.fromString("b187d555-f06f-4d65-9e53-da7c93f8eaa8")));
196
				featureVocabulary.addTerm(featureUseRecord);
197
				CdmStore.getService(IVocabularyService.class).saveOrUpdate(featureVocabulary);
198
				conversation.commit(true);
199
				
200
			}
201
				
202
			
203
			conversation.close();	
204
		}
205
	}
72

  
206 73
	
207 74
	public static final String ID = "eu.etaxonomy.taxeditor.editor.view.uses";
208 75
	private TreeViewer viewer;
209 76
	private Map<TaxonDescription, FeatureNodeContainerTree> featureNodeContainerCache = new HashMap<TaxonDescription, FeatureNodeContainerTree>();
210 77
	private ToggleDescriptionAction showAllElementsAction;
211 78
	private ToggleDescriptionAction hideAllElementsAction;
212
	private IContextListener contextListener;
213 79

  
214 80
	private int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
215 81
	
......
224 90
	@Override
225 91
	public void createViewer(Composite parent) {
226 92
		
227
		contextListener = new ContextListener();
228
		CdmStore.getContextManager().addContextListener(contextListener);
229
		
230 93
		viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL
231 94
				| SWT.V_SCROLL | SWT.FULL_SELECTION));
232
				
233 95
		viewer.setContentProvider(new UsesContentProvider(featureNodeContainerCache));
234 96
		//viewer.setContentProvider(new DescriptiveContentProvider(featureNodeContainerCache));
235 97
		
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateTaxonUseOperation.java
2 2

  
3 3
import java.util.HashSet;
4 4
import java.util.Set;
5
import java.util.UUID;
5 6

  
6 7
import org.eclipse.core.commands.ExecutionException;
7 8
import org.eclipse.core.commands.operations.IUndoContext;
......
9 10
import org.eclipse.core.runtime.IProgressMonitor;
10 11
import org.eclipse.core.runtime.IStatus;
11 12

  
13
import eu.etaxonomy.cdm.api.service.ITermService;
12 14
import eu.etaxonomy.cdm.model.common.Marker;
13 15
import eu.etaxonomy.cdm.model.common.MarkerType;
14 16
import eu.etaxonomy.cdm.model.description.Feature;
......
29 31
 */
30 32
public class CreateTaxonUseOperation extends AbstractPostOperation {
31 33
	private TaxonDescription description;
32
	private boolean isImageGallery;
33
	private Set<MarkerType> markerTypes = new HashSet<MarkerType>();
34 34
	private Marker marker;
35 35

  
36 36
	/**
......
58 58
	public CreateTaxonUseOperation(String label, IUndoContext undoContext,
59 59
			Taxon taxon, IPostOperationEnabled postOperationEnabled, boolean isImageGallery) {
60 60
		super(label, undoContext, taxon, postOperationEnabled);
61
		this.isImageGallery  = isImageGallery;
62 61
	}
63 62
	
64 63
	/* (non-Javadoc)
......
71 70
		
72 71
		description = TaxonDescription.NewInstance(taxon);
73 72
		monitor.worked(20);
74
		//this.markerTypes.addAll(CdmStore.getTermManager().getPreferredMarkerTypes());
75
		this.markerTypes.addAll(CdmStore.getTermManager().getPreferredTerms(MarkerType.class));
76
		for (MarkerType markerType : markerTypes) {
77
			if (markerType.getTitleCache().equals("use")) {
78
				marker = Marker.NewInstance(markerType, true);
79
				description.addMarker(marker);
80
			}
81
		}
82
		if(isImageGallery){
83
			description.setImageGallery(isImageGallery);
84
			// add the description element to hold the media elements for this image gallery
85
			TextData element = TextData.NewInstance(Feature.IMAGE());
86
			element.addMedia(Media.NewInstance());
87
			description.addElement(element);
88
		}
73
		MarkerType useMarkerType = (MarkerType) CdmStore.getService(ITermService.class).find(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
74
		marker = Marker.NewInstance(useMarkerType, true);
75
		description.addMarker(marker);
89 76
		monitor.worked(40);
90 77

  
91 78
		return postExecute(description);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/userecords/UseRecordsViewer.java
33 33
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
34 34
import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
35 35
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
36
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
37

  
38

  
36 39

  
37 40

  
38 41
/**
......
103 106
			}
104 107
		} else if (getInput() instanceof DescriptionElementBase) {
105 108
			createUseRecordSection(rootElement);
109
			//TODO Use the code below to move the useRecords view and UseRecordDetailElement into the details view.
110
			DescriptionElementBase desc = ((DescriptionElementBase) getInput()).
106 111

  
107 112
		} else if (getInput() instanceof TermVocabulary) {
108 113
			createTermVocabularySection(rootElement);

Also available in: Unified diff