0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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.s60tools.creator.job;
|
|
20 |
|
|
21 |
import org.eclipse.jface.dialogs.Dialog;
|
|
22 |
import org.eclipse.jface.dialogs.IDialogConstants;
|
|
23 |
import org.eclipse.swt.SWT;
|
|
24 |
import org.eclipse.swt.layout.GridData;
|
|
25 |
import org.eclipse.swt.layout.GridLayout;
|
|
26 |
import org.eclipse.swt.widgets.Button;
|
|
27 |
import org.eclipse.swt.widgets.Composite;
|
|
28 |
import org.eclipse.swt.widgets.Control;
|
|
29 |
import org.eclipse.swt.widgets.Label;
|
|
30 |
import org.eclipse.swt.widgets.Shell;
|
|
31 |
|
|
32 |
import com.nokia.s60tools.creator.common.ProductInfoRegistry;
|
|
33 |
import com.nokia.s60tools.creator.preferences.CreatorPreferences;
|
|
34 |
import com.nokia.s60tools.creator.resources.Messages;
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Dialog for asking confirmation for file replace from user
|
|
38 |
*/
|
|
39 |
public class ShutdownCreatorInDeviceDialog extends Dialog {
|
|
40 |
|
|
41 |
|
|
42 |
// Selected button
|
|
43 |
private int selection = 0;
|
|
44 |
|
|
45 |
// UI components
|
|
46 |
private Button dontShowAgainBtn = null;
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Constructor
|
|
50 |
* @param parentShell Shell
|
|
51 |
* @param destFileName Name of the script file
|
|
52 |
*/
|
|
53 |
public ShutdownCreatorInDeviceDialog(Shell parentShell) {
|
|
54 |
super(parentShell);
|
|
55 |
}
|
|
56 |
|
|
57 |
/* (non-Javadoc)
|
|
58 |
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
|
|
59 |
*/
|
|
60 |
protected void configureShell(Shell shell) {
|
|
61 |
super.configureShell(shell);
|
|
62 |
shell.setText(ProductInfoRegistry.getProductName());
|
|
63 |
}
|
|
64 |
|
|
65 |
/* (non-Javadoc)
|
|
66 |
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
|
67 |
*/
|
|
68 |
protected void createButtonsForButtonBar(Composite parent) {
|
|
69 |
GridLayout gdl = new GridLayout(1, false);
|
|
70 |
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
|
|
71 |
parent.setLayout(gdl);
|
|
72 |
parent.setLayoutData(gd);
|
|
73 |
|
|
74 |
createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
|
|
75 |
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
|
|
76 |
}
|
|
77 |
|
|
78 |
/* (non-Javadoc)
|
|
79 |
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
|
80 |
*/
|
|
81 |
protected Control createDialogArea(Composite parent) {
|
|
82 |
Composite dialogAreaComposite = (Composite) super.createDialogArea(parent);
|
|
83 |
Label label = new Label(dialogAreaComposite,SWT.NONE);
|
|
84 |
String txt = Messages.getString("ShutdownCreatorInDeviceDialog.Msg");//$NON-NLS-1$
|
|
85 |
|
|
86 |
label.setText(txt);
|
|
87 |
|
|
88 |
// "Don't ask again" check box
|
|
89 |
dontShowAgainBtn = new Button(dialogAreaComposite, SWT.CHECK);
|
|
90 |
dontShowAgainBtn.setText(Messages.getString("ShutdownCreatorInDeviceDialog.DontAskAgain_Txt")); //$NON-NLS-1$
|
|
91 |
dontShowAgainBtn.setSelection(CreatorPreferences.getDontAskShutdownCreator());
|
|
92 |
return dialogAreaComposite;
|
|
93 |
}
|
|
94 |
|
|
95 |
/* (non-Javadoc)
|
|
96 |
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
|
|
97 |
*/
|
|
98 |
protected void buttonPressed(int buttonId) {
|
|
99 |
// Save pressed button id
|
|
100 |
selection = buttonId;
|
|
101 |
|
|
102 |
if (buttonId != IDialogConstants.CANCEL_ID) {
|
|
103 |
// Save "Don't ask again" state
|
|
104 |
CreatorPreferences.setDontAskShutdownCreator(dontShowAgainBtn
|
|
105 |
.getSelection());
|
|
106 |
}
|
|
107 |
super.close();
|
|
108 |
}
|
|
109 |
|
|
110 |
/* (non-Javadoc)
|
|
111 |
* @see org.eclipse.jface.window.Window#open()
|
|
112 |
*/
|
|
113 |
public int open(){
|
|
114 |
return super.open();
|
|
115 |
}
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Returns id of selected button
|
|
119 |
* @return Id of selected button
|
|
120 |
*/
|
|
121 |
public int getSelection() {
|
|
122 |
return selection;
|
|
123 |
}
|
|
124 |
}
|