Revision ffa56d68
Added by Patrick Plitzner over 9 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/AnnotatedLineEditor.java | ||
---|---|---|
19 | 19 |
import org.eclipse.jface.text.source.IVerticalRuler; |
20 | 20 |
import org.eclipse.swt.widgets.Composite; |
21 | 21 |
import org.eclipse.ui.IEditorInput; |
22 |
import org.eclipse.ui.PlatformUI; |
|
22 | 23 |
import org.eclipse.ui.editors.text.TextEditor; |
23 | 24 |
import org.eclipse.ui.texteditor.IDocumentProvider; |
24 | 25 |
|
... | ... | |
258 | 259 |
if (getConversationHolder() != null) { |
259 | 260 |
getConversationHolder().bind(); |
260 | 261 |
} |
262 |
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus(); |
|
261 | 263 |
// TODO pass focus to underlying widgets |
262 | 264 |
} |
263 | 265 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditor.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
10 | 10 |
|
11 | 11 |
import org.eclipse.core.runtime.IProgressMonitor; |
12 | 12 |
import org.eclipse.swt.SWT; |
13 |
import org.eclipse.swt.layout.FillLayout; |
|
13 | 14 |
import org.eclipse.swt.widgets.Composite; |
14 | 15 |
import org.eclipse.ui.IEditorInput; |
15 | 16 |
import org.eclipse.ui.IEditorSite; |
16 | 17 |
import org.eclipse.ui.PartInitException; |
18 |
import org.eclipse.ui.PlatformUI; |
|
17 | 19 |
import org.eclipse.ui.part.EditorPart; |
18 |
import org.eclipse.swt.layout.FillLayout; |
|
19 | 20 |
|
20 | 21 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
21 | 22 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
... | ... | |
26 | 27 |
|
27 | 28 |
/** |
28 | 29 |
* Editor responsible for editing authorities related to a particular {@link Group} entity. |
29 |
*
|
|
30 |
* |
|
30 | 31 |
* @author cmathew |
31 | 32 |
* @created Mar 28, 2013 |
32 | 33 |
* |
... | ... | |
38 | 39 |
private boolean dirty; |
39 | 40 |
private ConversationHolder conversation; |
40 | 41 |
private CdmAuthorityCompositeViewer viewer; |
41 |
|
|
42 |
public CdmAuthorityEditor() {
|
|
43 |
|
|
42 |
|
|
43 |
public CdmAuthorityEditor() { |
|
44 |
|
|
44 | 45 |
} |
45 | 46 |
|
46 | 47 |
/** |
... | ... | |
51 | 52 |
public void createPartControl(Composite parent) { |
52 | 53 |
Composite container = new Composite(parent, SWT.NONE); |
53 | 54 |
container.setLayout(new FillLayout(SWT.HORIZONTAL)); |
54 |
|
|
55 |
|
|
55 | 56 |
this.viewer = new CdmAuthorityCompositeViewer(container, this,((CdmAuthorityEditorInput) getEditorInput()).getGroup()); |
56 | 57 |
|
57 | 58 |
conversation = ((CdmAuthorityEditorInput) getEditorInput()).getConversationHolder(); |
58 |
setPartName(getEditorInput().getName());
|
|
59 |
setPartName(getEditorInput().getName()); |
|
59 | 60 |
|
60 | 61 |
} |
61 | 62 |
|
... | ... | |
64 | 65 |
*/ |
65 | 66 |
@Override |
66 | 67 |
public void setFocus() { |
67 |
|
|
68 |
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus(); |
|
68 | 69 |
} |
69 | 70 |
|
70 | 71 |
/* (non-Javadoc) |
... | ... | |
74 | 75 |
public void doSave(IProgressMonitor monitor) { |
75 | 76 |
try { |
76 | 77 |
monitor.beginTask("Saving CDM Authority Editor", 1); |
77 |
getConversationHolder().commit(true);
|
|
78 |
getConversationHolder().commit(true); |
|
78 | 79 |
dirty = false; |
79 | 80 |
firePropertyChange(PROP_DIRTY); |
80 | 81 |
monitor.worked(1); |
... | ... | |
100 | 101 |
throws PartInitException { |
101 | 102 |
setSite(site); |
102 | 103 |
setInput(input); |
103 |
}
|
|
104 |
} |
|
104 | 105 |
|
105 | 106 |
/* (non-Javadoc) |
106 | 107 |
* @see org.eclipse.ui.part.EditorPart#isDirty() |
... | ... | |
124 | 125 |
@Override |
125 | 126 |
public void update(CdmDataChangeMap changeEvents) { |
126 | 127 |
// TODO Auto-generated method stub |
127 |
|
|
128 |
|
|
128 | 129 |
} |
129 | 130 |
|
130 | 131 |
/* (non-Javadoc) |
... | ... | |
132 | 133 |
*/ |
133 | 134 |
@Override |
134 | 135 |
public void changed(Object element) { |
135 |
//FIXME : should be optimised to split changes into adding / removing authorities
|
|
136 |
//FIXME : should be optimised to split changes into adding / removing authorities |
|
136 | 137 |
// vs updating authorites |
137 | 138 |
dirty = viewer.isDirty(); |
138 | 139 |
firePropertyChange(PROP_DIRTY); |
139 | 140 |
// if the change has happened on the group then refresh the table |
140 | 141 |
if(element instanceof Group) { |
141 |
|
|
142 |
|
|
142 | 143 |
//FIXME: activating (setting focus) on the editor happens on every change |
143 | 144 |
// This should be changed to only when the drop is successful |
144 | 145 |
getSite().getPage().activate(this); |
145 | 146 |
} |
146 |
|
|
147 |
|
|
147 | 148 |
} |
148 | 149 |
|
149 | 150 |
/* (non-Javadoc) |
... | ... | |
153 | 154 |
public ConversationHolder getConversationHolder() { |
154 | 155 |
return conversation; |
155 | 156 |
} |
156 |
|
|
157 |
|
|
157 | 158 |
/* |
158 | 159 |
* (non-Javadoc) |
159 |
*
|
|
160 |
* |
|
160 | 161 |
* @see org.eclipse.ui.forms.editor.FormEditor#dispose() |
161 | 162 |
*/ |
162 | 163 |
@Override |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
16 | 16 |
|
17 | 17 |
import org.apache.commons.lang.StringUtils; |
18 | 18 |
import org.eclipse.core.commands.operations.IUndoContext; |
19 |
import org.eclipse.core.runtime.IAdaptable; |
|
20 | 19 |
import org.eclipse.core.runtime.IProgressMonitor; |
21 | 20 |
import org.eclipse.core.runtime.OperationCanceledException; |
22 | 21 |
import org.eclipse.jface.action.MenuManager; |
... | ... | |
36 | 35 |
import org.eclipse.ui.IWorkbenchPart; |
37 | 36 |
import org.eclipse.ui.IWorkbenchPartReference; |
38 | 37 |
import org.eclipse.ui.PartInitException; |
38 |
import org.eclipse.ui.PlatformUI; |
|
39 | 39 |
import org.eclipse.ui.forms.ManagedForm; |
40 | 40 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
41 | 41 |
import org.eclipse.ui.forms.widgets.ScrolledForm; |
... | ... | |
67 | 67 |
import eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup; |
68 | 68 |
import eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup; |
69 | 69 |
import eu.etaxonomy.taxeditor.editor.name.dnd.NameEditorDropTargetListener; |
70 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
70 | 71 |
import eu.etaxonomy.taxeditor.model.IPartChangeListener; |
71 | 72 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
72 | 73 |
import eu.etaxonomy.taxeditor.model.TaxeditorPartService; |
73 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
|
74 | 74 |
import eu.etaxonomy.taxeditor.preference.Resources; |
75 | 75 |
import eu.etaxonomy.taxeditor.security.RequiredPermissions; |
76 | 76 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
80 | 80 |
* <p> |
81 | 81 |
* TaxonNameEditor class. |
82 | 82 |
* </p> |
83 |
*
|
|
83 |
* |
|
84 | 84 |
* @author p.ciardelli |
85 | 85 |
* @author n.hoffmann |
86 | 86 |
* @created 15.05.2008 |
87 | 87 |
* @version 1.0 |
88 | 88 |
*/ |
89 | 89 |
public class TaxonNameEditor extends EditorPart implements |
90 |
IMultiPageTaxonEditorPage, IAdaptable, IConversationEnabled,
|
|
91 |
IPostOperationEnabled, IPartContentHasDetails, IPartChangeListener,
|
|
90 |
IMultiPageTaxonEditorPage, IConversationEnabled, |
|
91 |
IPartContentHasDetails, IPartChangeListener, |
|
92 | 92 |
ISelectionListener, IDropTargetable, ISecuredEditor { |
93 | 93 |
|
94 | 94 |
/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon.name"</code> */ |
... | ... | |
124 | 124 |
* <p> |
125 | 125 |
* Constructor for TaxonNameEditor. |
126 | 126 |
* </p> |
127 |
*
|
|
127 |
* |
|
128 | 128 |
* @param editor |
129 | 129 |
* a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor} |
130 | 130 |
* object. |
... | ... | |
138 | 138 |
* <p> |
139 | 139 |
* getUndoContext |
140 | 140 |
* </p> |
141 |
*
|
|
141 |
* |
|
142 | 142 |
* @return a {@link org.eclipse.core.commands.operations.IUndoContext} |
143 | 143 |
* object. |
144 | 144 |
*/ |
... | ... | |
148 | 148 |
|
149 | 149 |
/* |
150 | 150 |
* (non-Javadoc) |
151 |
*
|
|
151 |
* |
|
152 | 152 |
* @see |
153 | 153 |
* org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets |
154 | 154 |
* .Composite) |
... | ... | |
169 | 169 |
* <p> |
170 | 170 |
* createManagedForm |
171 | 171 |
* </p> |
172 |
*
|
|
172 |
* |
|
173 | 173 |
* @param composite |
174 | 174 |
* a {@link org.eclipse.swt.widgets.Composite} object. |
175 | 175 |
*/ |
... | ... | |
191 | 191 |
selection = null; |
192 | 192 |
getSite().getSelectionProvider().setSelection(new StructuredSelection()); |
193 | 193 |
} |
194 |
|
|
195 |
|
|
194 |
|
|
195 |
|
|
196 | 196 |
return super.setInput(input); |
197 | 197 |
} |
198 | 198 |
}; |
... | ... | |
218 | 218 |
layout.horizontalSpacing = 0; |
219 | 219 |
|
220 | 220 |
parent.setLayout(layout); |
221 |
parent.setBackground(EditorUtil
|
|
221 |
parent.setBackground(AbstractUtility
|
|
222 | 222 |
.getColor(Resources.COLOR_COMPOSITE_BACKGROUND)); |
223 | 223 |
|
224 | 224 |
createOrUpdateNameComposites(); |
... | ... | |
247 | 247 |
* <p> |
248 | 248 |
* Getter for the field <code>taxon</code>. |
249 | 249 |
* </p> |
250 |
*
|
|
250 |
* |
|
251 | 251 |
* @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object. |
252 | 252 |
*/ |
253 | 253 |
public Taxon getTaxon() { |
... | ... | |
265 | 265 |
|
266 | 266 |
/* |
267 | 267 |
* (non-Javadoc) |
268 |
*
|
|
268 |
* |
|
269 | 269 |
* @see org.eclipse.ui.part.WorkbenchPart#setFocus() |
270 | 270 |
*/ |
271 | 271 |
/** {@inheritDoc} */ |
272 | 272 |
@Override |
273 | 273 |
public void setFocus() { |
274 |
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus(); |
|
274 | 275 |
if (getSelectedContainer() == null) { |
275 | 276 |
throw new IllegalStateException( |
276 | 277 |
"There should always be a selected object."); |
277 | 278 |
} |
278 | 279 |
getSelectedContainer().setSelected(); |
279 |
|
|
280 |
|
|
280 | 281 |
// check permissions |
281 | 282 |
boolean doEnable = permissionsSatisfied(); |
282 | 283 |
setEnabled(doEnable); |
... | ... | |
300 | 301 |
|
301 | 302 |
/* |
302 | 303 |
* (non-Javadoc) |
303 |
*
|
|
304 |
* |
|
304 | 305 |
* @see |
305 | 306 |
* eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder |
306 | 307 |
* () |
... | ... | |
309 | 310 |
* <p> |
310 | 311 |
* getConversationHolder |
311 | 312 |
* </p> |
312 |
*
|
|
313 |
* |
|
313 | 314 |
* @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} |
314 | 315 |
* object. |
315 | 316 |
*/ |
316 |
public ConversationHolder getConversationHolder() { |
|
317 |
@Override |
|
318 |
public ConversationHolder getConversationHolder() { |
|
317 | 319 |
return conversation; |
318 | 320 |
} |
319 | 321 |
|
320 | 322 |
/* |
321 | 323 |
* (non-Javadoc) |
322 |
*
|
|
324 |
* |
|
323 | 325 |
* @see |
324 | 326 |
* eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu |
325 | 327 |
* .etaxonomy.cdm.persistence.hibernate.CdmCrudEvent) |
326 | 328 |
*/ |
327 | 329 |
/** {@inheritDoc} */ |
328 |
public void update(CdmDataChangeMap events) { |
|
330 |
@Override |
|
331 |
public void update(CdmDataChangeMap events) { |
|
329 | 332 |
// redraw(); |
330 | 333 |
} |
331 | 334 |
|
332 | 335 |
/** |
333 | 336 |
* Redraws this editor return true on success |
334 |
*
|
|
337 |
* |
|
335 | 338 |
* @return a boolean. |
336 | 339 |
*/ |
337 |
public boolean redraw() { |
|
340 |
@Override |
|
341 |
public boolean redraw() { |
|
338 | 342 |
return redraw(true); |
339 | 343 |
} |
340 | 344 |
|
341 | 345 |
/** |
342 | 346 |
* {@inheritDoc} |
343 |
*
|
|
347 |
* |
|
344 | 348 |
* Redraws the editor controls |
345 | 349 |
*/ |
346 |
public boolean redraw(boolean focus) { |
|
350 |
@Override |
|
351 |
public boolean redraw(boolean focus) { |
|
347 | 352 |
|
348 | 353 |
createOrUpdateNameComposites(); |
349 | 354 |
|
... | ... | |
358 | 363 |
* <p> |
359 | 364 |
* getMultiPageTaxonEditor |
360 | 365 |
* </p> |
361 |
*
|
|
366 |
* |
|
362 | 367 |
* @return a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor} |
363 | 368 |
* object. |
364 | 369 |
*/ |
... | ... | |
368 | 373 |
|
369 | 374 |
/* |
370 | 375 |
* (non-Javadoc) |
371 |
*
|
|
376 |
* |
|
372 | 377 |
* @see |
373 | 378 |
* eu.etaxonomy.taxeditor.store.operations.IPostOperationEnabled#postOperation |
374 | 379 |
* () |
375 | 380 |
*/ |
376 | 381 |
/** {@inheritDoc} */ |
377 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
|
382 |
@Override |
|
383 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
|
378 | 384 |
|
379 | 385 |
editor.changed(objectAffectedByOperation); |
380 |
|
|
386 |
|
|
381 | 387 |
redraw(false); |
382 | 388 |
|
383 | 389 |
if (objectAffectedByOperation instanceof TaxonBase) { |
... | ... | |
391 | 397 |
* <p> |
392 | 398 |
* Getter for the field <code>managedForm</code>. |
393 | 399 |
* </p> |
394 |
*
|
|
400 |
* |
|
395 | 401 |
* @return the managedForm |
396 | 402 |
*/ |
397 | 403 |
public ManagedForm getManagedForm() { |
... | ... | |
402 | 408 |
* <p> |
403 | 409 |
* getControl |
404 | 410 |
* </p> |
405 |
*
|
|
411 |
* |
|
406 | 412 |
* @return a {@link org.eclipse.swt.widgets.Composite} object. |
407 | 413 |
*/ |
408 |
public Composite getControl() { |
|
414 |
@Override |
|
415 |
public Composite getControl() { |
|
409 | 416 |
return this.getManagedForm().getForm().getBody(); |
410 | 417 |
} |
411 | 418 |
|
... | ... | |
413 | 420 |
* <p> |
414 | 421 |
* Getter for the field <code>menu</code>. |
415 | 422 |
* </p> |
416 |
*
|
|
423 |
* |
|
417 | 424 |
* @return the menu |
418 | 425 |
*/ |
419 | 426 |
public Menu getMenu() { |
... | ... | |
429 | 436 |
* <p> |
430 | 437 |
* checkForEmptyNames |
431 | 438 |
* </p> |
432 |
*
|
|
439 |
* |
|
433 | 440 |
* @return true if there are empty names |
434 | 441 |
*/ |
435 | 442 |
public boolean checkForEmptyNames() { |
... | ... | |
495 | 502 |
public void init(IEditorSite site, IEditorInput input) |
496 | 503 |
throws PartInitException { |
497 | 504 |
|
498 |
if (!(input instanceof IEditorInput)) |
|
499 |
throw new PartInitException("Invalid Input: Must be IEditorInput"); |
|
505 |
if (!(input != null)) { |
|
506 |
throw new PartInitException("Invalid Input: Must be IEditorInput"); |
|
507 |
} |
|
500 | 508 |
|
501 | 509 |
if (input.getAdapter(Taxon.class) != null) { |
502 | 510 |
taxon = (Taxon) input.getAdapter(Taxon.class); |
... | ... | |
513 | 521 |
|
514 | 522 |
|
515 | 523 |
/** |
516 |
*
|
|
524 |
* |
|
517 | 525 |
*/ |
518 | 526 |
private void createDragSupport() { |
519 | 527 |
// Listen for names being dragged outside of existing homotypic groups - |
... | ... | |
531 | 539 |
* <p> |
532 | 540 |
* Getter for the field <code>acceptedNameContainer</code>. |
533 | 541 |
* </p> |
534 |
*
|
|
542 |
* |
|
535 | 543 |
* @return a |
536 | 544 |
* {@link eu.etaxonomy.taxeditor.editor.name.container.AcceptedNameContainer} |
537 | 545 |
* object. |
... | ... | |
544 | 552 |
* <p> |
545 | 553 |
* getSynonymGroup |
546 | 554 |
* </p> |
547 |
*
|
|
555 |
* |
|
548 | 556 |
* @param homotypicalGroup |
549 | 557 |
* a {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup} object. |
550 | 558 |
* @return a |
... | ... | |
566 | 574 |
* <p> |
567 | 575 |
* getDirtyNames |
568 | 576 |
* </p> |
569 |
*
|
|
577 |
* |
|
570 | 578 |
* @return a Set containing all composites that have been edited |
571 | 579 |
*/ |
572 | 580 |
public Set<AbstractGroupedContainer> getDirtyNames() { |
... | ... | |
585 | 593 |
* <p> |
586 | 594 |
* getGroupedContainers |
587 | 595 |
* </p> |
588 |
*
|
|
596 |
* |
|
589 | 597 |
* @return a {@link java.util.List} object. |
590 | 598 |
*/ |
591 | 599 |
public List<AbstractGroupedContainer> getGroupedContainers() { |
... | ... | |
602 | 610 |
* <p> |
603 | 611 |
* getAllGroups |
604 | 612 |
* </p> |
605 |
*
|
|
613 |
* |
|
606 | 614 |
* @return a {@link java.util.List} object. |
607 | 615 |
*/ |
608 | 616 |
public List<AbstractGroup> getAllGroups() { |
... | ... | |
611 | 619 |
allGroups.add(getAcceptedGroup()); |
612 | 620 |
|
613 | 621 |
// List<HomotypicalSynonymGroup> grps = getHeterotypicSynonymGroups(); // UNUSED => remove |
614 |
|
|
622 |
|
|
615 | 623 |
heterotypicSynonymGroups = getHeterotypicSynonymGroups(); |
616 |
|
|
624 |
|
|
617 | 625 |
if (heterotypicSynonymGroups != null) { |
618 | 626 |
allGroups.addAll(heterotypicSynonymGroups); |
619 | 627 |
} |
... | ... | |
627 | 635 |
|
628 | 636 |
/* |
629 | 637 |
* (non-Javadoc) |
630 |
*
|
|
638 |
* |
|
631 | 639 |
* @see org.eclipse.ui.part.EditorPart#isDirty() |
632 | 640 |
*/ |
633 | 641 |
/** {@inheritDoc} */ |
... | ... | |
638 | 646 |
|
639 | 647 |
/* |
640 | 648 |
* (non-Javadoc) |
641 |
*
|
|
649 |
* |
|
642 | 650 |
* @see org.eclipse.ui.part.WorkbenchPart#dispose() |
643 | 651 |
*/ |
644 | 652 |
/** {@inheritDoc} */ |
... | ... | |
649 | 657 |
|
650 | 658 |
/* |
651 | 659 |
* (non-Javadoc) |
652 |
*
|
|
660 |
* |
|
653 | 661 |
* @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed() |
654 | 662 |
*/ |
655 | 663 |
/** {@inheritDoc} */ |
... | ... | |
660 | 668 |
|
661 | 669 |
/* |
662 | 670 |
* (non-Javadoc) |
663 |
*
|
|
671 |
* |
|
664 | 672 |
* @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui. |
665 | 673 |
* IWorkbenchPart, org.eclipse.jface.viewers.ISelection) |
666 | 674 |
*/ |
667 | 675 |
/** {@inheritDoc} */ |
668 |
public void selectionChanged(IWorkbenchPart part, ISelection selection) { |
|
676 |
@Override |
|
677 |
public void selectionChanged(IWorkbenchPart part, ISelection selection) { |
|
669 | 678 |
|
670 | 679 |
} |
671 | 680 |
|
... | ... | |
673 | 682 |
* <p> |
674 | 683 |
* getNameEditor |
675 | 684 |
* </p> |
676 |
*
|
|
685 |
* |
|
677 | 686 |
* @return a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} |
678 | 687 |
* object. |
679 | 688 |
*/ |
680 |
public TaxonNameEditor getEditor() { |
|
689 |
@Override |
|
690 |
public TaxonNameEditor getEditor() { |
|
681 | 691 |
return this; |
682 | 692 |
} |
683 | 693 |
|
... | ... | |
685 | 695 |
* <p> |
686 | 696 |
* Getter for the field <code>selectedObject</code>. |
687 | 697 |
* </p> |
688 |
*
|
|
698 |
* |
|
689 | 699 |
* @return a |
690 | 700 |
* {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer} |
691 | 701 |
* object. |
... | ... | |
712 | 722 |
* dragEntered |
713 | 723 |
* </p> |
714 | 724 |
*/ |
715 |
public void dragEntered() { |
|
725 |
@Override |
|
726 |
public void dragEntered() { |
|
716 | 727 |
// TODO change this |
717 | 728 |
getControl().setBackground( |
718 |
EditorUtil.getColor(Resources.COLOR_DRAG_ENTER));
|
|
729 |
AbstractUtility.getColor(Resources.COLOR_DRAG_ENTER));
|
|
719 | 730 |
} |
720 | 731 |
|
721 | 732 |
/** |
... | ... | |
723 | 734 |
* dragLeft |
724 | 735 |
* </p> |
725 | 736 |
*/ |
726 |
public void dragLeft() { |
|
737 |
@Override |
|
738 |
public void dragLeft() { |
|
727 | 739 |
getControl().setBackground( |
728 |
EditorUtil.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
|
|
740 |
AbstractUtility.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
|
|
729 | 741 |
} |
730 | 742 |
|
731 | 743 |
|
... | ... | |
733 | 745 |
* <p> |
734 | 746 |
* setMisapplicationsGroup |
735 | 747 |
* </p> |
736 |
*
|
|
748 |
* |
|
737 | 749 |
* @param misappliedGroup |
738 | 750 |
* a |
739 | 751 |
* {@link eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup} |
... | ... | |
745 | 757 |
|
746 | 758 |
/* |
747 | 759 |
* (non-Javadoc) |
748 |
*
|
|
760 |
* |
|
749 | 761 |
* @see |
750 | 762 |
* eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage#isRedrawing() |
751 | 763 |
*/ |
... | ... | |
753 | 765 |
* <p> |
754 | 766 |
* isRedrawing |
755 | 767 |
* </p> |
756 |
*
|
|
768 |
* |
|
757 | 769 |
* @return a boolean. |
758 | 770 |
*/ |
759 |
public boolean isRedrawing() { |
|
771 |
@Override |
|
772 |
public boolean isRedrawing() { |
|
760 | 773 |
return false; |
761 | 774 |
} |
762 | 775 |
|
... | ... | |
764 | 777 |
* <p> |
765 | 778 |
* getToolkit |
766 | 779 |
* </p> |
767 |
*
|
|
780 |
* |
|
768 | 781 |
* @return a {@link org.eclipse.ui.forms.widgets.FormToolkit} object. |
769 | 782 |
*/ |
770 | 783 |
public FormToolkit getToolkit() { |
... | ... | |
775 | 788 |
* <p> |
776 | 789 |
* getHeterotypicSynonymGroups |
777 | 790 |
* </p> |
778 |
*
|
|
791 |
* |
|
779 | 792 |
* @return a {@link java.util.List} object. |
780 | 793 |
*/ |
781 | 794 |
public List<HomotypicalSynonymGroup> getHeterotypicSynonymGroups() { |
... | ... | |
786 | 799 |
* <p> |
787 | 800 |
* addHeterotypicSynonymGroup |
788 | 801 |
* </p> |
789 |
*
|
|
802 |
* |
|
790 | 803 |
* @param group |
791 | 804 |
* a |
792 | 805 |
* {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup} |
... | ... | |
800 | 813 |
* <p> |
801 | 814 |
* getHomotypicSynonymGroup |
802 | 815 |
* </p> |
803 |
*
|
|
816 |
* |
|
804 | 817 |
* @return a |
805 | 818 |
* {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup} |
806 | 819 |
* object. |
... | ... | |
810 | 823 |
} |
811 | 824 |
|
812 | 825 |
/** |
813 |
*
|
|
826 |
* |
|
814 | 827 |
* @param acceptedGroup |
815 | 828 |
*/ |
816 | 829 |
public void setAcceptedGroup(AcceptedGroup acceptedGroup) { |
... | ... | |
821 | 834 |
* <p> |
822 | 835 |
* Getter for the field <code>misappliedGroup</code>. |
823 | 836 |
* </p> |
824 |
*
|
|
837 |
* |
|
825 | 838 |
* @return a |
826 | 839 |
* {@link eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup} |
827 | 840 |
* object. |
... | ... | |
835 | 848 |
* <p> |
836 | 849 |
* isActive |
837 | 850 |
* </p> |
838 |
*
|
|
851 |
* |
|
839 | 852 |
* @return a boolean. |
840 | 853 |
*/ |
841 | 854 |
public boolean isActive() { |
842 |
IWorkbenchPart activePart = EditorUtil.getActivePart();
|
|
855 |
IWorkbenchPart activePart = AbstractUtility.getActivePart();
|
|
843 | 856 |
return editor.equals(activePart); |
844 | 857 |
} |
845 | 858 |
|
... | ... | |
847 | 860 |
* <p> |
848 | 861 |
* onComplete |
849 | 862 |
* </p> |
850 |
*
|
|
863 |
* |
|
851 | 864 |
* @return a boolean. |
852 | 865 |
*/ |
853 |
public boolean onComplete() { |
|
866 |
@Override |
|
867 |
public boolean onComplete() { |
|
854 | 868 |
getContainer(objectAffectedByLastOperation).setSelected(); |
855 | 869 |
return true; |
856 | 870 |
} |
857 | 871 |
|
858 | 872 |
/** {@inheritDoc} */ |
859 |
public void partChanged(Integer eventType, IWorkbenchPartReference partRef) { |
|
873 |
@Override |
|
874 |
public void partChanged(Integer eventType, IWorkbenchPartReference partRef) { |
|
860 | 875 |
if (!partRef.getPart(false).equals(editor)) { |
861 | 876 |
// getSelectedObject().colorSelected(AbstractGroupedContainer.SELECTED_NO_FOCUS); |
862 | 877 |
} |
... | ... | |
868 | 883 |
public void removeGroup(AbstractGroup group) { |
869 | 884 |
if (group != null) { |
870 | 885 |
group.dispose(); |
871 |
|
|
886 |
|
|
872 | 887 |
//if (heterotypicSynonymGroups != null) { |
873 | 888 |
heterotypicSynonymGroups.remove(group); |
874 | 889 |
//} |
... | ... | |
889 | 904 |
} |
890 | 905 |
return getAcceptedNameContainer(); |
891 | 906 |
} |
892 |
|
|
907 |
|
|
893 | 908 |
/* (non-Javadoc) |
894 | 909 |
* @see eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage#setOnError() |
895 | 910 |
*/ |
896 |
public void setOnError() { |
|
897 |
Color disabledColor = StoreUtil.getColor(Resources.COLOR_EDITOR_ERROR); |
|
911 |
@Override |
|
912 |
public void setOnError() { |
|
913 |
Color disabledColor = AbstractUtility.getColor(Resources.COLOR_EDITOR_ERROR); |
|
898 | 914 |
setEnabled(false, disabledColor); |
899 | 915 |
} |
900 | 916 |
|
... | ... | |
903 | 919 |
*/ |
904 | 920 |
@Override |
905 | 921 |
public void setDisabled(){ |
906 |
Color disabledColor = StoreUtil.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND);
|
|
922 |
Color disabledColor = AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND);
|
|
907 | 923 |
setEnabled(false); |
908 | 924 |
} |
909 |
|
|
925 |
|
|
910 | 926 |
protected void setEnabled(boolean enabled, Color background) { |
911 |
|
|
927 |
|
|
912 | 928 |
for(AbstractGroupedContainer groupedContainer : getGroupedContainers()){ |
913 | 929 |
groupedContainer.setEnabled(enabled); |
914 | 930 |
} |
915 |
|
|
931 |
|
|
916 | 932 |
// send an empty selection to the current provider - TODO only on error ??? |
917 | 933 |
if (!enabled) { |
918 | 934 |
getManagedForm().setInput(null); |
... | ... | |
923 | 939 |
} |
924 | 940 |
getControl().setBackground(background); |
925 | 941 |
} |
926 |
|
|
942 |
|
|
927 | 943 |
@Override |
928 | 944 |
public void setEnabled(boolean enabled) { |
929 |
Color background = StoreUtil.getColor(enabled ? Resources.COLOR_COMPOSITE_BACKGROUND : Resources.COLOR_TEXT_DISABLED_BACKGROUND);
|
|
945 |
Color background = AbstractUtility.getColor(enabled ? Resources.COLOR_COMPOSITE_BACKGROUND : Resources.COLOR_TEXT_DISABLED_BACKGROUND);
|
|
930 | 946 |
setEnabled(enabled, background); |
931 | 947 |
} |
932 | 948 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/DataImportEditor.java | ||
---|---|---|
82 | 82 |
*/ |
83 | 83 |
@Override |
84 | 84 |
public void setFocus() { |
85 |
tableViewer.getControl().setFocus(); |
|
85 | 86 |
//make sure to bind again if maybe in another view the conversation was unbound |
86 | 87 |
if(!conversation.isBound()){ |
87 | 88 |
conversation.bind(); |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java | ||
---|---|---|
195 | 195 |
*/ |
196 | 196 |
@Override |
197 | 197 |
public void setFocus() { |
198 |
viewer.getControl().setFocus(); |
|
198 | 199 |
//make sure to bind again if maybe in another view the conversation was unbound |
199 | 200 |
if(!conversation.isBound()){ |
200 | 201 |
conversation.bind(); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermEditor.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2009 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
52 | 52 |
public static final String ID = "eu.etaxonomy.taxeditor.editor.definedTerm"; |
53 | 53 |
|
54 | 54 |
public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.store.openDefinedTermEditor"; |
55 |
|
|
55 |
|
|
56 | 56 |
protected TreeViewer viewer; |
57 | 57 |
protected ConversationHolder conversation; |
58 | 58 |
private ISelectionService selectionService; |
... | ... | |
60 | 60 |
|
61 | 61 |
|
62 | 62 |
|
63 |
private int dndOperations = DND.DROP_COPY | DND.DROP_MOVE; |
|
63 |
private final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
|
|
64 | 64 |
/** |
65 |
*
|
|
65 |
* |
|
66 | 66 |
*/ |
67 | 67 |
public DefinedTermEditor() { |
68 | 68 |
super(); |
... | ... | |
71 | 71 |
|
72 | 72 |
@Override |
73 | 73 |
public void createPartControl(Composite parent) { |
74 |
|
|
74 |
|
|
75 | 75 |
// parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); |
76 |
|
|
76 |
|
|
77 | 77 |
FillLayout layout = new FillLayout(); |
78 | 78 |
layout.marginHeight = 0; |
79 | 79 |
layout.marginWidth = 0; |
80 | 80 |
layout.type = SWT.VERTICAL; |
81 |
|
|
81 |
|
|
82 | 82 |
parent.setLayout(layout); |
83 | 83 |
viewer = new TreeViewer(parent); |
84 | 84 |
viewer.getControl().setLayoutData(LayoutConstants.FILL()); |
85 | 85 |
viewer.setContentProvider(new TermContentProvider()); |
86 | 86 |
viewer.setLabelProvider(new TermLabelProvider()); |
87 | 87 |
viewer.setSorter(new ViewerSorter()); |
88 |
|
|
88 |
|
|
89 | 89 |
Transfer[] transfers = new Transfer[] { TermTransfer.getInstance() }; |
90 | 90 |
viewer.addDragSupport(dndOperations, transfers, new DefinedTermDragListener(viewer)); |
91 | 91 |
viewer.addDropSupport(dndOperations, transfers, new DefinedTermDropAdapter(this)); |
92 |
|
|
92 |
|
|
93 | 93 |
getDefinedTermEditorInput().initialiseVocabularies(); |
94 | 94 |
viewer.setInput(getDefinedTermEditorInput().getVocabularies()); |
95 |
|
|
95 |
|
|
96 | 96 |
getSite().setSelectionProvider(viewer); |
97 |
|
|
97 |
|
|
98 | 98 |
selectionService = getSite().getWorkbenchWindow().getSelectionService(); |
99 | 99 |
selectionService.addSelectionListener(this); |
100 |
|
|
100 |
|
|
101 | 101 |
setPartName(getEditorInput().getName()); |
102 | 102 |
createMenu(); |
103 | 103 |
} |
104 |
|
|
105 |
|
|
106 | 104 |
|
107 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 | 108 |
/** |
109 |
*
|
|
109 |
* |
|
110 | 110 |
*/ |
111 | 111 |
public TermEditorInput getDefinedTermEditorInput() { |
112 | 112 |
return (TermEditorInput) getEditorInput(); |
... | ... | |
117 | 117 |
*/ |
118 | 118 |
@Override |
119 | 119 |
public boolean postOperation(CdmBase objectAffectedByOperation) { |
120 |
|
|
121 |
|
|
122 |
viewer.refresh();
|
|
123 |
|
|
120 |
|
|
121 |
|
|
122 |
viewer.refresh(); |
|
123 |
|
|
124 | 124 |
if(objectAffectedByOperation != null){ |
125 | 125 |
viewer.setSelection(new StructuredSelection(objectAffectedByOperation)); |
126 | 126 |
} |
127 | 127 |
setDirty(true); |
128 | 128 |
|
129 | 129 |
return true; |
130 |
}
|
|
130 |
} |
|
131 | 131 |
|
132 | 132 |
private void createMenu() { |
133 | 133 |
// register context menu |
... | ... | |
135 | 135 |
menuManager |
136 | 136 |
.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); |
137 | 137 |
getSite().registerContextMenu(ID, menuManager, viewer); |
138 |
|
|
138 |
|
|
139 | 139 |
Control control = viewer.getControl(); |
140 | 140 |
Menu menu = menuManager.createContextMenu(control); |
141 | 141 |
control.setMenu(menu); |
142 | 142 |
} |
143 |
|
|
144 | 143 |
|
145 |
|
|
144 |
|
|
145 |
|
|
146 | 146 |
|
147 | 147 |
@Override |
148 | 148 |
public void doSave(IProgressMonitor monitor) { |
... | ... | |
150 | 150 |
setDirty(false); |
151 | 151 |
getDefinedTermEditorInput().initialiseVocabularies(); |
152 | 152 |
} |
153 |
|
|
153 |
|
|
154 | 154 |
|
155 | 155 |
@Override |
156 | 156 |
public void doSaveAs() {} |
... | ... | |
159 | 159 |
public void init(IEditorSite site, IEditorInput input) throws PartInitException { |
160 | 160 |
setSite(site); |
161 | 161 |
setInput(input); |
162 |
|
|
162 |
|
|
163 | 163 |
} |
164 | 164 |
|
165 | 165 |
@Override |
... | ... | |
174 | 174 |
|
175 | 175 |
@Override |
176 | 176 |
public void setFocus() { |
177 |
viewer.getControl().setFocus(); |
|
177 | 178 |
getConversationHolder().bind(); |
178 | 179 |
} |
179 | 180 |
|
180 | 181 |
@Override |
181 | 182 |
public void update(CdmDataChangeMap changeEvents) { |
182 | 183 |
// TODO Auto-generated method stub |
183 |
|
|
184 |
|
|
184 | 185 |
} |
185 | 186 |
|
186 | 187 |
@Override |
... | ... | |
191 | 192 |
@Override |
192 | 193 |
public void selectionChanged(IWorkbenchPart part, ISelection selection) { |
193 | 194 |
// TODO Auto-generated method stub |
194 |
|
|
195 |
|
|
195 | 196 |
} |
196 | 197 |
|
197 | 198 |
@Override |
... | ... | |
216 | 217 |
} |
217 | 218 |
|
218 | 219 |
/** |
219 |
*
|
|
220 |
* |
|
220 | 221 |
*/ |
221 | 222 |
public TreeViewer getViewer() { |
222 | 223 |
return viewer; |
Also available in: Unified diff
fix for #2754