Introduce OSGi Explorer
[lgpl/argeo-commons.git] / security / plugins / org.argeo.security.ui.rap / src / main / java / org / argeo / security / ui / rap / SecureWorkbenchWindowAdvisor.java
index f4c07a84ac21c98988dc7464cc1de6db068ff215..c2675d58b8398c37a2f2802a5f87dd12caf059f4 100644 (file)
@@ -1,6 +1,9 @@
 package org.argeo.security.ui.rap;
 
 import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
 import org.eclipse.ui.application.ActionBarAdvisor;
 import org.eclipse.ui.application.IActionBarConfigurer;
 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
@@ -26,7 +29,22 @@ public class SecureWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
 
                configurer.setShowPerspectiveBar(true);
                configurer.setTitle("Argeo Secure UI"); //$NON-NLS-1$
+       }
 
+       @Override
+       public void postWindowOpen() {
+               String defaultPerspective = getWindowConfigurer()
+                               .getWorkbenchConfigurer().getWorkbench()
+                               .getPerspectiveRegistry().getDefaultPerspective();
+               if (defaultPerspective == null) {
+                       IWorkbenchWindow window = getWindowConfigurer().getWindow();
+                       if (window == null)
+                               return;
+
+                       IWorkbenchAction openPerspectiveDialogAction = ActionFactory.OPEN_PERSPECTIVE_DIALOG
+                                       .create(window);
+                       openPerspectiveDialogAction.run();
+               }
        }
 
 }