|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 package com.nokia.s60tools.memspy.ui.wizards; |
|
21 |
|
22 |
|
23 import java.io.File; |
|
24 import java.lang.reflect.InvocationTargetException; |
|
25 import java.util.ArrayList; |
|
26 import java.util.Arrays; |
|
27 |
|
28 import org.eclipse.core.runtime.IProgressMonitor; |
|
29 import org.eclipse.jface.operation.IRunnableWithProgress; |
|
30 import org.eclipse.jface.resource.ImageDescriptor; |
|
31 import org.eclipse.jface.viewers.IStructuredSelection; |
|
32 import org.eclipse.jface.wizard.IWizardPage; |
|
33 import org.eclipse.swt.SWT; |
|
34 import org.eclipse.swt.widgets.MessageBox; |
|
35 import org.eclipse.ui.IWorkbench; |
|
36 |
|
37 import com.nokia.s60tools.memspy.containers.SWMTLogInfo; |
|
38 import com.nokia.s60tools.memspy.containers.ThreadInfo; |
|
39 import com.nokia.s60tools.memspy.model.AnalyserXMLGenerator; |
|
40 import com.nokia.s60tools.memspy.model.ImportEngine; |
|
41 import com.nokia.s60tools.memspy.model.MemSpyFileOperations; |
|
42 import com.nokia.s60tools.memspy.model.TraceCoreEngine; |
|
43 import com.nokia.s60tools.memspy.model.UserEnteredData.ValueTypes; |
|
44 import com.nokia.s60tools.memspy.resources.ImageKeys; |
|
45 import com.nokia.s60tools.memspy.resources.ImageResourceManager; |
|
46 import com.nokia.s60tools.memspy.ui.views.MemSpyMainView; |
|
47 import com.nokia.s60tools.memspy.ui.wizards.DeviceOrFileSelectionPage.PageType; |
|
48 import com.nokia.s60tools.memspy.ui.wizards.SelectActionPage.MemSpyAction; |
|
49 import com.nokia.s60tools.ui.wizards.S60ToolsWizard; |
|
50 import com.nokia.s60tools.util.debug.DbgUtility; |
|
51 |
|
52 public class MemSpyWizard extends S60ToolsWizard { |
|
53 |
|
54 public enum MemSpyWizardType{ FULL, COMPARE, SYMBOLS }; |
|
55 |
|
56 static private final ImageDescriptor bannerImgDescriptor = ImageResourceManager.getImageDescriptor(ImageKeys.IMG_WIZARD); |
|
57 |
|
58 |
|
59 SelectActionPage selectActionPage; |
|
60 DeviceOrFileSelectionPage importHeapPage; |
|
61 DeviceOrFileSelectionPage compareHeapsFirstPage; |
|
62 DeviceOrFileSelectionPage compareHeapsSecondPage; |
|
63 ParameterFilesPage parameterFilesPage; |
|
64 ExportFileNamePage exportFileNamePage; |
|
65 SWMTLogPage swmtLogPage; |
|
66 MemSpyMainView mainView; |
|
67 ImportEngine importEngine; |
|
68 MemSpyWizardDialog wizDialog; |
|
69 |
|
70 MemSpyWizardType wizardType; |
|
71 TraceCoreEngine traceEngine; |
|
72 AnalyserXMLGenerator fillValues; |
|
73 |
|
74 private final static String IMPORTING_FILES = "Importing Files"; |
|
75 |
|
76 public MemSpyWizard(){ |
|
77 super(bannerImgDescriptor); |
|
78 DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "MemSpyWizard constructor - start"); |
|
79 |
|
80 this.mainView = MemSpyMainView.showAndReturnYourself(); |
|
81 this.importEngine = mainView.getImportEngine(); |
|
82 this.setNeedsProgressMonitor(true); |
|
83 this.traceEngine = new TraceCoreEngine(); |
|
84 this.wizardType = MemSpyWizardType.FULL; |
|
85 this.fillValues = null; |
|
86 DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "MemSpyWizard constructor - end"); |
|
87 |
|
88 } |
|
89 |
|
90 public MemSpyWizard( MemSpyWizardType wizardType, AnalyserXMLGenerator fillValues ) { |
|
91 this(); |
|
92 this.wizardType = wizardType; |
|
93 this.fillValues = fillValues; |
|
94 if( wizardType != MemSpyWizardType.SYMBOLS ){ |
|
95 MemSpyMainView.showTraceViewer(); |
|
96 } |
|
97 } |
|
98 |
|
99 |
|
100 /** |
|
101 * (non-Javadoc) |
|
102 * |
|
103 * @see com.nokia.s60tools.ui.wizards.S60ToolsWizard#addPages() |
|
104 */ |
|
105 public void addPages() { |
|
106 DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "MemSpyWizard addpages - start"); |
|
107 |
|
108 // if wizard's type is full, add all pages. |
|
109 if( wizardType == MemSpyWizardType.FULL ){ |
|
110 |
|
111 selectActionPage = new SelectActionPage("Select Action"); |
|
112 addPage(selectActionPage); |
|
113 |
|
114 importHeapPage = new DeviceOrFileSelectionPage( "Get Heap From", |
|
115 "Import Heap Wizard, step 1", "Define source for Heap Dump files. Logs can be imported from already existing files or from device via TraceViewer.", ValueTypes.IMPORT_HEAP, |
|
116 PageType.IMPORT_PAGE, traceEngine ); |
|
117 addPage(importHeapPage); |
|
118 |
|
119 compareHeapsFirstPage = new DeviceOrFileSelectionPage("Select First Heap", |
|
120 "Compare Two Heaps Wizard, step 1", "Define source for first compared Heap Dump. Heap Dumps can be imported from already existing files\nor from device via TraceViewer.", ValueTypes.COMPARE_HEAP_FIRST_HEAP, |
|
121 PageType.COMPARE_FIRST_HEAP, traceEngine); |
|
122 addPage(compareHeapsFirstPage); |
|
123 |
|
124 compareHeapsSecondPage = new DeviceOrFileSelectionPage("Select Second Heap", |
|
125 "Compare Two Heaps Wizard, step 2", "Define source for second compared Heap Dump. Compared heap dumps must be from same thread.", ValueTypes.COMPARE_HEAP_SECOND_HEAP, |
|
126 PageType.COMPARE_SECOND_HEAP, traceEngine); |
|
127 addPage(compareHeapsSecondPage); |
|
128 |
|
129 exportFileNamePage = new ExportFileNamePage("Define export file name"); |
|
130 addPage(exportFileNamePage); |
|
131 |
|
132 parameterFilesPage = new ParameterFilesPage(null, null, "Import Heap Wizard, step 2"); |
|
133 addPage(parameterFilesPage); |
|
134 |
|
135 swmtLogPage = new SWMTLogPage("Get SWMT-logs", traceEngine); |
|
136 addPage(swmtLogPage); |
|
137 } |
|
138 // if wizard type is compare add only compare output and symbol pages. |
|
139 else if( wizardType == MemSpyWizardType.COMPARE){ |
|
140 |
|
141 compareHeapsFirstPage = new DeviceOrFileSelectionPage("Select First Heap", |
|
142 "Compare Two Heaps Wizard, step 1", "Define source for first compared Heap Dump. Heap Dumps can be imported from already existing files\nor from device via TraceViewer.", ValueTypes.COMPARE_HEAP_FIRST_HEAP, |
|
143 PageType.COMPARE_FIRST_HEAP, traceEngine); |
|
144 addPage(compareHeapsFirstPage); |
|
145 |
|
146 // prefill path of compared Heap Dump to wizard page. |
|
147 compareHeapsFirstPage.setHeapDumpFile( fillValues.getXMLSourceFile()[0] ); |
|
148 |
|
149 compareHeapsSecondPage = new DeviceOrFileSelectionPage("Select Second Heap", |
|
150 "Compare Two Heaps Wizard, step 2", "Define source for second compared Heap Dump. Compared heap dumps must be from same thread.", ValueTypes.COMPARE_HEAP_SECOND_HEAP, |
|
151 PageType.COMPARE_SECOND_HEAP, traceEngine); |
|
152 addPage(compareHeapsSecondPage); |
|
153 |
|
154 // reset file combo box text from second page. |
|
155 compareHeapsSecondPage.resetFileCombo(); |
|
156 |
|
157 exportFileNamePage = new ExportFileNamePage("Define export file name"); |
|
158 addPage(exportFileNamePage); |
|
159 |
|
160 parameterFilesPage = new ParameterFilesPage(fillValues.getXMLDebugMetaDataFile(), null, "Import Heap Wizard, step 2"); |
|
161 addPage(parameterFilesPage); |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 } |
|
167 else if( wizardType == MemSpyWizardType.SYMBOLS ){ |
|
168 parameterFilesPage = new ParameterFilesPage( fillValues.getXMLDebugMetaDataFile(), fillValues.getXMLDebugMetaDataDirectory(), "Edit Symbol Definitions" ); |
|
169 addPage(parameterFilesPage); |
|
170 } |
|
171 DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "MemSpyWizard addpages - end"); |
|
172 |
|
173 } |
|
174 |
|
175 /** |
|
176 * (non-Javadoc) |
|
177 * |
|
178 * @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage) |
|
179 */ |
|
180 public IWizardPage getNextPage(IWizardPage page) { |
|
181 |
|
182 |
|
183 if (page.equals( selectActionPage )) { |
|
184 |
|
185 SelectActionPage SelectWizardPage = (SelectActionPage) page; |
|
186 if ( SelectWizardPage.importHeapRadioButton.getSelection() ) { |
|
187 return importHeapPage; |
|
188 } |
|
189 else if ( SelectWizardPage.compareTwoHeapsRadioButton.getSelection() ) { |
|
190 return compareHeapsFirstPage; |
|
191 } |
|
192 else if ( SelectWizardPage.swmtRadioButton.getSelection() ) { |
|
193 return swmtLogPage; |
|
194 } |
|
195 } else if ( page.equals(importHeapPage) ) { |
|
196 return parameterFilesPage; |
|
197 } |
|
198 |
|
199 else if ( page.equals(compareHeapsFirstPage) ) { |
|
200 return compareHeapsSecondPage; |
|
201 } |
|
202 else if ( page.equals(compareHeapsSecondPage ) ) { |
|
203 return exportFileNamePage; |
|
204 } |
|
205 else if ( page.equals( exportFileNamePage ) ){ |
|
206 boolean setText = true; |
|
207 File file = new File( exportFileNamePage.getOutputFileName()); |
|
208 if( file.exists() ){ |
|
209 // if file already exists confirm that user wants to overwrite it. |
|
210 MessageBox messageBox = new MessageBox(this.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); |
|
211 messageBox.setText( MemSpyMainView.WARNING_COMPARE ); |
|
212 messageBox.setMessage( MemSpyMainView.WARNING_FILE_EXISTS ); |
|
213 int buttonID = messageBox.open(); |
|
214 if (buttonID == SWT.NO) { |
|
215 setText = false; |
|
216 } |
|
217 } |
|
218 if( setText == false ){ |
|
219 return exportFileNamePage; |
|
220 } |
|
221 return parameterFilesPage; |
|
222 } |
|
223 |
|
224 |
|
225 return page; |
|
226 } |
|
227 |
|
228 /** |
|
229 * (non-Javadoc) |
|
230 * @see org.eclipse.jface.wizard.Wizard#canFinish() |
|
231 */ |
|
232 public boolean canFinish() { |
|
233 if (this.getContainer().getCurrentPage() == parameterFilesPage) { |
|
234 return parameterFilesPage.canFinish(); |
|
235 } |
|
236 else if (this.getContainer().getCurrentPage() == swmtLogPage ){ |
|
237 return swmtLogPage.canFinish(); |
|
238 } |
|
239 else { |
|
240 return false; |
|
241 } |
|
242 |
|
243 } |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 /** |
|
249 * (non-Javadoc) |
|
250 * @see org.eclipse.jface.wizard.Wizard#performFinish() |
|
251 */ |
|
252 |
|
253 |
|
254 public boolean performFinish() { |
|
255 |
|
256 if( this.wizardType == MemSpyWizardType.FULL ){ |
|
257 // save form values |
|
258 saveUserEnteredData(); |
|
259 |
|
260 IRunnableWithProgress importFiles = null; |
|
261 |
|
262 // get selected action from first page. |
|
263 final MemSpyAction action = selectActionPage.getAction(); |
|
264 |
|
265 importHeapPage.getTraceEngine().shutDownMemSpy(); |
|
266 // Initialize XML generator |
|
267 AnalyserXMLGenerator generator = new AnalyserXMLGenerator(); |
|
268 |
|
269 |
|
270 if( action != MemSpyAction.SWMT ){ |
|
271 |
|
272 // read symbol definitions |
|
273 this.getSymbolInformation(generator); |
|
274 |
|
275 final AnalyserXMLGenerator finalGenerator = generator; |
|
276 |
|
277 // if importing Heap Dump(s) |
|
278 if( selectActionPage.getAction() == MemSpyAction.IMPORT_HEAP ){ |
|
279 final ArrayList<ThreadInfo> importedHeaps = importHeapPage.getImportedHeaps(); |
|
280 importFiles = new IRunnableWithProgress() { |
|
281 public void run(IProgressMonitor monitor) { |
|
282 monitor.beginTask(IMPORTING_FILES, IProgressMonitor.UNKNOWN); |
|
283 |
|
284 // import heaps |
|
285 importEngine.importAndAnalyseHeap( importedHeaps, finalGenerator, true ); |
|
286 } |
|
287 }; |
|
288 }//if Comparing heaps |
|
289 else if( selectActionPage.getAction() == MemSpyAction.COMPARE_HEAPS ){ |
|
290 |
|
291 final ArrayList<ThreadInfo> heaps = new ArrayList<ThreadInfo>(); |
|
292 |
|
293 heaps.add( compareHeapsFirstPage.getRecentHeap() ); |
|
294 heaps.add( compareHeapsSecondPage.getRecentHeap() ); |
|
295 final String output = exportFileNamePage.getOutputFileName(); |
|
296 |
|
297 importFiles = new IRunnableWithProgress() { |
|
298 public void run(IProgressMonitor monitor) { |
|
299 monitor.beginTask(IMPORTING_FILES, IProgressMonitor.UNKNOWN); |
|
300 // import heaps |
|
301 importEngine.importAndAnalyseHeap( heaps, finalGenerator, false ); |
|
302 // compare heaps |
|
303 importEngine.compareHeaps( heaps.get(0), heaps.get(1), finalGenerator, output ); |
|
304 } |
|
305 }; |
|
306 |
|
307 } |
|
308 } |
|
309 else{ // if importing SWMT-logs |
|
310 final ArrayList<SWMTLogInfo> logList = swmtLogPage.getLogList(); |
|
311 final AnalyserXMLGenerator finalGenerator = generator; |
|
312 importFiles = new IRunnableWithProgress() { |
|
313 public void run(IProgressMonitor monitor) { |
|
314 monitor.beginTask(IMPORTING_FILES, IProgressMonitor.UNKNOWN); |
|
315 |
|
316 // import heaps if SWMT logging was also dumping heap data for thread(s) |
|
317 final ArrayList<ThreadInfo> importedHeaps = traceEngine.getImportedSWMTHeaps(); |
|
318 if(importedHeaps != null){ |
|
319 //Don't delete temp folder and files yet, SWMT import will do that |
|
320 importEngine.importAndAnalyseHeap( importedHeaps, finalGenerator, false, false ); |
|
321 } |
|
322 |
|
323 // import swmt-logs and delete temp files & folder |
|
324 importEngine.importSWMTLogs( logList, true ); |
|
325 |
|
326 } |
|
327 }; |
|
328 } |
|
329 try { |
|
330 getContainer().run(true, false, importFiles); |
|
331 } |
|
332 catch (InvocationTargetException e1) { |
|
333 // do nothing |
|
334 e1.printStackTrace(); |
|
335 } |
|
336 catch (InterruptedException e1) { |
|
337 // do nothing |
|
338 e1.printStackTrace(); |
|
339 } |
|
340 MemSpyMainView.showAndReturnYourself(); |
|
341 } |
|
342 else if( this.wizardType == MemSpyWizardType.COMPARE ){ |
|
343 |
|
344 IRunnableWithProgress importFiles = null; |
|
345 |
|
346 compareHeapsFirstPage.getTraceEngine().shutDownMemSpy(); |
|
347 |
|
348 // Initialize XML generator |
|
349 AnalyserXMLGenerator generator = new AnalyserXMLGenerator(); |
|
350 |
|
351 // read symbol definitions |
|
352 this.getSymbolInformation(generator); |
|
353 |
|
354 final AnalyserXMLGenerator finalGenerator = generator; |
|
355 final ThreadInfo secondHeap = compareHeapsSecondPage.getRecentHeap(); |
|
356 |
|
357 // create new ThreadInfo object and format combobox value from first compare page to it's |
|
358 // threadFilePath variable.(We don't want to import that heap again as it has already |
|
359 // been updated.) |
|
360 ThreadInfo firstModifiedHeap = new ThreadInfo(); |
|
361 firstModifiedHeap.setThreadFilePath( compareHeapsFirstPage.getSelectedFilePath() ); |
|
362 firstModifiedHeap.setThreadName( secondHeap.getThreadName() ); |
|
363 final ThreadInfo firstHeap = firstModifiedHeap; |
|
364 |
|
365 final String output = exportFileNamePage.getOutputFileName(); |
|
366 |
|
367 importFiles = new IRunnableWithProgress() { |
|
368 public void run(IProgressMonitor monitor) { |
|
369 monitor.beginTask(IMPORTING_FILES, IProgressMonitor.UNKNOWN); |
|
370 ArrayList<ThreadInfo> heaps = new ArrayList<ThreadInfo>(); |
|
371 heaps.add( secondHeap ); |
|
372 importEngine.importAndAnalyseHeap(heaps, finalGenerator, false); |
|
373 importEngine.compareHeaps( firstHeap, secondHeap, finalGenerator, output ); |
|
374 } |
|
375 }; |
|
376 |
|
377 |
|
378 try { |
|
379 getContainer().run(true, false, importFiles); |
|
380 } |
|
381 catch (InvocationTargetException e1) { |
|
382 // do nothing |
|
383 e1.printStackTrace(); |
|
384 } |
|
385 catch (InterruptedException e1) { |
|
386 // do nothing |
|
387 e1.printStackTrace(); |
|
388 } |
|
389 MemSpyMainView.showAndReturnYourself(); |
|
390 |
|
391 } |
|
392 else if(this.wizardType == MemSpyWizardType.SYMBOLS ){ |
|
393 |
|
394 // read symbol definitions |
|
395 this.getSymbolInformation(fillValues); |
|
396 |
|
397 // send new symbols to Main View |
|
398 IRunnableWithProgress importFiles = new IRunnableWithProgress() { |
|
399 public void run(IProgressMonitor monitor) { |
|
400 monitor.beginTask("Saving new symbol definitions", IProgressMonitor.UNKNOWN); |
|
401 mainView.symbolsUpdated(fillValues); |
|
402 monitor.done(); |
|
403 } |
|
404 }; |
|
405 |
|
406 |
|
407 try { |
|
408 getContainer().run(true, false, importFiles); |
|
409 } |
|
410 catch (InvocationTargetException e1) { |
|
411 // do nothing |
|
412 e1.printStackTrace(); |
|
413 } |
|
414 catch (InterruptedException e1) { |
|
415 // do nothing |
|
416 e1.printStackTrace(); |
|
417 } |
|
418 } |
|
419 return true; |
|
420 } |
|
421 |
|
422 /** |
|
423 * (non-Javadoc) |
|
424 * @see org.eclipse.jface.wizard.Wizard#performCancel() |
|
425 */ |
|
426 public boolean performCancel() { |
|
427 try { |
|
428 if( this.wizardType == MemSpyWizardType.FULL){ |
|
429 this.saveUserEnteredData(); |
|
430 } |
|
431 |
|
432 MemSpyMainView.showAndReturnYourself(); |
|
433 |
|
434 // delete temp files |
|
435 MemSpyFileOperations.deleteTempMemSpyFiles(); |
|
436 traceEngine.shutDownMemSpy(); |
|
437 } catch (Exception e) { |
|
438 // Some failure in above should not prevent user Canceling dialog |
|
439 e.printStackTrace(); |
|
440 DbgUtility.println(DbgUtility.PRIORITY_OPERATION, "performCancel/exception: " + e); |
|
441 } |
|
442 |
|
443 return true; |
|
444 } |
|
445 |
|
446 /** |
|
447 * (non-Javadoc) |
|
448 * @see org.eclipse.jface.wizard.Wizard#getPreviousPage(org.eclipse.jface.wizard.IWizardPage) |
|
449 */ |
|
450 public IWizardPage getPreviousPage(IWizardPage page) { |
|
451 if (page.equals(importHeapPage)) { |
|
452 return selectActionPage; |
|
453 } else if (page.equals(compareHeapsFirstPage)) { |
|
454 return selectActionPage; |
|
455 } else if (page.equals(compareHeapsSecondPage)) { |
|
456 return compareHeapsFirstPage; |
|
457 } |
|
458 return page; |
|
459 } |
|
460 |
|
461 /** |
|
462 * setComparedHeaps |
|
463 * sets compared thread names into each compare page |
|
464 */ |
|
465 public void setComparedHeaps(){ |
|
466 |
|
467 // get recent thread infos from compare heap pages |
|
468 ThreadInfo firstHeap = null; |
|
469 ThreadInfo secondHeap = null; |
|
470 |
|
471 firstHeap = compareHeapsFirstPage.getRecentHeap(); |
|
472 secondHeap = compareHeapsSecondPage.getRecentHeap(); |
|
473 |
|
474 // save thread infos into compare pages |
|
475 compareHeapsSecondPage.setComparedHeap(firstHeap, secondHeap); |
|
476 compareHeapsFirstPage.setComparedHeap(firstHeap, secondHeap); |
|
477 } |
|
478 |
|
479 /** |
|
480 * updateThreadLists |
|
481 * updates tread lists into each file or device selection page |
|
482 * @param threadList |
|
483 */ |
|
484 public void updateThreadLists(ArrayList<ThreadInfo> threadList){ |
|
485 // Each page gets new thread list so that status of threads won't change when another page is modified. |
|
486 if(importHeapPage != null){ |
|
487 this.importHeapPage.setDeviceThreadList( copyThreadList( threadList ) ); |
|
488 this.importHeapPage.updateThreadList(); |
|
489 } |
|
490 if(compareHeapsFirstPage != null){ |
|
491 this.compareHeapsFirstPage.setDeviceThreadList( copyThreadList( threadList ) ); |
|
492 this.compareHeapsFirstPage.updateThreadList(); |
|
493 } |
|
494 if(compareHeapsFirstPage != null){ |
|
495 this.compareHeapsSecondPage.setDeviceThreadList( copyThreadList( threadList ) ); |
|
496 this.compareHeapsSecondPage.updateThreadList(); |
|
497 } |
|
498 } |
|
499 |
|
500 /** |
|
501 * Copies threads to new list. |
|
502 * @param threadList List to be copied. |
|
503 * @return New list containing thread information in new list. |
|
504 */ |
|
505 private ArrayList<ThreadInfo> copyThreadList(ArrayList<ThreadInfo> threadList) { |
|
506 ArrayList<ThreadInfo> returnList = new ArrayList<ThreadInfo>(); |
|
507 for(ThreadInfo thread : threadList) { |
|
508 returnList.add(thread.clone()); |
|
509 } |
|
510 return returnList; |
|
511 } |
|
512 |
|
513 /** |
|
514 * sets thread list selection and hides threadListTable from 2. comparePage |
|
515 * @param thread Thread information. |
|
516 */ |
|
517 public void setThreadListSelectionToComparePages( ThreadInfo thread ){ |
|
518 this.compareHeapsSecondPage.setThreadListSelection( thread ); |
|
519 } |
|
520 |
|
521 /** |
|
522 * shows or hides threadListTable in 2. comparePage |
|
523 */ |
|
524 public void showImportedHeapsInComparePage( boolean value ){ |
|
525 this.compareHeapsSecondPage.setImportedThreadTableVisible( value ); |
|
526 |
|
527 } |
|
528 |
|
529 |
|
530 |
|
531 /** |
|
532 * Check if compared heaps are from same thread |
|
533 * @return true if heaps are from same thread or other or both heaps are still undefined |
|
534 */ |
|
535 public boolean areComparedHeapsFromSameThread(){ |
|
536 if( compareHeapsFirstPage.getRecentHeap() != null && |
|
537 compareHeapsSecondPage.getRecentHeap() != null ){ |
|
538 if( compareHeapsFirstPage.getRecentHeap().getThreadName().equals(compareHeapsSecondPage.getRecentHeap().getThreadName() ) ){ |
|
539 return true; |
|
540 } |
|
541 else{ |
|
542 return false; |
|
543 } |
|
544 } |
|
545 else{ |
|
546 return true; |
|
547 } |
|
548 |
|
549 } |
|
550 |
|
551 |
|
552 /** |
|
553 * saveUserEnteredData |
|
554 * calls saveUserEnteredData method of all wizard pages. |
|
555 */ |
|
556 private void saveUserEnteredData(){ |
|
557 |
|
558 // Save form values so that they can be restored later |
|
559 if( selectActionPage != null){ |
|
560 selectActionPage.saveUserEnteredData(); |
|
561 } |
|
562 if( importHeapPage != null){ |
|
563 importHeapPage.saveUserEnteredData(); |
|
564 } |
|
565 if( parameterFilesPage != null){ |
|
566 parameterFilesPage.saveUserEnteredData(); |
|
567 } |
|
568 if( compareHeapsFirstPage != null){ |
|
569 compareHeapsFirstPage.saveUserEnteredData(); |
|
570 } |
|
571 if( compareHeapsSecondPage != null){ |
|
572 compareHeapsSecondPage.saveUserEnteredData(); |
|
573 } |
|
574 if( exportFileNamePage != null){ |
|
575 exportFileNamePage.saveUserEnteredData(); |
|
576 } |
|
577 if( swmtLogPage != null){ |
|
578 swmtLogPage.saveUserEnteredData(); |
|
579 } |
|
580 } |
|
581 |
|
582 public void updateConnectionSettings(){ |
|
583 if( importHeapPage != null ){ |
|
584 this.importHeapPage.updateConnectionSettings(); |
|
585 } |
|
586 if( compareHeapsFirstPage != null ){ |
|
587 this.compareHeapsFirstPage.updateConnectionSettings(); |
|
588 } |
|
589 if( compareHeapsSecondPage != null ){ |
|
590 this.compareHeapsSecondPage.updateConnectionSettings(); |
|
591 } |
|
592 if( swmtLogPage != null ){ |
|
593 this.swmtLogPage.updateConnectionSettings(); |
|
594 } |
|
595 |
|
596 if(traceEngine != null){ |
|
597 // Resetting progress status in case connection settings have been changed |
|
598 traceEngine.resetProgressStatus(); |
|
599 } |
|
600 |
|
601 } |
|
602 |
|
603 public void init(IWorkbench arg0, IStructuredSelection arg1) { |
|
604 |
|
605 } |
|
606 |
|
607 public void setData(MemSpyWizardDialog wizDialog){ |
|
608 this.wizDialog = wizDialog; |
|
609 } |
|
610 |
|
611 public void setCancelText( String newText ){ |
|
612 wizDialog.setCancelText( newText ); |
|
613 } |
|
614 |
|
615 private void getSymbolInformation( AnalyserXMLGenerator symbolInfo ){ |
|
616 |
|
617 // combine map and symbol files into one String[] and set them into xmlGenerator |
|
618 ArrayList<String> debugMetaData; |
|
619 String[] symbolFiles = parameterFilesPage.getSymbolFiles(); |
|
620 if( symbolFiles == null ){ |
|
621 debugMetaData = new ArrayList<String>(); |
|
622 } |
|
623 else{ |
|
624 debugMetaData = new ArrayList<String>(Arrays.asList( symbolFiles )); |
|
625 } |
|
626 if( parameterFilesPage.getMapFilesZip().equals("") == false ){ |
|
627 debugMetaData.add( parameterFilesPage.getMapFilesZip() ); |
|
628 } |
|
629 |
|
630 // Set meta data folder |
|
631 symbolInfo.setXMLDebugMetaDataFile(debugMetaData.toArray(new String [debugMetaData.size()])); |
|
632 if( parameterFilesPage.getMapFilesFolder().equals("") == false ){ |
|
633 symbolInfo.setXMLDebugMetaDataDirectory( parameterFilesPage.getMapFilesFolder() ); |
|
634 } |
|
635 else{ |
|
636 symbolInfo.setXMLDebugMetaDataDirectory(null); |
|
637 } |
|
638 |
|
639 } |
|
640 |
|
641 } |