Revision c1ae46ed
Added by Katja Luther about 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/SwitchUserHandlerE4.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.taxeditor.handler.e4; |
11 | 11 |
|
12 |
import java.util.Collection; |
|
13 |
|
|
12 | 14 |
import javax.inject.Named; |
13 | 15 |
|
16 |
import org.eclipse.e4.core.contexts.IEclipseContext; |
|
14 | 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; |
|
15 | 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; |
|
16 | 23 |
import org.eclipse.swt.SWT; |
17 | 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; |
|
18 | 30 |
|
19 | 31 |
import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource; |
20 | 32 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
29 | 41 |
public class SwitchUserHandlerE4 { |
30 | 42 |
|
31 | 43 |
@Execute |
32 |
public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) { |
|
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 |
|
|
33 | 53 |
|
34 | 54 |
RemotingLoginDialog loginDialog = new RemotingLoginDialog(shell, |
35 | 55 |
SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); |
36 | 56 |
|
37 | 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(); |
|
38 | 66 |
} |
39 | 67 |
} |
40 | 68 |
|
Also available in: Unified diff
fix #7993: close views when switching user and reopen them when user is authenticated