Project

General

Profile

« Previous | Next » 

Revision 89d5a9ad

Added by Patrick Plitzner over 6 years ago

fix #6785 Enable multiple opening of the same part

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenDerivateViewHandler.java
16 16

  
17 17
    @Override
18 18
    public Object execute(ExecutionEvent event) throws ExecutionException {
19
        MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
20
                AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW, PartState.ACTIVATE);
19
        EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class);
20
        MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW);
21
        partService.showPart(part, PartState.ACTIVATE);
21 22
        DerivateView derivateView = (DerivateView) part.getObject();
22 23
        derivateView.init(new DerivateViewEditorInput());
23 24
        return null;
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/OpenPartHandler.java
6 6
import org.eclipse.core.commands.ParameterizedCommand;
7 7
import org.eclipse.e4.core.di.annotations.CanExecute;
8 8
import org.eclipse.e4.core.di.annotations.Execute;
9
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
9 10
import org.eclipse.e4.ui.workbench.modeling.EPartService;
10 11
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
11 12

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

  
25 27
    @CanExecute

Also available in: Unified diff