Project

General

Profile

Download (19.6 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
//			this.acceptedGroup = null;
388
//			this.heterotypicSynonymGroups.clear();
389
//			this.misappliedGroup = null;
390
		}
391
		if (!(input != null)) {
392
            MessagingUtils.error(this.getClass(), new Exception(Messages.TaxonNameEditor_INVALID_INPUT));
393
            return;
394
        }
395

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

    
403
		this.input = input;
404
		conversation = input.getConversationHolder();
405

    
406
        createOrUpdateNameComposites();
407

    
408
        createDragSupport();
409

    
410
        setPartName();
411

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

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

    
432
	public AcceptedNameContainerE4 getAcceptedNameContainer() {
433
		return getAcceptedGroup().getAcceptedNameContainer();
434
	}
435

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

    
444
		return null;
445
	}
446

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

    
457
		for (AbstractGroupedContainerE4 composite : getGroupedContainers()) {
458
			if (composite.isDirty()) {
459
				dirtyNames.add(composite);
460
			}
461
		}
462

    
463
		return dirtyNames;
464
	}
465

    
466
	public List<AbstractGroupedContainerE4> getGroupedContainers() {
467
		List<AbstractGroupedContainerE4> groupedComposites = new ArrayList<>();
468

    
469
		for (AbstractGroupE4 group : getAllGroups()) {
470
		    if (group!= null){
471
		        groupedComposites.addAll(group.getGroupedContainers());
472
		    }
473
		}
474

    
475
		return groupedComposites;
476
	}
477

    
478
	public List<AbstractGroupE4> getAllGroups() {
479
		List<AbstractGroupE4> allGroups = new ArrayList<>();
480

    
481
		allGroups.add(getAcceptedGroup());
482

    
483
		heterotypicSynonymGroups = getHeterotypicSynonymGroups();
484

    
485
		if (heterotypicSynonymGroups != null) {
486
			allGroups.addAll(heterotypicSynonymGroups);
487
		}
488

    
489
		if (misappliedGroup != null) {
490
			allGroups.add(misappliedGroup);
491
		}
492

    
493
		return allGroups;
494
	}
495

    
496
	@Override
497
	public IEclipseContext getContext() {
498
	    return context;
499
	}
500

    
501
	public boolean isDirty() {
502
		return dirty.isDirty();
503
	}
504

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

    
517
	/** {@inheritDoc} */
518
	@Override
519
    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
520
	    System.err.println("Bla");
521
	}
522

    
523
	public AbstractGroupedContainerE4 getSelectedContainer() {
524
		return (selection != null) ? getContainer(selection)
525
				: getAcceptedNameContainer();
526
	}
527

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

    
535
    @Override
536
    public void dragLeft() {
537
        getControl().setBackground(
538
                AbstractUtility.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
539
    }
540

    
541

    
542
	public void setMisapplicationsGroup(MisappliedGroupE4 misappliedGroup) {
543
		this.misappliedGroup = misappliedGroup;
544
	}
545

    
546
	public FormToolkit getToolkit() {
547
		return managedForm.getToolkit();
548
	}
549

    
550
	public List<HomotypicalSynonymGroupE4> getHeterotypicSynonymGroups() {
551
		return heterotypicSynonymGroups;
552
	}
553

    
554
	public void addHeterotypicSynonymGroup(HomotypicalSynonymGroupE4 group) {
555
		heterotypicSynonymGroups.add(group);
556
	}
557

    
558
	public AcceptedGroupE4 getAcceptedGroup() {
559
		return acceptedGroup;
560
	}
561

    
562
	public void setAcceptedGroup(AcceptedGroupE4 acceptedGroup) {
563
		this.acceptedGroup = acceptedGroup;
564
	}
565

    
566
	public MisappliedGroupE4 getMisappliedGroup() {
567
		return misappliedGroup;
568
	}
569

    
570
	public boolean isActive() {
571
		return this.equals(AbstractUtility.getActivePart());
572
	}
573

    
574
    @Override
575
    public boolean onComplete() {
576
		getContainer(objectAffectedByLastOperation).setSelected();
577
		return true;
578
	}
579

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

    
588
	public void removeGroup(AbstractGroupE4 group) {
589
		if (group != null) {
590
			group.dispose();
591

    
592
			//if (heterotypicSynonymGroups != null) {
593
			heterotypicSynonymGroups.remove(group);
594
			//}
595
		}
596
	}
597

    
598
	public AbstractGroupedContainerE4 getContainer(TaxonBase taxonBase) {
599
		@SuppressWarnings("rawtypes")
600
        List<AbstractGroupedContainerE4> groupedContainers = getGroupedContainers();
601
		for (AbstractGroupedContainerE4 container : groupedContainers) {
602
			if (container.getData().equals(taxonBase)
603
					&& container.getNameViewer().getTextWidget() != null) {
604
				return container;
605
			}
606
		}
607
		return getAcceptedNameContainer();
608
	}
609

    
610
    public void setOnError() {
611
		Color disabledColor =  AbstractUtility.getColor(Resources.COLOR_EDITOR_ERROR);
612
		setEnabled(false, disabledColor);
613
	}
614

    
615
	public void setDisabled(){
616
		Color disabledColor =  AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND);
617
		setEnabled(false, disabledColor);
618
	}
619

    
620
	protected void setEnabled(boolean enabled, Color background) {
621

    
622
		for(AbstractGroupedContainerE4 groupedContainer : getGroupedContainers()){
623
			groupedContainer.setEnabled(enabled);
624
		}
625

    
626
		// send an empty selection to the current provider - TODO only on error ???
627
		if (!enabled) {
628
			getManagedForm().setInput(null);
629

    
630
			for (AbstractGroupedContainerE4 groupedContainer : getGroupedContainers()) {
631
				groupedContainer.setBackground(background);
632
			}
633
		}
634
		getControl().setBackground(background);
635
	}
636

    
637
    @Override
638
    public void changed(Object element) {
639
        // setDirty(true);
640
        // 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
641
        if (element != null){
642
            dirty.setDirty(true);
643
            //refresh part title
644
            //TODO: refresh taxon node in taxon navigator
645
            setPartName();
646
        }
647

    
648
        if (element instanceof TaxonBase) {
649
            AbstractGroupedContainerE4 container = getContainer((TaxonBase) element);
650
            if (container != null) {
651
                container.refresh();
652
            }
653
        }
654
        if (element instanceof TaxonRelationship) {
655
            AbstractGroupedContainerE4 container = getContainer(((TaxonRelationship) element).getFromTaxon());
656
            if (container != null) {
657
                container.refresh();
658
            }
659
        }
660
    }
661

    
662
    public void setPartName(){
663
        thisPart.setLabel(this.taxon.getName().getFullTitleCache());
664
    }
665

    
666
    @Override
667
    public void forceDirty() {
668
        setDirty();
669
    }
670

    
671

    
672
    public IUndoContext getUndoContext() {
673
        return undoContext;
674
    }
675

    
676
    @Override
677
    public Composite getControl(){
678
        return managedForm.getForm().getBody();
679
    }
680

    
681
    public EMenuService getMenuService() {
682
        return menuService;
683
    }
684

    
685
    public ESelectionService getSelectionService() {
686
        return selService;
687
    }
688

    
689

    
690
    /**
691
     * {@inheritDoc}
692
     */
693
    @Override
694
    public boolean canAttachMedia() {
695
        return true;
696
    }
697

    
698
    public TaxonEditorInputE4 getEditorInput() {
699
        return input;
700
    }
701

    
702
    /**
703
     * {@inheritDoc}
704
     */
705
    @Override
706
    public TaxonNameEditorE4 getEditor() {
707
        return this;
708
    }
709

    
710
}
(2-2/2)