2 * Copyright (C) 2007-2012 Mathieu Baudier
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.security
.ui
.rap
;
18 import org
.eclipse
.swt
.SWT
;
19 import org
.eclipse
.swt
.graphics
.Point
;
20 import org
.eclipse
.swt
.graphics
.Rectangle
;
21 import org
.eclipse
.swt
.widgets
.Display
;
22 import org
.eclipse
.ui
.IWorkbenchWindow
;
23 import org
.eclipse
.ui
.actions
.ActionFactory
;
24 import org
.eclipse
.ui
.actions
.ActionFactory
.IWorkbenchAction
;
25 import org
.eclipse
.ui
.application
.ActionBarAdvisor
;
26 import org
.eclipse
.ui
.application
.IActionBarConfigurer
;
27 import org
.eclipse
.ui
.application
.IWorkbenchWindowConfigurer
;
28 import org
.eclipse
.ui
.application
.WorkbenchWindowAdvisor
;
30 /** Eclipse RAP specific window advisor */
31 public class RapWindowAdvisor
extends WorkbenchWindowAdvisor
{
33 private String username
;
35 public RapWindowAdvisor(IWorkbenchWindowConfigurer configurer
,
38 this.username
= username
;
42 public ActionBarAdvisor
createActionBarAdvisor(
43 IActionBarConfigurer configurer
) {
44 return new RapActionBarAdvisor(configurer
, username
);
47 public void preWindowOpen() {
48 IWorkbenchWindowConfigurer configurer
= getWindowConfigurer();
49 configurer
.setShowCoolBar(true);
50 configurer
.setShowMenuBar(false);
51 configurer
.setShowStatusLine(false);
52 configurer
.setShowPerspectiveBar(true);
53 configurer
.setTitle("Argeo Secure UI"); //$NON-NLS-1$
55 // http://dev.eclipse.org/newslists/news.eclipse.technology.rap/msg02697.html
56 configurer
.setShellStyle(SWT
.NONE
);
57 Rectangle bounds
= Display
.getCurrent().getBounds();
58 configurer
.setInitialSize(new Point(bounds
.width
, bounds
.height
));
62 public void postWindowOpen() {
63 String defaultPerspective
= getWindowConfigurer()
64 .getWorkbenchConfigurer().getWorkbench()
65 .getPerspectiveRegistry().getDefaultPerspective();
66 if (defaultPerspective
== null) {
67 IWorkbenchWindow window
= getWindowConfigurer().getWindow();
71 IWorkbenchAction openPerspectiveDialogAction
= ActionFactory
.OPEN_PERSPECTIVE_DIALOG
73 openPerspectiveDialogAction
.run();