Project

General

Profile

Download (1022 Bytes) Statistics
| Branch: | Tag: | Revision:
1

    
2
package eu.etaxonomy.taxeditor.workbench;
3

    
4
import java.util.Map;
5

    
6
import org.eclipse.core.commands.ParameterizedCommand;
7
import org.eclipse.e4.core.di.annotations.CanExecute;
8
import org.eclipse.e4.core.di.annotations.Execute;
9
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
10
import org.eclipse.e4.ui.workbench.modeling.EPartService;
11
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
12

    
13
public class OpenPartHandler {
14

    
15
    @Execute
16
    public void execute(ParameterizedCommand commandParameters, EPartService partService) {
17

    
18
        if (null == commandParameters) {
19
            return;
20
        }
21
        Map parameterMap = commandParameters.getParameterMap();
22
        String partId = parameterMap.get(AppModelId.COMMANDPARAMETER_EU_ETAXONOMY_TAXEDITOR_WORKBENCH_COMMANDPARAMETER_PARTNAME).toString();
23
        MPart part = partService.createPart(partId);
24
        partService.showPart(part, PartState.ACTIVATE);
25
    }
26

    
27
    @CanExecute
28
    public boolean canExecute() {
29
        return true;
30
    }
31

    
32
}
(5-5/8)