Revision fadf903a
Added by Patrick Plitzner almost 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.editor; |
|
11 |
|
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.Arrays; |
|
14 |
import java.util.HashSet; |
|
15 |
import java.util.List; |
|
16 |
import java.util.Map; |
|
17 |
import java.util.Set; |
|
18 |
import java.util.UUID; |
|
19 |
|
|
20 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
21 |
import org.eclipse.ui.IEditorInput; |
|
22 |
import org.eclipse.ui.IMemento; |
|
23 |
import org.eclipse.ui.IPersistableElement; |
|
24 |
|
|
25 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
|
26 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
|
27 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
|
28 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
|
29 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
30 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
31 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
|
32 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
|
33 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
34 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
35 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
36 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
37 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
|
38 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
|
39 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
|
40 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
|
41 |
import eu.etaxonomy.taxeditor.model.DataChangeBridge; |
|
42 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
43 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
44 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
45 |
|
|
46 |
|
|
47 |
/** |
|
48 |
* <p>TaxonEditorInput class.</p> |
|
49 |
* |
|
50 |
* @author n.hoffmann |
|
51 |
* @created 19.03.2009 |
|
52 |
* @version 1.0 |
|
53 |
*/ |
|
54 |
public class TaxonEditorInput extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled, IPersistableElement { |
|
55 |
|
|
56 |
private static final String INCORRECT_STATE = Messages.TaxonEditorInput_INCORRECT_STATE; |
|
57 |
|
|
58 |
private final ConversationHolder conversation; |
|
59 |
|
|
60 |
private TaxonNode taxonNode; |
|
61 |
|
|
62 |
private TaxonEditorInputDataChangeBehaviour dataChangeBehavior; |
|
63 |
|
|
64 |
private TaxonBase initiallySelectedTaxonBase; |
|
65 |
|
|
66 |
private enum CdmType { |
|
67 |
TAXON_NODE, |
|
68 |
TAXON_BASE, |
|
69 |
PARENT_TAXON_NODE |
|
70 |
} |
|
71 |
|
|
72 |
private TaxonEditorInput(UUID uuid, CdmType type) { |
|
73 |
super(true); |
|
74 |
this.conversation = CdmStore.createConversation(); |
|
75 |
switch(type) { |
|
76 |
case PARENT_TAXON_NODE: |
|
77 |
initForParentTaxonNode(uuid); |
|
78 |
break; |
|
79 |
case TAXON_BASE: |
|
80 |
initForTaxonBase(uuid); |
|
81 |
break; |
|
82 |
case TAXON_NODE: |
|
83 |
initForTaxonNode(uuid); |
|
84 |
break; |
|
85 |
} |
|
86 |
} |
|
87 |
|
|
88 |
private void init(TaxonNode taxonNode) { |
|
89 |
this.taxonNode = taxonNode; |
|
90 |
} |
|
91 |
|
|
92 |
|
|
93 |
/** |
|
94 |
* <p>NewInstance</p> |
|
95 |
* |
|
96 |
* @param taxonNodeUuid a {@link java.util.UUID} object. |
|
97 |
* @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object. |
|
98 |
* @throws java.lang.Exception if any. |
|
99 |
*/ |
|
100 |
private void initForTaxonNode(UUID taxonNodeUuid) { |
|
101 |
|
|
102 |
|
|
103 |
TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, getTaxonNodePropertyPaths()); |
|
104 |
|
|
105 |
if(taxonNode == null){ |
|
106 |
MessagingUtils.warningDialog(Messages.TaxonEditorInput_NOT_IMPLEMENTED, TaxonEditorInput.class, Messages.TaxonEditorInput_NOT_IMPLEMENTED_MESSAGE); |
|
107 |
} |
|
108 |
init(taxonNode); |
|
109 |
|
|
110 |
} |
|
111 |
|
|
112 |
private void initForTaxonBase(UUID taxonBaseUuid) { |
|
113 |
TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid, getTaxonBasePropertyPaths()); |
|
114 |
if (taxonBase != null){ |
|
115 |
if(taxonBase.isInstanceOf(Taxon.class)){ |
|
116 |
Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class); |
|
117 |
|
|
118 |
if (taxon.getTaxonNodes().size() == 0 && taxon.isMisapplication()){ |
|
119 |
// TODO get accepted taxon |
|
120 |
MessagingUtils.info(Messages.TaxonEditorInput_OPEN_MISSAPPLIED_NAME); |
|
121 |
|
|
122 |
Set<Taxon> acceptedTaxa = new HashSet<Taxon>(); |
|
123 |
Set<TaxonRelationship> relations = taxon.getRelationsFromThisTaxon(); |
|
124 |
for(TaxonRelationship relation : relations){ |
|
125 |
if(relation.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){ |
|
126 |
acceptedTaxa.add(relation.getToTaxon()); |
|
127 |
} |
|
128 |
} |
|
129 |
setInputForMultipleTaxa(conversation, acceptedTaxa); |
|
130 |
|
|
131 |
}else{ |
|
132 |
setInputForMultipleNodes(conversation, taxon.getTaxonNodes()); |
|
133 |
} |
|
134 |
}else if(taxonBase instanceof Synonym){ |
|
135 |
Synonym synonym = (Synonym) taxonBase; |
|
136 |
|
|
137 |
Set<Taxon> taxa = new HashSet<>(); |
|
138 |
Taxon taxon = synonym.getAcceptedTaxon(); |
|
139 |
if (taxon != null){ |
|
140 |
taxa.add(taxon); |
|
141 |
} |
|
142 |
setInputForMultipleTaxa(conversation, taxa); |
|
143 |
} |
|
144 |
} |
|
145 |
} |
|
146 |
|
|
147 |
|
|
148 |
/** |
|
149 |
* <p>NewEmptyInstance</p> |
|
150 |
* |
|
151 |
* @param parentNodeUuid a {@link java.util.UUID} object. |
|
152 |
* @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object. |
|
153 |
*/ |
|
154 |
private void initForParentTaxonNode(UUID parentNodeUuid){ |
|
155 |
|
|
156 |
|
|
157 |
TaxonName name = PreferencesUtil.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null); |
|
158 |
ITaxonTreeNode parentNode = CdmStore.getService(IClassificationService.class).getTreeNodeByUuid(parentNodeUuid); |
|
159 |
|
|
160 |
Taxon newTaxon = Taxon.NewInstance(name, parentNode.getReference()); |
|
161 |
TaxonNode newTaxonNode = parentNode.addChildTaxon(newTaxon, parentNode.getReference(), parentNode.getMicroReference()); |
|
162 |
|
|
163 |
// add the new taxon to the editors persistence context |
|
164 |
UUID newTaxonNodeUuid = CdmStore.getService(ITaxonNodeService.class).save(newTaxonNode).getUuid(); |
|
165 |
|
|
166 |
initForTaxonNode(newTaxonNodeUuid); |
|
167 |
} |
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
|
172 |
private void setInputForMultipleNodes(ConversationHolder conversation, Set<TaxonNode> taxonNodes){ |
|
173 |
if(taxonNodes.size() == 1){ |
|
174 |
TaxonNode taxonNode = taxonNodes.iterator().next(); |
|
175 |
init(taxonNode); |
|
176 |
}else if(taxonNodes.size() > 1){ |
|
177 |
TaxonNode taxonNode = ChooseFromMultipleTaxonNodesDialog.choose(taxonNodes); |
|
178 |
if(taxonNode != null){ |
|
179 |
init(taxonNode); |
|
180 |
} |
|
181 |
} else if (taxonNodes.size() == 0) { |
|
182 |
// this is an undesired state |
|
183 |
MessagingUtils.warningDialog(INCORRECT_STATE,TaxonEditorInput.class,Messages.TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION); |
|
184 |
} |
|
185 |
} |
|
186 |
|
|
187 |
private void setInputForMultipleTaxa(ConversationHolder conversation, Set<Taxon> taxa){ |
|
188 |
if(taxa.size() == 1){ |
|
189 |
Taxon taxon = taxa.iterator().next(); |
|
190 |
Set<TaxonNode> nodes = taxon.getTaxonNodes(); |
|
191 |
setInputForMultipleNodes(conversation, nodes); |
|
192 |
}else if(taxa.size() > 1){ |
|
193 |
Set<TaxonNode> taxonNodes = new HashSet<TaxonNode>(); |
|
194 |
for ( Taxon taxon : taxa ){ |
|
195 |
taxonNodes.addAll(taxon.getTaxonNodes()); |
|
196 |
} |
|
197 |
setInputForMultipleNodes(conversation, taxonNodes); |
|
198 |
}else if(taxa.size() == 0){ |
|
199 |
// this is an undesired state |
|
200 |
MessagingUtils.warningDialog(INCORRECT_STATE, TaxonEditorInput.class, Messages.TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT); |
|
201 |
} |
|
202 |
} |
|
203 |
|
|
204 |
/** |
|
205 |
* <p>NewInstance</p> |
|
206 |
* |
|
207 |
* @param taxonNodeUuid a {@link java.util.UUID} object. |
|
208 |
* @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object. |
|
209 |
* @throws java.lang.Exception if any. |
|
210 |
*/ |
|
211 |
public static TaxonEditorInput NewInstance(UUID taxonNodeUuid) throws Exception { |
|
212 |
return new TaxonEditorInput(taxonNodeUuid, CdmType.TAXON_NODE); |
|
213 |
|
|
214 |
} |
|
215 |
|
|
216 |
/** |
|
217 |
* <p>NewInstanceFromTaxonBase</p> |
|
218 |
* |
|
219 |
* @param taxonBaseUuid a {@link java.util.UUID} object. |
|
220 |
* @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object. |
|
221 |
*/ |
|
222 |
public static TaxonEditorInput NewInstanceFromTaxonBase(UUID taxonBaseUuid){ |
|
223 |
return new TaxonEditorInput(taxonBaseUuid, CdmType.TAXON_BASE); |
|
224 |
} |
|
225 |
|
|
226 |
|
|
227 |
/** |
|
228 |
* <p>NewEmptyInstance</p> |
|
229 |
* |
|
230 |
* @param parentNodeUuid a {@link java.util.UUID} object. |
|
231 |
* @return a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object. |
|
232 |
*/ |
|
233 |
public static TaxonEditorInput NewEmptyInstance(UUID parentNodeUuid){ |
|
234 |
return new TaxonEditorInput(parentNodeUuid, CdmType.PARENT_TAXON_NODE); |
|
235 |
} |
|
236 |
|
|
237 |
/* (non-Javadoc) |
|
238 |
* @see org.eclipse.ui.IEditorInput#exists() |
|
239 |
*/ |
|
240 |
/** |
|
241 |
* <p>exists</p> |
|
242 |
* |
|
243 |
* @return a boolean. |
|
244 |
*/ |
|
245 |
@Override |
|
246 |
public boolean exists() { |
|
247 |
return taxonNode != null; |
|
248 |
} |
|
249 |
|
|
250 |
/* (non-Javadoc) |
|
251 |
* @see org.eclipse.ui.IEditorInput#getImageDescriptor() |
|
252 |
*/ |
|
253 |
/** |
|
254 |
* <p>getImageDescriptor</p> |
|
255 |
* |
|
256 |
* @return a {@link org.eclipse.jface.resource.ImageDescriptor} object. |
|
257 |
*/ |
|
258 |
@Override |
|
259 |
public ImageDescriptor getImageDescriptor() { |
|
260 |
return null; |
|
261 |
} |
|
262 |
|
|
263 |
/* (non-Javadoc) |
|
264 |
* @see org.eclipse.ui.IEditorInput#getName() |
|
265 |
*/ |
|
266 |
/** |
|
267 |
* <p>getName</p> |
|
268 |
* |
|
269 |
* @return a {@link java.lang.String} object. |
|
270 |
*/ |
|
271 |
@Override |
|
272 |
public String getName() { |
|
273 |
if(getTaxon() == null){ |
|
274 |
return null; |
|
275 |
} |
|
276 |
TaxonName name = getTaxon().getName(); |
|
277 |
if (name == null || name.getTitleCache() == null) { |
|
278 |
return Messages.TaxonEditorInput_NEW_TAXON; |
|
279 |
} else { |
|
280 |
return name.getTitleCache(); |
|
281 |
} |
|
282 |
} |
|
283 |
|
|
284 |
/* (non-Javadoc) |
|
285 |
* @see org.eclipse.ui.IEditorInput#getPersistable() |
|
286 |
*/ |
|
287 |
/** |
|
288 |
* <p>getPersistable</p> |
|
289 |
* |
|
290 |
* @return a {@link org.eclipse.ui.IPersistableElement} object. |
|
291 |
*/ |
|
292 |
@Override |
|
293 |
public IPersistableElement getPersistable() { |
|
294 |
// if(CdmStore.isActive()){ |
|
295 |
// TaxonNode test = CdmStore.getTaxonTreeService().getTaxonNodeByUuid(taxonNode.getUuid()); |
|
296 |
// boolean isPersistable = CdmStore.getTaxonTreeService().getTaxonNodeByUuid(taxonNode.getUuid()) != null; |
|
297 |
// if (isPersistable) { |
|
298 |
// return this; |
|
299 |
// } |
|
300 |
// } |
|
301 |
return null; |
|
302 |
} |
|
303 |
|
|
304 |
/* (non-Javadoc) |
|
305 |
* @see org.eclipse.ui.IEditorInput#getToolTipText() |
|
306 |
*/ |
|
307 |
/** |
|
308 |
* <p>getToolTipText</p> |
|
309 |
* |
|
310 |
* @return a {@link java.lang.String} object. |
|
311 |
*/ |
|
312 |
@Override |
|
313 |
public String getToolTipText() { |
|
314 |
return getName(); |
|
315 |
} |
|
316 |
|
|
317 |
/* (non-Javadoc) |
|
318 |
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) |
|
319 |
*/ |
|
320 |
/** {@inheritDoc} */ |
|
321 |
@Override |
|
322 |
public Object getAdapter(Class adapter) { |
|
323 |
|
|
324 |
if (adapter == Taxon.class) { |
|
325 |
return getTaxon(); |
|
326 |
} |
|
327 |
|
|
328 |
if (adapter == TaxonNode.class) { |
|
329 |
return taxonNode; |
|
330 |
} |
|
331 |
|
|
332 |
return null; |
|
333 |
} |
|
334 |
|
|
335 |
/** |
|
336 |
* {@inheritDoc} |
|
337 |
* |
|
338 |
* Overrides equals to ensure that a taxon can only be edited by |
|
339 |
* one editor at a time. |
|
340 |
*/ |
|
341 |
@Override |
|
342 |
public boolean equals(Object obj) { |
|
343 |
if (TaxonEditorInput.class.equals(obj.getClass()) |
|
344 |
&& getTaxon() != null |
|
345 |
&& getTaxon().equals(((TaxonEditorInput) obj).getTaxon())) { |
|
346 |
if (((TaxonEditorInput) obj).getInitiallySelectedTaxonBase() != null){ |
|
347 |
setInitiallySelectedTaxonBase(((TaxonEditorInput) obj).getInitiallySelectedTaxonBase()); |
|
348 |
} |
|
349 |
return true; |
|
350 |
} |
|
351 |
return false; |
|
352 |
} |
|
353 |
|
|
354 |
/** |
|
355 |
* <p>getTaxon</p> |
|
356 |
* |
|
357 |
* @return the taxon |
|
358 |
*/ |
|
359 |
public Taxon getTaxon(){ |
|
360 |
Taxon taxon = CdmBase.deproxy(taxonNode.getTaxon(), Taxon.class); |
|
361 |
return taxon; |
|
362 |
} |
|
363 |
|
|
364 |
/** |
|
365 |
* <p>Getter for the field <code>taxonNode</code>.</p> |
|
366 |
* |
|
367 |
* @return the taxonNode |
|
368 |
*/ |
|
369 |
public TaxonNode getTaxonNode() { |
|
370 |
return taxonNode; |
|
371 |
} |
|
372 |
|
|
373 |
/* |
|
374 |
* (non-Javadoc) |
|
375 |
* @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder() |
|
376 |
*/ |
|
377 |
/** |
|
378 |
* <p>getConversationHolder</p> |
|
379 |
* |
|
380 |
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object. |
|
381 |
*/ |
|
382 |
@Override |
|
383 |
public ConversationHolder getConversationHolder() { |
|
384 |
return conversation; |
|
385 |
} |
|
386 |
|
|
387 |
/* |
|
388 |
* (non-Javadoc) |
|
389 |
* @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmCrudEvent) |
|
390 |
*/ |
|
391 |
/** {@inheritDoc} */ |
|
392 |
@Override |
|
393 |
public void update(CdmDataChangeMap events) { |
|
394 |
if(dataChangeBehavior == null){ |
|
395 |
dataChangeBehavior = new TaxonEditorInputDataChangeBehaviour(this); |
|
396 |
} |
|
397 |
|
|
398 |
DataChangeBridge.handleDataChange(events, dataChangeBehavior); |
|
399 |
} |
|
400 |
|
|
401 |
/* (non-Javadoc) |
|
402 |
* @see org.eclipse.ui.IPersistableElement#getFactoryId() |
|
403 |
*/ |
|
404 |
/** |
|
405 |
* <p>getFactoryId</p> |
|
406 |
* |
|
407 |
* @return a {@link java.lang.String} object. |
|
408 |
*/ |
|
409 |
@Override |
|
410 |
public String getFactoryId() { |
|
411 |
return TaxonEditorInputFactory.getFactoryId(); |
|
412 |
} |
|
413 |
|
|
414 |
/* (non-Javadoc) |
|
415 |
* @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento) |
|
416 |
*/ |
|
417 |
/** {@inheritDoc} */ |
|
418 |
@Override |
|
419 |
public void saveState(IMemento memento) { |
|
420 |
TaxonEditorInputFactory.saveState(memento, this); |
|
421 |
} |
|
422 |
|
|
423 |
|
|
424 |
/** |
|
425 |
* <p>Setter for the field <code>initiallySelectedTaxonBase</code>.</p> |
|
426 |
* |
|
427 |
* @param taxonBase a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object. |
|
428 |
*/ |
|
429 |
public void setInitiallySelectedTaxonBase(TaxonBase taxonBase) { |
|
430 |
this.initiallySelectedTaxonBase = taxonBase; |
|
431 |
} |
|
432 |
|
|
433 |
/** |
|
434 |
* <p>Getter for the field <code>initiallySelectedTaxonBase</code>.</p> |
|
435 |
* |
|
436 |
* @return a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object. |
|
437 |
*/ |
|
438 |
public TaxonBase getInitiallySelectedTaxonBase() { |
|
439 |
return initiallySelectedTaxonBase; |
|
440 |
} |
|
441 |
|
|
442 |
// @Override |
|
443 |
// public String toString() { |
|
444 |
// return String.format("%s[%s]", this.getClass().getSimpleName(), getTaxon()); |
|
445 |
// } |
|
446 |
|
|
447 |
|
|
448 |
/* (non-Javadoc) |
|
449 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities() |
|
450 |
*/ |
|
451 |
@Override |
|
452 |
public List<TaxonNode> getRootEntities() { |
|
453 |
return Arrays.asList(taxonNode); |
|
454 |
} |
|
455 |
|
|
456 |
/* (non-Javadoc) |
|
457 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge() |
|
458 |
*/ |
|
459 |
@Override |
|
460 |
public void merge() { |
|
461 |
CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true); |
|
462 |
|
|
463 |
} |
|
464 |
|
|
465 |
@Override |
|
466 |
public Map<Object, List<String>> getPropertyPathsMap() { |
|
467 |
return null; |
|
468 |
} |
|
469 |
|
|
470 |
private List<String> getTaxonNodePropertyPaths() { |
|
471 |
List<String> taxonNodePropertyPaths = new ArrayList<String>(); |
|
472 |
for(String propertyPath : getTaxonBasePropertyPaths()) { |
|
473 |
taxonNodePropertyPaths.add("taxon." + propertyPath); //$NON-NLS-1$ |
|
474 |
} |
|
475 |
return taxonNodePropertyPaths; |
|
476 |
} |
|
477 |
|
|
478 |
private List<String> getTaxonBasePropertyPaths() { |
|
479 |
List<String> taxonBasePropertyPaths = Arrays.asList(new String[] { |
|
480 |
"sec", //$NON-NLS-1$ |
|
481 |
"createdBy", //$NON-NLS-1$ |
|
482 |
"updatedBy", //$NON-NLS-1$ |
|
483 |
"annotations", //$NON-NLS-1$ |
|
484 |
"markers", //$NON-NLS-1$ |
|
485 |
"credits", //$NON-NLS-1$ |
|
486 |
"extensions", //$NON-NLS-1$ |
|
487 |
"rights", //$NON-NLS-1$ |
|
488 |
"sources", //$NON-NLS-1$ |
|
489 |
"descriptions", //$NON-NLS-1$ |
|
490 |
"relationsToThisTaxon", //$NON-NLS-1$ |
|
491 |
"relationsFromThisTaxon", //$NON-NLS-1$ |
|
492 |
"taxonNodes", //$NON-NLS-1$ |
|
493 |
"descriptions.descriptionElements.feature", //$NON-NLS-1$ |
|
494 |
"descriptions.descriptionElements.area", //$NON-NLS-1$ |
|
495 |
"descriptions.descriptionElements.status", //$NON-NLS-1$ |
|
496 |
"descriptions.markers", //$NON-NLS-1$ |
|
497 |
"name.descriptions", //$NON-NLS-1$ |
|
498 |
"name.typeDesignations", //$NON-NLS-1$ |
|
499 |
"name.status", //$NON-NLS-1$ |
|
500 |
"name.nomenclaturalReference.inReference", //$NON-NLS-1$ |
|
501 |
"name.taxonBases.taxonNodes", //$NON-NLS-1$ |
|
502 |
"name.relationsFromThisName", //$NON-NLS-1$ |
|
503 |
"name.relationsToThisName", //$NON-NLS-1$ |
|
504 |
"name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status", //$NON-NLS-1$ |
|
505 |
"name.homotypicalGroup.typifiedNames.relationsToThisName.fromName", //$NON-NLS-1$ |
|
506 |
"synonymRelations.synonym.name.status.type", //$NON-NLS-1$ |
|
507 |
"synonymRelations.synonym.name.relationsToThisName.fromName", //$NON-NLS-1$ |
|
508 |
"synonymRelations.synonym.name.nomenclaturalReference.inReference.authorship", //$NON-NLS-1$ |
|
509 |
"synonymRelations.synonym.name.nomenclaturalReference.authorship", //$NON-NLS-1$ |
|
510 |
"synonymRelations.synonym.name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations" //$NON-NLS-1$ |
|
511 |
}); |
|
512 |
|
|
513 |
return taxonBasePropertyPaths; |
|
514 |
} |
|
515 |
|
|
516 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInputDataChangeBehaviour.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.editor; |
|
11 |
|
|
12 |
import org.apache.log4j.Logger; |
|
13 |
|
|
14 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
|
15 |
import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour; |
|
16 |
|
|
17 |
/** |
|
18 |
* <p>TaxonEditorInputDataChangeBehaviour class.</p> |
|
19 |
* |
|
20 |
* @author n.hoffmann |
|
21 |
* @created Jan 5, 2010 |
|
22 |
* @version 1.0 |
|
23 |
*/ |
|
24 |
public class TaxonEditorInputDataChangeBehaviour extends |
|
25 |
AbstractDataChangeBehaviour { |
|
26 |
private static final Logger logger = Logger |
|
27 |
.getLogger(TaxonEditorInputDataChangeBehaviour.class); |
|
28 |
|
|
29 |
private TaxonEditorInput source; |
|
30 |
|
|
31 |
/** |
|
32 |
* <p>Constructor for TaxonEditorInputDataChangeBehaviour.</p> |
|
33 |
* |
|
34 |
* @param taxonEditorInput a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object. |
|
35 |
*/ |
|
36 |
public TaxonEditorInputDataChangeBehaviour(TaxonEditorInput taxonEditorInput) { |
|
37 |
source = taxonEditorInput; |
|
38 |
} |
|
39 |
|
|
40 |
/* (non-Javadoc) |
|
41 |
* @see eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour#reactOnDataChange(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap) |
|
42 |
*/ |
|
43 |
/** {@inheritDoc} */ |
|
44 |
@Override |
|
45 |
public void reactOnDataChange(CdmDataChangeMap events) { |
|
46 |
source.update(events); |
|
47 |
|
|
48 |
} |
|
49 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInputFactory.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.editor; |
|
11 |
|
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
import org.eclipse.core.runtime.IAdaptable; |
|
15 |
import org.eclipse.ui.IElementFactory; |
|
16 |
import org.eclipse.ui.IMemento; |
|
17 |
|
|
18 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
|
19 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
|
20 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
21 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
22 |
|
|
23 |
|
|
24 |
/** |
|
25 |
* <p>TaxonEditorInputFactory class.</p> |
|
26 |
* |
|
27 |
* @author p.ciardelli |
|
28 |
* @created 23.04.2009 |
|
29 |
* @version 1.0 |
|
30 |
*/ |
|
31 |
public class TaxonEditorInputFactory implements IElementFactory { |
|
32 |
|
|
33 |
/** |
|
34 |
* Factory id. The workbench plug-in registers a factory by this name |
|
35 |
* with the "org.eclipse.ui.elementFactories" extension point. |
|
36 |
*/ |
|
37 |
private static final String ID_FACTORY = "eu.etaxonomy.taxeditor.editor.name.taxonEditorInputFactory"; //$NON-NLS-1$ |
|
38 |
|
|
39 |
/** |
|
40 |
* Tag for the IFile.fullPath of the file resource. |
|
41 |
*/ |
|
42 |
private static final String TAXON_NODE_UUID = "uuid"; //$NON-NLS-1$ |
|
43 |
|
|
44 |
/* (non-Javadoc) |
|
45 |
* @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento) |
|
46 |
*/ |
|
47 |
/** {@inheritDoc} */ |
|
48 |
public IAdaptable createElement(IMemento memento) { |
|
49 |
// Get the uuid |
|
50 |
String taxonNodeUuid = memento.getString(TAXON_NODE_UUID); |
|
51 |
if(! CdmStore.isActive()){ |
|
52 |
return null; |
|
53 |
} |
|
54 |
if (taxonNodeUuid == null || CdmStore.getService(IClassificationService.class).getTaxonNodeByUuid(UUID.fromString(taxonNodeUuid)) == null) { |
|
55 |
MessagingUtils.warn(this.getClass(), Messages.TaxonEditorInputFactory_NOT_FOUND_TAXON + taxonNodeUuid); |
|
56 |
return null; |
|
57 |
} |
|
58 |
try { |
|
59 |
return TaxonEditorInput.NewInstance(UUID.fromString(taxonNodeUuid)); |
|
60 |
} catch (Exception e) { |
|
61 |
MessagingUtils.warningDialog(Messages.TaxonEditorInputFactory_COULD_NOT_CREATE, TaxonEditorInputFactory.class, e.getMessage()); |
|
62 |
} |
|
63 |
return null; |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* Returns the element factory id for this class. |
|
68 |
* |
|
69 |
* @return the element factory id |
|
70 |
*/ |
|
71 |
public static String getFactoryId() { |
|
72 |
return ID_FACTORY; |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* Saves the state of the given file editor input into the given memento. |
|
77 |
* |
|
78 |
* @param memento the storage area for element state |
|
79 |
* @param input the file editor input |
|
80 |
*/ |
|
81 |
public static void saveState(IMemento memento, TaxonEditorInput input) { |
|
82 |
String uuid = input.getTaxonNode().getUuid().toString(); |
|
83 |
memento.putString(TAXON_NODE_UUID, uuid); |
|
84 |
} |
|
85 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaContentProvider.java | ||
---|---|---|
29 | 29 |
import eu.etaxonomy.cdm.model.occurrence.FieldUnit; |
30 | 30 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; |
31 | 31 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
32 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
|
|
32 |
import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
|
|
33 | 33 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
34 | 34 |
|
35 | 35 |
/** |
... | ... | |
47 | 47 |
@Override |
48 | 48 |
public Object[] getChildren(Object parentElement) { |
49 | 49 |
|
50 |
if (parentElement instanceof TaxonEditorInput || parentElement instanceof Taxon) { |
|
50 |
if (parentElement instanceof TaxonEditorInputE4 || parentElement instanceof Taxon) {
|
|
51 | 51 |
|
52 | 52 |
Taxon taxon = null; |
53 |
if (parentElement instanceof TaxonEditorInput){ |
|
54 |
taxon = ((TaxonEditorInput) parentElement).getTaxon(); |
|
53 |
if (parentElement instanceof TaxonEditorInputE4){
|
|
54 |
taxon = ((TaxonEditorInputE4) parentElement).getTaxon();
|
|
55 | 55 |
} else{ |
56 | 56 |
taxon = HibernateProxyHelper.deproxy(parentElement, Taxon.class); |
57 | 57 |
} |
eu.etaxonomy.taxeditor.navigation/plugin.xml | ||
---|---|---|
31 | 31 |
</menuContribution> |
32 | 32 |
</extension> |
33 | 33 |
<extension |
34 |
point="org.eclipse.ui.navigator.navigatorContent"> |
|
35 |
<navigatorContent |
|
36 |
contentProvider="eu.etaxonomy.taxeditor.navigation.navigator.ClassificationContentProvider" |
|
37 |
id="eu.etaxonomy.taxeditor.navigation.classificationContent" |
|
38 |
labelProvider="eu.etaxonomy.taxeditor.navigation.navigator.ClassificationLabelProvider" |
|
39 |
name="%navigatorContent.name"> |
|
40 |
<triggerPoints> |
|
41 |
<instanceof |
|
42 |
value="eu.etaxonomy.taxeditor.navigation.navigator.Root"> |
|
43 |
</instanceof> |
|
44 |
</triggerPoints> |
|
45 |
<possibleChildren> |
|
46 |
<instanceof |
|
47 |
value="eu.etaxonomy.cdm.model.taxon.TaxonNode"> |
|
48 |
</instanceof> |
|
49 |
</possibleChildren> |
|
50 |
<dropAssistant |
|
51 |
class="eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapterAssistant" |
|
52 |
id="eu.etaxonomy.taxeditor.navigation.navigator.dropassistant"> |
|
53 |
<possibleDropTargets></possibleDropTargets> |
|
54 |
</dropAssistant> |
|
55 |
</navigatorContent> |
|
56 |
<navigatorContent |
|
57 |
contentProvider="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodeContentProvider" |
|
58 |
id="eu.etaxonomy.taxeditor.navigation.taxonNodeContent" |
|
59 |
labelProvider="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodeLabelProvider" |
|
60 |
name="%navigatorContent.name.0"> |
|
61 |
<triggerPoints> |
|
62 |
<or> |
|
63 |
<instanceof |
|
64 |
value="eu.etaxonomy.cdm.model.taxon.TaxonNode"> |
|
65 |
</instanceof> |
|
66 |
<and> |
|
67 |
<instanceof |
|
68 |
value="eu.etaxonomy.cdm.model.taxon.Classification"> |
|
69 |
</instanceof> |
|
70 |
<test |
|
71 |
forcePluginActivation="true" |
|
72 |
property="eu.etaxonomy.taxeditor.propertytests.hasTaxa"> |
|
73 |
</test> |
|
74 |
</and> |
|
75 |
</or> |
|
76 |
</triggerPoints> |
|
77 |
<dropAssistant |
|
78 |
class="eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapterAssistant" |
|
79 |
id="eu.etaxonomy.taxeditor.navigation.navigator.dropassistant"> |
|
80 |
<possibleDropTargets> |
|
81 |
<or> |
|
82 |
<instanceof |
|
83 |
value="eu.etaxonomy.cdm.model.taxon.TaxonNode"> |
|
84 |
</instanceof> |
|
85 |
<instanceof |
|
86 |
value="eu.etaxonomy.cdm.model.taxon.Classification"> |
|
87 |
</instanceof> |
|
88 |
</or> |
|
89 |
</possibleDropTargets> |
|
90 |
</dropAssistant> |
|
91 |
<possibleChildren> |
|
92 |
<instanceof |
|
93 |
value="eu.etaxonomy.cdm.model.taxon.TaxonNode"> |
|
94 |
</instanceof> |
|
95 |
</possibleChildren> |
|
96 |
</navigatorContent> |
|
97 |
<navigatorContent |
|
98 |
activeByDefault="false" |
|
99 |
contentProvider="eu.etaxonomy.taxeditor.navigation.navigator.SynonymContentProvider" |
|
100 |
id="eu.etaxonomy.taxeditor.navigation.synonymContent" |
|
101 |
labelProvider="eu.etaxonomy.taxeditor.navigation.navigator.SynonymLabelProvider" |
|
102 |
name="%navigatorContent.name.1" |
|
103 |
priority="highest"> |
|
104 |
<triggerPoints> |
|
105 |
<and> |
|
106 |
<instanceof |
|
107 |
value="eu.etaxonomy.cdm.model.taxon.TaxonNode"> |
|
108 |
</instanceof> |
|
109 |
<test |
|
110 |
forcePluginActivation="true" |
|
111 |
property="eu.etaxonomy.taxeditor.propertytests.hasSynonyms"> |
|
112 |
</test> |
|
113 |
</and> |
|
114 |
</triggerPoints> |
|
115 |
<possibleChildren> |
|
116 |
<instanceof |
|
117 |
value="eu.etaxonomy.cdm.model.taxon.Synonym"> |
|
118 |
</instanceof> |
|
119 |
</possibleChildren> |
|
120 |
</navigatorContent> |
|
121 |
</extension> |
|
122 |
<extension |
|
123 |
point="org.eclipse.ui.navigator.viewer"> |
|
124 |
<viewer |
|
125 |
viewerId="eu.etaxonomy.taxeditor.navigation.navigator"> |
|
126 |
<popupMenu |
|
127 |
id="eu.etaxonomy.taxeditor.navigation.navigatorpopup"> |
|
128 |
</popupMenu> |
|
129 |
</viewer> |
|
130 |
<viewerContentBinding viewerId="eu.etaxonomy.taxeditor.navigation.navigator"> |
|
131 |
<includes> |
|
132 |
<contentExtension |
|
133 |
pattern="eu.etaxonomy.taxeditor.navigation.classificationContent"> |
|
134 |
</contentExtension> |
|
135 |
<contentExtension pattern="eu.etaxonomy.taxeditor.navigation.taxonNodeContent"/> |
|
136 |
<contentExtension pattern="eu.etaxonomy.taxeditor.navigation.taxonlinkhelper"/> |
|
137 |
<contentExtension |
|
138 |
pattern="eu.etaxonomy.taxeditor.navigation.synonymContent"> |
|
139 |
</contentExtension> |
|
140 |
</includes> |
|
141 |
</viewerContentBinding> |
|
142 |
<dragAssistant |
|
143 |
class="eu.etaxonomy.taxeditor.navigation.navigator.dnd.TaxonNavigatorDragAdapterAssistant" |
|
144 |
viewerId="eu.etaxonomy.taxeditor.navigation.navigator"> |
|
145 |
</dragAssistant> |
|
146 |
</extension> |
|
147 |
<extension |
|
148 |
point="org.eclipse.ui.navigator.linkHelper"> |
|
149 |
<linkHelper |
|
150 |
class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonLinkHelper" |
|
151 |
id="eu.etaxonomy.taxeditor.navigation.taxonlinkhelper"> |
|
152 |
<selectionEnablement> |
|
153 |
<instanceof value="eu.etaxonomy.cdm.model.taxon.TaxonNode"/> |
|
154 |
</selectionEnablement> |
|
155 |
<editorInputEnablement> |
|
156 |
<instanceof value="eu.etaxonomy.taxeditor.editor.TaxonEditorInput"/> |
|
157 |
</editorInputEnablement> |
|
158 |
</linkHelper> |
|
159 |
</extension> |
|
160 |
<extension |
|
161 | 34 |
point="org.eclipse.core.runtime.adapters"> |
162 | 35 |
<factory |
163 | 36 |
adaptableType="org.eclipse.core.internal.resources.Workspace" |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/ClassificationContentProvider.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
|
11 |
|
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
import org.apache.log4j.Logger; |
|
16 |
import org.eclipse.jface.viewers.ITreeContentProvider; |
|
17 |
import org.eclipse.jface.viewers.Viewer; |
|
18 |
|
|
19 |
import eu.etaxonomy.cdm.model.common.ITreeNode; |
|
20 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
21 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
|
22 |
|
|
23 |
/** |
|
24 |
* <p>ClassificationContentProvider class.</p> |
|
25 |
* |
|
26 |
* @author n.hoffmann |
|
27 |
* @created 17.06.2009 |
|
28 |
* @version 1.0 |
|
29 |
*/ |
|
30 |
public class ClassificationContentProvider implements ITreeContentProvider { |
|
31 |
private static final Logger logger = Logger |
|
32 |
.getLogger(ClassificationContentProvider.class); |
|
33 |
|
|
34 |
/* (non-Javadoc) |
|
35 |
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) |
|
36 |
*/ |
|
37 |
/** {@inheritDoc} */ |
|
38 |
public Object[] getChildren(Object parentElement) { |
|
39 |
if (parentElement instanceof Root) { |
|
40 |
return ((Root) parentElement).getParentBeans().toArray(); |
|
41 |
}else if(parentElement instanceof Classification){ |
|
42 |
return ((Classification) parentElement).getChildNodes().toArray(); |
|
43 |
} |
|
44 |
|
|
45 |
|
|
46 |
return new Object[0]; |
|
47 |
} |
|
48 |
|
|
49 |
/* (non-Javadoc) |
|
50 |
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) |
|
51 |
*/ |
|
52 |
/** {@inheritDoc} */ |
|
53 |
public Object getParent(Object element) { |
|
54 |
return null; |
|
55 |
} |
|
56 |
|
|
57 |
/* (non-Javadoc) |
|
58 |
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) |
|
59 |
*/ |
|
60 |
/** {@inheritDoc} */ |
|
61 |
public boolean hasChildren(Object element) { |
|
62 |
return this.getChildren(element).length > 0; |
|
63 |
} |
|
64 |
|
|
65 |
/* (non-Javadoc) |
|
66 |
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) |
|
67 |
*/ |
|
68 |
/** {@inheritDoc} */ |
|
69 |
public Object[] getElements(Object inputElement) { |
|
70 |
return this.getChildren(inputElement); |
|
71 |
} |
|
72 |
|
|
73 |
/* (non-Javadoc) |
|
74 |
* @see org.eclipse.jface.viewers.IContentProvider#dispose() |
|
75 |
*/ |
|
76 |
/** |
|
77 |
* <p>dispose</p> |
|
78 |
*/ |
|
79 |
public void dispose() { |
|
80 |
} |
|
81 |
|
|
82 |
/* (non-Javadoc) |
|
83 |
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) |
|
84 |
*/ |
|
85 |
/** {@inheritDoc} */ |
|
86 |
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
|
87 |
} |
|
88 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/ClassificationLabelProvider.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
|
11 |
|
|
12 |
import org.apache.log4j.Logger; |
|
13 |
import org.eclipse.jface.viewers.ColumnLabelProvider; |
|
14 |
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; |
|
15 |
import org.eclipse.jface.viewers.ILabelProvider; |
|
16 |
import org.eclipse.jface.viewers.StyledString; |
|
17 |
import org.eclipse.swt.graphics.Image; |
|
18 |
import org.eclipse.ui.navigator.IDescriptionProvider; |
|
19 |
|
|
20 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
|
21 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
|
22 |
|
|
23 |
/** |
|
24 |
* <p>ClassificationLabelProvider class.</p> |
|
25 |
* |
|
26 |
* @author n.hoffmann |
|
27 |
* @created 17.06.2009 |
|
28 |
* @version 1.0 |
|
29 |
*/ |
|
30 |
public class ClassificationLabelProvider extends ColumnLabelProvider |
|
31 |
implements ILabelProvider, IDescriptionProvider, IStyledLabelProvider { |
|
32 |
private static final Logger logger = Logger |
|
33 |
.getLogger(ClassificationLabelProvider.class); |
|
34 |
|
|
35 |
/* (non-Javadoc) |
|
36 |
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object) |
|
37 |
*/ |
|
38 |
/** {@inheritDoc} */ |
|
39 |
@Override |
|
40 |
public Image getImage(Object element) { |
|
41 |
return null; |
|
42 |
} |
|
43 |
|
|
44 |
/* (non-Javadoc) |
|
45 |
* @see org.eclipse.jface.viewers.ColumnLabelProvider#getText(java.lang.Object) |
|
46 |
*/ |
|
47 |
/** {@inheritDoc} */ |
|
48 |
@Override |
|
49 |
public String getText(Object element) { |
|
50 |
if(element instanceof Classification){ |
|
51 |
String text = ((Classification) element).getName().getText(); |
|
52 |
return text != null ? text : Messages.ClassificationLabelProvider_UNNAMED_TREE; |
|
53 |
} |
|
54 |
return new String(); |
|
55 |
} |
|
56 |
|
|
57 |
/* (non-Javadoc) |
|
58 |
* @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object) |
|
59 |
*/ |
|
60 |
/** {@inheritDoc} */ |
|
61 |
public String getDescription(Object anElement) { |
|
62 |
if (anElement instanceof Classification) { |
|
63 |
return "Taxonomic Tree: " + ((Classification) anElement).getTitleCache(); //$NON-NLS-1$ |
|
64 |
} |
|
65 |
return null; |
|
66 |
} |
|
67 |
|
|
68 |
/* (non-Javadoc) |
|
69 |
* @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object) |
|
70 |
*/ |
|
71 |
/** {@inheritDoc} */ |
|
72 |
public StyledString getStyledText(Object element) { |
|
73 |
return new StyledString(getText(element), StyledString.DECORATIONS_STYLER); |
|
74 |
} |
|
75 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/SynonymContentProvider.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
|
11 |
|
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.List; |
|
14 |
|
|
15 |
import org.apache.log4j.Logger; |
|
16 |
import org.eclipse.jface.viewers.ITreeContentProvider; |
|
17 |
import org.eclipse.jface.viewers.Viewer; |
|
18 |
|
|
19 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
20 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
21 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
22 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
23 |
|
|
24 |
/** |
|
25 |
* <p>SynonymContentProvider class.</p> |
|
26 |
* |
|
27 |
* @author p.ciardelli |
|
28 |
* @created 02.06.2009 |
|
29 |
* @version 1.0 |
|
30 |
*/ |
|
31 |
public class SynonymContentProvider implements ITreeContentProvider { |
|
32 |
private static final Logger logger = Logger |
|
33 |
.getLogger(SynonymContentProvider.class); |
|
34 |
|
|
35 |
private static final Object[] NO_CHILDREN = new Object[0]; |
|
36 |
|
|
37 |
/** {@inheritDoc} */ |
|
38 |
public Object[] getChildren(Object parentElement) { |
|
39 |
Object[] children = null; |
|
40 |
if (parentElement instanceof Synonym) { |
|
41 |
children = NO_CHILDREN; |
|
42 |
} else if (parentElement instanceof TaxonNode) { |
|
43 |
List<TaxonBase> list = new ArrayList<TaxonBase>(); |
|
44 |
|
|
45 |
Taxon taxon = ((TaxonNode) parentElement).getTaxon(); |
|
46 |
|
|
47 |
for (TaxonBase taxonBase : new IterableSynonymyList(taxon)) { |
|
48 |
if (taxonBase instanceof Synonym) { |
|
49 |
list.add(taxonBase); |
|
50 |
} |
|
51 |
} |
|
52 |
children = list.toArray(); |
|
53 |
} |
|
54 |
return children != null ? children : NO_CHILDREN; |
|
55 |
} |
|
56 |
|
|
57 |
/** {@inheritDoc} */ |
|
58 |
public Object getParent(Object element) { |
|
59 |
return null; |
|
60 |
} |
|
61 |
|
|
62 |
/** {@inheritDoc} */ |
|
63 |
public boolean hasChildren(Object element) { |
|
64 |
return this.getChildren(element).length > 0; |
|
65 |
} |
|
66 |
|
|
67 |
/** {@inheritDoc} */ |
|
68 |
public Object[] getElements(Object inputElement) { |
|
69 |
return this.getChildren(inputElement); |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* <p>dispose</p> |
|
74 |
*/ |
|
75 |
public void dispose() { |
|
76 |
} |
|
77 |
|
|
78 |
/** {@inheritDoc} */ |
|
79 |
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
|
80 |
} |
|
81 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/SynonymLabelProvider.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
|
11 |
|
|
12 |
import org.apache.log4j.Logger; |
|
13 |
import org.eclipse.jface.viewers.ColumnLabelProvider; |
|
14 |
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; |
|
15 |
import org.eclipse.jface.viewers.ILabelProvider; |
|
16 |
import org.eclipse.jface.viewers.StyledString; |
|
17 |
import org.eclipse.swt.graphics.Image; |
|
18 |
import org.eclipse.ui.navigator.IDescriptionProvider; |
|
19 |
|
|
20 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author p.ciardelli |
|
24 |
* @created 02.06.2009 |
|
25 |
* @version 1.0 |
|
26 |
*/ |
|
27 |
/** |
|
28 |
* <p>SynonymLabelProvider class.</p> |
|
29 |
* |
|
30 |
* @author p.ciardelli |
|
31 |
* @created 04.06.2009 |
|
32 |
* @version 1.0 |
|
33 |
*/ |
|
34 |
public class SynonymLabelProvider extends ColumnLabelProvider |
|
35 |
implements ILabelProvider, IDescriptionProvider, IStyledLabelProvider { |
|
36 |
private static final Logger logger = Logger |
|
37 |
.getLogger(SynonymLabelProvider.class); |
|
38 |
|
|
39 |
/** {@inheritDoc} */ |
|
40 |
public Image getImage(Object element) { |
|
41 |
return null; |
|
42 |
} |
|
43 |
|
|
44 |
/** {@inheritDoc} */ |
|
45 |
public String getText(Object element) { |
|
46 |
if (element instanceof Synonym && |
|
47 |
((Synonym) element).getName() != null) { |
|
48 |
|
|
49 |
return "= " + ((Synonym) element).getName().getTitleCache(); //$NON-NLS-1$ |
|
50 |
} |
|
51 |
return new String(); |
|
52 |
} |
|
53 |
|
|
54 |
/* (non-Javadoc) |
|
55 |
* @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object) |
|
56 |
*/ |
|
57 |
/** {@inheritDoc} */ |
|
58 |
public String getDescription(Object anElement) { |
|
59 |
if (anElement instanceof Synonym) { |
|
60 |
Synonym data = (Synonym) anElement; |
|
61 |
return "Synonym: " + data.getTitleCache(); //$NON-NLS-1$ |
|
62 |
} |
|
63 |
return null; |
|
64 |
} |
|
65 |
|
|
66 |
/* (non-Javadoc) |
|
67 |
* @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object) |
|
68 |
*/ |
|
69 |
/** {@inheritDoc} */ |
|
70 |
public StyledString getStyledText(Object element) { |
|
71 |
return new StyledString(getText(element), StyledString.QUALIFIER_STYLER); |
|
72 |
} |
|
73 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonLinkHelper.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2007 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
|
|
10 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
|
11 |
|
|
12 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
13 |
import org.eclipse.jface.viewers.StructuredSelection; |
|
14 |
import org.eclipse.ui.IEditorInput; |
|
15 |
import org.eclipse.ui.IWorkbenchPage; |
|
16 |
import org.eclipse.ui.navigator.ILinkHelper; |
|
17 |
|
|
18 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
19 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; |
|
20 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
21 |
import eu.etaxonomy.taxeditor.navigation.l10n.Messages; |
|
22 |
|
|
23 |
/** |
|
24 |
* When a taxon is open in an editor and this editor has focus, its entry in the |
|
25 |
* navigator's taxonomic tree is selected. |
|
26 |
* |
|
27 |
* @author p.ciardelli |
|
28 |
* @created 03.06.2009 |
|
29 |
* @version 1.0 |
|
30 |
*/ |
|
31 |
public class TaxonLinkHelper implements ILinkHelper { |
|
32 |
|
|
33 |
/** Constant <code>ID="eu.etaxonomy.taxeditor.navigation.taxon"{trunked}</code> */ |
|
34 |
public static final String ID = "eu.etaxonomy.taxeditor.navigation.taxonlinkhelper"; //$NON-NLS-1$ |
|
35 |
|
|
36 |
/* (non-Javadoc) |
|
37 |
* @see org.eclipse.ui.navigator.ILinkHelper#activateEditor(org.eclipse.ui.IWorkbenchPage, org.eclipse.jface.viewers.IStructuredSelection) |
|
38 |
*/ |
|
39 |
/** {@inheritDoc} */ |
|
40 |
@Override |
|
41 |
public void activateEditor(IWorkbenchPage page, |
|
42 |
IStructuredSelection selection) { |
|
43 |
try { |
|
44 |
if (selection == null || selection.isEmpty()) { |
|
45 |
return; |
|
46 |
} |
|
47 |
// if (selection.getFirstElement() instanceof TaxonNode) { |
|
48 |
// TaxonNode taxonNode = (TaxonNode) selection.getFirstElement(); |
|
49 |
// TaxonEditorInput taxonEditorInput; |
|
50 |
// |
|
51 |
// taxonEditorInput = TaxonEditorInput.NewInstance(taxonNode.getUuid()); |
|
52 |
// |
|
53 |
// IEditorPart editor = null; |
|
54 |
// if ((editor = page.findEditor(taxonEditorInput)) != null) { |
|
55 |
// page.bringToTop(editor); |
|
56 |
// } |
|
57 |
// } |
|
58 |
} catch (Exception e) { |
|
59 |
MessagingUtils.warningDialog(Messages.TaxonLinkHelper_CREATE_FAIL, this, e.getMessage()); |
|
60 |
} |
|
61 |
} |
|
62 |
|
|
63 |
/* (non-Javadoc) |
|
64 |
* @see org.eclipse.ui.navigator.ILinkHelper#findSelection(org.eclipse.ui.IEditorInput) |
|
65 |
*/ |
|
66 |
/** {@inheritDoc} */ |
|
67 |
@Override |
|
68 |
public IStructuredSelection findSelection(IEditorInput editorInput) { |
|
69 |
if (editorInput instanceof TaxonEditorInput) { |
|
70 |
TaxonNode taxonNode = ((TaxonEditorInput) editorInput).getTaxonNode(); |
|
71 |
if (taxonNode != null) { |
|
72 |
return new StructuredSelection(taxonNode); |
|
73 |
} |
|
74 |
} |
|
75 |
return StructuredSelection.EMPTY; |
|
76 |
} |
|
77 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorContentService.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
|
2 |
|
|
3 |
import org.eclipse.ui.internal.navigator.NavigatorContentService; |
|
4 |
import org.eclipse.ui.navigator.INavigatorDnDService; |
|
5 |
|
|
6 |
public class TaxonNavigatorContentService extends NavigatorContentService { |
|
7 |
|
|
8 |
private TaxonNavigatorDnDService navigatorDnDService; |
|
9 |
|
|
10 |
public TaxonNavigatorContentService(String viewerID) { |
|
11 |
super(viewerID); |
|
12 |
|
|
13 |
|
|
14 |
} |
|
15 |
|
|
16 |
public TaxonNavigatorContentService(String aViewerId, |
|
17 |
TaxonNavigatorViewer taxonNavigatorViewer) { |
|
18 |
super(aViewerId, taxonNavigatorViewer); |
|
19 |
getDnDService(); |
|
20 |
} |
|
21 |
|
|
22 |
@Override |
|
23 |
public TaxonNavigatorDnDService getDnDService() { |
|
24 |
if (navigatorDnDService == null) { |
|
25 |
navigatorDnDService = new TaxonNavigatorDnDService(this); |
|
26 |
} |
|
27 |
return navigatorDnDService; |
|
28 |
} |
|
29 |
|
|
30 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDnDService.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
|
2 |
|
|
3 |
import java.util.Arrays; |
|
4 |
import java.util.Comparator; |
|
5 |
import java.util.HashMap; |
|
6 |
import java.util.Iterator; |
|
7 |
import java.util.LinkedHashSet; |
|
8 |
import java.util.Map; |
|
9 |
import java.util.Set; |
|
10 |
|
|
11 |
import org.eclipse.jface.util.LocalSelectionTransfer; |
|
12 |
import org.eclipse.jface.viewers.IStructuredSelection; |
|
13 |
import org.eclipse.swt.dnd.TransferData; |
|
14 |
import org.eclipse.ui.internal.navigator.dnd.CommonDropAdapterDescriptor; |
|
15 |
import org.eclipse.ui.internal.navigator.dnd.CommonDropDescriptorManager; |
|
16 |
import org.eclipse.ui.internal.navigator.extensions.CommonDragAssistantDescriptor; |
|
17 |
import org.eclipse.ui.internal.navigator.extensions.NavigatorViewerDescriptor; |
|
18 |
import org.eclipse.ui.navigator.CommonDragAdapterAssistant; |
|
19 |
import org.eclipse.ui.navigator.CommonDropAdapter; |
|
20 |
import org.eclipse.ui.navigator.CommonDropAdapterAssistant; |
|
21 |
import org.eclipse.ui.navigator.INavigatorContentService; |
|
22 |
import org.eclipse.ui.navigator.INavigatorDnDService; |
|
23 |
|
|
24 |
import eu.etaxonomy.taxeditor.navigation.navigator.dnd.TaxonNavigatorDragAdapterAssistant; |
|
25 |
|
|
26 |
public class TaxonNavigatorDnDService implements INavigatorDnDService { |
|
27 |
private static final CommonDropAdapterAssistant[] NO_ASSISTANTS = new CommonDropAdapterAssistant[0]; |
|
28 |
|
|
29 |
private INavigatorContentService contentService; |
|
30 |
|
|
31 |
private TaxonNavigatorDragAdapterAssistant[] dragAssistants; |
|
32 |
|
|
33 |
private TreeNodeDropAdapter dropAdapter; |
|
34 |
|
|
35 |
private final Map dropAssistants = new HashMap(); |
|
36 |
|
|
37 |
public TaxonNavigatorDnDService(INavigatorContentService contentService){ |
|
38 |
this.contentService = contentService; |
|
39 |
} |
|
40 |
|
|
41 |
|
|
42 |
@Override |
|
43 |
public CommonDragAdapterAssistant[] getCommonDragAssistants() { |
|
44 |
|
|
45 |
return dragAssistants; |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public void bindDragAssistant(CommonDragAdapterAssistant anAssistant) { |
|
50 |
if(dragAssistants == null) |
|
51 |
initializeDragAssistants(); |
|
52 |
TaxonNavigatorDragAdapterAssistant[] newDragAssistants = new TaxonNavigatorDragAdapterAssistant[dragAssistants.length + 1]; |
|
53 |
System.arraycopy(dragAssistants, 0, newDragAssistants, 0, dragAssistants.length); |
|
54 |
newDragAssistants[dragAssistants.length] = (TaxonNavigatorDragAdapterAssistant) anAssistant; |
|
55 |
dragAssistants = newDragAssistants; |
|
56 |
|
|
57 |
} |
|
58 |
|
|
59 |
private void initializeDragAssistants() { |
|
60 |
int i = 0; |
|
61 |
Set dragDescriptors = ((NavigatorViewerDescriptor) contentService |
|
62 |
.getViewerDescriptor()).getDragAssistants(); |
|
63 |
dragAssistants = new TaxonNavigatorDragAdapterAssistant[dragDescriptors |
|
64 |
.size()]; |
|
65 |
for (Iterator iter = dragDescriptors.iterator(); iter.hasNext();) { |
|
66 |
CommonDragAssistantDescriptor descriptor = (CommonDragAssistantDescriptor) iter |
|
67 |
.next(); |
|
68 |
dragAssistants[i++] = (TaxonNavigatorDragAdapterAssistant) descriptor.createDragAssistant(); |
|
69 |
} |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public CommonDropAdapterAssistant[] findCommonDropAdapterAssistants( |
|
74 |
Object aDropTarget, TransferData aTransferType) { |
|
75 |
CommonDropAdapterDescriptor[] descriptors = CommonDropDescriptorManager |
|
76 |
.getInstance().findCommonDropAdapterAssistants(aDropTarget, |
|
77 |
contentService); |
|
78 |
|
|
79 |
if (descriptors.length == 0) { |
|
80 |
return NO_ASSISTANTS; |
|
81 |
} |
|
82 |
|
|
83 |
if (LocalSelectionTransfer.getTransfer().isSupportedType(aTransferType) |
|
84 |
&& LocalSelectionTransfer.getTransfer().getSelection() instanceof IStructuredSelection) { |
|
85 |
return getAssistantsBySelection(descriptors, (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection()); |
|
86 |
} |
|
87 |
return getAssistantsByTransferData(descriptors, aTransferType); |
|
88 |
} |
|
89 |
|
|
90 |
private CommonDropAdapterAssistant[] getAssistantsByTransferData( |
|
91 |
CommonDropAdapterDescriptor[] descriptors, |
|
92 |
TransferData aTransferType) { |
|
93 |
|
|
94 |
Set assistants = new LinkedHashSet(); |
|
95 |
for (int i = 0; i < descriptors.length; i++) { |
|
96 |
CommonDropAdapterAssistant asst = getAssistant(descriptors[i]); |
|
97 |
if (asst.isSupportedType(aTransferType)) { |
|
98 |
assistants.add(asst); |
|
99 |
} |
|
100 |
} |
|
101 |
return sortAssistants((CommonDropAdapterAssistant[]) assistants |
|
102 |
.toArray(new CommonDropAdapterAssistant[assistants.size()])); |
|
103 |
|
|
104 |
} |
|
105 |
|
|
106 |
private CommonDropAdapterAssistant[] getAssistantsBySelection( |
|
107 |
CommonDropAdapterDescriptor[] descriptors, IStructuredSelection aSelection) { |
|
108 |
|
|
109 |
Set assistants = new LinkedHashSet(); |
|
110 |
|
|
111 |
for (int i = 0; i < descriptors.length; i++) { |
|
112 |
if(descriptors[i].areDragElementsSupported(aSelection)) { |
|
113 |
assistants.add(getAssistant(descriptors[i])); |
|
114 |
} |
|
115 |
} |
|
116 |
|
|
117 |
return sortAssistants((CommonDropAdapterAssistant[]) assistants |
|
118 |
.toArray(new CommonDropAdapterAssistant[assistants.size()])); |
|
119 |
} |
|
120 |
|
|
121 |
private CommonDropAdapterAssistant getAssistant( |
|
122 |
CommonDropAdapterDescriptor descriptor) { |
|
123 |
TreeNodeDropAdapterAssistant asst = (TreeNodeDropAdapterAssistant) dropAssistants |
|
124 |
.get(descriptor); |
|
125 |
if (asst != null) { |
|
126 |
return asst; |
|
127 |
} |
|
128 |
synchronized (dropAssistants) { |
|
129 |
asst = (TreeNodeDropAdapterAssistant) dropAssistants.get(descriptor); |
|
130 |
if (asst == null) { |
|
131 |
dropAssistants.put(descriptor, (asst = (TreeNodeDropAdapterAssistant) descriptor |
|
132 |
.createDropAssistant())); |
|
133 |
asst.init(contentService); |
|
134 |
//asst.setCommonDropAdapter(dropAdapter); |
|
135 |
} |
|
136 |
} |
|
137 |
return asst; |
|
138 |
} |
|
139 |
|
|
140 |
|
|
141 |
private CommonDropAdapterAssistant[] sortAssistants(CommonDropAdapterAssistant[] array) { |
|
142 |
Arrays.sort(array, new Comparator() { |
|
143 |
public int compare(Object arg0, Object arg1) { |
|
144 |
CommonDropAdapterAssistant a = (CommonDropAdapterAssistant) arg0; |
|
145 |
CommonDropAdapterAssistant b = (CommonDropAdapterAssistant) arg1; |
|
146 |
// This is to ensure that the navigator resources drop assistant will |
|
147 |
// always be first on the list of drop assistant, if a conflict ever |
|
148 |
// occurs. |
|
149 |
String id = "org.eclipse.ui.navigator.resources."; //$NON-NLS-1$ |
|
150 |
if (a.getClass().getName().startsWith(id)) |
|
151 |
return -1; |
|
152 |
if (b.getClass().getName().startsWith(id)) |
|
153 |
return 1; |
|
154 |
return a.getClass().getName().compareTo(b.getClass().getName()); |
|
155 |
} |
|
156 |
}); |
|
157 |
return array; |
|
158 |
} |
|
159 |
|
|
160 |
@Override |
|
161 |
public CommonDropAdapterAssistant[] findCommonDropAdapterAssistants( |
|
162 |
Object aDropTarget, IStructuredSelection theDragSelection) { |
|
163 |
// TODO Auto-generated method stub |
|
164 |
return null; |
|
165 |
} |
|
166 |
|
|
167 |
public void setDropAdaptor(TreeNodeDropAdapter da) { |
|
168 |
dropAdapter = da; |
|
169 |
} |
|
170 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorViewer.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
|
2 |
|
|
3 |
import org.eclipse.swt.dnd.DND; |
|
4 |
import org.eclipse.swt.dnd.Transfer; |
|
5 |
import org.eclipse.swt.widgets.Composite; |
|
6 |
import org.eclipse.ui.internal.navigator.NavigatorContentService; |
|
7 |
import org.eclipse.ui.internal.navigator.dnd.NavigatorDnDService; |
|
8 |
import org.eclipse.ui.navigator.CommonDragAdapter; |
|
9 |
import org.eclipse.ui.navigator.CommonDropAdapter; |
|
10 |
import org.eclipse.ui.navigator.CommonViewer; |
|
11 |
import org.eclipse.ui.navigator.INavigatorContentService; |
|
12 |
|
|
13 |
import eu.etaxonomy.taxeditor.dnd.transfer.TaxonNodeTransfer; |
|
14 |
|
|
15 |
public class TaxonNavigatorViewer extends CommonViewer { |
|
16 |
|
|
17 |
private NavigatorContentService contentService; |
|
18 |
String viewerId; |
|
19 |
|
Also available in: Unified diff
ref #6913 Remove e3 taxon navigator extensions