Revision 5aeccadc
Added by Katja Luther over 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/FeatureTreeSelectionDialog.java | ||
---|---|---|
13 | 13 |
import java.util.List; |
14 | 14 |
import java.util.UUID; |
15 | 15 |
|
16 |
import org.eclipse.core.runtime.IStatus; |
|
17 |
import org.eclipse.jface.dialogs.InputDialog; |
|
18 |
import org.eclipse.swt.SWT; |
|
19 |
import org.eclipse.swt.widgets.Composite; |
|
20 |
import org.eclipse.swt.widgets.Control; |
|
21 |
import org.eclipse.swt.widgets.Event; |
|
22 |
import org.eclipse.swt.widgets.Link; |
|
23 |
import org.eclipse.swt.widgets.Listener; |
|
24 | 16 |
import org.eclipse.swt.widgets.Shell; |
25 | 17 |
|
26 | 18 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
... | ... | |
71 | 63 |
} |
72 | 64 |
} |
73 | 65 |
|
74 |
/** {@inheritDoc} */ |
|
75 |
@Override |
|
76 |
protected Control createExtendedContentArea(Composite parent) { |
|
77 |
Link link = new Link(parent, SWT.NONE); |
|
78 |
link.setText(getNewWizardLinkText()); |
|
79 |
link.addListener (SWT.Selection, new Listener () { |
|
80 |
@Override |
|
81 |
public void handleEvent(Event event) { |
|
82 |
|
|
83 |
InputDialog input = new InputDialog(getShell(), "New feature tree", "Enter label for new feature tree", null, null); |
|
84 |
int status = input.open(); |
|
85 |
if (status == IStatus.OK) { |
|
86 |
String label = input.getValue(); |
|
87 |
if(label!=null){ |
|
88 |
FeatureTree featureTree = FeatureTree.NewInstance(); |
|
89 |
featureTree.setTitleCache(label, false); |
|
90 |
CdmStore.getService(IFeatureTreeService.class).save(featureTree); |
|
91 |
UuidAndTitleCache<FeatureTree> uuidAndTitleCache = new UuidAndTitleCache<FeatureTree>(FeatureTree.class, featureTree.getUuid(),featureTree.getId(), featureTree.getTitleCache()); |
|
92 |
model.add(uuidAndTitleCache); |
|
93 |
setPattern(featureTree); |
|
94 |
} |
|
95 |
} |
|
96 |
} |
|
97 |
}); |
|
98 |
return link; |
|
99 |
} |
|
66 |
// /** {@inheritDoc} */
|
|
67 |
// @Override
|
|
68 |
// protected Control createExtendedContentArea(Composite parent) {
|
|
69 |
// Link link = new Link(parent, SWT.NONE);
|
|
70 |
// link.setText(getNewWizardLinkText());
|
|
71 |
// link.addListener (SWT.Selection, new Listener () {
|
|
72 |
// @Override
|
|
73 |
// public void handleEvent(Event event) {
|
|
74 |
// |
|
75 |
// InputDialog input = new InputDialog(getShell(), "New feature tree", "Enter label for new feature tree", null, null);
|
|
76 |
// int status = input.open();
|
|
77 |
// if (status == IStatus.OK) {
|
|
78 |
// String label = input.getValue();
|
|
79 |
// if(label!=null){
|
|
80 |
// FeatureTree featureTree = FeatureTree.NewInstance();
|
|
81 |
// featureTree.setTitleCache(label, false);
|
|
82 |
// CdmStore.getService(IFeatureTreeService.class).save(featureTree);
|
|
83 |
// UuidAndTitleCache<FeatureTree> uuidAndTitleCache = new UuidAndTitleCache<FeatureTree>(FeatureTree.class, featureTree.getUuid(),featureTree.getId(), featureTree.getTitleCache());
|
|
84 |
// model.add(uuidAndTitleCache);
|
|
85 |
// setPattern(featureTree);
|
|
86 |
// }
|
|
87 |
// }
|
|
88 |
// }
|
|
89 |
// });
|
|
90 |
// return link;
|
|
91 |
// }
|
|
100 | 92 |
|
101 | 93 |
/** {@inheritDoc} */ |
102 | 94 |
@Override |
103 |
protected String getNewWizardLinkText() {
|
|
104 |
return String.format("Create a new <a>%1s</a>" , "Feature tree ");
|
|
95 |
protected String[] getNewWizardText() {
|
|
96 |
return new String[]{ "Feature tree "};
|
|
105 | 97 |
} |
106 | 98 |
|
107 | 99 |
|
Also available in: Unified diff
e4 migration of selection dialogs