01 /*
02 *
03 * Licensed to the Apache Software Foundation (ASF) under one
04 * or more contributor license agreements. See the NOTICE file
05 * distributed with this work for additional information
06 * regarding copyright ownership. The ASF licenses this file
07 * to you under the Apache License, Version 2.0 (the
08 * "License"); you may not use this file except in compliance
09 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 */
21 package org.apache.qpid.management.ui;
22
23 import org.eclipse.core.runtime.IPlatformRunnable;
24 import org.eclipse.swt.widgets.Display;
25 import org.eclipse.swt.widgets.Shell;
26 import org.eclipse.ui.PlatformUI;
27
28 /**
29 * This class controls all aspects of the application's execution
30 * @author Bhupendra Bhardwaj
31 */
32 public class Application implements IPlatformRunnable
33 {
34 static Shell shell = null;
35
36 /*
37 * The call to createAndRunWorkbench will not return until the workbench is closed.
38 * The SWT event loop and other low-level logistics are handled inside this method.
39 * @see org.eclipse.core.runtime.IPlatformRunnable#run(java.lang.Object)
40 */
41 public Object run(Object args) throws Exception
42 {
43 Display display = PlatformUI.createDisplay();
44 try
45 {
46 int returnCode = PlatformUI.createAndRunWorkbench(display,
47 new ApplicationWorkbenchAdvisor());
48 if (returnCode == PlatformUI.RETURN_RESTART)
49 {
50 return IPlatformRunnable.EXIT_RESTART;
51 }
52 return IPlatformRunnable.EXIT_OK;
53 } finally
54 {
55 display.dispose();
56 }
57 }
58
59 static Shell getActiveShell()
60 {
61 return shell;
62 }
63 }
|