]> git.argeo.org Git - lgpl/argeo-commons.git/blob - SecureWorkbenchWindowAdvisor.java
c2675d58b8398c37a2f2802a5f87dd12caf059f4
[lgpl/argeo-commons.git] / SecureWorkbenchWindowAdvisor.java
1 package org.argeo.security.ui.rap;
2
3 import org.eclipse.swt.graphics.Point;
4 import org.eclipse.ui.IWorkbenchWindow;
5 import org.eclipse.ui.actions.ActionFactory;
6 import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
7 import org.eclipse.ui.application.ActionBarAdvisor;
8 import org.eclipse.ui.application.IActionBarConfigurer;
9 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
10 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
11
12 public class SecureWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
13
14 public SecureWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
15 super(configurer);
16 }
17
18 public ActionBarAdvisor createActionBarAdvisor(
19 IActionBarConfigurer configurer) {
20 return new SecureActionBarAdvisor(configurer, true);
21 }
22
23 public void preWindowOpen() {
24 IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
25 configurer.setInitialSize(new Point(1200, 900));
26 configurer.setShowCoolBar(true);
27 configurer.setShowMenuBar(true);
28 configurer.setShowStatusLine(false);
29
30 configurer.setShowPerspectiveBar(true);
31 configurer.setTitle("Argeo Secure UI"); //$NON-NLS-1$
32 }
33
34 @Override
35 public void postWindowOpen() {
36 String defaultPerspective = getWindowConfigurer()
37 .getWorkbenchConfigurer().getWorkbench()
38 .getPerspectiveRegistry().getDefaultPerspective();
39 if (defaultPerspective == null) {
40 IWorkbenchWindow window = getWindowConfigurer().getWindow();
41 if (window == null)
42 return;
43
44 IWorkbenchAction openPerspectiveDialogAction = ActionFactory.OPEN_PERSPECTIVE_DIALOG
45 .create(window);
46 openPerspectiveDialogAction.run();
47 }
48 }
49
50 }