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.core.job;
|
|
20 |
|
|
21 |
import java.io.IOException;
|
|
22 |
import java.util.ArrayList;
|
|
23 |
import java.util.List;
|
|
24 |
|
|
25 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
26 |
import org.eclipse.core.runtime.IStatus;
|
|
27 |
import org.eclipse.core.runtime.Status;
|
|
28 |
import org.eclipse.core.runtime.jobs.Job;
|
|
29 |
import org.eclipse.swt.SWT;
|
|
30 |
import org.eclipse.swt.widgets.Display;
|
|
31 |
|
|
32 |
import com.nokia.s60tools.appdep.core.AppDepCacheIndexManager;
|
|
33 |
import com.nokia.s60tools.appdep.core.AppDepCoreFacade;
|
|
34 |
import com.nokia.s60tools.appdep.core.AppDepSettings;
|
|
35 |
import com.nokia.s60tools.appdep.core.CacheDataLoadProcessManager;
|
|
36 |
import com.nokia.s60tools.appdep.core.IBuildType;
|
|
37 |
import com.nokia.s60tools.appdep.core.ICacheIndexListener;
|
|
38 |
import com.nokia.s60tools.appdep.core.ITargetPlatform;
|
|
39 |
import com.nokia.s60tools.appdep.core.data.CacheIndex;
|
|
40 |
import com.nokia.s60tools.appdep.exceptions.CacheFileDoesNotExistException;
|
|
41 |
import com.nokia.s60tools.appdep.exceptions.InvalidCmdLineToolSettingException;
|
|
42 |
import com.nokia.s60tools.appdep.resources.Messages;
|
|
43 |
import com.nokia.s60tools.appdep.ui.dialogs.AppDepMessageBox;
|
|
44 |
import com.nokia.s60tools.appdep.ui.views.main.MainView;
|
|
45 |
import com.nokia.s60tools.appdep.ui.wizards.WizardUtils;
|
|
46 |
import com.nokia.s60tools.appdep.util.AppDepConsole;
|
|
47 |
import com.nokia.s60tools.sdk.SdkInformation;
|
|
48 |
import com.nokia.s60tools.util.cmdline.ICmdLineCommandExecutorObserver;
|
|
49 |
import com.nokia.s60tools.util.cmdline.UnsupportedOSException;
|
|
50 |
import com.nokia.s60tools.util.console.IConsolePrintUtility;
|
|
51 |
import com.nokia.s60tools.util.debug.DbgUtility;
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Generates cache as a background job.
|
|
55 |
*/
|
|
56 |
public class GenerateCacheJob extends Job
|
|
57 |
implements ICmdLineCommandExecutorObserver,
|
|
58 |
ICacheGenerationJob,
|
|
59 |
ICacheIndexListener{
|
|
60 |
|
|
61 |
/**
|
|
62 |
* Core facade to delegate execution of cache generation.
|
|
63 |
*/
|
|
64 |
private AppDepCoreFacade invoker = null;
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Current tool settings used for generation.
|
|
68 |
*/
|
|
69 |
private AppDepSettings settings = null;
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Job progress monitor.
|
|
73 |
*/
|
|
74 |
private IProgressMonitor monitor = null;
|
|
75 |
|
|
76 |
/**
|
|
77 |
* External appdep core tool process handle.
|
|
78 |
*/
|
|
79 |
private Process proc = null;
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Maximum number of steps for job (100%)
|
|
83 |
*/
|
|
84 |
private final int steps = 100;
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Storing previous percentage amount got from job progress notifications.
|
|
88 |
*/
|
|
89 |
private int previousPercentage = 0;
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Job's cancel status.
|
|
93 |
*/
|
|
94 |
private boolean isCanceled = false;
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Target platforms the cache is generated for.
|
|
98 |
*/
|
|
99 |
private ITargetPlatform[] targets = null;
|
|
100 |
|
|
101 |
/**
|
|
102 |
* This list is used to find out when all cache indices are updated
|
|
103 |
* after the cache generation job is finished.
|
|
104 |
*/
|
|
105 |
private List<String> dirtyCachesBuilDirArrList = null;
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Exit value from cache generation command done by appdep core.
|
|
109 |
*/
|
|
110 |
private int exitValue;
|
|
111 |
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Constructor.
|
|
115 |
* @param name Name of the job to be presented to user in Job title.
|
|
116 |
* @param settings Settings object used for the cache generation.
|
|
117 |
*/
|
|
118 |
public GenerateCacheJob(String name, AppDepSettings settings) {
|
|
119 |
super(name);
|
|
120 |
setUser(true);
|
|
121 |
this.settings = settings;
|
|
122 |
targets = settings.getCurrentlyUsedTargetPlatforms();
|
|
123 |
dirtyCachesBuilDirArrList = new ArrayList<String>();
|
|
124 |
}
|
|
125 |
|
|
126 |
/* (non-Javadoc)
|
|
127 |
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
|
|
128 |
*/
|
|
129 |
protected IStatus run(IProgressMonitor progressMonitor) {
|
|
130 |
|
|
131 |
this.monitor = progressMonitor;
|
|
132 |
try {
|
|
133 |
AppDepJobManager.getInstance().registerJob(this);
|
|
134 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.StartingCacheGener_Msg")); //$NON-NLS-1$
|
|
135 |
invoker = new AppDepCoreFacade(settings, this);
|
|
136 |
// Storing caches that really need update, must be called before calling generateCache
|
|
137 |
storeDirtyCachesBuildDirList();
|
|
138 |
invoker.generateCache(this);
|
|
139 |
} catch (InvalidCmdLineToolSettingException e1) {
|
|
140 |
e1.printStackTrace();
|
|
141 |
return completedWithStartupError(Messages.getString("GenerateCacheJob.CacheGenerFailed_Msg_InvalidSettings") //$NON-NLS-1$
|
|
142 |
+ e1.getMessage());
|
|
143 |
} catch (UnsupportedOSException e2) {
|
|
144 |
e2.printStackTrace();
|
|
145 |
String msg = Messages.getString("GenerateCacheJob.CacheGenerFailed_Msg_OS_NotSupported"); //$NON-NLS-1$
|
|
146 |
return completedWithStartupError(msg + ": " //$NON-NLS-1$
|
|
147 |
+ e2.getMessage());
|
|
148 |
}
|
|
149 |
|
|
150 |
return Job.ASYNC_FINISH;
|
|
151 |
|
|
152 |
}
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Stores the list of caches that needs update.
|
|
156 |
*/
|
|
157 |
private void storeDirtyCachesBuildDirList() {
|
|
158 |
dirtyCachesBuilDirArrList.clear();
|
|
159 |
SdkInformation sdkInfo = settings.getCurrentlyUsedSdk();
|
|
160 |
IBuildType buildType = settings.getBuildType();
|
|
161 |
for (int i = 0; i < targets.length; i++) {
|
|
162 |
ITargetPlatform targetPlatform = targets[i];
|
|
163 |
String targetPlatformId = targetPlatform.getId();
|
|
164 |
String buildDir = settings.getBuildDir(targetPlatformId);
|
|
165 |
if(settings.cacheNeedsUpdate(sdkInfo, new ITargetPlatform[]{targetPlatform}, buildType)){
|
|
166 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP, "DIRTY CACHE build dir: " + buildDir); //$NON-NLS-1$
|
|
167 |
// Storing build directory in lower case letters for later getting correct match
|
|
168 |
dirtyCachesBuilDirArrList.add(buildDir.toLowerCase());
|
|
169 |
}
|
|
170 |
}
|
|
171 |
// Finally checking if we are in SIS mode we need to also include it into the list
|
|
172 |
if(settings.isInSISFileAnalysisMode()){
|
|
173 |
String buildDir = settings.getBuildDir(AppDepSettings.TARGET_TYPE_ID_SIS);
|
|
174 |
dirtyCachesBuilDirArrList.add(buildDir.toLowerCase());
|
|
175 |
}
|
|
176 |
}
|
|
177 |
|
|
178 |
/**
|
|
179 |
* Shows error message to user when job could not be started due to fault
|
|
180 |
* in input parameters.
|
|
181 |
* @param consoleMsg Message printed to console.
|
|
182 |
* @return <code>IStatus</code> object.
|
|
183 |
*/
|
|
184 |
private IStatus completedWithStartupError(String consoleMsg){
|
|
185 |
AppDepConsole.getInstance().println(consoleMsg, IConsolePrintUtility.MSG_ERROR);
|
|
186 |
AppDepJobManager.getInstance().unregisterJob(this);
|
|
187 |
monitor.done();
|
|
188 |
return Status.OK_STATUS;
|
|
189 |
}
|
|
190 |
|
|
191 |
/* (non-Javadoc)
|
|
192 |
* @see com.nokia.s60tools.util.cmdline.ICmdLineCommandExecutorObserver#progress(int)
|
|
193 |
*/
|
|
194 |
public void progress(int percentage) {
|
|
195 |
|
|
196 |
isCanceled = monitor.isCanceled();
|
|
197 |
if (isCanceled){
|
|
198 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.CacheGener_Canceled_By_User_Msg")); //$NON-NLS-1$
|
|
199 |
proc.destroy();
|
|
200 |
monitor.done();
|
|
201 |
done(Status.CANCEL_STATUS);
|
|
202 |
return;
|
|
203 |
}
|
|
204 |
monitor.subTask(percentage + Messages.getString("GenerateCacheJob.Percent_Complete")); //$NON-NLS-1$
|
|
205 |
monitor.worked(percentage - previousPercentage);
|
|
206 |
previousPercentage = percentage;
|
|
207 |
|
|
208 |
}
|
|
209 |
|
|
210 |
/* (non-Javadoc)
|
|
211 |
* @see com.nokia.s60tools.util.cmdline.ICmdLineCommandExecutorObserver#processCreated(java.lang.Process)
|
|
212 |
*/
|
|
213 |
public void processCreated(Process proc) {
|
|
214 |
|
|
215 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.CacheGener_Started_Msg")); //$NON-NLS-1$
|
|
216 |
|
|
217 |
// Storing reference to the process
|
|
218 |
this.proc = proc;
|
|
219 |
|
|
220 |
String sdkStr = settings.getCurrentlyUsedSdk().getSdkId();
|
|
221 |
|
|
222 |
String buildTypeStr = settings.getBuildType().getBuildTypeName();
|
|
223 |
String cacheGenerateMsg = Messages.getString("GenerateCacheJob.CacheGener_For_Msg") //$NON-NLS-1$
|
|
224 |
+ sdkStr + "/" + settings.getCurrentlyUsedTargetPlatformsAsString() //$NON-NLS-1$
|
|
225 |
+ " (" + buildTypeStr + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
|
226 |
monitor.beginTask(cacheGenerateMsg, steps);
|
|
227 |
|
|
228 |
}
|
|
229 |
|
|
230 |
/* (non-Javadoc)
|
|
231 |
* @see com.nokia.s60tools.util.cmdline.ICmdLineCommandExecutorObserver#interrupted(java.lang.String)
|
|
232 |
*/
|
|
233 |
public void interrupted(String reasonMsg) {
|
|
234 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.CacheGener_Interrupted_Msg")); //$NON-NLS-1$
|
|
235 |
AppDepJobManager.getInstance().unregisterJob(this);
|
|
236 |
}
|
|
237 |
|
|
238 |
/* (non-Javadoc)
|
|
239 |
* @see com.nokia.s60tools.util.cmdline.ICmdLineCommandExecutorObserver#completed(int)
|
|
240 |
*/
|
|
241 |
public void completed(int exitValue) {
|
|
242 |
|
|
243 |
// Storing exitValue for future reference
|
|
244 |
this.exitValue = exitValue;
|
|
245 |
|
|
246 |
if (!isCanceled){
|
|
247 |
if(exitValue == 0){
|
|
248 |
//
|
|
249 |
// Cache generation was completed successfully
|
|
250 |
//
|
|
251 |
|
|
252 |
// Doing cache index update it it is needed
|
|
253 |
if(dirtyCachesBuilDirArrList.size() > 0){
|
|
254 |
// Starting cache index update
|
|
255 |
AppDepCacheIndexManager.getInstance().addListener(this);
|
|
256 |
|
|
257 |
monitor.subTask(Messages.getString("GenerateCacheJob.CacheIndex_Updating_Msg")); //$NON-NLS-1$
|
|
258 |
for (int i = 0; i < targets.length; i++) {
|
|
259 |
String targetPlatformId = targets[i].getId();
|
|
260 |
try {
|
|
261 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.CacheIndex_Update_Starting_Msg")); //$NON-NLS-1$
|
|
262 |
String buildDir = settings.getBuildDir(targetPlatformId);
|
|
263 |
// Converting build directory to lower case for correct match
|
|
264 |
if(dirtyCachesBuilDirArrList.contains(buildDir.toLowerCase())){
|
|
265 |
String cacheFileAbsolutePathName = settings.getCacheFileAbsolutePathName(targetPlatformId);
|
|
266 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP, "Updating cache index for: " + cacheFileAbsolutePathName); //$NON-NLS-1$
|
|
267 |
CacheIndex.updateCacheIndexFor(cacheFileAbsolutePathName,
|
|
268 |
buildDir);
|
|
269 |
}
|
|
270 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.CacheIndex_Update_Started_Msg")); //$NON-NLS-1$
|
|
271 |
} catch (IOException e1) {
|
|
272 |
e1.printStackTrace();
|
|
273 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.CacheIndex_Update_Failed_IOExecption_Msg") //$NON-NLS-1$
|
|
274 |
+ e1.getMessage(), IConsolePrintUtility.MSG_ERROR);
|
|
275 |
} catch (CacheFileDoesNotExistException e2) {
|
|
276 |
e2.printStackTrace();
|
|
277 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.CacheIndex_Update_Failed_FileNotExist_Msg") //$NON-NLS-1$
|
|
278 |
+ e2.getMessage(), IConsolePrintUtility.MSG_ERROR);
|
|
279 |
}
|
|
280 |
}
|
|
281 |
|
|
282 |
// Job is still active until cache indices has been updated...
|
|
283 |
}
|
|
284 |
else{
|
|
285 |
// No need to update any cache indices...we are done
|
|
286 |
monitor.done();
|
|
287 |
done(Status.OK_STATUS);
|
|
288 |
// Showing completion status message to user now.
|
|
289 |
runCacheCompletionMsgBoxInUIThread();
|
|
290 |
}
|
|
291 |
|
|
292 |
}
|
|
293 |
else{
|
|
294 |
//
|
|
295 |
// Something failed in cache generation
|
|
296 |
//
|
|
297 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.CacheGener_Failed_WithCode_Msg") + exitValue); //$NON-NLS-1$
|
|
298 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.CacheGener_Removing_Corrupted_Files_Msg")); //$NON-NLS-1$
|
|
299 |
// If was not canceled by user
|
|
300 |
// => Job itself was terminated normally even though there was some error in cache generation.
|
|
301 |
monitor.done();
|
|
302 |
done(Status.OK_STATUS);
|
|
303 |
// Showing completion status message to user now.
|
|
304 |
runCacheCompletionMsgBoxInUIThread();
|
|
305 |
}
|
|
306 |
|
|
307 |
}
|
|
308 |
else{
|
|
309 |
// User canceled the operation.
|
|
310 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.CacheGener_Removing_Partially_Generated_Files_Msg")); //$NON-NLS-1$
|
|
311 |
}
|
|
312 |
|
|
313 |
AppDepConsole.getInstance().println(Messages.getString("GenerateCacheJob.CacheGener_Ended_WithExitVal_Msg") + exitValue); //$NON-NLS-1$
|
|
314 |
AppDepJobManager.getInstance().unregisterJob(this);
|
|
315 |
}
|
|
316 |
|
|
317 |
/**
|
|
318 |
* Informs user about cache generation results. Gives an error message in case
|
|
319 |
* of an error has happened or in case of success queries if user wants to
|
|
320 |
* select a component from just generated cache.
|
|
321 |
*/
|
|
322 |
private void informUserAboutCacheCreationCompletion() {
|
|
323 |
|
|
324 |
try {
|
|
325 |
|
|
326 |
String targetPlatformStr = settings.getCurrentlyUsedTargetsAsString();
|
|
327 |
String msg = null;
|
|
328 |
AppDepMessageBox msgBox = null;
|
|
329 |
|
|
330 |
if(exitValue != 0){
|
|
331 |
// Something failed
|
|
332 |
msg = Messages.getString("GenerateCacheJob.CacheGener_Failed_For_Msg") + targetPlatformStr //$NON-NLS-1$
|
|
333 |
+ " (" + Messages.getString("GenerateCacheJob.Exit_Code") + "=" + exitValue + "). " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
|
334 |
+ Messages.getString("GenerateCacheJob.See_Console_Log_Msg"); //$NON-NLS-1$
|
|
335 |
|
|
336 |
msgBox = new AppDepMessageBox(msg, SWT.ICON_ERROR | SWT.OK);
|
|
337 |
msgBox.open();
|
|
338 |
}
|
|
339 |
else{
|
|
340 |
// Generation completed successfully
|
|
341 |
|
|
342 |
// Setting cache update flag
|
|
343 |
settings.cacheWasUpdated();
|
|
344 |
|
|
345 |
msg = Messages.getString("GenerateCacheJob.CacheGener_Completed_For_Msg") + targetPlatformStr + ". " //$NON-NLS-1$ //$NON-NLS-2$
|
|
346 |
+ Messages.getString("GenerateCacheJob.CacheGener_Do_You_Want_To_Select_Component_Question"); //$NON-NLS-1$
|
|
347 |
|
|
348 |
msgBox = new AppDepMessageBox(msg, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
|
|
349 |
int userResponse = msgBox.open();
|
|
350 |
if(userResponse == SWT.YES){
|
|
351 |
// Invoking component selection dialog
|
|
352 |
if(WizardUtils.invokeSDKAndTargetPlatformSelectionWizard(msgBox.getParent(),
|
|
353 |
false,
|
|
354 |
settings,
|
|
355 |
true)){
|
|
356 |
MainView.update();
|
|
357 |
}
|
|
358 |
}
|
|
359 |
else{
|
|
360 |
// Otherwise just reloading cache and refreshing existing view with new information
|
|
361 |
try {
|
|
362 |
CacheDataLoadProcessManager.runCacheLoadProcess(settings, true);
|
|
363 |
} catch (Exception e) {
|
|
364 |
e.printStackTrace();
|
|
365 |
// Cache reload failed
|
|
366 |
msg = Messages.getString("GeneralMessages.CacheDataReload_Failed_For_Msg") //$NON-NLS-1$
|
|
367 |
+ " '" + targetPlatformStr + "'. " //$NON-NLS-1$ //$NON-NLS-2$
|
|
368 |
+ Messages.getString("GenerateCacheJob.See_Console_Log_Msg"); //$NON-NLS-1$
|
|
369 |
|
|
370 |
msgBox = new AppDepMessageBox(msg, SWT.ICON_ERROR | SWT.OK);
|
|
371 |
msgBox.open();
|
|
372 |
}
|
|
373 |
MainView.update();
|
|
374 |
}
|
|
375 |
}
|
|
376 |
|
|
377 |
} catch (Exception e) {
|
|
378 |
e.printStackTrace();
|
|
379 |
}
|
|
380 |
|
|
381 |
}
|
|
382 |
|
|
383 |
/* (non-Javadoc)
|
|
384 |
* @see com.nokia.s60tools.appdep.core.IManageableJob#forcedShutdown()
|
|
385 |
*/
|
|
386 |
public void forcedShutdown() {
|
|
387 |
if(proc != null){
|
|
388 |
proc.destroy();
|
|
389 |
try {
|
|
390 |
proc.waitFor();
|
|
391 |
} catch (InterruptedException e) {
|
|
392 |
e.printStackTrace();
|
|
393 |
}
|
|
394 |
}
|
|
395 |
}
|
|
396 |
|
|
397 |
/* (non-Javadoc)
|
|
398 |
* @see com.nokia.s60tools.appdep.core.job.ICacheGenerationJob#getTargetSdkForJob()
|
|
399 |
*/
|
|
400 |
public SdkInformation getTargetSdkForJob() {
|
|
401 |
return settings.getCurrentlyUsedSdk();
|
|
402 |
}
|
|
403 |
|
|
404 |
/* (non-Javadoc)
|
|
405 |
* @see com.nokia.s60tools.appdep.core.job.ICacheGenerationJob#getBuildTypeForJob()
|
|
406 |
*/
|
|
407 |
public IBuildType getBuildTypeForJob() {
|
|
408 |
return settings.getBuildType();
|
|
409 |
}
|
|
410 |
|
|
411 |
/* (non-Javadoc)
|
|
412 |
* @see com.nokia.s60tools.appdep.core.job.ICacheGenerationJob#getTargetPlatformForJob()
|
|
413 |
*/
|
|
414 |
public ITargetPlatform[] getTargetPlatformForJob() {
|
|
415 |
return settings.getCurrentlyUsedTargetPlatforms();
|
|
416 |
}
|
|
417 |
|
|
418 |
/**
|
|
419 |
* Convenience method for creating cache generation job
|
|
420 |
* for the currently active settings.
|
|
421 |
*/
|
|
422 |
public static void triggerCacheGenerationForCurrentlyActiveSettings(){
|
|
423 |
// Cache generation uses the settings set by the user.
|
|
424 |
// Getting a local copy of currently active settings...
|
|
425 |
AppDepSettings localSettings
|
|
426 |
= (AppDepSettings) AppDepSettings.getActiveSettings().clone();
|
|
427 |
//... and passing it to cache generate job object
|
|
428 |
Job jb = new GenerateCacheJob(Messages.getString("GeneralMessages.CacheGeneration_Job_Title_Text"), localSettings); //$NON-NLS-1$
|
|
429 |
|
|
430 |
// We do not want cache generation to block other
|
|
431 |
// jobs and therefore using the lowest priority
|
|
432 |
jb.setPriority(Job.DECORATE);
|
|
433 |
jb.schedule();
|
|
434 |
}
|
|
435 |
|
|
436 |
/* (non-Javadoc)
|
|
437 |
* @see com.nokia.s60tools.appdep.core.ICacheIndexListener#cacheIndexCreationCompleted(com.nokia.s60tools.appdep.core.data.CacheIndex)
|
|
438 |
*/
|
|
439 |
public void cacheIndexCreationCompleted(CacheIndex cacheIndexObj) {
|
|
440 |
|
|
441 |
String buildDirectory = cacheIndexObj.getBuildDirectory();
|
|
442 |
DbgUtility.println(DbgUtility.PRIORITY_LOOP, "DIRTY CACHE UPDATED for build dir: " + buildDirectory); //$NON-NLS-1$
|
|
443 |
|
|
444 |
// Converting build directory in lower case letters for getting correct match
|
|
445 |
dirtyCachesBuilDirArrList.remove(buildDirectory.toLowerCase());
|
|
446 |
// Have all the scheduled cache indices updated
|
|
447 |
if(dirtyCachesBuilDirArrList.size() == 0){
|
|
448 |
// No more need for listening completions
|
|
449 |
AppDepCacheIndexManager.getInstance().removeListener(this);
|
|
450 |
|
|
451 |
// Job has completed successfully
|
|
452 |
monitor.done();
|
|
453 |
done(Status.OK_STATUS);
|
|
454 |
// Showing completion status message to user
|
|
455 |
runCacheCompletionMsgBoxInUIThread();
|
|
456 |
}
|
|
457 |
}
|
|
458 |
|
|
459 |
/**
|
|
460 |
* Schedules completion message box showing to the UI Thread.
|
|
461 |
* Showing dialog in UI thread causes <code>IllegalThreadAccess</code> exception.
|
|
462 |
*/
|
|
463 |
private void runCacheCompletionMsgBoxInUIThread() {
|
|
464 |
// Informing used about the result of cache generation
|
|
465 |
Runnable cacheCreationCompletedRunnable = new Runnable(){
|
|
466 |
public void run(){
|
|
467 |
informUserAboutCacheCreationCompletion();
|
|
468 |
}
|
|
469 |
};
|
|
470 |
|
|
471 |
// Showing a visible message in its own thread
|
|
472 |
// in order not to cause invalid thread access
|
|
473 |
Display.getDefault().asyncExec(cacheCreationCompletedRunnable);
|
|
474 |
}
|
|
475 |
|
|
476 |
}
|