Project

General

Profile

« Previous | Next » 

Revision 8079fdb3

Added by Patrick Plitzner over 6 years ago

ref #7086, #7095 Added "Open in..." menu for WS and matrix editor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/handler/OpenCharacterMatrixHandler.java
1 1

  
2 2
package eu.etaxonomy.taxeditor.editor.workingSet.handler;
3 3

  
4
import org.eclipse.e4.core.di.annotations.Execute;
5
import org.eclipse.e4.ui.model.application.MApplication;
6
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
7
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
8
import org.eclipse.e4.ui.workbench.modeling.EModelService;
4
import java.util.UUID;
5

  
9 6
import org.eclipse.e4.ui.workbench.modeling.EPartService;
10
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
11 7
import org.eclipse.swt.widgets.Shell;
12 8

  
9
import eu.etaxonomy.cdm.api.service.IWorkingSetService;
13 10
import eu.etaxonomy.cdm.model.description.WorkingSet;
14
import eu.etaxonomy.taxeditor.editor.workingSet.matrix.CharacterMatrix;
15
import eu.etaxonomy.taxeditor.ui.dialog.selection.WorkingSetSelectionDialog;
16
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
17

  
18
public class OpenCharacterMatrixHandler {
19

  
20
	@Execute
21
	public void execute(Shell shell, EPartService partService, MApplication application, EModelService modelService) {
22
	    WorkingSet workingSet = WorkingSetSelectionDialog.select(shell, null);
23
	    if(workingSet==null){
24
	        return;
25
	    }
26
	    MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.workingSet.matrix.CharacterMatrix");
27

  
28
        MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
29
        if(editorAreaPartStack!=null){
30
            editorAreaPartStack.getChildren().add(part);
31
        }
32
        part = partService.showPart(part, PartState.ACTIVATE);
33

  
34
        CharacterMatrix editor = (CharacterMatrix) part.getObject();
35
        editor.init(workingSet);
36

  
37
	}
11
import eu.etaxonomy.taxeditor.editor.EditorUtil;
12
import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
13
import eu.etaxonomy.taxeditor.store.CdmStore;
14

  
15
public class OpenCharacterMatrixHandler extends DefaultOpenHandlerBaseE4<WorkingSet>{
16

  
17
    /**
18
     * {@inheritDoc}
19
     */
20
    @Override
21
    protected WorkingSet getEntity(UUID uuid) {
22
        return CdmStore.getService(IWorkingSetService.class).load(uuid);
23
    }
24

  
25
    @Override
26
    protected void open(WorkingSet entity, Shell shell, EPartService partService) {
27
        EditorUtil.openCharacterMatrix(entity.getUuid(), modelService, partService, application);
28
    }
29

  
30
    /**
31
     * {@inheritDoc}
32
     */
33
    @Override
34
    protected boolean canExecute(WorkingSet entity) {
35
        return true;
36
    }
38 37

  
39 38
}

Also available in: Unified diff