Project

General

Profile

Download (1.7 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

    
10
package eu.etaxonomy.taxeditor.view.datasource.e4.handler;
11

    
12
import javax.inject.Named;
13

    
14
import org.eclipse.e4.core.di.annotations.Execute;
15
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16
import org.eclipse.e4.ui.services.IServiceConstants;
17
import org.eclipse.e4.ui.workbench.modeling.EPartService;
18
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
19
import org.eclipse.swt.widgets.Shell;
20

    
21
import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
22
import eu.etaxonomy.taxeditor.view.datasource.e4.CdmDataSourceViewPartE4;
23

    
24
/**
25
 *
26
 * @author pplitzner
27
 * @date 22.08.2017
28
 *
29
 */
30
abstract class AbstractDataSourceHandlerE4 {
31

    
32
	@Execute
33
    public void execute(EPartService partService,
34
            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
35
            @Named(IServiceConstants.ACTIVE_SELECTION)CdmMetaDataAwareDataSourceContainer container,
36
            MPart dataSourcePart) {
37

    
38
		boolean refresh = specificExecute((CdmDataSourceViewPartE4) dataSourcePart.getObject(), container, shell);
39

    
40
		MPart dataSourceView = partService.showPart(
41
                "eu.etaxonomy.taxeditor.view.datasource",
42
                PartState.ACTIVATE);
43

    
44
		CdmDataSourceViewPartE4 view = (CdmDataSourceViewPartE4) dataSourceView.getObject();
45
		if(refresh) {
46
            view.refresh();
47
        }
48
	}
49

    
50
	public abstract boolean specificExecute(CdmDataSourceViewPartE4 dataSourceViewPart, CdmMetaDataAwareDataSourceContainer container, Shell shell);
51
}
(1-1/7)