Project

General

Profile

« Previous | Next » 

Revision d3c30945

Added by Patrick Plitzner almost 6 years ago

ref #6902 Open AlignmentEditor in editor area

  • fix dirty flag when closing editor

View differences:

eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/EditSequenceHandlerE4.java
6 6
import org.eclipse.e4.core.di.annotations.CanExecute;
7 7
import org.eclipse.e4.core.di.annotations.Execute;
8 8
import org.eclipse.e4.core.di.annotations.Optional;
9
import org.eclipse.e4.ui.model.application.MApplication;
9 10
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
10 11
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
11 12
import org.eclipse.e4.ui.services.IServiceConstants;
13
import org.eclipse.e4.ui.workbench.modeling.EModelService;
12 14
import org.eclipse.e4.ui.workbench.modeling.EPartService;
13
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
14 15
import org.eclipse.jface.viewers.TreeNode;
15 16
import org.eclipse.ui.PartInitException;
16 17

  
17 18
import eu.etaxonomy.cdm.model.molecular.Sequence;
19
import eu.etaxonomy.taxeditor.editor.EditorUtil;
18 20
import eu.etaxonomy.taxeditor.molecular.AppModelId;
19 21
import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditorInput;
20 22
import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
......
34 36

  
35 37
    @Execute
36 38
    public void execute(@Optional@Named(IServiceConstants.ACTIVE_SELECTION)TreeNode treeNodeOfSelection,
37
            EPartService partService) {
39
            EPartService partService, EModelService modelService, MApplication application) {
38 40
        if(treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof Sequence){
39 41
            AlignmentEditorInput input = new AlignmentEditorInput(((Sequence)treeNodeOfSelection.getValue()).getUuid());  //TODO Should there always be a new instance created here? What if the specified CDM node is already opened in an AlignmentEditor? => Possible create Singleton that keeps instances by sequence objects in a map.
40 42
            try {
41
                MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_MOLECULAR_EDITOR_E4_ALIGNMENTEDITORE4);
42
                part = partService.showPart(part, PartState.ACTIVATE);
43
                String partId = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_MOLECULAR_EDITOR_E4_ALIGNMENTEDITORE4;
44
                MPart part = EditorUtil.showPart(partId, modelService, partService, application);
43 45
                AlignmentEditorE4 alignmentEditor = (AlignmentEditorE4) part.getObject();
44 46
                alignmentEditor.init(input);
45 47
            }
......
59 61
        menuItem.setVisible(canExecute);
60 62
        return canExecute;
61 63
    }
62
}
64
}

Also available in: Unified diff