Project

General

Profile

Download (19.3 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
	        input.bind();
237

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

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

    
252
	@Override
253
    public ConversationHolder getConversationHolder() {
254
		return conversation;
255
	}
256

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

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

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

    
279
		createOrUpdateNameComposites();
280

    
281
		if (focus) {
282
			setFocus();
283
		}
284

    
285
		return true;
286
	}
287

    
288
	@Override
289
    public boolean postOperation(CdmBase objectAffectedByOperation) {
290

    
291
		changed(objectAffectedByOperation);
292

    
293
		redraw(false);
294

    
295
		if (objectAffectedByOperation instanceof TaxonBase) {
296
			objectAffectedByLastOperation = (TaxonBase) objectAffectedByOperation;
297
		}
298

    
299
		return true;
300
	}
301

    
302
	public ManagedForm getManagedForm() {
303
		return managedForm;
304
	}
305

    
306

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

    
324
	public Set<AbstractGroupedContainerE4> getEmptyContainers() {
325
		Set<AbstractGroupedContainerE4> containersWithEmptyNames = new HashSet<>();
326

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

    
334
		return containersWithEmptyNames;
335
	}
336

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

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

    
346
	    }
347
	    conversation.commit(true);
348
	    monitor.worked(1);
349

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

    
358
	        monitor.subTask(Messages.TaxonNameEditor_SAVING_COMPOSITES
359
	                + container.getTaxonBase().getTitleCache());
360
	        container.persistName();
361

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

    
367
	     // Otherwise declare this step as done.
368
	        monitor.worked(1);
369

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

    
375

    
376
        dirty.setDirty(false);
377

    
378
	    // Stop the progress monitor.
379
	    monitor.done();
380
	}
381

    
382
	public void init(TaxonEditorInputE4 input) {
383

    
384
		if (!(input != null)) {
385
            MessagingUtils.error(this.getClass(), new Exception(Messages.TaxonNameEditor_INVALID_INPUT));
386
            return;
387
        }
388

    
389
		if (input.getAdapter(Taxon.class) != null) {
390
			taxon = CdmBase.deproxy(input.getAdapter(Taxon.class), Taxon.class);
391
		} else {
392
		    MessagingUtils.error(this.getClass(), new Exception(Messages.TaxonNameEditor_INVALID_INPUT_TAXON_NULL));
393
		    return;
394
		}
395

    
396
		this.input = input;
397
		conversation = input.getConversationHolder();
398

    
399
        createOrUpdateNameComposites();
400

    
401
        createDragSupport();
402

    
403
        setPartName();
404

    
405
        //set initial selection
406
        TaxonBase initiallySelectedTaxonBase = input.getInitiallySelectedTaxonBase();
407
        if(initiallySelectedTaxonBase!=null){
408
            selService.setSelection(new StructuredSelection(initiallySelectedTaxonBase));
409
            getContainer(initiallySelectedTaxonBase).setSelected();
410
        }
411
	}
412

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

    
425
	public AcceptedNameContainerE4 getAcceptedNameContainer() {
426
		return getAcceptedGroup().getAcceptedNameContainer();
427
	}
428

    
429
	public HomotypicalSynonymGroupE4 getHomotypicalGroupContainer(
430
			HomotypicalGroup homotypicalGroup) {
431
		for (HomotypicalSynonymGroupE4 group : getHeterotypicSynonymGroups()) {
432
			if (group.getGroup().equals(homotypicalGroup)) {
433
				return group;
434
			}
435
		}
436

    
437
		return null;
438
	}
439

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

    
450
		for (AbstractGroupedContainerE4 composite : getGroupedContainers()) {
451
			if (composite.isDirty()) {
452
				dirtyNames.add(composite);
453
			}
454
		}
455

    
456
		return dirtyNames;
457
	}
458

    
459
	public List<AbstractGroupedContainerE4> getGroupedContainers() {
460
		List<AbstractGroupedContainerE4> groupedComposites = new ArrayList<>();
461

    
462
		for (AbstractGroupE4 group : getAllGroups()) {
463
		    if (group!= null){
464
		        groupedComposites.addAll(group.getGroupedContainers());
465
		    }
466
		}
467

    
468
		return groupedComposites;
469
	}
470

    
471
	public List<AbstractGroupE4> getAllGroups() {
472
		List<AbstractGroupE4> allGroups = new ArrayList<>();
473

    
474
		allGroups.add(getAcceptedGroup());
475

    
476
		heterotypicSynonymGroups = getHeterotypicSynonymGroups();
477

    
478
		if (heterotypicSynonymGroups != null) {
479
			allGroups.addAll(heterotypicSynonymGroups);
480
		}
481

    
482
		if (misappliedGroup != null) {
483
			allGroups.add(misappliedGroup);
484
		}
485

    
486
		return allGroups;
487
	}
488

    
489
	@Override
490
	public IEclipseContext getContext() {
491
	    return context;
492
	}
493

    
494
	public boolean isDirty() {
495
		return dirty.isDirty();
496
	}
497

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

    
510
	/** {@inheritDoc} */
511
	@Override
512
    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
513

    
514
	}
515

    
516
	public AbstractGroupedContainerE4 getSelectedContainer() {
517
		return (selection != null) ? getContainer(selection)
518
				: getAcceptedNameContainer();
519
	}
520

    
521
    @Override
522
    public void dragEntered() {
523
        // TODO change this
524
        getControl().setBackground(
525
                AbstractUtility.getColor(Resources.COLOR_DRAG_ENTER));
526
    }
527

    
528
    @Override
529
    public void dragLeft() {
530
        getControl().setBackground(
531
                AbstractUtility.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
532
    }
533

    
534

    
535
	public void setMisapplicationsGroup(MisappliedGroupE4 misappliedGroup) {
536
		this.misappliedGroup = misappliedGroup;
537
	}
538

    
539
	public FormToolkit getToolkit() {
540
		return managedForm.getToolkit();
541
	}
542

    
543
	public List<HomotypicalSynonymGroupE4> getHeterotypicSynonymGroups() {
544
		return heterotypicSynonymGroups;
545
	}
546

    
547
	public void addHeterotypicSynonymGroup(HomotypicalSynonymGroupE4 group) {
548
		heterotypicSynonymGroups.add(group);
549
	}
550

    
551
	public AcceptedGroupE4 getAcceptedGroup() {
552
		return acceptedGroup;
553
	}
554

    
555
	public void setAcceptedGroup(AcceptedGroupE4 acceptedGroup) {
556
		this.acceptedGroup = acceptedGroup;
557
	}
558

    
559
	public MisappliedGroupE4 getMisappliedGroup() {
560
		return misappliedGroup;
561
	}
562

    
563
	public boolean isActive() {
564
		return this.equals(AbstractUtility.getActivePart());
565
	}
566

    
567
    @Override
568
    public boolean onComplete() {
569
		getContainer(objectAffectedByLastOperation).setSelected();
570
		return true;
571
	}
572

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

    
581
	public void removeGroup(AbstractGroupE4 group) {
582
		if (group != null) {
583
			group.dispose();
584

    
585
			//if (heterotypicSynonymGroups != null) {
586
			heterotypicSynonymGroups.remove(group);
587
			//}
588
		}
589
	}
590

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

    
602
    public void setOnError() {
603
		Color disabledColor =  AbstractUtility.getColor(Resources.COLOR_EDITOR_ERROR);
604
		setEnabled(false, disabledColor);
605
	}
606

    
607
	public void setDisabled(){
608
		Color disabledColor =  AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND);
609
		setEnabled(false, disabledColor);
610
	}
611

    
612
	protected void setEnabled(boolean enabled, Color background) {
613

    
614
		for(AbstractGroupedContainerE4 groupedContainer : getGroupedContainers()){
615
			groupedContainer.setEnabled(enabled);
616
		}
617

    
618
		// send an empty selection to the current provider - TODO only on error ???
619
		if (!enabled) {
620
			getManagedForm().setInput(null);
621

    
622
			for (AbstractGroupedContainerE4 groupedContainer : getGroupedContainers()) {
623
				groupedContainer.setBackground(background);
624
			}
625
		}
626
		getControl().setBackground(background);
627
	}
628

    
629
    @Override
630
    public void changed(Object element) {
631
        // setDirty(true);
632
        // 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
633
        if (element != null){
634
            dirty.setDirty(true);
635
            //refresh part title
636
            //TODO: refresh taxon node in taxon navigator
637
            setPartName();
638
        }
639

    
640
        if (element instanceof TaxonBase) {
641
            AbstractGroupedContainerE4 container = getContainer((TaxonBase) element);
642
            if (container != null) {
643
                container.refresh();
644
            }
645
        }
646
        if (element instanceof TaxonRelationship) {
647
            AbstractGroupedContainerE4 container = getContainer(((TaxonRelationship) element).getFromTaxon());
648
            if (container != null) {
649
                container.refresh();
650
            }
651
        }
652
    }
653

    
654
    public void setPartName(){
655
        thisPart.setLabel(this.taxon.getName().getFullTitleCache());
656
    }
657

    
658
    @Override
659
    public void forceDirty() {
660
        setDirty();
661
    }
662

    
663

    
664
    public IUndoContext getUndoContext() {
665
        return undoContext;
666
    }
667

    
668
    @Override
669
    public Composite getControl(){
670
        return managedForm.getForm().getBody();
671
    }
672

    
673
    public EMenuService getMenuService() {
674
        return menuService;
675
    }
676

    
677
    public ESelectionService getSelectionService() {
678
        return selService;
679
    }
680

    
681

    
682
    /**
683
     * {@inheritDoc}
684
     */
685
    @Override
686
    public boolean canAttachMedia() {
687
        return true;
688
    }
689

    
690
    public TaxonEditorInputE4 getEditorInput() {
691
        return input;
692
    }
693

    
694
    /**
695
     * {@inheritDoc}
696
     */
697
    @Override
698
    public TaxonNameEditorE4 getEditor() {
699
        return this;
700
    }
701

    
702
}
(2-2/2)