Project

General

Profile

Download (2.17 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.handler.e4;
11

    
12
import java.util.Collection;
13

    
14
import javax.inject.Named;
15

    
16
import org.eclipse.e4.core.contexts.IEclipseContext;
17
import org.eclipse.e4.core.di.annotations.Execute;
18
import org.eclipse.e4.ui.model.application.MApplication;
19
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
20
import org.eclipse.e4.ui.services.IServiceConstants;
21
import org.eclipse.e4.ui.workbench.modeling.EModelService;
22
import org.eclipse.e4.ui.workbench.modeling.EPartService;
23
import org.eclipse.swt.SWT;
24
import org.eclipse.swt.widgets.Shell;
25
import org.eclipse.ui.IPerspectiveRegistry;
26
import org.eclipse.ui.IWorkbench;
27
import org.eclipse.ui.IWorkbenchPage;
28
import org.eclipse.ui.IWorkbenchWindow;
29
import org.eclipse.ui.PlatformUI;
30

    
31
import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource;
32
import eu.etaxonomy.taxeditor.store.CdmStore;
33
import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
34

    
35
/**
36
 *
37
 * @author pplitzner
38
 * @date 10.10.2017
39
 *
40
 */
41
public class SwitchUserHandlerE4 {
42

    
43
    @Execute
44
    public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell, EModelService modelService, EPartService partService, MApplication application,
45
            IEclipseContext context) {
46
        Collection<MPart> parts = partService.getParts();
47
        String partId = "eu.etaxonomy.taxeditor.navigation.navigator";
48
        for (MPart part : parts) {
49
            partService.hidePart(part);
50

    
51
        }
52

    
53

    
54
		RemotingLoginDialog loginDialog = new RemotingLoginDialog(shell,
55
		        SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
56

    
57
		loginDialog.open((CdmRemoteSource) CdmStore.getActiveCdmSource(), false, false);
58

    
59
		 IWorkbench workbench = PlatformUI.getWorkbench();
60
         IWorkbenchWindow window = workbench
61
                 .getActiveWorkbenchWindow();
62

    
63
         IPerspectiveRegistry registry = workbench.getPerspectiveRegistry();
64
         IWorkbenchPage page = window.getActivePage();
65
         page.resetPerspective();
66
	}
67
}
68

    
(10-10/10)