Revision defd0d5c
Added by Patrick Plitzner over 3 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/character/CharacterEditor.java | ||
---|---|---|
178 | 178 |
|
179 | 179 |
structuresTreeEditorComposite = addFeatureTreeEditor(composite); |
180 | 180 |
|
181 |
initFeatureTreeComposite(structuresTreeEditorComposite, |
|
181 |
initFeatureTreeComposite(TermType.Structure, structuresTreeEditorComposite,
|
|
182 | 182 |
new FeatureNodeDragListener(structuresTreeEditorComposite.getViewer()), null, null, null, null); |
183 | 183 |
|
184 | 184 |
structuresTreeEditorComposite.getLabel_title().setText(Messages.CharacterEditor_STRUCTURES); |
... | ... | |
191 | 191 |
composite_1.setLayout(gl_composite_1); |
192 | 192 |
|
193 | 193 |
propertiesTreeEditorComposite = addFeatureTreeEditor(composite_1); |
194 |
initFeatureTreeComposite(propertiesTreeEditorComposite, |
|
194 |
initFeatureTreeComposite(TermType.Property, propertiesTreeEditorComposite,
|
|
195 | 195 |
|
196 | 196 |
new CharacterDragListener(structuresTreeEditorComposite.getViewer(), propertiesTreeEditorComposite.getViewer()), |
197 | 197 |
null, |
... | ... | |
237 | 237 |
}); |
238 | 238 |
|
239 | 239 |
characterTreeEditorComposite = addFeatureTreeEditor(composite_3); |
240 |
initFeatureTreeComposite(characterTreeEditorComposite, new FeatureNodeDragListener(characterTreeEditorComposite.getViewer()), |
|
240 |
initFeatureTreeComposite(TermType.Feature, characterTreeEditorComposite, new FeatureNodeDragListener(characterTreeEditorComposite.getViewer()),
|
|
241 | 241 |
new CharacterDropAdapter(this, characterTreeEditorComposite.getViewer(), sync), |
242 | 242 |
|
243 | 243 |
new Transfer[] {FeatureNodeTransfer.getInstance(), CharacterTransfer.getInstance()}, |
... | ... | |
259 | 259 |
} |
260 | 260 |
|
261 | 261 |
private void initFeatureTreeComposite( |
262 |
TermType termType, |
|
262 | 263 |
FeatureTreeEditorComposite featureTreeEditorComposite, |
263 | 264 |
FeatureNodeDragListener featureNodeDragListener, |
264 | 265 |
FeatureTreeDropAdapter featureNodeDropAdapter, |
... | ... | |
271 | 272 |
featureNodeDropAdapter, |
272 | 273 |
transfers, |
273 | 274 |
viewerSelectionChangedListener, |
274 |
new FeatureTreeChooserListener(featureTreeEditorComposite), |
|
275 |
new FeatureTreeChooserListener(featureTreeEditorComposite, termType),
|
|
275 | 276 |
modifyListener); |
276 | 277 |
} |
277 | 278 |
|
... | ... | |
434 | 435 |
} |
435 | 436 |
|
436 | 437 |
private class FeatureTreeChooserListener extends SelectionAdapter{ |
437 |
FeatureTreeEditorComposite featureTreeEditorComposite; |
|
438 |
private FeatureTreeEditorComposite featureTreeEditorComposite; |
|
439 |
private TermType termType; |
|
438 | 440 |
|
439 |
public FeatureTreeChooserListener(FeatureTreeEditorComposite featureTreeEditorComposite) { |
|
441 |
public FeatureTreeChooserListener(FeatureTreeEditorComposite featureTreeEditorComposite, TermType termType) {
|
|
440 | 442 |
super(); |
441 | 443 |
this.featureTreeEditorComposite = featureTreeEditorComposite; |
444 |
this.termType = termType; |
|
442 | 445 |
} |
443 | 446 |
|
444 | 447 |
@Override |
445 | 448 |
public void widgetSelected(SelectionEvent e) { |
446 |
FeatureTree tree = FeatureTreeSelectionDialog.select(featureTreeEditorComposite.getDisplay().getActiveShell(), //conversation, |
|
447 |
null); |
|
449 |
FeatureTree tree = FeatureTreeSelectionDialog.select(featureTreeEditorComposite.getDisplay().getActiveShell(), null, termType); |
|
448 | 450 |
if(tree!=null){ |
449 | 451 |
featureTreeEditorComposite.setSelectedTree(tree); |
450 | 452 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/FeatureTreeSelectionDialog.java | ||
---|---|---|
19 | 19 |
import org.eclipse.swt.widgets.Shell; |
20 | 20 |
|
21 | 21 |
import eu.etaxonomy.cdm.api.service.IFeatureTreeService; |
22 |
import eu.etaxonomy.cdm.model.common.TermType; |
|
22 | 23 |
import eu.etaxonomy.cdm.model.description.FeatureTree; |
23 | 24 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
24 | 25 |
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard; |
... | ... | |
31 | 32 |
public class FeatureTreeSelectionDialog extends |
32 | 33 |
AbstractFilteredCdmResourceSelectionDialog<FeatureTree> { |
33 | 34 |
|
35 |
private final TermType termType; |
|
36 |
|
|
37 |
public static FeatureTree select(Shell shell, |
|
38 |
FeatureTree featureTree) { |
|
39 |
return select(shell, featureTree, null); |
|
40 |
|
|
41 |
} |
|
34 | 42 |
public static FeatureTree select(Shell shell, |
35 |
FeatureTree featureTree) { |
|
43 |
FeatureTree featureTree, TermType termType) {
|
|
36 | 44 |
FeatureTreeSelectionDialog dialog = new FeatureTreeSelectionDialog(shell, |
37 |
Messages.FeatureTreeSelectionDialog_CHOOSE_TREE, false, featureTree); |
|
45 |
Messages.FeatureTreeSelectionDialog_CHOOSE_TREE, false, featureTree, termType);
|
|
38 | 46 |
return getSelectionFromDialog(dialog); |
39 | 47 |
} |
40 | 48 |
|
41 | 49 |
protected FeatureTreeSelectionDialog(Shell shell, |
42 | 50 |
String title, boolean multi, |
43 |
FeatureTree cdmObject) { |
|
44 |
super(shell, |
|
45 |
title, multi, FeatureTreeSelectionDialog.class.getCanonicalName(), cdmObject);
|
|
51 |
FeatureTree cdmObject, TermType termType) {
|
|
52 |
super(shell, title, multi, FeatureTreeSelectionDialog.class.getCanonicalName(), cdmObject);
|
|
53 |
this.termType = termType;
|
|
46 | 54 |
} |
47 | 55 |
|
48 | 56 |
@Override |
... | ... | |
52 | 60 |
|
53 | 61 |
@Override |
54 | 62 |
protected void callService(String pattern) { |
55 |
model = CdmStore.getService(IFeatureTreeService.class).getUuidAndTitleCache(FeatureTree.class, limitOfInitialElements, pattern);
|
|
63 |
model = CdmStore.getService(IFeatureTreeService.class).getUuidAndTitleCacheByTermType(FeatureTree.class, termType, limitOfInitialElements, pattern);
|
|
56 | 64 |
} |
57 | 65 |
|
58 | 66 |
@Override |
Also available in: Unified diff
ref #8146 Restrict term tree selection by termType