2 * Copyright (C) 2007-2012 Argeo GmbH
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
.slc
.client
.rap
;
18 import org
.argeo
.security
.ui
.rap
.RapWindowAdvisor
;
19 import org
.argeo
.security
.ui
.rap
.RapWorkbenchAdvisor
;
20 import org
.argeo
.security
.ui
.rap
.SecureEntryPoint
;
21 import org
.eclipse
.swt
.SWT
;
22 import org
.eclipse
.swt
.graphics
.Point
;
23 import org
.eclipse
.swt
.graphics
.Rectangle
;
24 import org
.eclipse
.swt
.widgets
.Display
;
25 import org
.eclipse
.swt
.widgets
.Shell
;
26 import org
.eclipse
.ui
.IWorkbenchWindow
;
27 import org
.eclipse
.ui
.actions
.ActionFactory
;
28 import org
.eclipse
.ui
.actions
.ActionFactory
.IWorkbenchAction
;
29 import org
.eclipse
.ui
.application
.IWorkbenchWindowConfigurer
;
30 import org
.eclipse
.ui
.application
.WorkbenchWindowAdvisor
;
33 * This class controls all aspects of the application's execution and is
34 * contributed through the plugin.xml.
36 public class SlcSecureRap
extends SecureEntryPoint
{
39 protected RapWorkbenchAdvisor
createRapWorkbenchAdvisor(
40 final String username
) {
41 return new RapWorkbenchAdvisor(username
) {
43 public WorkbenchWindowAdvisor
createWorkbenchWindowAdvisor(
44 IWorkbenchWindowConfigurer configurer
) {
45 return new SlcRapWorkbenchWindowAdvisor(configurer
, username
);
51 /** Workaround for resize issue */
52 class SlcRapWorkbenchWindowAdvisor
extends RapWindowAdvisor
{
54 public SlcRapWorkbenchWindowAdvisor(
55 IWorkbenchWindowConfigurer configurer
, String username
) {
56 super(configurer
, username
);
59 public void preWindowOpen() {
60 IWorkbenchWindowConfigurer configurer
= getWindowConfigurer();
61 configurer
.setShowCoolBar(true);
62 configurer
.setShowMenuBar(false);
63 configurer
.setShowStatusLine(false);
64 configurer
.setShowPerspectiveBar(true);
65 configurer
.setTitle("Argeo Secure UI"); //$NON-NLS-1$
67 // http://dev.eclipse.org/newslists/news.eclipse.technology.rap/msg02697.html
68 configurer
.setShellStyle(SWT
.NO_TRIM
);
69 Rectangle bounds
= Display
.getCurrent().getBounds();
70 configurer
.setInitialSize(new Point(bounds
.width
, bounds
.height
));
74 public void postWindowCreate() {
75 Shell shell
= getWindowConfigurer().getWindow().getShell();
76 shell
.setMaximized(true);
80 public void postWindowOpen() {
81 String defaultPerspective
= getWindowConfigurer()
82 .getWorkbenchConfigurer().getWorkbench()
83 .getPerspectiveRegistry().getDefaultPerspective();
84 if (defaultPerspective
== null) {
85 IWorkbenchWindow window
= getWindowConfigurer().getWindow();
89 IWorkbenchAction openPerspectiveDialogAction
= ActionFactory
.OPEN_PERSPECTIVE_DIALOG
91 openPerspectiveDialogAction
.run();