1 package org
.argeo
.security
.ui
.rcp
;
3 import org
.eclipse
.ui
.IPerspectiveDescriptor
;
4 import org
.eclipse
.ui
.application
.IWorkbenchWindowConfigurer
;
5 import org
.eclipse
.ui
.application
.WorkbenchAdvisor
;
6 import org
.eclipse
.ui
.application
.WorkbenchWindowAdvisor
;
8 public class SecureWorkbenchAdvisor
extends WorkbenchAdvisor
{
9 public final static String INITIAL_PERSPECTIVE_PROPERTY
= "org.argeo.security.ui.initialPerspective";
10 private String initialPerspective
= System
.getProperty(
11 INITIAL_PERSPECTIVE_PROPERTY
, null);
13 private final String username
;
15 public SecureWorkbenchAdvisor(String username
) {
16 this.username
= username
;
19 public WorkbenchWindowAdvisor
createWorkbenchWindowAdvisor(
20 IWorkbenchWindowConfigurer configurer
) {
21 return new SecureWorkbenchWindowAdvisor(configurer
, username
);
24 public String
getInitialWindowPerspectiveId() {
25 if (initialPerspective
!= null) {
26 // check whether this user can see the declared perspective
27 // (typically the perspective won't be listed if this user doesn't
28 // have the right to see it)
29 IPerspectiveDescriptor pd
= getWorkbenchConfigurer().getWorkbench()
30 .getPerspectiveRegistry()
31 .findPerspectiveWithId(initialPerspective
);
35 return initialPerspective
;