0
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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.appdep.ui.wizards;
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
import java.util.ArrayList;
|
|
25 |
import java.util.List;
|
|
26 |
|
|
27 |
import org.eclipse.jface.dialogs.IMessageProvider;
|
|
28 |
import org.eclipse.jface.viewers.CheckboxTableViewer;
|
|
29 |
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
|
30 |
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
|
31 |
import org.eclipse.jface.viewers.ViewerFilter;
|
|
32 |
import org.eclipse.jface.window.Window;
|
|
33 |
import org.eclipse.swt.SWT;
|
|
34 |
import org.eclipse.swt.custom.BusyIndicator;
|
|
35 |
import org.eclipse.swt.events.FocusEvent;
|
|
36 |
import org.eclipse.swt.events.FocusListener;
|
|
37 |
import org.eclipse.swt.events.SelectionEvent;
|
|
38 |
import org.eclipse.swt.events.SelectionListener;
|
|
39 |
import org.eclipse.swt.layout.GridData;
|
|
40 |
import org.eclipse.swt.layout.GridLayout;
|
|
41 |
import org.eclipse.swt.widgets.Button;
|
|
42 |
import org.eclipse.swt.widgets.Composite;
|
|
43 |
import org.eclipse.swt.widgets.Display;
|
|
44 |
import org.eclipse.swt.widgets.Shell;
|
|
45 |
import org.eclipse.swt.widgets.Text;
|
|
46 |
import org.eclipse.swt.widgets.Widget;
|
|
47 |
|
|
48 |
import com.nokia.s60tools.appdep.AppDepHelpContextIDs;
|
|
49 |
import com.nokia.s60tools.appdep.core.AppDepSettings;
|
|
50 |
import com.nokia.s60tools.appdep.core.ICacheIndexListener;
|
|
51 |
import com.nokia.s60tools.appdep.core.ITargetPlatform;
|
|
52 |
import com.nokia.s60tools.appdep.core.data.CacheIndex;
|
|
53 |
import com.nokia.s60tools.appdep.core.job.IJobCompletionListener;
|
|
54 |
import com.nokia.s60tools.appdep.core.job.IManageableJob;
|
|
55 |
import com.nokia.s60tools.appdep.exceptions.InvalidCmdLineToolSettingException;
|
|
56 |
import com.nokia.s60tools.appdep.plugin.AppDepPlugin;
|
|
57 |
import com.nokia.s60tools.appdep.resources.Messages;
|
|
58 |
import com.nokia.s60tools.appdep.ui.dialogs.AddSISFilesDialog;
|
|
59 |
import com.nokia.s60tools.appdep.ui.wizards.BuildTargetEntry.BuildTargetStatusEnum;
|
|
60 |
import com.nokia.s60tools.appdep.ui.wizards.BuildTargetSelectionBuildTypeFilter.BuildTargetFilterModeEnum;
|
|
61 |
import com.nokia.s60tools.appdep.util.LogUtils;
|
|
62 |
import com.nokia.s60tools.sdk.SdkInformation;
|
|
63 |
import com.nokia.s60tools.ui.S60ToolsTable;
|
|
64 |
import com.nokia.s60tools.ui.S60ToolsTableColumnData;
|
|
65 |
import com.nokia.s60tools.ui.S60ToolsTableFactory;
|
|
66 |
import com.nokia.s60tools.ui.wizards.S60ToolsWizardPage;
|
|
67 |
import com.nokia.s60tools.util.debug.DbgUtility;
|
|
68 |
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Wizard page showing the available targets among which
|
|
72 |
* the user select a target(s) for seeking components to analyze.
|
|
73 |
*/
|
|
74 |
public class SelectBuildTargetWizardPage extends S60ToolsWizardPage implements SelectionListener,
|
|
75 |
IJobCompletionListener,
|
|
76 |
FocusListener,
|
|
77 |
ICacheIndexListener,
|
|
78 |
IRefreshable{
|
|
79 |
//
|
|
80 |
// Constants
|
|
81 |
//
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Build type text for release (urel) builds.
|
|
85 |
*/
|
|
86 |
private static final String BUILD_TYPE_RELEASE_STR = Messages.getString("SelectBuildTargetWizardPage.BuildType_Release_InfoMsg"); //$NON-NLS-1$
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Build type text for release (urel) builds.
|
|
90 |
*/
|
|
91 |
private static final String BUILD_TYPE_DEBUG_STR = Messages.getString("SelectBuildTargetWizardPage.BuildType_Debug_InfoMsg"); //$NON-NLS-1$
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Style bits used for read only labels.
|
|
95 |
*/
|
|
96 |
private static final int READ_ONLY_LABEL_FIELD_STYLEBITS = SWT.READ_ONLY | SWT.NO_FOCUS;
|
|
97 |
|
|
98 |
|
|
99 |
/**
|
|
100 |
* States used to store the button state
|
|
101 |
* result based on the multiselection.
|
|
102 |
* The actual resolution of button statuses
|
|
103 |
* is done after the state for current selection
|
|
104 |
* is resolved.
|
|
105 |
*
|
|
106 |
* Cancel can be pressed in wizard regardless of the state.
|
|
107 |
* The order of the state's under this enumerator is IMPORTANT!
|
|
108 |
* Because values run from 0...N the states with bigger value
|
|
109 |
* are regarded as more important problems to be reported to
|
|
110 |
* a user in case there are more than one problem issue in
|
|
111 |
* multiselection. I.e. problems that prohibit proceeding
|
|
112 |
* in the wizard.
|
|
113 |
*/
|
|
114 |
private enum TargetSelStateEnum {
|
|
115 |
EStateNotSet, // Initial state that should not exist after target check.
|
|
116 |
EAllTargetCachesUpToDate, // => Can press Next not Finish,
|
|
117 |
ECacheNotGeneratedForSomeTarget, // => Can press Next or Finish
|
|
118 |
ECacheNeedsUpdateForSomeTarget, // => Can press Next or Finish
|
|
119 |
ESISFileCacheNeedsToBeGenerated, // => Can press Next or Finish, generation will be started
|
|
120 |
EDumpsisDoesNotExist, // => Cannot press Next nor Finish, dumpsis.exe does not exist, checked when in SIS analysis mode
|
|
121 |
EElftranDoesNotExist, // => Cannot press Next nor Finish
|
|
122 |
ECachesIsBeingIndexedForSomeTarget, // => Cannot press Next nor Finish
|
|
123 |
ENoComponentsForSomeTarget, // => Cannot press Next nor Finish
|
|
124 |
EInvalidToolchainMix, // => Cannot press Next nor Finish
|
|
125 |
ESomeTargetNotSupported, // => Cannot press Next nor Finish
|
|
126 |
ESomeTargetStateNotResolved, // => Cannot press Next nor Finish
|
|
127 |
ECacheIsBeingGeneratedForSomeTarget // => Cannot press Next nor Finish, severity changed into this level because cache generation forbids actions for whole SDK
|
|
128 |
};
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Title for the currently selected SDK.
|
|
132 |
*/
|
|
133 |
private Text sdkNameFieldTitleText;
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Name of the currently selected SDK.
|
|
137 |
*/
|
|
138 |
private Text sdkNameFieldValueText;
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Title for the currently used build type.
|
|
142 |
*/
|
|
143 |
private Text buildTypeFieldTitleText;
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Name of the currently the currently used build type.
|
|
147 |
*/
|
|
148 |
private Text buildTypeFieldValueText;
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Viewer component for showing available targets.
|
|
152 |
*/
|
|
153 |
private CheckboxTableViewer buildTargetViewer;
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Checkbox that can be used to toggle between showing
|
|
157 |
* of release and debug build type targets.
|
|
158 |
*/
|
|
159 |
private Button showDebugTargetsInsteadOfReleaseTargetsCheckbox;
|
|
160 |
|
|
161 |
/**
|
|
162 |
* Checkbox that can be used to limit amount of showed
|
|
163 |
* targets into supported and non-empty ones.
|
|
164 |
*/
|
|
165 |
private Button showOnlySupportedAndNonEmptyTargetsCheckbox;
|
|
166 |
|
|
167 |
/**
|
|
168 |
* Content provider for the viewer component.
|
|
169 |
*/
|
|
170 |
private SelectBuildTargetWizardPageContentProvider contentProvider;
|
|
171 |
|
|
172 |
/**
|
|
173 |
* This field determines the current status for the selection of multiple
|
|
174 |
* targets.
|
|
175 |
* IMPORTANT: Value should be set always by using setSelectionState method, not directly
|
|
176 |
* unless purpose is to initialize, or re-initialize the value!
|
|
177 |
*/
|
|
178 |
private TargetSelStateEnum selectionState = TargetSelStateEnum.EStateNotSet;
|
|
179 |
|
|
180 |
/**
|
|
181 |
* This filter is used to filter target viewer elements based on the build type.
|
|
182 |
*/
|
|
183 |
private BuildTargetSelectionBuildTypeFilter buildTypeFilter;
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Accepts in Build Target Selection -wizard page only the targets
|
|
187 |
* that are non-empty or supported.
|
|
188 |
*/
|
|
189 |
private BuildTargetSelectionNonEmptyAndNonSuppTargetFilter nonEmptyAndNonSuppTargetFilter;
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Set to <code>true</code> if programmatic selection is ongoing, otherwise <code>false</code>.
|
|
193 |
* If programmatic selection is ongoing and therefore
|
|
194 |
* not need to trigger similar event handling as due to UI selection.
|
|
195 |
*/
|
|
196 |
private boolean isProgrammaticSelectionOngoingFlag;
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Open Add SIS files dialog -button
|
|
200 |
*/
|
|
201 |
private Button addSISFilesButton = null;
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Constructor.
|
|
205 |
*/
|
|
206 |
public SelectBuildTargetWizardPage(){
|
|
207 |
super(Messages.getString("SelectBuildTargetWizardPage.WizardPageName")); //$NON-NLS-1$
|
|
208 |
|
|
209 |
setTitle(Messages.getString("SelectBuildTargetWizardPage.WizardPageTitle")); //$NON-NLS-1$
|
|
210 |
setDescription(Messages.getString("SelectBuildTargetWizardPage.WizardPageDescription")); //$NON-NLS-1$
|
|
211 |
|
|
212 |
// User cannot finish the page before some valid
|
|
213 |
// selection is made.
|
|
214 |
setPageComplete(false);
|
|
215 |
}
|
|
216 |
|
|
217 |
/**
|
|
218 |
* Creates checkbox viewer component for showing build targets.
|
|
219 |
* @param parent Parent composite for the created composite.
|
|
220 |
* @return New <code>CheckboxTableViewer</code> object instance.
|
|
221 |
*/
|
|
222 |
protected CheckboxTableViewer createBuildTargetTableViewer(Composite parent) {
|
|
223 |
|
|
224 |
ArrayList<S60ToolsTableColumnData> columnDataArr = new ArrayList<S60ToolsTableColumnData>();
|
|
225 |
|
|
226 |
//
|
|
227 |
// NOTE: Column indices must start from zero (0) and
|
|
228 |
// the columns must be added in ascending numeric
|
|
229 |
// order.
|
|
230 |
//
|
|
231 |
columnDataArr.add(new S60ToolsTableColumnData(Messages.getString("SelectBuildTargetWizardPage.TargetType_ColumnText"), //$NON-NLS-1$
|
|
232 |
120,
|
|
233 |
BuildTargetEntry.TARGET_TYPE_COLUMN_INDEX,
|
|
234 |
BuildTargetTableViewerSorter.CRITERIA_TARGET_TYPE));
|
|
235 |
columnDataArr.add(new S60ToolsTableColumnData(Messages.getString("SelectBuildTargetWizardPage.ComponentCount_ColumnText"), //$NON-NLS-1$
|
|
236 |
100,
|
|
237 |
BuildTargetEntry.COMPONENT_COUNT_COLUMN_INDEX,
|
|
238 |
BuildTargetTableViewerSorter.CRITERIA_COMPONENT_COUNT,
|
|
239 |
SWT.RIGHT));
|
|
240 |
columnDataArr.add(new S60ToolsTableColumnData(Messages.getString("SelectBuildTargetWizardPage.Status_ColumnText"), //$NON-NLS-1$
|
|
241 |
160,
|
|
242 |
BuildTargetEntry.STATUS_COLUMN_INDEX,
|
|
243 |
BuildTargetTableViewerSorter.CRITERIA_STATUS));
|
|
244 |
|
|
245 |
S60ToolsTableColumnData[] arr
|
|
246 |
= columnDataArr.toArray(
|
|
247 |
new S60ToolsTableColumnData[0]);
|
|
248 |
|
|
249 |
S60ToolsTable tbl = S60ToolsTableFactory.createCheckboxTable(parent, arr);
|
|
250 |
|
|
251 |
CheckboxTableViewer tblViewer = new CheckboxTableViewer(tbl.getTableInstance());
|
|
252 |
tbl.setHostingViewer(tblViewer);
|
|
253 |
|
|
254 |
return tblViewer;
|
|
255 |
}
|
|
256 |
|
|
257 |
/* (non-Javadoc)
|
|
258 |
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
|
259 |
*/
|
|
260 |
public void createControl(Composite parent) {
|
|
261 |
|
|
262 |
// Creating one column only sub composite for controls
|
|
263 |
Composite c = new Composite(parent, SWT.NONE);
|
|
264 |
final int cols = 1;
|
|
265 |
GridLayout gdl = new GridLayout(cols, false);
|
|
266 |
GridData gd = new GridData(GridData.FILL_BOTH);
|
|
267 |
c.setLayout(gdl);
|
|
268 |
c.setLayoutData(gd);
|
|
269 |
|
|
270 |
// Creating grid layout composite for information labels
|
|
271 |
Composite titleAreaComposite = new Composite(c, SWT.NONE);
|
|
272 |
GridLayout gdl2 = new GridLayout(2, false);
|
|
273 |
GridData gd2 = new GridData(GridData.FILL_HORIZONTAL);
|
|
274 |
titleAreaComposite.setLayout(gdl2);
|
|
275 |
titleAreaComposite.setLayoutData(gd2);
|
|
276 |
|
|
277 |
// Adding SDK and build type information labels
|
|
278 |
addSDKInformationLabels(titleAreaComposite);
|
|
279 |
addBuildTypeInformationLabels(titleAreaComposite);
|
|
280 |
|
|
281 |
// Creating build target viewer component
|
|
282 |
buildTargetViewer = createBuildTargetTableViewer(c);
|
|
283 |
GridData targetViewerGd = new GridData(GridData.FILL_BOTH);
|
|
284 |
buildTargetViewer.getControl().setLayoutData(targetViewerGd);
|
|
285 |
buildTargetViewer.setSorter(new BuildTargetTableViewerSorter());
|
|
286 |
|
|
287 |
// Adding checkboxes and Add SIS files -button inside a new composite object
|
|
288 |
final int compBottomControlsCols = 2;
|
|
289 |
Composite compBottomControls = new Composite(c, SWT.NONE);
|
|
290 |
GridLayout gLToBottomControls = new GridLayout(compBottomControlsCols, false);
|
|
291 |
compBottomControls.setLayout(gLToBottomControls);
|
|
292 |
compBottomControls.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
|
293 |
|
|
294 |
// Checkbox for showing debug build type targets instead of release targets
|
|
295 |
String checkBoxLabelText = Messages.getString("SelectBuildTargetWizardPage.ShowDebugBuild_CheckboxCaptionText"); //$NON-NLS-1$
|
|
296 |
// Creating viewer filter for doing filtering according build type
|
|
297 |
buildTypeFilter = new BuildTargetSelectionBuildTypeFilter(BuildTargetFilterModeEnum.EShowReleaseTargets);
|
|
298 |
showDebugTargetsInsteadOfReleaseTargetsCheckbox = addCheckBoxControl(compBottomControls, checkBoxLabelText, false,
|
|
299 |
buildTypeFilter, null);
|
|
300 |
|
|
301 |
// Adding SIS file addition dialog launching button
|
|
302 |
addSISFilesButton = new Button(compBottomControls, SWT.PUSH );
|
|
303 |
addSISFilesButton.setText(Messages.getString("SelectBuildTargetWizardPage.AddSISFile_BtnCaptionText")); //$NON-NLS-1$
|
|
304 |
addSISFilesButton.addSelectionListener(this);
|
|
305 |
GridData gDToButton = new GridData(GridData.HORIZONTAL_ALIGN_END);
|
|
306 |
addSISFilesButton.setLayoutData(gDToButton);
|
|
307 |
|
|
308 |
// Checkbox for showing only supported and non-empty targets
|
|
309 |
checkBoxLabelText = Messages.getString("SelectBuildTargetWizardPage.ShowSupportedAndNonEmptyTargets_CheckboxCaptionText"); //$NON-NLS-1$
|
|
310 |
// Creating viewer filter for checkbox
|
|
311 |
nonEmptyAndNonSuppTargetFilter = new BuildTargetSelectionNonEmptyAndNonSuppTargetFilter(true);
|
|
312 |
GridData cbLayoutData2 = new GridData(GridData.GRAB_HORIZONTAL);
|
|
313 |
showOnlySupportedAndNonEmptyTargetsCheckbox = addCheckBoxControl(compBottomControls, checkBoxLabelText, true,
|
|
314 |
nonEmptyAndNonSuppTargetFilter, cbLayoutData2);
|
|
315 |
|
|
316 |
// Providers cannot be created before all the controls have been created
|
|
317 |
setProvidersAndListenersForBuildTargetViewer();
|
|
318 |
|
|
319 |
// Setting initial focus of the wizard page
|
|
320 |
setInitialFocus();
|
|
321 |
|
|
322 |
// Setting control for this page
|
|
323 |
setControl(c);
|
|
324 |
|
|
325 |
// Setting context help ID
|
|
326 |
AppDepPlugin.setContextSensitiveHelpID(getControl(), AppDepHelpContextIDs.APPDEP_WIZARD_PAGE_BUILD_TARGET_SELECT);
|
|
327 |
}
|
|
328 |
|
|
329 |
/**
|
|
330 |
* Adds checkbox control with given parameters.
|
|
331 |
* @param compBottomControls Parent composite.
|
|
332 |
* @param checkBoxLabelText Label text for the checkbox.
|
|
333 |
* @param initialSelectionStatus set to <code>true</code> if initially selected, otherwise <code>false</code>.
|
|
334 |
* @param filter Filter to be applied related to checkbox, or <code>null</code> if not used.
|
|
335 |
* @param gdData grid data to be applied related to checkbox, or <code>null</code> if not used.
|
|
336 |
*/
|
|
337 |
private Button addCheckBoxControl(Composite compBottomControls, String checkBoxLabelText, boolean initialSelectionStatus,
|
|
338 |
ViewerFilter filter, GridData gdData) {
|
|
339 |
Button checkboxControl = new Button(compBottomControls, SWT.CHECK);
|
|
340 |
checkboxControl.setText(checkBoxLabelText);
|
|
341 |
checkboxControl.setSelection(initialSelectionStatus); // By default showing release targets
|
|
342 |
checkboxControl.addSelectionListener(this);
|
|
343 |
if(filter != null){
|
|
344 |
buildTargetViewer.addFilter(filter);
|
|
345 |
}
|
|
346 |
if(gdData != null){
|
|
347 |
checkboxControl.setLayoutData(gdData);
|
|
348 |
}
|
|
349 |
return checkboxControl;
|
|
350 |
}
|
|
351 |
|
|
352 |
/**
|
|
353 |
* Adds SDK information labels.
|
|
354 |
* @param titleAreaComposite parent composite to labels.
|
|
355 |
*/
|
|
356 |
private void addSDKInformationLabels(Composite titleAreaComposite) {
|
|
357 |
sdkNameFieldTitleText = new Text(titleAreaComposite, READ_ONLY_LABEL_FIELD_STYLEBITS);
|
|
358 |
String titleText = Messages.getString("SelectBuildTargetWizardPage.SDK_Str") + ": "; //$NON-NLS-1$ //$NON-NLS-2$
|
|
359 |
sdkNameFieldTitleText.setText(titleText);
|
|
360 |
sdkNameFieldTitleText.addFocusListener(this);
|
|
361 |
sdkNameFieldValueText = new Text(titleAreaComposite, READ_ONLY_LABEL_FIELD_STYLEBITS);
|
|
362 |
sdkNameFieldValueText.addFocusListener(this);
|
|
363 |
}
|
|
364 |
|
|
365 |
/**
|
|
366 |
* Adds build type information labels.
|
|
367 |
* @param titleAreaComposite parent composite to labels.
|
|
368 |
*/
|
|
369 |
private void addBuildTypeInformationLabels(Composite titleAreaComposite) {
|
|
370 |
buildTypeFieldTitleText = new Text(titleAreaComposite, READ_ONLY_LABEL_FIELD_STYLEBITS);
|
|
371 |
buildTypeFieldTitleText.setText(Messages.getString("SelectBuildTargetWizardPage.BuildType_Str") + ": "); //$NON-NLS-1$ //$NON-NLS-2$
|
|
372 |
buildTypeFieldTitleText.addFocusListener(this);
|
|
373 |
buildTypeFieldValueText = new Text(titleAreaComposite, READ_ONLY_LABEL_FIELD_STYLEBITS);
|
|
374 |
// Setting default build type value...
|
|
375 |
buildTypeFieldValueText.setText(BUILD_TYPE_RELEASE_STR);
|
|
376 |
// ...and storing the default value also to dialog settings
|
|
377 |
updateDialogSettings(SelectSDKWizard.BUILD_TYPE_DESCR_DLG_SETTING_KEY, BUILD_TYPE_RELEASE_STR);
|
|
378 |
buildTypeFieldValueText.addFocusListener(this);
|
|
379 |
}
|
|
380 |
|
|
381 |
/**
|
|
382 |
* Sets providers and listeners for build target viewer control.
|
|
383 |
*/
|
|
384 |
private void setProvidersAndListenersForBuildTargetViewer() {
|
|
385 |
contentProvider = new SelectBuildTargetWizardPageContentProvider(this);
|
|
386 |
buildTargetViewer.setContentProvider(contentProvider);
|
|
387 |
buildTargetViewer.setLabelProvider(new SelectBuildTargetWizardPageLabelProvider());
|
|
388 |
buildTargetViewer.setInput(contentProvider);
|
|
389 |
|
|
390 |
// Adding selection change listener
|
|
391 |
buildTargetViewer.addSelectionChangedListener(new ISelectionChangedListener(){
|
|
392 |
/* (non-Javadoc)
|
|
393 |
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
|
|
394 |
*/
|
|
395 |
public void selectionChanged(SelectionChangedEvent event) {
|
|
396 |
// Triggering status recalculation only if non-programmatic selection
|
|
397 |
if(! isProgrammaticSelectionOngoing()){
|
|
398 |
// Skipping programmatic selection because we are sure that event came from UI selection
|
|
399 |
recalculateButtonStates(true, null);
|
|
400 |
}
|
|
401 |
}
|
|
402 |
|
|
403 |
});
|
|
404 |
|
|
405 |
}
|
|
406 |
|
|
407 |
/* (non-Javadoc)
|
|
408 |
* @see com.nokia.s60tools.appdep.ui.wizards.S60ToolsWizardPage#setInitialFocus()
|
|
409 |
*/
|
|
410 |
public void setInitialFocus() {
|
|
411 |
buildTargetViewer.getTable().setFocus();
|
|
412 |
}
|
|
413 |
|
|
414 |
/* (non-Javadoc)
|
|
415 |
* @see com.nokia.s60tools.appdep.ui.wizards.S60ToolsWizardPage#recalculateButtonStates()
|
|
416 |
*/
|
|
417 |
public void recalculateButtonStates() {
|
|
418 |
// By default we check, if programmatic selection is possible
|
|
419 |
recalculateButtonStates(false, null);
|
|
420 |
}
|
|
421 |
|
|
422 |
/**
|
|
423 |
* Page specific recalculate buttons implementation.
|
|
424 |
* @param skipProgrammaticSelectionCheck set to <code>true</code> if needed to skip, automatic programmatic
|
|
425 |
* selection based on current settings, otherwise set to <code>false</code>.
|
|
426 |
* @param forceCheckedEntriesArr If this is not <code>null</code>, using these entries instead of current selection
|
|
427 |
* if current selection do not have any components (used in double-click event).
|
|
428 |
*/
|
|
429 |
public void recalculateButtonStates(boolean skipProgrammaticSelectionCheck, Object[] forceCheckedEntriesArr) {
|
|
430 |
|
|
431 |
try {
|
|
432 |
SelectSDKWizard wiz = (SelectSDKWizard) getWizard();
|
|
433 |
AppDepSettings settings = wiz.getSettings();
|
|
434 |
Object[] checkedEntriesArr = buildTargetViewer.getCheckedElements();; // Getting all checked targets
|
|
435 |
if(checkedEntriesArr.length == 0 && forceCheckedEntriesArr != null){
|
|
436 |
// Using forced target set instead
|
|
437 |
checkedEntriesArr = forceCheckedEntriesArr;
|
|
438 |
}
|
|
439 |
|
|
440 |
// Re-initializing selection state
|
|
441 |
selectionState = TargetSelStateEnum.EStateNotSet;
|
|
442 |
|
|
443 |
// If programmatic selection is not skipped and there are no target nodes selected...
|
|
444 |
if( checkedEntriesArr.length == 0){
|
|
445 |
// Trying to make selection based on the settings if allowed according boolean flag
|
|
446 |
if(!skipProgrammaticSelectionCheck && makeProgrammaticElementCheckingBasedOnSettings(settings)){
|
|
447 |
// Getting all targets checked by programmatic selection
|
|
448 |
checkedEntriesArr = buildTargetViewer.getCheckedElements();
|
|
449 |
if(checkedEntriesArr.length == 0){
|
|
450 |
// Trying to avoid internal errors, but this is something that should be trapped during
|
|
451 |
// development time. Internal error messages are not localized.
|
|
452 |
String errMsg = "Programmatic selection failed unexpectedly in class '" //$NON-NLS-1$
|
|
453 |
+ SelectBuildTargetWizardPage.class.getSimpleName()
|
|
454 |
+ "'."; //$NON-NLS-1$
|
|
455 |
LogUtils.logInternalErrorAndThrowException(errMsg);
|
|
456 |
return;
|
|
457 |
}
|
|
458 |
}
|
|
459 |
else{
|
|
460 |
// Failed to make programmatic selection, or programmatic selection was skipped.
|
|
461 |
// Making sure that no targets are selected in settings
|
|
462 |
settings.clearCurrentlyUsedTargetPlatforms();
|
|
463 |
// And showing initial message, because no items are selected currently
|
|
464 |
showInitialStateMessage(wiz);
|
|
465 |
//.. and returning
|
|
466 |
return;
|
|
467 |
}
|
|
468 |
}
|
|
469 |
|
|
470 |
// Going through all the selected nodes one by one and setting selection state.
|
|
471 |
// State can be multiple times during method execution because only more severe
|
|
472 |
// error state will override existing selection state.
|
|
473 |
// See comment block from TargetSelStateEnum enumeration for detailed info.
|
|
474 |
List<BuildTargetEntry> selectedTargetsArr = new ArrayList<BuildTargetEntry>();
|
|
475 |
// SDK information is needed for finding out SDK supports required tools (dumpsis.exe and elftran.exe)
|
|
476 |
SdkInformation sdkInfo = getSelectedSdk();
|
|
477 |
|
|
478 |
// Checking if we are in SIS mode and settings selection state if needed
|
|
479 |
checkSISModeStatusAndSetSelectionStateIfNeeded(settings, sdkInfo);
|
|
480 |
|
|
481 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP, "----- Checked items START ==>"); // //$NON-NLS-1$
|
|
482 |
|
|
483 |
//Recalculate state based on the selection made by a user
|
|
484 |
for (int i = 0; i < checkedEntriesArr.length; i++) {
|
|
485 |
// Casting selected node to correct type
|
|
486 |
BuildTargetEntry targetEntry = (BuildTargetEntry) checkedEntriesArr[i];
|
|
487 |
// Debug printing checked items
|
|
488 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP, targetEntry.getTargetDescription());
|
|
489 |
// Added target to target selection array
|
|
490 |
selectedTargetsArr.add(targetEntry);
|
|
491 |
// Resolves selection state based on target's status
|
|
492 |
BuildTargetStatusEnum status = targetEntry.getStatus();
|
|
493 |
setSelectionStateBasedOnTargetStatus(settings, sdkInfo, status, targetEntry.getTargetName());
|
|
494 |
|
|
495 |
// In case we are about to generate/update cache files...
|
|
496 |
if(selectionState == TargetSelStateEnum.ECacheNotGeneratedForSomeTarget
|
|
497 |
||
|
|
498 |
selectionState == TargetSelStateEnum.ECacheNeedsUpdateForSomeTarget
|
|
499 |
||
|
|
500 |
selectionState == TargetSelStateEnum.ESISFileCacheNeedsToBeGenerated){
|
|
501 |
//... we finally check, if we cannot start cache generation due to fact
|
|
502 |
// that there is already a cache generation process for this SDK ongoing.
|
|
503 |
if(settings.isCacheGenerationOngoingForSdk(sdkInfo)){
|
|
504 |
setSelectionState(TargetSelStateEnum.ECacheIsBeingGeneratedForSomeTarget);
|
|
505 |
}
|
|
506 |
}
|
|
507 |
}
|
|
508 |
|
|
509 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP, "<== Checked items END -----"); // //$NON-NLS-1$
|
|
510 |
|
|
511 |
// Checking that the selected combination is otherwise valid.
|
|
512 |
// Updates selection state accordingly. Must be called before
|
|
513 |
// page completion check and before settings button statuses.
|
|
514 |
CheckValidityOfTargetSelection(selectedTargetsArr, settings);
|
|
515 |
|
|
516 |
// Storing user selection if we have a valid selection
|
|
517 |
boolean isPageCompleted = checkPageCompleteStatus();
|
|
518 |
|
|
519 |
//If page is completed it means there is a valid selection existing
|
|
520 |
if(isPageCompleted){
|
|
521 |
// Storing user selection
|
|
522 |
wiz.setUserSelection(sdkInfo, selectedTargetsArr.toArray(new BuildTargetEntry[0]));
|
|
523 |
}
|
|
524 |
|
|
525 |
// Setting buttons states and visible messages according selection state.
|
|
526 |
// Must be called before calling updateInformationForNextPage.
|
|
527 |
setUserMessageAndButtonState(wiz, isPageCompleted, selectedTargetsArr);
|
|
528 |
|
|
529 |
} catch (Exception e) {
|
|
530 |
e.printStackTrace(); // Development time trace.
|
|
531 |
String errMsg = e.getMessage();
|
|
532 |
LogUtils.logStackTrace(errMsg , e); // Trace for production environment
|
|
533 |
throw new RuntimeException(errMsg); // Mapping exception to anonymous run-time error
|
|
534 |
}
|
|
535 |
}
|
|
536 |
|
|
537 |
/**
|
|
538 |
* Shows initial message in state when there are no checked items.
|
|
539 |
* @param wiz Wizard instance for setting button statuses.
|
|
540 |
*/
|
|
541 |
private void showInitialStateMessage(SelectSDKWizard wiz) {
|
|
542 |
this.setMessage(Messages.getString("SelectBuildTargetWizardPage.Startup_InfoMsg")); //$NON-NLS-1$
|
|
543 |
this.setErrorMessage(null);
|
|
544 |
setPageComplete(false);
|
|
545 |
// Finishing is forbidden
|
|
546 |
wiz.disableCanFinish();
|
|
547 |
}
|
|
548 |
|
|
549 |
/**
|
|
550 |
* Checks possible SIS mode and sets selections state if needed.
|
|
551 |
* @param settings settings used to check mode
|
|
552 |
* @param sdkInfo selected SDK
|
|
553 |
*/
|
|
554 |
private void checkSISModeStatusAndSetSelectionStateIfNeeded(AppDepSettings settings, SdkInformation sdkInfo) {
|
|
555 |
//If we are about to add SIS files to be analyzed
|
|
556 |
if(settings.isInSISFileAnalysisMode()){
|
|
557 |
//Setting initial state as SIS generation (in the following for loop only
|
|
558 |
//more serious errors will overwrite this state)
|
|
559 |
if(!settings.isDumpsisAvailable(sdkInfo)){
|
|
560 |
//If we are in SIS Analysis mode and there is no dumpsis.exe available
|
|
561 |
setSelectionState(TargetSelStateEnum.EDumpsisDoesNotExist);
|
|
562 |
}
|
|
563 |
else{
|
|
564 |
// Dumpsis available and we can continue into cache creation.
|
|
565 |
setSelectionState(TargetSelStateEnum.ESISFileCacheNeedsToBeGenerated);
|
|
566 |
}
|
|
567 |
}
|
|
568 |
}
|
|
569 |
|
|
570 |
/**
|
|
571 |
* Makes programmatic checking of elements based on the given settings if possible.
|
|
572 |
* @param settings settings to be used for resolving the targets to be checked.
|
|
573 |
* @return <code>true</code> if selection was made successfully, otherwise <code>false</code>.
|
|
574 |
*/
|
|
575 |
private boolean makeProgrammaticElementCheckingBasedOnSettings(
|
|
576 |
AppDepSettings settings) {
|
|
577 |
// ...checking if we can create a selection based on the
|
|
578 |
// currently used SDK and target platform information.
|
|
579 |
Object[] objectArr = resolveTargetsBasedOnCurrentSettings(settings);
|
|
580 |
if(objectArr.length > 0){
|
|
581 |
// No normal events triggered on programmatic selection
|
|
582 |
setProgrammaticSelectionOngoingFlag(true);
|
|
583 |
for (int i = 0; i < objectArr.length; i++) {
|
|
584 |
Object object = objectArr[i];
|
|
585 |
buildTargetViewer.setChecked(object, true);
|
|
586 |
}
|
|
587 |
// Back to normal event handling
|
|
588 |
setProgrammaticSelectionOngoingFlag(false);
|
|
589 |
return true; // Selection was made successfully
|
|
590 |
}
|
|
591 |
|
|
592 |
return false; // Could not make selection
|
|
593 |
}
|
|
594 |
|
|
595 |
/**
|
|
596 |
* Checks build target's status and sets current selection state flag accordingly.
|
|
597 |
* @param settings current settings
|
|
598 |
* @param sdkInfo Selected SDK
|
|
599 |
* @param status build target status
|
|
600 |
* @param buildTargetId Build target id to based on which set status.
|
|
601 |
*/
|
|
602 |
private void setSelectionStateBasedOnTargetStatus(AppDepSettings settings,
|
|
603 |
SdkInformation sdkInfo, BuildTargetStatusEnum status, String buildTargetId) throws Exception{
|
|
604 |
|
|
605 |
switch (status) {
|
|
606 |
|
|
607 |
case ENotSupported:
|
|
608 |
// If the selected target is not supported, there is no sense to check
|
|
609 |
// other selections, because this is the most severe selection error.
|
|
610 |
setSelectionState(TargetSelStateEnum.ESomeTargetNotSupported);
|
|
611 |
break;
|
|
612 |
|
|
613 |
case EEmptyTarget:
|
|
614 |
setSelectionState(TargetSelStateEnum.ENoComponentsForSomeTarget);
|
|
615 |
break;
|
|
616 |
|
|
617 |
case ECacheNeedsUpdate:
|
|
618 |
if(settings.areToolsRequiredByCoreAvailable(sdkInfo, buildTargetId)){
|
|
619 |
// Informing about cache update need if elftran.exe available
|
|
620 |
setSelectionState(TargetSelStateEnum.ECacheNeedsUpdateForSomeTarget);
|
|
621 |
}
|
|
622 |
else{
|
|
623 |
// Otherwise informing used that elftran is not available
|
|
624 |
setSelectionState(TargetSelStateEnum.EElftranDoesNotExist);
|
|
625 |
}
|
|
626 |
break;
|
|
627 |
|
|
628 |
case ENoCache:
|
|
629 |
if(settings.areToolsRequiredByCoreAvailable(sdkInfo, buildTargetId)){
|
|
630 |
// Informing about cache creation need if elftran.exe available
|
|
631 |
setSelectionState(TargetSelStateEnum.ECacheNotGeneratedForSomeTarget);
|
|
632 |
}
|
|
633 |
else{
|
|
634 |
// Otherwise informing used that elftran is not available
|
|
635 |
setSelectionState(TargetSelStateEnum.EElftranDoesNotExist);
|
|
636 |
}
|
|
637 |
break;
|
|
638 |
|
|
639 |
case ECachesIsBeingIndexed:
|
|
640 |
setSelectionState(TargetSelStateEnum.ECachesIsBeingIndexedForSomeTarget);
|
|
641 |
break;
|
|
642 |
|
|
643 |
case ECacheIsBeingGenerated:
|
|
644 |
setSelectionState(TargetSelStateEnum.ECacheIsBeingGeneratedForSomeTarget);
|
|
645 |
break;
|
|
646 |
|
|
647 |
case ECacheReady:
|
|
648 |
setSelectionState(TargetSelStateEnum.EAllTargetCachesUpToDate);
|
|
649 |
break;
|
|
650 |
|
|
651 |
default:
|
|
652 |
// Trying to avoid internal errors, but this is something that should be trapped during development time.
|
|
653 |
// Because this method should be capable of handling all enum values and should be modified
|
|
654 |
// accordingly if new enum values are added. Internal error messages are not localised.
|
|
655 |
String errMsg = "Unexpected enum value for enumerator '" //$NON-NLS-1$
|
|
656 |
+ BuildTargetStatusEnum.class.getSimpleName()
|
|
657 |
+ "': " //$NON-NLS-1$
|
|
658 |
+ status.toString();
|
|
659 |
LogUtils.logInternalErrorAndThrowException(errMsg);
|
|
660 |
}
|
|
661 |
}
|
|
662 |
|
|
663 |
/**
|
|
664 |
* Checks that the selected target combination is valid.
|
|
665 |
* @param selectedTargetsArr Selected nodes to be checked for validity.
|
|
666 |
* @param st Settings object to query settings related information from.
|
|
667 |
* @return <code>true</code> if we have valid target selection
|
|
668 |
*/
|
|
669 |
private void CheckValidityOfTargetSelection(List<BuildTargetEntry> selectedTargetsArr, AppDepSettings st) {
|
|
670 |
// Only sensible to check if there is multiselection
|
|
671 |
if(selectedTargetsArr.size() > 1){
|
|
672 |
|
|
673 |
// Checking that each target use the same default toolchain
|
|
674 |
String targetNameFirst = selectedTargetsArr.get(0).getTargetName();
|
|
675 |
try {
|
|
676 |
String toolchainFirst = st.getDefaultToolchainForTarget(targetNameFirst).getToolchainName();
|
|
677 |
for (int i = 1; i < selectedTargetsArr.size(); i++) {
|
|
678 |
String targetName = selectedTargetsArr.get(i).getTargetName();
|
|
679 |
String toolchain = st.getDefaultToolchainForTarget(targetName).getToolchainName();
|
|
680 |
if(!toolchain.equals(toolchainFirst)){
|
|
681 |
setSelectionState(TargetSelStateEnum.EInvalidToolchainMix);
|
|
682 |
}
|
|
683 |
}
|
|
684 |
} catch (InvalidCmdLineToolSettingException e) {
|
|
685 |
// We might get this exception when user has selected platform that is not supported.
|
|
686 |
// Just debug printing for development purposes for logging possible internal errors.
|
|
687 |
DbgUtility.println(DbgUtility.PRIORITY_OPERATION, e.getMessage());
|
|
688 |
}
|
|
689 |
|
|
690 |
}
|
|
691 |
}
|
|
692 |
|
|
693 |
/**
|
|
694 |
* Checks page completion status based on selection state.
|
|
695 |
* Return status tells if flip to next page is allowed.
|
|
696 |
* @return <code>true</code> if page can be completed, otherwise <code>false</code>.
|
|
697 |
*/
|
|
698 |
boolean checkPageCompleteStatus(){
|
|
699 |
|
|
700 |
boolean pageCompleteStatus = false;
|
|
701 |
|
|
702 |
if(selectionState.equals(TargetSelStateEnum.EAllTargetCachesUpToDate)){
|
|
703 |
// Can proceed to component selection
|
|
704 |
pageCompleteStatus = true;
|
|
705 |
}
|
|
706 |
else if(selectionState.equals(TargetSelStateEnum.ECacheNotGeneratedForSomeTarget)){
|
|
707 |
// Can proceed for cache generation options
|
|
708 |
pageCompleteStatus = true;
|
|
709 |
}
|
|
710 |
else if(selectionState.equals(TargetSelStateEnum.ECacheNeedsUpdateForSomeTarget)){
|
|
711 |
// Can proceed for cache generation options
|
|
712 |
pageCompleteStatus = true;
|
|
713 |
}
|
|
714 |
else if(selectionState.equals(TargetSelStateEnum.ESISFileCacheNeedsToBeGenerated)){
|
|
715 |
// Can proceed for cache generation options or start SIS cache generation
|
|
716 |
pageCompleteStatus = true;
|
|
717 |
}
|
|
718 |
else if(selectionState.equals(TargetSelStateEnum.EDumpsisDoesNotExist)){
|
|
719 |
// Cannot proceed for cache generation options
|
|
720 |
pageCompleteStatus = false;
|
|
721 |
}
|
|
722 |
else if(selectionState.equals(TargetSelStateEnum.EElftranDoesNotExist)){
|
|
723 |
// Cannot proceed for cache generation options
|
|
724 |
pageCompleteStatus = false;
|
|
725 |
}
|
|
726 |
else if(selectionState.equals(TargetSelStateEnum.ECachesIsBeingIndexedForSomeTarget)){
|
|
727 |
// Cannot proceed until index has been created
|
|
728 |
pageCompleteStatus = false;
|
|
729 |
}
|
|
730 |
else if(selectionState.equals(TargetSelStateEnum.ECacheIsBeingGeneratedForSomeTarget)){
|
|
731 |
// Cannot proceed until cache has been created for this SKD's target
|
|
732 |
pageCompleteStatus = false;
|
|
733 |
}
|
|
734 |
else if(selectionState.equals(TargetSelStateEnum.ENoComponentsForSomeTarget)){
|
|
735 |
// Cannot proceed if some selection does not have components
|
|
736 |
pageCompleteStatus = false;
|
|
737 |
}
|
|
738 |
else if(selectionState.equals(TargetSelStateEnum.ESomeTargetNotSupported)){
|
|
739 |
// Cannot proceed if some target is not supported
|
|
740 |
pageCompleteStatus = false;
|
|
741 |
}
|
|
742 |
else if(selectionState.equals(TargetSelStateEnum.EInvalidToolchainMix)){
|
|
743 |
// Cannot proceed if toolchain mix is not allowed
|
|
744 |
pageCompleteStatus = false;
|
|
745 |
}
|
|
746 |
else{
|
|
747 |
// Trying to avoid internal errors, but this is something that should be trapped during
|
|
748 |
// development time. Internal error messages are not localized.
|
|
749 |
LogUtils.logInternalErrorAndThrowException("Unexpected target selection state:" + selectionState.ordinal()); //$NON-NLS-1$
|
|
750 |
}
|
|
751 |
|
|
752 |
return pageCompleteStatus;
|
|
753 |
}
|
|
754 |
|
|
755 |
/**
|
|
756 |
* Sets user messages and button enable/disable states according the current selection state.
|
|
757 |
* @param wiz Wizard object needed for settings button enable/disable states.
|
|
758 |
* @param isPageCompleted Page completion status returned by <code>checkPageCompleteStatus</code>.
|
|
759 |
* @param selectedTargetsArr Currently selected targets.
|
|
760 |
*/
|
|
761 |
private void setUserMessageAndButtonState(SelectSDKWizard wiz, boolean isPageCompleted, List<BuildTargetEntry> selectedTargetsArr) throws Exception{
|
|
762 |
|
|
763 |
//
|
|
764 |
// Settings user messages and button state according the selection state
|
|
765 |
//
|
|
766 |
if(selectionState.equals(TargetSelStateEnum.EAllTargetCachesUpToDate)){
|
|
767 |
this.setMessage(Messages.getString("SelectBuildTargetWizardPage.Press_Next_To_Continue")); //$NON-NLS-1$
|
|
768 |
this.setErrorMessage(null);
|
|
769 |
setPageComplete(isPageCompleted);
|
|
770 |
// Finishing is forbidden
|
|
771 |
wiz.disableCanFinish();
|
|
772 |
}
|
|
773 |
else if(selectionState.equals(TargetSelStateEnum.ECacheNotGeneratedForSomeTarget)){
|
|
774 |
this.setMessage(Messages.getString("SelectBuildTargetWizardPage.Cache_Generation_Needed") //$NON-NLS-1$
|
|
775 |
+ Messages.getString("SelectBuildTargetWizardPage.Press_Finish_To_Start_Generation") //$NON-NLS-1$
|
|
776 |
+ Messages.getString("SelectBuildTargetWizardPage.Press_Next_To_To_Modify_Generation_Options"), //$NON-NLS-1$
|
|
777 |
IMessageProvider.WARNING);
|
|
778 |
this.setErrorMessage(null);
|
|
779 |
|
|
780 |
// Updating available cache generation options
|
|
781 |
wiz.setDefaultCacheGenerationOptionsBasedOnTheSelectedTarget();
|
|
782 |
|
|
783 |
setPageComplete(isPageCompleted);
|
|
784 |
// Pressing Finish in order to
|
|
785 |
// start cache generation is allowed.
|
|
786 |
wiz.enableCanFinish(ISelectSDKWizard.FINISH_CACHE_CREATION);
|
|
787 |
}
|
|
788 |
else if(selectionState.equals(TargetSelStateEnum.ECacheNeedsUpdateForSomeTarget)){
|
|
789 |
this.setMessage(Messages.getString("SelectBuildTargetWizardPage.Cache_Needs_Update"), //$NON-NLS-1$
|
|
790 |
IMessageProvider.WARNING);
|
|
791 |
this.setErrorMessage(null);
|
|
792 |
// Updating available cache generation options
|
|
793 |
wiz.setDefaultCacheGenerationOptionsBasedOnTheSelectedTarget();
|
|
794 |
|
|
795 |
setPageComplete(isPageCompleted);
|
|
796 |
// User is also allowed to press Finish,
|
|
797 |
// and start cache update with default generation
|
|
798 |
// options.
|
|
799 |
wiz.enableCanFinish(ISelectSDKWizard.FINISH_CACHE_CREATION);
|
|
800 |
}
|
|
801 |
else if(selectionState.equals(TargetSelStateEnum.ESISFileCacheNeedsToBeGenerated)){
|
|
802 |
// Can proceed for cache generation options or start SIS cache generation
|
|
803 |
this.setMessage(Messages.getString("SelectBuildTargetWizardPage.Cache_Generation_Needed_For_SIS_Files") //$NON-NLS-1$
|
|
804 |
+ Messages.getString("SelectBuildTargetWizardPage.Press_Finish_To_Start_Generation") //$NON-NLS-1$
|
|
805 |
+ Messages.getString("SelectBuildTargetWizardPage.Press_Next_To_To_Modify_Generation_Options"), //$NON-NLS-1$
|
|
806 |
IMessageProvider.WARNING);
|
|
807 |
this.setErrorMessage(null);
|
|
808 |
|
|
809 |
// Updating available cache generation options
|
|
810 |
wiz.setDefaultCacheGenerationOptionsBasedOnTheSelectedTarget();
|
|
811 |
|
|
812 |
setPageComplete(isPageCompleted);
|
|
813 |
// Pressing Finish in order to
|
|
814 |
// start cache generation is allowed.
|
|
815 |
wiz.enableCanFinish(ISelectSDKWizard.FINISH_CACHE_CREATION);
|
|
816 |
}
|
|
817 |
else if(selectionState.equals(TargetSelStateEnum.EDumpsisDoesNotExist)){
|
|
818 |
this.setMessage(null);
|
|
819 |
this.setErrorMessage(Messages.getString("SelectBuildTargetWizardPage.Dumpsis.exe_Does_Not_Exist_ErrorMsg")); //$NON-NLS-1$
|
|
820 |
// Cannot proceed for cache generation options
|
|
821 |
setPageComplete(isPageCompleted);
|
|
822 |
// Finishing is forbidden
|
|
823 |
wiz.disableCanFinish();
|
|
824 |
}
|
|
825 |
else if(selectionState.equals(TargetSelStateEnum.EElftranDoesNotExist)){
|
|
826 |
this.setMessage(null);
|
|
827 |
// If we end-up here, there is at least a single target selected
|
|
828 |
String targetId = selectedTargetsArr.get(0).getTargetName(); // and all selected targets must use same toolchain (=dump tool)
|
|
829 |
String errMsgFormatString = Messages.getString("SelectBuildTargetWizardPage.BinaryDumpTool_Does_Not_Exist_ErrorMsg"); //$NON-NLS-1$
|
|
830 |
this.setErrorMessage(String.format(errMsgFormatString, wiz.getSettings().getCurrentlyUsedCoreDumpToolName(targetId)));
|
|
831 |
// Cannot proceed for cache generation options
|
|
832 |
setPageComplete(isPageCompleted);
|
|
833 |
// Finishing is forbidden
|
|
834 |
wiz.disableCanFinish();
|
|
835 |
}
|
|
836 |
else if(selectionState.equals(TargetSelStateEnum.ECachesIsBeingIndexedForSomeTarget)){
|
|
837 |
this.setMessage(null);
|
|
838 |
|
|
839 |
this.setMessage(Messages.getString("SelectBuildTargetWizardPage.Cache_Index_Not_Yet_Created"), //$NON-NLS-1$
|
|
840 |
IMessageProvider.WARNING);
|
|
841 |
this.setErrorMessage(null);
|
|
842 |
setPageComplete(isPageCompleted);
|
|
843 |
// Finishing is forbidden
|
|
844 |
wiz.disableCanFinish();
|
|
845 |
}
|
|
846 |
else if(selectionState.equals(TargetSelStateEnum.ECacheIsBeingGeneratedForSomeTarget)){
|
|
847 |
this.setMessage(Messages.getString("SelectBuildTargetWizardPage.Cache_Is_Being_Generated"), //$NON-NLS-1$
|
|
848 |
IMessageProvider.WARNING);
|
|
849 |
this.setErrorMessage(null);
|
|
850 |
setPageComplete(isPageCompleted);
|
|
851 |
// Finishing is forbidden
|
|
852 |
wiz.disableCanFinish();
|
|
853 |
}
|
|
854 |
else if(selectionState.equals(TargetSelStateEnum.ENoComponentsForSomeTarget)){
|
|
855 |
// Disabling operations if there are not components built
|
|
856 |
this.setMessage(null);
|
|
857 |
this.setErrorMessage(Messages.getString("SelectBuildTargetWizardPage.Selected_Target_Does_Not_Have_BuiltComponents")); //$NON-NLS-1$
|
|
858 |
setPageComplete(isPageCompleted);
|
|
859 |
// Finishing is forbidden
|
|
860 |
wiz.disableCanFinish();
|
|
861 |
}
|
|
862 |
else if(selectionState.equals(TargetSelStateEnum.ESomeTargetNotSupported)){
|
|
863 |
this.setMessage(null);
|
|
864 |
this.setErrorMessage(Messages.getString("SelectBuildTargetWizardPage.Target_Not_Supported")); //$NON-NLS-1$
|
|
865 |
setPageComplete(isPageCompleted);
|
|
866 |
// Finishing is forbidden
|
|
867 |
wiz.disableCanFinish();
|
|
868 |
}
|
|
869 |
else if(selectionState.equals(TargetSelStateEnum.EInvalidToolchainMix)){
|
|
870 |
// Disabling operations if there cross-SDK/Platform target selections
|
|
871 |
this.setMessage(null);
|
|
872 |
this.setErrorMessage(Messages.getString("SelectBuildTargetWizardPage.Invalid_Toolchain_Mix_ErrorMsg")); //$NON-NLS-1$
|
|
873 |
setPageComplete(isPageCompleted);
|
|
874 |
// Finishing is forbidden
|
|
875 |
wiz.disableCanFinish();
|
|
876 |
}
|
|
877 |
else{
|
|
878 |
// Trying to avoid internal errors, but this is something that should be trapped during
|
|
879 |
// development time. Internal error messages are not localized.
|
|
880 |
LogUtils.logInternalErrorAndThrowException("Unexpected target selection state:" + selectionState.ordinal()); //$NON-NLS-1$
|
|
881 |
}
|
|
882 |
}
|
|
883 |
|
|
884 |
/**
|
|
885 |
* Resolve the target node based on the given settings.
|
|
886 |
* @param settings Settings to get environment data from,
|
|
887 |
* @return Wizard node matching with current settings, or
|
|
888 |
* <code>null</code> if not found.
|
|
889 |
*/
|
|
890 |
private Object[] resolveTargetsBasedOnCurrentSettings(AppDepSettings settings) {
|
|
891 |
ArrayList<Object> objs = new ArrayList<Object>();
|
|
892 |
SdkInformation sdkInfo = settings.getCurrentlyUsedSdk();
|
|
893 |
ITargetPlatform[] targetPlatforms = settings.getCurrentlyUsedTargetPlatforms();
|
|
894 |
String buildTypeString = settings.getBuildType().getBuildTypeName();
|
|
895 |
if(sdkInfo != null && targetPlatforms.length > 0){
|
|
896 |
// Trying to resolve correct nodes
|
|
897 |
for (int i = 0; i < targetPlatforms.length; i++) {
|
|
898 |
ITargetPlatform platform = targetPlatforms[i];
|
|
899 |
String targetPlatformId = platform.getId();
|
|
900 |
if(!targetPlatformId.equals(AppDepSettings.TARGET_TYPE_ID_SIS)){
|
|
901 |
Object obj = contentProvider.find(sdkInfo.getSdkId(),targetPlatformId,
|
|
902 |
buildTypeString);
|
|
903 |
if(obj!= null){
|
|
904 |
objs.add(obj);
|
|
905 |
}
|
|
906 |
}
|
|
907 |
}
|
|
908 |
}
|
|
909 |
return objs.toArray();
|
|
910 |
}
|
|
911 |
|
|
912 |
/* (non-Javadoc)
|
|
913 |
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
|
914 |
*/
|
|
915 |
public void widgetSelected(SelectionEvent event) {
|
|
916 |
try {
|
|
917 |
|
|
918 |
final Widget w = event.widget;
|
|
919 |
|
|
920 |
// Addi SIS files -button pressed?
|
|
921 |
if(w.equals(addSISFilesButton)){
|
|
922 |
addSISFilesButtonPressed();
|
|
923 |
return;
|
|
924 |
}
|
|
925 |
|
|
926 |
// Otherwise we have been registered only to listen checkboxes, so we are always sure
|
|
927 |
// that we do not get any other events than those already checked above.
|
|
928 |
Runnable checkboxRunnable = new Runnable(){
|
|
929 |
|
|
930 |
public void run() {
|
|
931 |
if (w.equals(showOnlySupportedAndNonEmptyTargetsCheckbox)) {
|
|
932 |
boolean isSelected = showOnlySupportedAndNonEmptyTargetsCheckbox.getSelection();
|
|
933 |
if(isSelected){
|
|
934 |
nonEmptyAndNonSuppTargetFilter.setFilterEnabled(true);
|
|
935 |
}
|
|
936 |
else{
|
|
937 |
nonEmptyAndNonSuppTargetFilter.setFilterEnabled(false);
|
|
938 |
}
|
|
939 |
// Refreshing page contents
|
|
940 |
refresh();
|
|
941 |
// And updating button statuses and message area
|
|
942 |
recalculateButtonStates();
|
|
943 |
}
|
|
944 |
else if (w.equals(showDebugTargetsInsteadOfReleaseTargetsCheckbox)) {
|
|
945 |
// Always clearing already made target platform selections when switching mode
|
|
946 |
SelectSDKWizard wiz = (SelectSDKWizard) getWizard();
|
|
947 |
wiz.getSettings().clearCurrentlyUsedTargetPlatforms();
|
|
948 |
// Switching mode based on the checkbox selection
|
|
949 |
boolean isSelected = showDebugTargetsInsteadOfReleaseTargetsCheckbox.getSelection();
|
|
950 |
if(isSelected){
|
|
951 |
buildTypeFilter.setFilterMode(BuildTargetFilterModeEnum.EShowDebugTargets);
|
|
952 |
buildTypeFieldValueText.setText(BUILD_TYPE_DEBUG_STR);
|
|
953 |
updateDialogSettings(SelectSDKWizard.BUILD_TYPE_DESCR_DLG_SETTING_KEY, BUILD_TYPE_DEBUG_STR);
|
|
954 |
buildTypeFieldValueText.pack();
|
|
955 |
}
|
|
956 |
else{
|
|
957 |
buildTypeFilter.setFilterMode(BuildTargetFilterModeEnum.EShowReleaseTargets);
|
|
958 |
buildTypeFieldValueText.setText(BUILD_TYPE_RELEASE_STR);
|
|
959 |
updateDialogSettings(SelectSDKWizard.BUILD_TYPE_DESCR_DLG_SETTING_KEY, BUILD_TYPE_RELEASE_STR);
|
|
960 |
buildTypeFieldValueText.pack();
|
|
961 |
}
|
|
962 |
// Refreshing page contents
|
|
963 |
refresh();
|
|
964 |
// And updating button statuses and message area
|
|
965 |
recalculateButtonStates();
|
|
966 |
}
|
|
967 |
}
|
|
968 |
|
|
969 |
};
|
|
970 |
|
|
971 |
// Showing busy cursor while updating UI because may take some time
|
|
972 |
Display d = getShell().getDisplay();
|
|
973 |
BusyIndicator.showWhile(d, checkboxRunnable);
|
|
974 |
|
|
975 |
} catch (Exception e) {
|
|
976 |
e.printStackTrace();
|
|
977 |
}
|
|
978 |
}
|
|
979 |
|
|
980 |
/* (non-Javadoc)
|
|
981 |
* @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
|
|
982 |
*/
|
|
983 |
public void widgetDefaultSelected(SelectionEvent event) {
|
|
984 |
// We can ignore this
|
|
985 |
}
|
|
986 |
|
|
987 |
/* (non-Javadoc)
|
|
988 |
* @see com.nokia.s60tools.appdep.core.job.IJobCompletionListener#backgroundJobCompleted(com.nokia.s60tools.appdep.core.job.IManageableJob)
|
|
989 |
*/
|
|
990 |
public void backgroundJobCompleted(IManageableJob jobObject) {
|
|
991 |
refreshTreeViewerAndButtonsStatusesInUIThread();
|
|
992 |
}
|
|
993 |
|
|
994 |
/**
|
|
995 |
* Refreshes tree view and updates button statuses.
|
|
996 |
*/
|
|
997 |
private void refreshTreeViewerAndButtonsStatusesInUIThread() {
|
|
998 |
|
|
999 |
Runnable refreshTreeViewerAndButtonsStatusesRunnable = new Runnable(){
|
|
1000 |
public void run(){
|
|
1001 |
try {
|
|
1002 |
// Refreshing page contents
|
|
1003 |
refresh();
|
|
1004 |
recalculateButtonStates();
|
|
1005 |
} catch (Exception e) {
|
|
1006 |
e.printStackTrace();
|
|
1007 |
}
|
|
1008 |
}
|
|
1009 |
};
|
|
1010 |
|
|
1011 |
// Update request will be done in its own thread
|
|
1012 |
// in order not to cause invalid thread access
|
|
1013 |
Display.getDefault().asyncExec(refreshTreeViewerAndButtonsStatusesRunnable);
|
|
1014 |
}
|
|
1015 |
|
|
1016 |
/* (non-Javadoc)
|
|
1017 |
* @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
|
|
1018 |
*/
|
|
1019 |
public void focusGained(FocusEvent e) {
|
|
1020 |
Widget w = e.widget;
|
|
1021 |
if(w.equals(sdkNameFieldTitleText)
|
|
1022 |
||
|
|
1023 |
w.equals(sdkNameFieldValueText)
|
|
1024 |
||
|
|
1025 |
w.equals(buildTypeFieldTitleText)
|
|
1026 |
||
|
|
1027 |
w.equals(buildTypeFieldValueText)
|
|
1028 |
){
|
|
1029 |
setInitialFocus();
|
|
1030 |
}
|
|
1031 |
}
|
|
1032 |
|
|
1033 |
/* (non-Javadoc)
|
|
1034 |
* @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
|
|
1035 |
*/
|
|
1036 |
public void focusLost(FocusEvent e) {
|
|
1037 |
// No need to do anything
|
|
1038 |
}
|
|
1039 |
|
|
1040 |
/* (non-Javadoc)
|
|
1041 |
* @see com.nokia.s60tools.appdep.core.ICacheIndexListener#cacheIndexCreationCompleted(com.nokia.s60tools.appdep.core.data.CacheIndex)
|
|
1042 |
*/
|
|
1043 |
public void cacheIndexCreationCompleted(CacheIndex cacheIndexObj) {
|
|
1044 |
refreshTreeViewerAndButtonsStatusesInUIThread();
|
|
1045 |
}
|
|
1046 |
|
|
1047 |
/**
|
|
1048 |
* @return the selectionState
|
|
1049 |
*/
|
|
1050 |
public TargetSelStateEnum getSelectionState() {
|
|
1051 |
return selectionState;
|
|
1052 |
}
|
|
1053 |
|
|
1054 |
/**
|
|
1055 |
* @param selectionState the selectionState to set
|
|
1056 |
*/
|
|
1057 |
public void setSelectionState(TargetSelStateEnum selectionState) {
|
|
1058 |
// Changing current selection state ordinal is greater than previous
|
|
1059 |
if(selectionState.ordinal() > this.selectionState.ordinal()){
|
|
1060 |
this.selectionState = selectionState;
|
|
1061 |
}
|
|
1062 |
}
|
|
1063 |
|
|
1064 |
/**
|
|
1065 |
* Gets build target viewer component.
|
|
1066 |
* @return build target viewer component.
|
|
1067 |
*/
|
|
1068 |
public CheckboxTableViewer getBuildTargetViewer() {
|
|
1069 |
return buildTargetViewer;
|
|
1070 |
}
|
|
1071 |
|
|
1072 |
/**
|
|
1073 |
* Gets the SDK selected for the wizard page.
|
|
1074 |
* @return SDK selected for the wizard page.
|
|
1075 |
*/
|
|
1076 |
public SdkInformation getSelectedSdk() {
|
|
1077 |
AppDepSettings settings = getSettings();
|
|
1078 |
return settings.getCurrentlyUsedSdk();
|
|
1079 |
}
|
|
1080 |
|
|
1081 |
/**
|
|
1082 |
* Gets settings used for this wizard page.
|
|
1083 |
* @return settings used for this wizard page.
|
|
1084 |
*/
|
|
1085 |
public AppDepSettings getSettings() {
|
|
1086 |
SelectSDKWizard wiz = (SelectSDKWizard) getWizard();
|
|
1087 |
return wiz.getSettings();
|
|
1088 |
}
|
|
1089 |
|
|
1090 |
/* (non-Javadoc)
|
|
1091 |
* @see com.nokia.s60tools.appdep.ui.wizards.IRefreshable#refresh()
|
|
1092 |
*/
|
|
1093 |
public void refresh() {
|
|
1094 |
// Refreshing selected SDK text if needed
|
|
1095 |
String sdkId = getSelectedSdk().getSdkId();
|
|
1096 |
if(!sdkId.equals(sdkNameFieldValueText.getText())){
|
|
1097 |
sdkNameFieldValueText.setText(sdkId);
|
|
1098 |
sdkNameFieldValueText.pack();
|
|
1099 |
}
|
|
1100 |
|
|
1101 |
// Refreshing target table
|
|
1102 |
buildTargetViewer.refresh();
|
|
1103 |
}
|
|
1104 |
|
|
1105 |
/**
|
|
1106 |
* Checking if programmatic selection is ongoing and therefore
|
|
1107 |
* not need to trigger similar event handling as due to UI selection.
|
|
1108 |
* @return <code>true</code> if programmatic selection is ongoing, otherwise <code>false</code>.
|
|
1109 |
*/
|
|
1110 |
private boolean isProgrammaticSelectionOngoing() {
|
|
1111 |
return isProgrammaticSelectionOngoingFlag;
|
|
1112 |
}
|
|
1113 |
|
|
1114 |
/**
|
|
1115 |
* Sets or unsets programmatic selection flag.
|
|
1116 |
* @param isProgrammaticSelectionOngoingFlag <code>true</code> if programmatic selection is ongoing, otherwise <code>false</code>.
|
|
1117 |
*/
|
|
1118 |
public void setProgrammaticSelectionOngoingFlag(
|
|
1119 |
boolean isProgrammaticSelectionOngoingFlag) {
|
|
1120 |
this.isProgrammaticSelectionOngoingFlag = isProgrammaticSelectionOngoingFlag;
|
|
1121 |
}
|
|
1122 |
|
|
1123 |
/**
|
|
1124 |
* Handles Add SIS files -button press event.
|
|
1125 |
*/
|
|
1126 |
public void addSISFilesButtonPressed() {
|
|
1127 |
Shell sh = AppDepPlugin.getCurrentlyActiveWbWindowShell();
|
|
1128 |
AddSISFilesDialog entryDialog = new AddSISFilesDialog(sh);
|
|
1129 |
entryDialog.create();
|
|
1130 |
// If already selected some set of SIS files getting the list...
|
|
1131 |
if(getSettings().isInSISFileAnalysisMode()){
|
|
1132 |
//...and setting the initial list
|
|
1133 |
String[] filesForAnalysis = getSettings().getSISFilesForAnalysis();
|
|
1134 |
entryDialog.setInitialSISFileSet(filesForAnalysis);
|
|
1135 |
}
|
|
1136 |
int userSelection = entryDialog.open();
|
|
1137 |
if(userSelection == Window.OK){
|
|
1138 |
// Getting selected SIS files
|
|
1139 |
String[] selectedSISFiles = entryDialog.getSelectedSISFiles();
|
|
1140 |
if(selectedSISFiles.length > 0){
|
|
1141 |
// Entering to SIS file mode...
|
|
1142 |
getSettings().setIsInSISFileAnalysisMode(true);
|
|
1143 |
// ...and setting files to current settings
|
|
1144 |
getSettings().setSISFilesForAnalysis(selectedSISFiles );
|
|
1145 |
}
|
|
1146 |
else{
|
|
1147 |
// Disabling SIS file mode
|
|
1148 |
getSettings().setIsInSISFileAnalysisMode(false);
|
|
1149 |
getSettings().setSISFilesForAnalysis(null);
|
|
1150 |
}
|
|
1151 |
// SIS analysis mode may have toggled, therefore needing to update button status.
|
|
1152 |
recalculateButtonStates();
|
|
1153 |
}
|
|
1154 |
}
|
|
1155 |
|
|
1156 |
/**
|
|
1157 |
* Stores value for given key into dialog settings.
|
|
1158 |
* @param key key for the setting
|
|
1159 |
* @param value value for the setting
|
|
1160 |
*/
|
|
1161 |
private void updateDialogSettings(String key, String value) {
|
|
1162 |
SelectSDKWizard wiz = (SelectSDKWizard) getWizard();
|
|
1163 |
wiz.updateDialogSettings(key, value);
|
|
1164 |
}
|
|
1165 |
|
|
1166 |
public SelectBuildTargetWizardPageContentProvider getContentProvider(){
|
|
1167 |
return contentProvider;
|
|
1168 |
}
|
|
1169 |
|
|
1170 |
}
|
|
1171 |
|