1 package org
.argeo
.cms
.ui
.workbench
.rap
;
3 import org
.eclipse
.ui
.IPerspectiveDescriptor
;
4 import org
.eclipse
.ui
.application
.IWorkbenchConfigurer
;
5 import org
.eclipse
.ui
.application
.IWorkbenchWindowConfigurer
;
6 import org
.eclipse
.ui
.application
.WorkbenchAdvisor
;
7 import org
.eclipse
.ui
.application
.WorkbenchWindowAdvisor
;
9 /** Eclipse RAP specific workbench advisor */
10 public class RapWorkbenchAdvisor
extends WorkbenchAdvisor
{
11 public final static String INITIAL_PERSPECTIVE_PROPERTY
= "org.argeo.security.ui.initialPerspective";
12 public final static String SAVE_AND_RESTORE_PROPERTY
= "org.argeo.security.ui.saveAndRestore";
14 private String initialPerspective
= System
.getProperty(
15 INITIAL_PERSPECTIVE_PROPERTY
, null);
17 private String username
;
19 public RapWorkbenchAdvisor(String username
) {
20 this.username
= username
;
24 public void initialize(IWorkbenchConfigurer configurer
) {
25 super.initialize(configurer
);
26 Boolean saveAndRestore
= Boolean
.parseBoolean(System
.getProperty(
27 SAVE_AND_RESTORE_PROPERTY
, "false"));
28 configurer
.setSaveAndRestore(saveAndRestore
);
31 public WorkbenchWindowAdvisor
createWorkbenchWindowAdvisor(
32 IWorkbenchWindowConfigurer configurer
) {
33 return new RapWindowAdvisor(configurer
, username
);
36 public String
getInitialWindowPerspectiveId() {
37 if (initialPerspective
!= null) {
38 // check whether this user can see the declared perspective
39 // (typically the perspective won't be listed if this user doesn't
40 // have the right to see it)
41 IPerspectiveDescriptor pd
= getWorkbenchConfigurer().getWorkbench()
42 .getPerspectiveRegistry()
43 .findPerspectiveWithId(initialPerspective
);
47 return initialPerspective
;