Project

General

Profile

Download (19.4 KB) Statistics
| Branch: | Tag: | Revision:
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.name.e4;
11

    
12
import java.util.ArrayList;
13
import java.util.HashSet;
14
import java.util.List;
15
import java.util.Set;
16

    
17
import javax.annotation.PostConstruct;
18
import javax.annotation.PreDestroy;
19
import javax.inject.Inject;
20

    
21
import org.apache.commons.lang.StringUtils;
22
import org.eclipse.core.commands.operations.IUndoContext;
23
import org.eclipse.core.commands.operations.UndoContext;
24
import org.eclipse.core.runtime.IProgressMonitor;
25
import org.eclipse.core.runtime.OperationCanceledException;
26
import org.eclipse.e4.core.contexts.IEclipseContext;
27
import org.eclipse.e4.core.services.events.IEventBroker;
28
import org.eclipse.e4.ui.di.Focus;
29
import org.eclipse.e4.ui.di.Persist;
30
import org.eclipse.e4.ui.model.application.ui.MDirtyable;
31
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
32
import org.eclipse.e4.ui.services.EMenuService;
33
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
34
import org.eclipse.jface.dialogs.MessageDialog;
35
import org.eclipse.jface.viewers.ISelection;
36
import org.eclipse.jface.viewers.ISelectionProvider;
37
import org.eclipse.jface.viewers.StructuredSelection;
38
import org.eclipse.swt.dnd.DND;
39
import org.eclipse.swt.dnd.DropTarget;
40
import org.eclipse.swt.dnd.Transfer;
41
import org.eclipse.swt.graphics.Color;
42
import org.eclipse.swt.widgets.Composite;
43
import org.eclipse.ui.ISelectionListener;
44
import org.eclipse.ui.IWorkbenchPart;
45
import org.eclipse.ui.IWorkbenchPartReference;
46
import org.eclipse.ui.forms.ManagedForm;
47
import org.eclipse.ui.forms.widgets.FormToolkit;
48
import org.eclipse.ui.forms.widgets.ScrolledForm;
49
import org.eclipse.ui.forms.widgets.TableWrapLayout;
50

    
51
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
52
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
53
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
54
import eu.etaxonomy.cdm.model.common.CdmBase;
55
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
56
import eu.etaxonomy.cdm.model.taxon.Taxon;
57
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
58
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
59
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
60
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
61
import eu.etaxonomy.taxeditor.editor.CdmDataTransfer;
62
import eu.etaxonomy.taxeditor.editor.ISecuredEditor;
63
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
64
import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
65
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
66
import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupE4;
67
import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainerE4;
68
import eu.etaxonomy.taxeditor.editor.name.e4.container.AcceptedGroupE4;
69
import eu.etaxonomy.taxeditor.editor.name.e4.container.AcceptedNameContainerE4;
70
import eu.etaxonomy.taxeditor.editor.name.e4.container.ContainerFactoryE4;
71
import eu.etaxonomy.taxeditor.editor.name.e4.container.HomotypicalSynonymGroupE4;
72
import eu.etaxonomy.taxeditor.editor.name.e4.container.MisappliedGroupE4;
73
import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDropTargetListenerE4;
74
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
75
import eu.etaxonomy.taxeditor.model.AbstractUtility;
76
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
77
import eu.etaxonomy.taxeditor.model.IPartChangeListener;
78
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
79
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
80
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
81
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
82
import eu.etaxonomy.taxeditor.model.MessagingUtils;
83
import eu.etaxonomy.taxeditor.model.TaxeditorPartService;
84
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
85
import eu.etaxonomy.taxeditor.preference.Resources;
86
import eu.etaxonomy.taxeditor.security.RequiredPermissions;
87
import eu.etaxonomy.taxeditor.store.CdmStore;
88
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
89

    
90
/**
91
 *
92
 * @author pplitzner
93
 * @date Aug 24, 2017
94
 *
95
 */
96
public class TaxonNameEditorE4 implements IConversationEnabled, IDirtyMarkable, IPartContentHasDetails,
97
        IPartContentHasSupplementalData, IPartContentHasMedia, IPartContentHasFactualData, IPartChangeListener,
98
        ISelectionListener, ISecuredEditor, IPostOperationEnabled, IE4SavablePart, ITaxonEditor, IDropTargetableE4 {
99

    
100
	private Taxon taxon;
101

    
102
	private ManagedForm managedForm;
103
	private ScrolledForm scrolledForm;
104
	private Composite parent;
105
	private ISelectionProvider simpleSelectionProvider;
106

    
107
	private TaxonBase selection;
108

    
109
	private ConversationHolder conversation;
110

    
111
	private AcceptedGroupE4 acceptedGroup;
112
	private List<HomotypicalSynonymGroupE4> heterotypicSynonymGroups = new ArrayList<>();
113
	private MisappliedGroupE4 misappliedGroup;
114

    
115
	private DropTarget target;
116

    
117
	private TaxonBase objectAffectedByLastOperation;
118

    
119
	@Inject
120
	private EMenuService menuService;
121

    
122
	@Inject
123
	private ESelectionService selService;
124

    
125
	@Inject
126
	private IEclipseContext context;
127

    
128
	@Inject
129
	private MDirtyable dirty;
130

    
131
	private MPart thisPart;
132

    
133
    private TaxonEditorInputE4 input;
134

    
135
    private UndoContext undoContext;
136

    
137
    @Inject
138
    private IEventBroker eventBroker;
139

    
140
	@Inject
141
	public TaxonNameEditorE4() {
142
	    undoContext = new UndoContext();
143
	}
144

    
145

    
146
	@PostConstruct
147
    public void createPartControl(Composite parent, MPart thisPart) {
148
	    this.thisPart = thisPart;
149

    
150
        createManagedForm(parent);
151

    
152
		TaxeditorPartService.getInstance().addListener(
153
				TaxeditorPartService.PART_ACTIVATED, this);
154

    
155
	}
156

    
157
	protected void createManagedForm(Composite composite) {
158

    
159
		managedForm = new ManagedForm(composite) {
160

    
161
			@Override
162
			public void dirtyStateChanged() {
163
			    dirty.setDirty(true);
164
			}
165

    
166
			@Override
167
			public boolean setInput(Object input) {
168
				if (input instanceof AbstractGroupedContainerE4) {
169
				    TaxonBase newSelection = ((AbstractGroupedContainerE4) input).getData();
170
				    if(selection!=newSelection || TaxonNameEditorE4.this.isDirty()){
171
				        selection = newSelection;
172
				        selService.setSelection(new StructuredSelection(selection));
173
				    }
174
				}else if(input == null){
175
					selection = null;
176
                    selService.setSelection(new StructuredSelection());
177
				}
178

    
179

    
180
				return super.setInput(input);
181
			}
182
		};
183

    
184
		scrolledForm = managedForm.getForm();
185
		parent = scrolledForm.getBody();
186

    
187
		parent.setData(taxon);
188

    
189
		TableWrapLayout layout = new TableWrapLayout();
190
		layout.leftMargin = 0;
191
		layout.rightMargin = 0;
192
		layout.topMargin = 0;
193
		layout.bottomMargin = 0;
194

    
195
		layout.verticalSpacing = 0;
196
		layout.horizontalSpacing = 0;
197

    
198
		parent.setLayout(layout);
199
		parent.setBackground(AbstractUtility
200
				.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
201
	}
202

    
203
	public void createOrUpdateNameComposites() {
204
		ContainerFactoryE4.createOrUpdateAcceptedTaxonsHomotypicGroup(this);
205
		ContainerFactoryE4.createOrUpdateHeterotypicSynonymyGroups(this);
206
		ContainerFactoryE4.createOrUpdateMisapplicationsGroup(this);
207

    
208

    
209
		// Redraw composite
210
//		managedForm.reflow(true);
211
		managedForm.refresh();
212
	}
213

    
214
	@Override
215
    public Taxon getTaxon() {
216
		return HibernateProxyHelper.deproxy(taxon);
217
	}
218

    
219
	public void setDirty() {
220
		managedForm.dirtyStateChanged();
221
	}
222

    
223
	@Focus
224
	public void setFocus() {
225
	    //make sure to bind again if maybe in another view the conversation was unbound
226
        if(conversation!=null && !conversation.isBound()){
227
            conversation.bind();
228
        }
229

    
230
	    if(input!=null){
231
	        if (getSelectedContainer() == null) {
232
	            throw new IllegalStateException(
233
	                    Messages.TaxonNameEditor_THERE_SHOULD_ALWAYS_BE);
234
	        }
235
	        getSelectedContainer().setSelected();
236
	        if (!input.getCdmEntitySession().isActive()){
237
	            input.bind();
238
	        }
239

    
240
	        // check permissions
241
	        boolean doEnable = permissionsSatisfied();
242
	        managedForm.getForm().setEnabled(doEnable);
243
	    }
244
        eventBroker.post(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR, this);
245
	}
246

    
247
	@Override
248
	public boolean permissionsSatisfied() {
249
		TaxonNode taxonNode = input.getTaxonNode();
250
		boolean doEnable = CdmStore.currentAuthentiationHasPermission(taxonNode, RequiredPermissions.TAXONNODE_EDIT);
251
		return doEnable;
252
	}
253

    
254
	@Override
255
    public ConversationHolder getConversationHolder() {
256
		return conversation;
257
	}
258

    
259
	/** {@inheritDoc} */
260
	@Override
261
    public void update(CdmDataChangeMap events) {
262
		// redraw();
263
	}
264

    
265
	/**
266
	 * Redraws this editor return true on success
267
	 *
268
	 * @return a boolean.
269
	 */
270
    public boolean redraw() {
271
		return redraw(true);
272
	}
273

    
274
	/**
275
	 * {@inheritDoc}
276
	 *
277
	 * Redraws the editor controls
278
	 */
279
    public boolean redraw(boolean focus) {
280

    
281
		createOrUpdateNameComposites();
282

    
283
		if (focus) {
284
			setFocus();
285
		}
286

    
287
		return true;
288
	}
289

    
290
	@Override
291
    public boolean postOperation(CdmBase objectAffectedByOperation) {
292

    
293
		changed(objectAffectedByOperation);
294

    
295
		redraw(false);
296

    
297
		if (objectAffectedByOperation instanceof TaxonBase) {
298
			objectAffectedByLastOperation = (TaxonBase) objectAffectedByOperation;
299
		}
300

    
301
		return true;
302
	}
303

    
304
	public ManagedForm getManagedForm() {
305
		return managedForm;
306
	}
307

    
308

    
309
	/**
310
	 * <p>
311
	 * checkForEmptyNames
312
	 * </p>
313
	 *
314
	 * @return true if there are empty names
315
	 */
316
	public boolean checkForEmptyNames() {
317
		for (AbstractGroupedContainerE4 container : getGroupedContainers()) {
318
			if (container.getName() == null
319
					|| StringUtils.isEmpty(container.getName().getTitleCache())) {
320
				return true;
321
			}
322
		}
323
		return false;
324
	}
325

    
326
	public Set<AbstractGroupedContainerE4> getEmptyContainers() {
327
		Set<AbstractGroupedContainerE4> containersWithEmptyNames = new HashSet<>();
328

    
329
		for (AbstractGroupedContainerE4 container : getGroupedContainers()) {
330
			if (container.getName() == null
331
					|| StringUtils.isEmpty(container.getName().getTitleCache())) {
332
				containersWithEmptyNames.add(container);
333
			}
334
		}
335

    
336
		return containersWithEmptyNames;
337
	}
338

    
339
	/** {@inheritDoc} */
340
	@Override
341
    @Persist
342
	public void save(IProgressMonitor monitor) {
343

    
344
	    monitor.beginTask(Messages.TaxonNameEditor_SAVING_NAMES, getGroupedContainers().size());
345
	    if (!conversation.isBound()) {
346
	        conversation.bind();
347

    
348
	    }
349
	    conversation.commit(true);
350
	    monitor.worked(1);
351

    
352
	    // check for empty names
353
	    if (checkForEmptyNames()) {
354
	        MessageDialog.openWarning(AbstractUtility.getShell(), Messages.MultiPageTaxonEditor_NO_NAME_SPECIFIED,
355
	                Messages.MultiPageTaxonEditor_NO_NAME_SPECIFIED_MESSAGE);
356
	        return;
357
	    }
358
	    for (AbstractGroupedContainerE4 container : getGroupedContainers()) {
359

    
360
	        monitor.subTask(Messages.TaxonNameEditor_SAVING_COMPOSITES
361
	                + container.getTaxonBase().getTitleCache());
362
	        container.persistName();
363

    
364
	        // In case the progress monitor was canceled throw an exception.
365
	        if (monitor.isCanceled()) {
366
	            throw new OperationCanceledException();
367
	        }
368

    
369
	     // Otherwise declare this step as done.
370
	        monitor.worked(1);
371

    
372
	    }
373
	    input.merge();
374
	    // commit the conversation and start a new transaction immediately
375
        conversation.commit(true);
376

    
377

    
378
        dirty.setDirty(false);
379

    
380
	    // Stop the progress monitor.
381
	    monitor.done();
382
	}
383

    
384
	public void init(TaxonEditorInputE4 input) {
385
		if (this.input != null){
386
			this.input.dispose();
387
		}
388
		if (!(input != null)) {
389
            MessagingUtils.error(this.getClass(), new Exception(Messages.TaxonNameEditor_INVALID_INPUT));
390
            return;
391
        }
392

    
393
		if (input.getAdapter(Taxon.class) != null) {
394
			taxon = CdmBase.deproxy(input.getAdapter(Taxon.class), Taxon.class);
395
		} else {
396
		    MessagingUtils.error(this.getClass(), new Exception(Messages.TaxonNameEditor_INVALID_INPUT_TAXON_NULL));
397
		    return;
398
		}
399

    
400
		this.input = input;
401
		conversation = input.getConversationHolder();
402

    
403
        createOrUpdateNameComposites();
404

    
405
        createDragSupport();
406

    
407
        setPartName();
408

    
409
        //set initial selection
410
        TaxonBase initiallySelectedTaxonBase = input.getInitiallySelectedTaxonBase();
411
        if(initiallySelectedTaxonBase!=null){
412
            selService.setSelection(new StructuredSelection(initiallySelectedTaxonBase));
413
            getContainer(initiallySelectedTaxonBase).setSelected();
414
        }
415
	}
416

    
417
   private void createDragSupport() {
418
       // Listen for names being dragged outside of existing homotypic groups -
419
       // user wants to create a new group
420
       Transfer[] types = new Transfer[] { CdmDataTransfer.getInstance() };
421
       int operations = DND.DROP_MOVE;
422
       if (target == null) {
423
           target = new DropTarget(parent, operations);
424
           target.setTransfer(types);
425
           target.addDropListener(new NameEditorDropTargetListenerE4(this));
426
       }
427
   }
428

    
429
	public AcceptedNameContainerE4 getAcceptedNameContainer() {
430
		return getAcceptedGroup().getAcceptedNameContainer();
431
	}
432

    
433
	public HomotypicalSynonymGroupE4 getHomotypicalGroupContainer(
434
			HomotypicalGroup homotypicalGroup) {
435
		for (HomotypicalSynonymGroupE4 group : getHeterotypicSynonymGroups()) {
436
			if (group.getGroup().equals(homotypicalGroup)) {
437
				return group;
438
			}
439
		}
440

    
441
		return null;
442
	}
443

    
444
	/**
445
	 * <p>
446
	 * getDirtyNames
447
	 * </p>
448
	 *
449
	 * @return a Set containing all composites that have been edited
450
	 */
451
	public Set<AbstractGroupedContainerE4> getDirtyNames() {
452
		Set<AbstractGroupedContainerE4> dirtyNames = new HashSet<>();
453

    
454
		for (AbstractGroupedContainerE4 composite : getGroupedContainers()) {
455
			if (composite.isDirty()) {
456
				dirtyNames.add(composite);
457
			}
458
		}
459

    
460
		return dirtyNames;
461
	}
462

    
463
	public List<AbstractGroupedContainerE4> getGroupedContainers() {
464
		List<AbstractGroupedContainerE4> groupedComposites = new ArrayList<>();
465

    
466
		for (AbstractGroupE4 group : getAllGroups()) {
467
		    if (group!= null){
468
		        groupedComposites.addAll(group.getGroupedContainers());
469
		    }
470
		}
471

    
472
		return groupedComposites;
473
	}
474

    
475
	public List<AbstractGroupE4> getAllGroups() {
476
		List<AbstractGroupE4> allGroups = new ArrayList<>();
477

    
478
		allGroups.add(getAcceptedGroup());
479

    
480
		heterotypicSynonymGroups = getHeterotypicSynonymGroups();
481

    
482
		if (heterotypicSynonymGroups != null) {
483
			allGroups.addAll(heterotypicSynonymGroups);
484
		}
485

    
486
		if (misappliedGroup != null) {
487
			allGroups.add(misappliedGroup);
488
		}
489

    
490
		return allGroups;
491
	}
492

    
493
	@Override
494
	public IEclipseContext getContext() {
495
	    return context;
496
	}
497

    
498
	public boolean isDirty() {
499
		return dirty.isDirty();
500
	}
501

    
502
	@PreDestroy
503
	public void dispose() {
504
        if(conversation!=null){
505
            conversation.unregisterForDataStoreChanges(this);
506
            conversation.close();
507
        }
508
        if(input!=null){
509
            input.dispose();
510
        }
511
        eventBroker.post(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR, null);
512
	}
513

    
514
	/** {@inheritDoc} */
515
	@Override
516
    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
517

    
518
	}
519

    
520
	public AbstractGroupedContainerE4 getSelectedContainer() {
521
		return (selection != null) ? getContainer(selection)
522
				: getAcceptedNameContainer();
523
	}
524

    
525
    @Override
526
    public void dragEntered() {
527
        // TODO change this
528
        getControl().setBackground(
529
                AbstractUtility.getColor(Resources.COLOR_DRAG_ENTER));
530
    }
531

    
532
    @Override
533
    public void dragLeft() {
534
        getControl().setBackground(
535
                AbstractUtility.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
536
    }
537

    
538

    
539
	public void setMisapplicationsGroup(MisappliedGroupE4 misappliedGroup) {
540
		this.misappliedGroup = misappliedGroup;
541
	}
542

    
543
	public FormToolkit getToolkit() {
544
		return managedForm.getToolkit();
545
	}
546

    
547
	public List<HomotypicalSynonymGroupE4> getHeterotypicSynonymGroups() {
548
		return heterotypicSynonymGroups;
549
	}
550

    
551
	public void addHeterotypicSynonymGroup(HomotypicalSynonymGroupE4 group) {
552
		heterotypicSynonymGroups.add(group);
553
	}
554

    
555
	public AcceptedGroupE4 getAcceptedGroup() {
556
		return acceptedGroup;
557
	}
558

    
559
	public void setAcceptedGroup(AcceptedGroupE4 acceptedGroup) {
560
		this.acceptedGroup = acceptedGroup;
561
	}
562

    
563
	public MisappliedGroupE4 getMisappliedGroup() {
564
		return misappliedGroup;
565
	}
566

    
567
	public boolean isActive() {
568
		return this.equals(AbstractUtility.getActivePart());
569
	}
570

    
571
    @Override
572
    public boolean onComplete() {
573
		getContainer(objectAffectedByLastOperation).setSelected();
574
		return true;
575
	}
576

    
577
	/** {@inheritDoc} */
578
	@Override
579
    public void partChanged(Integer eventType, IWorkbenchPartReference partRef) {
580
		if (!partRef.getPart(false).equals(this)) {
581
			// getSelectedObject().colorSelected(AbstractGroupedContainer.SELECTED_NO_FOCUS);
582
		}
583
	}
584

    
585
	public void removeGroup(AbstractGroupE4 group) {
586
		if (group != null) {
587
			group.dispose();
588

    
589
			//if (heterotypicSynonymGroups != null) {
590
			heterotypicSynonymGroups.remove(group);
591
			//}
592
		}
593
	}
594

    
595
	public AbstractGroupedContainerE4 getContainer(TaxonBase taxonBase) {
596
		List<AbstractGroupedContainerE4> groupedContainers = getGroupedContainers();
597
		for (AbstractGroupedContainerE4 container : groupedContainers) {
598
			if (container.getData().equals(taxonBase)
599
					&& container.getNameViewer().getTextWidget() != null) {
600
				return container;
601
			}
602
		}
603
		return getAcceptedNameContainer();
604
	}
605

    
606
    public void setOnError() {
607
		Color disabledColor =  AbstractUtility.getColor(Resources.COLOR_EDITOR_ERROR);
608
		setEnabled(false, disabledColor);
609
	}
610

    
611
	public void setDisabled(){
612
		Color disabledColor =  AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND);
613
		setEnabled(false, disabledColor);
614
	}
615

    
616
	protected void setEnabled(boolean enabled, Color background) {
617

    
618
		for(AbstractGroupedContainerE4 groupedContainer : getGroupedContainers()){
619
			groupedContainer.setEnabled(enabled);
620
		}
621

    
622
		// send an empty selection to the current provider - TODO only on error ???
623
		if (!enabled) {
624
			getManagedForm().setInput(null);
625

    
626
			for (AbstractGroupedContainerE4 groupedContainer : getGroupedContainers()) {
627
				groupedContainer.setBackground(background);
628
			}
629
		}
630
		getControl().setBackground(background);
631
	}
632

    
633
    @Override
634
    public void changed(Object element) {
635
        // setDirty(true);
636
        // if the attribute is null then do not set the dirty flag -> hotfix for the problem that for tasks done in service methods the changes are saved automatically
637
        if (element != null){
638
            dirty.setDirty(true);
639
            //refresh part title
640
            //TODO: refresh taxon node in taxon navigator
641
            setPartName();
642
        }
643

    
644
        if (element instanceof TaxonBase) {
645
            AbstractGroupedContainerE4 container = getContainer((TaxonBase) element);
646
            if (container != null) {
647
                container.refresh();
648
            }
649
        }
650
        if (element instanceof TaxonRelationship) {
651
            AbstractGroupedContainerE4 container = getContainer(((TaxonRelationship) element).getFromTaxon());
652
            if (container != null) {
653
                container.refresh();
654
            }
655
        }
656
    }
657

    
658
    public void setPartName(){
659
        thisPart.setLabel(this.taxon.getName().getFullTitleCache());
660
    }
661

    
662
    @Override
663
    public void forceDirty() {
664
        setDirty();
665
    }
666

    
667

    
668
    public IUndoContext getUndoContext() {
669
        return undoContext;
670
    }
671

    
672
    @Override
673
    public Composite getControl(){
674
        return managedForm.getForm().getBody();
675
    }
676

    
677
    public EMenuService getMenuService() {
678
        return menuService;
679
    }
680

    
681
    public ESelectionService getSelectionService() {
682
        return selService;
683
    }
684

    
685

    
686
    /**
687
     * {@inheritDoc}
688
     */
689
    @Override
690
    public boolean canAttachMedia() {
691
        return true;
692
    }
693

    
694
    public TaxonEditorInputE4 getEditorInput() {
695
        return input;
696
    }
697

    
698
    /**
699
     * {@inheritDoc}
700
     */
701
    @Override
702
    public TaxonNameEditorE4 getEditor() {
703
        return this;
704
    }
705

    
706
}
(2-2/2)