Project

General

Profile

« Previous | Next » 

Revision 2d8daa57

Added by Patrick Plitzner almost 7 years ago

ref #6566 Migrate "Open in" context menu for specimen editor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenHandlerBaseE4.java
4 4

  
5 5
import org.eclipse.e4.core.di.annotations.Execute;
6 6
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
7
import org.eclipse.e4.ui.workbench.modeling.EPartService;
8
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
7 9

  
8
public abstract class DefaultOpenHandlerBaseE4 <T> {
10
public abstract class DefaultOpenHandlerBaseE4 <ENTITY, PART> {
9 11

  
10 12
    @Execute
11
    public Object execute(MHandledMenuItem menuItem){
13
    public void execute(MHandledMenuItem menuItem, EPartService partService){
14
        String partId = getPartId();
15
        PART part= (PART) partService.createPart(partId).getObject();
16

  
17
        ENTITY entity = null;
12 18
        String commandId = menuItem.getCommand().getElementId();
13 19
        UUID uuid = (UUID) menuItem.getTransientData().get(commandId+".uuid");
14 20
        //check if uuid parameter is set
15 21
        if(uuid!=null){
16
            T entity = getEntity(uuid);
17
            open(entity);
22
            entity = getEntity(uuid);
18 23
        }
19
        return null;
24
        initPart(entity, part);
25
        partService.showPart(partId, PartState.ACTIVATE);
20 26
    }
21 27

  
28
    protected abstract void initPart(ENTITY entity, PART part);
22 29

  
23
    protected abstract T getEntity(UUID uuid);
30
    protected abstract String getPartId();
24 31

  
25
    protected abstract void open(T entity);
32
    protected abstract ENTITY getEntity(UUID uuid);
26 33

  
27 34
}

Also available in: Unified diff