author | stechong |
Fri, 11 Jun 2010 12:09:52 -0500 | |
branch | C3_BUILDER_WORK |
changeset 1462 | b38491fd06da |
parent 1444 | 4f7d895e3e16 |
child 1667 | 352fb86872dd |
permissions | -rw-r--r-- |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
1 |
/* |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
2 |
* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
8 |
* |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
11 |
* |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
13 |
* |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
15 |
* |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
16 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
17 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
18 |
package com.nokia.carbide.cpp.sdk.ui.shared; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
19 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
20 |
import java.io.File; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
21 |
import java.util.List; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
22 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
23 |
import org.eclipse.jface.dialogs.IDialogConstants; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
24 |
import org.eclipse.jface.dialogs.MessageDialog; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
25 |
import org.eclipse.jface.dialogs.TrayDialog; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
26 |
import org.eclipse.swt.SWT; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
27 |
import org.eclipse.swt.events.SelectionAdapter; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
28 |
import org.eclipse.swt.events.SelectionEvent; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
29 |
import org.eclipse.swt.events.SelectionListener; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
30 |
import org.eclipse.swt.graphics.Point; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
31 |
import org.eclipse.swt.layout.GridData; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
32 |
import org.eclipse.swt.layout.GridLayout; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
33 |
import org.eclipse.swt.widgets.Button; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
34 |
import org.eclipse.swt.widgets.Composite; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
35 |
import org.eclipse.swt.widgets.Control; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
36 |
import org.eclipse.swt.widgets.DirectoryDialog; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
37 |
import org.eclipse.swt.widgets.Label; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
38 |
import org.eclipse.swt.widgets.Shell; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
39 |
import org.eclipse.swt.widgets.Text; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
40 |
import org.eclipse.ui.PlatformUI; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
41 |
import org.osgi.framework.Version; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
42 |
|
1434 | 43 |
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo; |
44 |
import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK; |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
45 |
import com.nokia.carbide.cpp.internal.sdk.ui.Messages; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
46 |
import com.nokia.carbide.cpp.internal.sdk.ui.SDKUIHelpIds; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
47 |
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
48 |
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
49 |
import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory; |
740
ba87a4b50604
Fix bug in checking drive in EPOCROOT on Linux
Ed Swartz <ed.swartz@nokia.com>
parents:
677
diff
changeset
|
50 |
import com.nokia.cpp.internal.api.utils.core.HostOS; |
677 | 51 |
import com.nokia.cpp.internal.api.utils.ui.BrowseDialogUtils; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
52 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
53 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
54 |
* Dialog that allows the user to add a new Symbian OS SDK or custkit |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
55 |
* to the devices.xml file. |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
56 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
57 |
public class AddSDKDialog extends TrayDialog { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
58 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
59 |
private Text deviceIDtext; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
60 |
private Text epocRootText; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
61 |
private Button browseEPOCROOTButton; |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
62 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
63 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
64 |
* Create the dialog |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
65 |
* @param parentShell |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
66 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
67 |
public AddSDKDialog(Shell parentShell) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
68 |
super(parentShell); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
69 |
} |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
70 |
|
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
71 |
/** |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
72 |
* Create contents of the button bar |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
73 |
* @param parent |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
74 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
75 |
@Override |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
76 |
protected void createButtonsForButtonBar(Composite parent) { |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
77 |
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
78 |
true); |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
79 |
createButton(parent, IDialogConstants.CANCEL_ID, |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
80 |
IDialogConstants.CANCEL_LABEL, false); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
81 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
82 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
83 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
84 |
* Create contents of the dialog |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
85 |
* @param parent |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
86 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
87 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
88 |
protected Control createDialogArea(Composite parent) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
89 |
Composite container = (Composite) super.createDialogArea(parent); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
90 |
final GridLayout gridLayout = new GridLayout(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
91 |
gridLayout.numColumns = 3; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
92 |
container.setLayout(gridLayout); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
93 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
94 |
final Label deviceIdLabel = new Label(container, SWT.NONE); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
95 |
deviceIdLabel.setToolTipText(Messages.getString("AddSDKDialog.Enter_unique_id_for_sdk")); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
96 |
deviceIdLabel.setText(Messages.getString("AddSDKDialog.SDK_ID")); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
97 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
98 |
deviceIDtext = new Text(container, SWT.BORDER); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
99 |
deviceIDtext.setLayoutData(new GridData(263, SWT.DEFAULT)); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
100 |
new Label(container, SWT.NONE); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
101 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
102 |
final Label epocrootLabel = new Label(container, SWT.NONE); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
103 |
epocrootLabel.setToolTipText(Messages.getString("AddSDKDialog.Enter_location_where_epoc32_folder")); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
104 |
epocrootLabel.setText("EPOCROOT:"); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
105 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
106 |
epocRootText = new Text(container, SWT.BORDER); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
107 |
epocRootText.setLayoutData(new GridData(263, SWT.DEFAULT)); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
108 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
109 |
browseEPOCROOTButton = new Button(container, SWT.NONE); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
110 |
browseEPOCROOTButton.setToolTipText(Messages.getString("AddSDKDialog.Choose_folder_where_epoc32_exists")); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
111 |
browseEPOCROOTButton.setText(Messages.getString("AddSDKDialog.Browse")); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
112 |
addButtonListener(browseEPOCROOTButton); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
113 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
114 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, SDKUIHelpIds.SDK_ADD_DIALOG); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
115 |
return container; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
116 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
117 |
|
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
118 |
/* (non-Javadoc) |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
119 |
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
120 |
*/ |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
121 |
protected void configureShell(Shell shell) { |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
122 |
super.configureShell(shell); |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
123 |
shell.setText(Messages.getString("AddSDKDialog.Add_New_SDK")); //$NON-NLS-1$ |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
124 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
125 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
126 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
127 |
* Return the initial size of the dialog |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
128 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
129 |
@Override |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
130 |
protected Point getInitialSize() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
131 |
//return new Point(428, 256); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
132 |
return super.getInitialSize(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
133 |
} |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
134 |
|
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
135 |
/* |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
136 |
* (non-Javadoc) |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
137 |
* @see org.eclipse.jface.dialogs.Dialog#okPressed() |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
138 |
*/ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
139 |
@Override |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
140 |
protected void okPressed() { |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
141 |
|
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
142 |
if (deviceIDtext.getText().length() > 0){ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
143 |
if (!isValidIDName(deviceIDtext.getText())){ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
144 |
return; |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
145 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
146 |
} else { |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
147 |
MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Missing_SDK_ID"), Messages.getString("AddSDKDialog.Enter_SDK_ID")); //$NON-NLS-1$ //$NON-NLS-2$ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
148 |
return; |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
149 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
150 |
|
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
151 |
if (epocRootText.getText().length() > 1){ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
152 |
if (HostOS.IS_WIN32 && epocRootText.getText().charAt(1) != ':'){ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
153 |
MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Malformed_EPOCROOT"), Messages.getString("AddSDKDialog.EPOCROOT_drive_spec")); //$NON-NLS-1$ //$NON-NLS-2$ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
154 |
return; |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
155 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
156 |
if (epocRootText.getText().toUpperCase().endsWith("EPOC32") || epocRootText.getText().toUpperCase().endsWith("EPOC32\\")){ //$NON-NLS-1$ //$NON-NLS-2$ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
157 |
if (!MessageDialog.openConfirm(getShell(), Messages.getString("AddSDKDialog.Possible_wrong_epocroot"), Messages.getString("AddSDKDialog.EPOCROOT_Should_Point"))){ //$NON-NLS-1$ //$NON-NLS-2$ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
158 |
return; |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
159 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
160 |
} else { |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
161 |
File epocRootFile = new File(epocRootText.getText()); |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
162 |
if (!epocRootFile.exists()){ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
163 |
if (!MessageDialog.openConfirm(getShell(), Messages.getString("AddSDKDialog.EPOCROOT_does_not_exist"), Messages.getString("AddSDKDialog.EPOCROOT_does_not_exist_msg"))){ //$NON-NLS-1$ //$NON-NLS-2$ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
164 |
return; |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
165 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
166 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
167 |
if (epocRootFile.toString().indexOf(" ") != -1){ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
168 |
// Paths should not have spaces... |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
169 |
MessageDialog.openError(getShell(), "EPOC Root Contains Spaces", Messages.getString("AddSDKDialog.EPOCROOT_contains_spaces")); //$NON-NLS-1$ //$NON-NLS-2$ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
170 |
return; |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
171 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
172 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
173 |
} else { |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
174 |
if (epocRootText.getText().length() == 1 && epocRootText.getText().charAt(0) == '\\'){ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
175 |
// OK - Currently accept only a '\'. May need to reconsider side-effects |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
176 |
} else { |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
177 |
MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Missing_EPOCROOT"), Messages.getString("AddSDKDialog.Please_enter_an_EPOCROOT")); //$NON-NLS-1$ //$NON-NLS-2$ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
178 |
return; |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
179 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
180 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
181 |
|
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
182 |
// No objections raised, write the new device entry |
1434 | 183 |
String vendorName = ISBSv1BuildInfo.S60_SDK_NAME; |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
184 |
Version osVersion = new Version("9.4.0"); //$NON-NLS-1$ |
1444
4f7d895e3e16
Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents:
1434
diff
changeset
|
185 |
Version sdkVersion = new Version("5.0"); //$NON-NLS-1$ |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
186 |
ISymbianSDK sdk = SymbianSDKFactory.createInstance(deviceIDtext.getText(), |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
187 |
epocRootText.getText(), |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
188 |
vendorName, |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
189 |
osVersion, |
1462 | 190 |
sdkVersion); |
1434 | 191 |
((SymbianSDK)sdk).setEnabled(true); |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
192 |
SDKCorePlugin.getSDKManager().addSDK(sdk); |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
193 |
List<ISymbianSDK> sdkList = SDKCorePlugin.getSDKManager().getSDKList(); |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
194 |
if (sdkList != null){ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
195 |
sdkList.add(sdk); |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
196 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
197 |
super.okPressed(); |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
198 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
199 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
200 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
201 |
* Sets the listener event to a button. |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
202 |
* |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
203 |
* @param aButton |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
204 |
*/ |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
205 |
private void addButtonListener(final Button aButton) { |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
206 |
SelectionListener listener = new SelectionAdapter() { |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
207 |
public void widgetSelected(SelectionEvent e) { |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
208 |
if (e.getSource().equals(browseEPOCROOTButton)) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
209 |
browseEPOCROOT(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
210 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
211 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
212 |
}; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
213 |
aButton.addSelectionListener(listener); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
214 |
} |
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
215 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
216 |
private void browseEPOCROOT(){ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
217 |
DirectoryDialog browseDir = new DirectoryDialog(getShell(), SWT.OPEN); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
218 |
browseDir.setMessage(Messages.getString("AddSDKDialog.Choose_location_for_EPOCROOT")); //$NON-NLS-1$ |
740
ba87a4b50604
Fix bug in checking drive in EPOCROOT on Linux
Ed Swartz <ed.swartz@nokia.com>
parents:
677
diff
changeset
|
219 |
BrowseDialogUtils.initializeFrom(browseDir, HostOS.IS_WIN32 ? "C:/Symbian/" : null); //$NON-NLS-1$ |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
220 |
String dirText = browseDir.open(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
221 |
if (dirText != null){ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
222 |
epocRootText.setText(dirText); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
223 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
224 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
225 |
|
1421
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
226 |
private boolean isValidIDName(String sdkID){ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
227 |
boolean isValid = true; |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
228 |
|
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
229 |
// check for spaces in ID |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
230 |
if (sdkID.contains(" ")){ //$NON-NLS-1$ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
231 |
MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Invalid_SDK_ID"), Messages.getString("AddSDKDialog.SDK_ID_No_Spaces")); //$NON-NLS-1$ //$NON-NLS-2$ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
232 |
return false; |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
233 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
234 |
|
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
235 |
// check that the ID is unique... |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
236 |
for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()){ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
237 |
if (sdk.getUniqueId().equalsIgnoreCase(sdkID)){ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
238 |
// id already exists, choose a different one... |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
239 |
MessageDialog.openError(getShell(), Messages.getString("AddSDKDialog.Duplicate_ID"), Messages.getString("AddSDKDialog.Duplicate_ID_Msg")); //$NON-NLS-1$ //$NON-NLS-2$ |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
240 |
return false; |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
241 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
242 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
243 |
|
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
244 |
return isValid; |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
245 |
} |
587da7cb64b7
New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents:
740
diff
changeset
|
246 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
247 |
} |