Revision c5ed01f6
Added by Katja Luther over 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractUriWithExceptionLabelElement.java | ||
---|---|---|
38 | 38 |
|
39 | 39 |
protected void init(CdmFormFactory formFactory, String labelString, T initialObject, Integer textHeight, int style) { |
40 | 40 |
//label |
41 |
initLabel(formFactory, labelString, false, getLayoutComposite()); |
|
41 |
initLabel(formFactory, labelString, false, getLayoutComposite(), false);
|
|
42 | 42 |
|
43 | 43 |
//uri text |
44 | 44 |
initText(formFactory, null, textHeight, null, false, style, getLayoutComposite()); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java | ||
---|---|---|
11 | 11 |
import java.util.Map; |
12 | 12 |
import java.util.Set; |
13 | 13 |
|
14 |
import org.eclipse.jface.layout.GridDataFactory; |
|
14 | 15 |
import org.eclipse.jface.util.IPropertyChangeListener; |
15 | 16 |
import org.eclipse.jface.viewers.ISelection; |
16 | 17 |
import org.eclipse.jface.viewers.ISelectionProvider; |
17 | 18 |
import org.eclipse.jface.window.Window; |
19 |
import org.eclipse.nebula.widgets.richtext.RichTextEditor; |
|
18 | 20 |
import org.eclipse.swt.SWT; |
19 | 21 |
import org.eclipse.swt.custom.StyledText; |
20 | 22 |
import org.eclipse.swt.events.FocusAdapter; |
... | ... | |
33 | 35 |
import org.eclipse.swt.widgets.Display; |
34 | 36 |
import org.eclipse.swt.widgets.Event; |
35 | 37 |
import org.eclipse.swt.widgets.Label; |
38 |
import org.eclipse.swt.widgets.Text; |
|
36 | 39 |
import org.eclipse.ui.forms.IFormColors; |
37 | 40 |
import org.eclipse.ui.forms.widgets.ExpandableComposite; |
38 | 41 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
... | ... | |
2989 | 2992 |
return section; |
2990 | 2993 |
} |
2991 | 2994 |
|
2995 |
public RichTextWithLabelElement createRichTextLabelElement(ICdmFormElement parentElement, String labelString, String initialText, int textHeight, int style) { |
|
2996 |
RichTextWithLabelElement element = new RichTextWithLabelElement(this, parentElement, labelString, |
|
2997 |
initialText, textHeight, style); |
|
2998 |
adapt(element); |
|
2999 |
parentElement.addElement(element); |
|
3000 |
return element; |
|
3001 |
} |
|
3002 |
|
|
3003 |
|
|
3004 |
|
|
2992 | 3005 |
|
2993 | 3006 |
|
2994 | 3007 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/NumberWithLabelElement.java | ||
---|---|---|
40 | 40 |
public NumberWithLabelElement(CdmFormFactory toolkit, |
41 | 41 |
ICdmFormElement parentElement, String labelString, |
42 | 42 |
Number initialNumber, int style) { |
43 |
super(toolkit, parentElement, labelString, null, null, style); |
|
43 |
super(toolkit, parentElement, labelString, null, null, style, false);
|
|
44 | 44 |
setNumber(initialNumber); |
45 | 45 |
} |
46 | 46 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/RichTextWithLabelElement.java | ||
---|---|---|
1 |
/** |
|
2 |
* |
|
3 |
*/ |
|
4 |
package eu.etaxonomy.taxeditor.ui.element; |
|
5 |
|
|
6 |
import java.awt.Point; |
|
7 |
|
|
8 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
9 |
import org.eclipse.jface.layout.GridDataFactory; |
|
10 |
import org.eclipse.jface.viewers.CellEditor.LayoutData; |
|
11 |
import org.eclipse.nebula.widgets.richtext.RichTextEditor; |
|
12 |
import org.eclipse.nebula.widgets.richtext.RichTextEditorConfiguration; |
|
13 |
import org.eclipse.nebula.widgets.richtext.toolbar.ToolbarButton; |
|
14 |
import org.eclipse.nebula.widgets.richtext.toolbar.ToolbarConfiguration; |
|
15 |
import org.eclipse.swt.SWT; |
|
16 |
import org.eclipse.swt.events.KeyAdapter; |
|
17 |
import org.eclipse.swt.events.KeyEvent; |
|
18 |
import org.eclipse.swt.events.ModifyEvent; |
|
19 |
import org.eclipse.swt.events.ModifyListener; |
|
20 |
import org.eclipse.swt.events.SelectionAdapter; |
|
21 |
import org.eclipse.swt.events.SelectionEvent; |
|
22 |
import org.eclipse.swt.graphics.Color; |
|
23 |
import org.eclipse.swt.layout.GridLayout; |
|
24 |
import org.eclipse.swt.layout.RowLayout; |
|
25 |
import org.eclipse.swt.widgets.Button; |
|
26 |
import org.eclipse.swt.widgets.Composite; |
|
27 |
import org.eclipse.swt.widgets.Control; |
|
28 |
import org.eclipse.swt.widgets.Label; |
|
29 |
import org.eclipse.swt.widgets.Listener; |
|
30 |
import org.eclipse.swt.widgets.Text; |
|
31 |
import org.eclipse.ui.forms.widgets.TableWrapData; |
|
32 |
import org.eclipse.ui.forms.widgets.TableWrapLayout; |
|
33 |
|
|
34 |
import eu.etaxonomy.cdm.common.CdmUtils; |
|
35 |
import eu.etaxonomy.taxeditor.preference.Resources; |
|
36 |
|
|
37 |
/** |
|
38 |
* @author n.hoffmann |
|
39 |
* @version $Id: $ |
|
40 |
*/ |
|
41 |
public class RichTextWithLabelElement extends AbstractCdmFormElement implements ModifyListener, IEnableableFormElement, |
|
42 |
ISelectable { |
|
43 |
|
|
44 |
|
|
45 |
protected RichTextEditor richtextEditor; |
|
46 |
private Label label; |
|
47 |
private boolean buttonVisible = true; |
|
48 |
|
|
49 |
private final boolean isMultiLine; |
|
50 |
|
|
51 |
public static final int MAX_HEIGHT = 0; |
|
52 |
public static final int SINGLE = -1; |
|
53 |
|
|
54 |
protected RichTextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, boolean isMultiLine) { |
|
55 |
super(formFactory, parentElement); |
|
56 |
this.isMultiLine = isMultiLine; |
|
57 |
} |
|
58 |
|
|
59 |
protected RichTextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString, |
|
60 |
String initialText, Integer textHeight, int style) { |
|
61 |
this(formFactory, parentElement, labelString, initialText, textHeight, null, true, style); |
|
62 |
} |
|
63 |
|
|
64 |
protected RichTextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString, |
|
65 |
String initialText, Integer textHeight, boolean isMultiLine, int style) { |
|
66 |
this(formFactory, parentElement, labelString, initialText, textHeight, null, isMultiLine, style); |
|
67 |
} |
|
68 |
|
|
69 |
protected RichTextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString, |
|
70 |
String initialText, Integer textHeight, Integer textLimit, int style) { |
|
71 |
this(formFactory, parentElement, labelString, initialText, textHeight, textLimit, false, style); |
|
72 |
} |
|
73 |
|
|
74 |
protected RichTextWithLabelElement(CdmFormFactory formFactory, ICdmFormElement parentElement, String labelString, |
|
75 |
String initialText, Integer textHeight, Integer textLimit, boolean isMultiLine, int style) { |
|
76 |
super(formFactory, parentElement); |
|
77 |
|
|
78 |
this.isMultiLine = isMultiLine; |
|
79 |
|
|
80 |
// initLabel(formFactory, labelString, isMultiLine, getLayoutComposite()); |
|
81 |
|
|
82 |
initText( initialText, textHeight, textLimit, isMultiLine, style, getLayoutComposite()); |
|
83 |
} |
|
84 |
|
|
85 |
protected void initText(String initialText, Integer textHeight, Integer textLimit, |
|
86 |
boolean isMultiLine, int style, Composite layoutComposite) { |
|
87 |
layoutComposite.setLayout(new GridLayout(1, true)); |
|
88 |
|
|
89 |
|
|
90 |
ToolbarConfiguration toolBarConfig = new ToolbarConfiguration(); |
|
91 |
|
|
92 |
RichTextEditorConfiguration config = new RichTextEditorConfiguration(); |
|
93 |
config.setMinSize(800, 600); |
|
94 |
|
|
95 |
final RichTextEditor editor = new RichTextEditor(layoutComposite, config); |
|
96 |
GridDataFactory.fillDefaults().grab(true, true).applyTo(editor); |
|
97 |
//editor.setText(initialText); |
|
98 |
//editor.setEditable(true); |
|
99 |
|
|
100 |
final Text htmlOutput = new Text(layoutComposite, |
|
101 |
SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY); |
|
102 |
GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 100).applyTo(htmlOutput); |
|
103 |
htmlOutput.setEditable(true); |
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
editor.addModifyListener(new ModifyListener() { |
|
108 |
|
|
109 |
@Override |
|
110 |
public void modifyText(ModifyEvent e) { |
|
111 |
org.eclipse.swt.graphics.Point point = htmlOutput.getSelection(); |
|
112 |
htmlOutput.setText(htmlOutput.getText() + " - " + point.x + ":"+point.y); |
|
113 |
} |
|
114 |
}); |
|
115 |
|
|
116 |
editor.addKeyListener(new KeyAdapter() { |
|
117 |
|
|
118 |
@Override |
|
119 |
public void keyPressed(KeyEvent e) { |
|
120 |
org.eclipse.swt.graphics.Point point = htmlOutput.getSelection(); |
|
121 |
htmlOutput.setText(htmlOutput.getText() + " - " + point.x + ":"+point.y); |
|
122 |
|
|
123 |
} |
|
124 |
}); |
|
125 |
|
|
126 |
// editor.addToolbarButton(new ToolbarButton("jsButton", |
|
127 |
// "myScriptCommand", "Execute Javascript", "other,0", |
|
128 |
// null) { |
|
129 |
// @Override |
|
130 |
// public String getJavascriptToExecute() { |
|
131 |
// return "alert('Javascript call')"; |
|
132 |
// } |
|
133 |
// }); |
|
134 |
|
|
135 |
// add additional controls for showing interactions |
|
136 |
|
|
137 |
createControlPanel(layoutComposite, editor, textHeight); |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
protected void createControlPanel(Composite parent, final RichTextEditor editor, int textHeight) { |
|
142 |
Composite controlPanel = new Composite(parent, SWT.NONE); |
|
143 |
TableWrapLayout layout; |
|
144 |
layout = LayoutConstants.LAYOUT(3, false); |
|
145 |
controlPanel.setLayout(layout); |
|
146 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(controlPanel); |
|
147 |
|
|
148 |
Label inputLabel = new Label(controlPanel, SWT.NONE); |
|
149 |
inputLabel.setText("Text to set:"); |
|
150 |
// GridDataFactory.fillDefaults().applyTo(inputLabel); |
|
151 |
|
|
152 |
Text input = new Text(controlPanel, SWT.BORDER); |
|
153 |
TableWrapData layoutData; |
|
154 |
if(isMultiLine){ |
|
155 |
layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1); |
|
156 |
} |
|
157 |
else{ |
|
158 |
layoutData = LayoutConstants.FILL(); |
|
159 |
} |
|
160 |
input.setLayoutData(layoutData); |
|
161 |
// GridDataFactory.fillDefaults().grab(true, false).applyTo(input); |
|
162 |
|
|
163 |
input.addKeyListener(new KeyAdapter() { |
|
164 |
@Override |
|
165 |
public void keyPressed(KeyEvent e) { |
|
166 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { |
|
167 |
editor.setText(input.getText()); |
|
168 |
} |
|
169 |
} |
|
170 |
}); |
|
171 |
|
|
172 |
Button setButton = new Button(controlPanel, SWT.PUSH); |
|
173 |
setButton.setText("Set Text"); |
|
174 |
// GridDataFactory.defaultsFor(setButton).applyTo(setButton); |
|
175 |
|
|
176 |
setButton.addSelectionListener(new SelectionAdapter() { |
|
177 |
@Override |
|
178 |
public void widgetSelected(SelectionEvent e) { |
|
179 |
editor.setText(input.getText()); |
|
180 |
} |
|
181 |
}); |
|
182 |
|
|
183 |
Composite buttonPanel = new Composite(controlPanel, SWT.NONE); |
|
184 |
buttonPanel.setLayout(new RowLayout()); |
|
185 |
// GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(buttonPanel); |
|
186 |
|
|
187 |
Button getButton = new Button(buttonPanel, SWT.PUSH); |
|
188 |
getButton.setText("Get text"); |
|
189 |
getButton.addSelectionListener(new SelectionAdapter() { |
|
190 |
@Override |
|
191 |
public void widgetSelected(SelectionEvent e) { |
|
192 |
MessageDialog.openInformation(null, "Editor Input", |
|
193 |
editor.getText()); |
|
194 |
} |
|
195 |
}); |
|
196 |
|
|
197 |
final Button enableButton = new Button(buttonPanel, SWT.PUSH); |
|
198 |
enableButton.setText("Disable"); |
|
199 |
enableButton.addSelectionListener(new SelectionAdapter() { |
|
200 |
@Override |
|
201 |
public void widgetSelected(SelectionEvent e) { |
|
202 |
boolean editable = editor.isEditable(); |
|
203 |
editor.setEditable(!editable); |
|
204 |
|
|
205 |
enableButton.setText(editable ? "Enable" : "Disable"); |
|
206 |
} |
|
207 |
}); |
|
208 |
|
|
209 |
final Button updateButton = new Button(buttonPanel, SWT.PUSH); |
|
210 |
updateButton.setText("Update Toolbar"); |
|
211 |
|
|
212 |
final ToolbarButton button = new ToolbarButton("javaButton", |
|
213 |
"myJavaCommand", "Execute Java", "other", |
|
214 |
null) { |
|
215 |
|
|
216 |
@Override |
|
217 |
public Object execute() { |
|
218 |
MessageDialog.openInformation(null, "Information", |
|
219 |
"Java callback: " + editor.getSelectedHTML()); |
|
220 |
|
|
221 |
editor.insertHTML("<em>" + editor.getSelectedHTML() + "</em>"); |
|
222 |
return null; |
|
223 |
} |
|
224 |
}; |
|
225 |
|
|
226 |
updateButton.addSelectionListener(new SelectionAdapter() { |
|
227 |
@Override |
|
228 |
public void widgetSelected(SelectionEvent e) { |
|
229 |
if (!buttonVisible) { |
|
230 |
editor.addToolbarButton(button); |
|
231 |
} else { |
|
232 |
editor.removeToolbarButton(button); |
|
233 |
} |
|
234 |
buttonVisible = !buttonVisible; |
|
235 |
editor.updateToolbar(); |
|
236 |
} |
|
237 |
}); |
|
238 |
|
|
239 |
Button setFocusButton = new Button(buttonPanel, SWT.PUSH); |
|
240 |
setFocusButton.setText("Set Focus"); |
|
241 |
setFocusButton.addSelectionListener(new SelectionAdapter() { |
|
242 |
@Override |
|
243 |
public void widgetSelected(SelectionEvent e) { |
|
244 |
editor.setFocus(); |
|
245 |
} |
|
246 |
}); |
|
247 |
|
|
248 |
} |
|
249 |
|
|
250 |
protected void initLabel(CdmFormFactory formFactory, String labelString, boolean isMultiLine, Composite layoutComposite) { |
|
251 |
if (labelString != null) { |
|
252 |
label = formFactory.createLabel(layoutComposite, CdmUtils.Nz(labelString), SWT.NULL); |
|
253 |
addControl(label); |
|
254 |
if(isMultiLine){ |
|
255 |
label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
|
256 |
((TableWrapData)label.getLayoutData()).valign = TableWrapData.MIDDLE; |
|
257 |
} |
|
258 |
else{ |
|
259 |
label.setLayoutData(LayoutConstants.LEFT()); |
|
260 |
((TableWrapData)label.getLayoutData()).valign = TableWrapData.MIDDLE; |
|
261 |
} |
|
262 |
} |
|
263 |
} |
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
|
|
268 |
/** {@inheritDoc} */ |
|
269 |
@Override |
|
270 |
public void setBackground(Color color) { |
|
271 |
if (label != null) { |
|
272 |
label.setBackground(color); |
|
273 |
} |
|
274 |
} |
|
275 |
|
|
276 |
@Override |
|
277 |
public void setSelected(boolean selected) { |
|
278 |
setBackground(selected ? SELECTED : getPersistentBackground()); |
|
279 |
} |
|
280 |
|
|
281 |
@Override |
|
282 |
public void setIrrelevant(boolean irrelevant) { |
|
283 |
// TODO Auto-generated method stub |
|
284 |
|
|
285 |
} |
|
286 |
|
|
287 |
@Override |
|
288 |
public void setEnabled(boolean enabled) { |
|
289 |
// TODO Auto-generated method stub |
|
290 |
|
|
291 |
} |
|
292 |
|
|
293 |
@Override |
|
294 |
public boolean isEnabled() { |
|
295 |
// TODO Auto-generated method stub |
|
296 |
return false; |
|
297 |
} |
|
298 |
|
|
299 |
@Override |
|
300 |
public void modifyText(ModifyEvent e) { |
|
301 |
// TODO Auto-generated method stub |
|
302 |
|
|
303 |
} |
|
304 |
|
|
305 |
|
|
306 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java | ||
---|---|---|
9 | 9 |
import org.eclipse.swt.events.ModifyEvent; |
10 | 10 |
import org.eclipse.swt.events.ModifyListener; |
11 | 11 |
import org.eclipse.swt.graphics.Color; |
12 |
import org.eclipse.swt.layout.GridData; |
|
12 | 13 |
import org.eclipse.swt.widgets.Composite; |
13 | 14 |
import org.eclipse.swt.widgets.Control; |
14 | 15 |
import org.eclipse.swt.widgets.Label; |
... | ... | |
122 | 123 |
protected void initLabel(CdmFormFactory formFactory, String labelString, boolean isMultiLine, Composite layoutComposite) { |
123 | 124 |
if (labelString != null) { |
124 | 125 |
label = formFactory.createLabel(layoutComposite, CdmUtils.Nz(labelString), SWT.NULL); |
126 |
|
|
125 | 127 |
addControl(label); |
126 | 128 |
if(isMultiLine){ |
127 | 129 |
label.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/UriWithLabelElement.java | ||
---|---|---|
49 | 49 |
protected void init(CdmFormFactory formFactory, String labelString, URI initialObject, Integer textHeight, int style) { |
50 | 50 |
|
51 | 51 |
//label |
52 |
initLabel(formFactory, labelString, false, getLayoutComposite()); |
|
52 |
initLabel(formFactory, labelString, false, getLayoutComposite(), false);
|
|
53 | 53 |
|
54 | 54 |
//composite(uri + button) |
55 | 55 |
Composite textAndButton = formFactory.createComposite(getLayoutComposite(), style); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/CdmSectionPart.java | ||
---|---|---|
22 | 22 |
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode; |
23 | 23 |
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit; |
24 | 24 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
25 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
|
25 | 26 |
import eu.etaxonomy.taxeditor.model.IElementHasDetails; |
26 | 27 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
27 | 28 |
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship; |
... | ... | |
32 | 33 |
import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection; |
33 | 34 |
import eu.etaxonomy.taxeditor.ui.section.key.ScopeRestrictionSection; |
34 | 35 |
import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection; |
36 |
import eu.etaxonomy.taxeditor.ui.section.name.NameDetailSection; |
|
37 |
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection; |
|
35 | 38 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopeDetailSection; |
36 | 39 |
import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection; |
40 |
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection; |
|
37 | 41 |
|
38 | 42 |
/** |
39 | 43 |
* <p> |
... | ... | |
102 | 106 |
formSection instanceof ScopeRestrictionSection || |
103 | 107 |
formSection instanceof TaxonomicScopeSection)) { |
104 | 108 |
input = ((PolytomousKeyNode)input).getKey(); |
105 |
} |
|
109 |
} else if ((input instanceof TaxonRelationship) |
|
110 |
&& (formSection instanceof NonViralNameDetailSection)) { |
|
111 |
((NonViralNameDetailSection) formSection) |
|
112 |
.setTaxonBase( ((TaxonRelationship)input).getFromTaxon()); |
|
113 |
return true; |
|
114 |
} |
|
106 | 115 |
|
107 | 116 |
|
108 | 117 |
formSection.setEntity((T) input); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.view.detail; |
11 | 11 |
|
12 | 12 |
import java.util.Collection; |
13 |
import java.util.Set; |
|
13 | 14 |
|
14 | 15 |
import org.eclipse.core.runtime.IProgressMonitor; |
15 | 16 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
... | ... | |
19 | 20 |
import org.eclipse.jface.viewers.TreeNode; |
20 | 21 |
import org.eclipse.jface.viewers.Viewer; |
21 | 22 |
import org.eclipse.swt.widgets.Composite; |
23 |
import org.eclipse.ui.IEditorInput; |
|
22 | 24 |
import org.eclipse.ui.IEditorPart; |
23 | 25 |
import org.eclipse.ui.IMemento; |
24 | 26 |
import org.eclipse.ui.IWorkbenchPart; |
... | ... | |
29 | 31 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
30 | 32 |
import eu.etaxonomy.cdm.model.description.Feature; |
31 | 33 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
34 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
35 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
|
36 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
|
37 |
import eu.etaxonomy.taxeditor.editor.ITaxonEditor; |
|
32 | 38 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
33 | 39 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
34 | 40 |
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer; |
... | ... | |
227 | 233 |
@Override |
228 | 234 |
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) { |
229 | 235 |
} |
236 |
@Override |
|
237 |
public void showViewer(Object part, IStructuredSelection selection){ |
|
238 |
this.part = part; |
|
230 | 239 |
|
240 |
Object element = selection.getFirstElement(); |
|
241 |
//avoid widget is disposed exceptions |
|
242 |
if (getViewer().getControl()==null || getViewer().getControl().isDisposed()){ |
|
243 |
return; |
|
244 |
} |
|
231 | 245 |
|
232 |
|
|
246 |
setPartName(createPartTitle(element)); |
|
247 |
if (element instanceof Taxon){ |
|
248 |
Taxon taxon = HibernateProxyHelper.deproxy(element, Taxon.class); |
|
249 |
if (taxon.isMisapplication()){ |
|
250 |
|
|
251 |
if (part instanceof ITaxonEditor){ |
|
252 |
Taxon accepted= ((ITaxonEditor)part).getTaxon(); |
|
253 |
Set<TaxonRelationship> rels = taxon.getTaxonRelations(accepted); |
|
254 |
|
|
255 |
if (rels.iterator().hasNext()){ |
|
256 |
TaxonRelationship rel = rels.iterator().next(); |
|
257 |
if (rel.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){ |
|
258 |
getViewer().setInput(rel); |
|
259 |
showViewer(); |
|
260 |
return; |
|
261 |
} |
|
262 |
} |
|
263 |
} |
|
264 |
|
|
265 |
|
|
266 |
} |
|
267 |
} |
|
268 |
getViewer().setInput(element); |
|
269 |
showViewer(); |
|
270 |
} |
|
233 | 271 |
} |
272 |
|
|
273 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java | ||
---|---|---|
771 | 771 |
|
772 | 772 |
TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); |
773 | 773 |
|
774 |
ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); |
|
774 |
// ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
|
|
775 | 775 |
addPart(taxonRelationshipDetailSection); |
776 |
addPart(referencedEntityBaseDetailSection); |
|
776 |
// addPart(referencedEntityBaseDetailSection); |
|
777 |
NonViralNameDetailSection nonViralNameSection = formFactory |
|
778 |
.createNonViralNameDetailSection(getConversationHolder(), parent, this, true, |
|
779 |
ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); |
|
780 |
addPart(nonViralNameSection); |
|
781 |
// formFactory.createHorizontalSeparator(parent, SWT.BORDER); |
|
782 |
// //if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE))){ |
|
783 |
// NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, |
|
784 |
// ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); |
|
785 |
// formFactory.createHorizontalSeparator(parent, SWT.BORDER); |
|
786 |
// addPart(referenceDetailSection); |
|
787 |
|
|
788 |
//} |
|
777 | 789 |
} |
778 | 790 |
|
779 | 791 |
private void createTermVocabularySection(RootElement parent) { |
Also available in: Unified diff
ref #6390: revert some changes and add DetailsViewPart changes