|
1 /* |
|
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package com.nokia.mj.impl.installer.ui.eswt2; |
|
20 |
|
21 import com.nokia.mj.impl.installer.ui.InstallInfo; |
|
22 import com.nokia.mj.impl.installer.ui.LaunchAppInfo; |
|
23 |
|
24 import org.eclipse.swt.SWT; |
|
25 import org.eclipse.swt.widgets.Composite; |
|
26 import org.eclipse.swt.widgets.Button; |
|
27 |
|
28 /** |
|
29 * LaunchAppQueryView asks from the user if the installed |
|
30 * application should be displayed. |
|
31 */ |
|
32 public class LaunchAppQueryView extends ConfirmationViewBase |
|
33 { |
|
34 private LaunchAppInfo iLaunchAppInfo = null; |
|
35 private Button iDefaultButton = null; |
|
36 |
|
37 /** Constructor */ |
|
38 protected LaunchAppQueryView() |
|
39 { |
|
40 super(); |
|
41 } |
|
42 |
|
43 /** Constructor */ |
|
44 protected LaunchAppQueryView(InstallerUiEswt aInstaller, Composite aParent) |
|
45 { |
|
46 super(aInstaller, aParent, 8); |
|
47 setTitle(InstallerUiTexts.get(InstallerUiTexts.INSTALLATION_COMPLETE)); |
|
48 setCommands("Show", //InstallerUiTexts.get(InstallerUiTexts.SHOW), |
|
49 InstallerUiTexts.get(InstallerUiTexts.CLOSE)); |
|
50 } |
|
51 |
|
52 /** Show launch app query. */ |
|
53 public boolean launchAppQuery(LaunchAppInfo aLaunchAppInfo) |
|
54 { |
|
55 if (isDisposed() || aLaunchAppInfo == null) |
|
56 { |
|
57 return false; |
|
58 } |
|
59 |
|
60 iLaunchAppInfo = aLaunchAppInfo; |
|
61 // Use confirm() from super class to display the view. |
|
62 boolean result = confirm(); |
|
63 // Return the result to the client. |
|
64 return result; |
|
65 } |
|
66 |
|
67 protected void createView() |
|
68 { |
|
69 // Add header. |
|
70 String title = "Installed"; |
|
71 addHeader(title, iInstallerUi.getInstallInfo(), null); |
|
72 // Add content to the application info Composite. |
|
73 addAppInfo(iInstallerUi.getInstallInfo(), true); |
|
74 } |
|
75 |
|
76 /** |
|
77 * This method is called after user has answered to query. |
|
78 */ |
|
79 protected void getDataFromView() |
|
80 { |
|
81 // User selection data is initialized in button listeners. |
|
82 } |
|
83 |
|
84 /** |
|
85 * Returns SWT style for this view. |
|
86 */ |
|
87 protected int getStyle() |
|
88 { |
|
89 return SWT.V_SCROLL; |
|
90 } |
|
91 |
|
92 /** |
|
93 * Called after view and commands have been created. Subclasses |
|
94 * can overrride this method to set focus to their own default |
|
95 * commands. |
|
96 */ |
|
97 protected void setDefaultCommand() |
|
98 { |
|
99 if (iDefaultButton != null) |
|
100 { |
|
101 iDefaultButton.setFocus(); |
|
102 getShell().setDefaultButton(iDefaultButton); |
|
103 } |
|
104 } |
|
105 } |