372 /** Tree parent object which not shown to user. */ |
371 /** Tree parent object which not shown to user. */ |
373 private TreeParent invisibleRoot; |
372 private TreeParent invisibleRoot; |
374 |
373 |
375 /** Double click action. */ |
374 /** Double click action. */ |
376 private Action doubleClickAction; |
375 private Action doubleClickAction; |
|
376 |
377 /** Click action. */ |
377 /** Click action. */ |
378 private Action clickAction; |
378 private Action clickAction; |
|
379 |
379 /** Change detail level action. */ |
380 /** Change detail level action. */ |
380 public Action changeDetails; |
381 public Action changeDetails; |
|
382 |
381 /** Select S60 log file action. */ |
383 /** Select S60 log file action. */ |
382 private Action s60LogTargetAction; |
384 private Action s60LogTargetAction; |
|
385 |
383 /** Select TraceViewer connection action. */ |
386 /** Select TraceViewer connection action. */ |
384 private Action externalLogTargetAction; |
387 // private Action externalLogTargetAction; |
|
388 |
385 /** Select fast data gathering mode */ |
389 /** Select fast data gathering mode */ |
386 private Action externalFastLogTargetAction; |
390 private Action externalFastLogTargetAction; |
|
391 |
387 /** Select Ask always action. */ |
392 /** Select Ask always action. */ |
388 private Action askLogTargetAction; |
393 private Action askLogTargetAction; |
|
394 |
389 /** Save report file action. */ |
395 /** Save report file action. */ |
390 private Action saveReportAction; |
396 private Action saveReportAction; |
|
397 |
391 /** Save test run action. */ |
398 /** Save test run action. */ |
392 private Action saveDataFileAction; |
399 private Action saveDataFileAction; |
|
400 |
393 /** AnalyzeTool results action. */ |
401 /** AnalyzeTool results action. */ |
394 private Action analyzeResults; |
402 private Action analyzeResults; |
|
403 |
395 /** Activate AnalyzeTool build action. */ |
404 /** Activate AnalyzeTool build action. */ |
396 public Action buildWithAtool; |
405 public Action buildWithAtool; |
|
406 |
397 /** Clean AnalyzeTool changes action. */ |
407 /** Clean AnalyzeTool changes action. */ |
398 private Action cleanAtoolChanges; |
408 private Action cleanAtoolChanges; |
|
409 |
399 /** Start/Stop trace action. */ |
410 /** Start/Stop trace action. */ |
400 public Action traceAction; |
411 public Action traceAction; |
|
412 |
401 /** Start subtest action. */ |
413 /** Start subtest action. */ |
402 private Action startSubtest; |
414 private Action startSubtest; |
|
415 |
403 /** Stop subtest action. */ |
416 /** Stop subtest action. */ |
404 private Action stopSubtest; |
417 private Action stopSubtest; |
|
418 |
405 /** Refresh(re-creates) project results */ |
419 /** Refresh(re-creates) project results */ |
406 private Action refreshResults; |
420 private Action refreshResults; |
|
421 |
407 /** Copies selected memory leak item info to the clipboard. */ |
422 /** Copies selected memory leak item info to the clipboard. */ |
408 private Action copyAction; |
423 private Action copyAction; |
|
424 |
409 /** Action to open AnalyzeTool preference page. */ |
425 /** Action to open AnalyzeTool preference page. */ |
410 private Action openPrefs; |
426 private Action openPrefs; |
|
427 |
411 /** |
428 /** |
412 * Clears selected project results without removing temporary files |
429 * Clears selected project results without removing temporary files |
413 */ |
430 */ |
414 private Action clearProjectResults; |
431 private Action clearProjectResults; |
415 |
432 |
634 AbstractList<MMPInfo> modules = Util |
646 AbstractList<MMPInfo> modules = Util |
635 .loadProjectTargetsInfo(project); |
647 .loadProjectTargetsInfo(project); |
636 projectModules.put(project, modules); |
648 projectModules.put(project, modules); |
637 |
649 |
638 boolean xmlFile = Util.isFileXML(selectedFile); |
650 boolean xmlFile = Util.isFileXML(selectedFile); |
639 // if file is xml file |
651 // if file is XML file |
640 // no need to analyze data file |
652 // no need to analyze data file |
641 // => just create results from xml file |
653 // => just create results from XML file |
642 if (xmlFile) { |
654 if (xmlFile) { |
643 Job analyzingXMLJob = new Job(Constants.ANALYZE_TOOL_TITLE) { |
655 Job analyzingXMLJob = new Job(Constants.ANALYZE_TOOL_TITLE) { |
644 @Override |
656 @Override |
645 protected IStatus run(IProgressMonitor monitor) { |
657 protected IStatus run(IProgressMonitor monitor) { |
646 |
658 |
708 || analyzeJob.getResult().getCode() == IStatus.CANCEL |
720 || analyzeJob.getResult().getCode() == IStatus.CANCEL |
709 || analyzeJob.getResult().getCode() == IStatus.ERROR) { |
721 || analyzeJob.getResult().getCode() == IStatus.ERROR) { |
710 analyzeJob = new Job(Constants.ANALYZE_TOOL_TITLE) { |
722 analyzeJob = new Job(Constants.ANALYZE_TOOL_TITLE) { |
711 @Override |
723 @Override |
712 protected IStatus run(IProgressMonitor monitor) { |
724 protected IStatus run(IProgressMonitor monitor) { |
713 // inform progressdialog that task execution starts |
725 // inform progress dialog that task execution starts |
714 // this make progressdialog visible on the UI |
726 // this make progress dialog visible on the UI |
715 monitor.beginTask(Constants.PROGRESSDIALOG_ATOOL, |
727 monitor.beginTask(Constants.PROGRESSDIALOG_ATOOL, |
716 IProgressMonitor.UNKNOWN); |
728 IProgressMonitor.UNKNOWN); |
717 |
729 |
718 fileOpenHistory.setFileName(usedFile); |
730 fileOpenHistory.setFileName(usedFile); |
719 // add2UserActionHistory( "File opened: " + usedFile ); |
731 // add2UserActionHistory( "File opened: " + usedFile ); |
720 |
732 |
721 // set used datafile name |
733 // set used datafile name |
722 usedDataFileName = usedFile; |
734 usedDataFileName = usedFile; |
723 |
735 |
724 if (chart != null) { |
736 if (chart != null) { |
725 resetGraphView();// clear out the graph view |
737 resetGraphView();// clear out the graph view |
726 } |
738 } |
727 |
739 |
728 // create atool object and execute atool |
740 // create atool object and execute atool |
729 UseAtool atool = new UseAtool(); |
741 UseAtool atool = new UseAtool(); |
730 |
742 |
731 // create xml file |
743 // create XML file |
732 Constants.COMMAND_LINE_ERROR_CODE errorCode = atool |
744 Constants.COMMAND_LINE_ERROR_CODE errorCode = atool |
733 .createXMLFileToCarbide(monitor, projectRef, |
745 .createXmlAndCleanDatFilesToCarbide(monitor, |
734 usedFile, "-a"); |
746 projectRef, usedFile, "-a"); |
735 String xmlFileLocation = null; |
747 |
736 xmlFileLocation = atool.getDataFileName(); |
748 String xmlFileLocation = atool.getXmlFilePath(); |
|
749 String cleanDatFileLocation = atool.getCleanDatFilePath(); |
737 |
750 |
738 // if some error occurs display it to user. |
751 // if some error occurs display it to user. |
739 if (errorCode != Constants.COMMAND_LINE_ERROR_CODE.OK) { |
752 if (errorCode != Constants.COMMAND_LINE_ERROR_CODE.OK) { |
740 fileOpenHistory.removeFileName(usedFile); |
753 fileOpenHistory.removeFileName(usedFile); |
741 Util.displayCommandLineError(errorCode); |
754 Util.displayCommandLineError(errorCode); |
742 } |
755 } |
|
756 |
743 // if XML file generation failed => info to the user |
757 // if XML file generation failed => info to the user |
744 else if (xmlFileLocation == null) { |
758 else if (xmlFileLocation == null) { |
745 fileOpenHistory.removeFileName(usedFile); |
759 fileOpenHistory.removeFileName(usedFile); |
746 if (showErrorInfo) { |
760 if (showErrorInfo) { |
747 showErrorMessage(Constants.INFO_FILE_INVALID); |
761 showErrorMessage(Constants.INFO_FILE_INVALID); |
748 } |
762 } |
749 } else { |
763 } else { |
750 // Parse the xml file |
764 // Parse the XML file |
751 ParseXMLFileSAX dataFileParser = new ParseXMLFileSAX( |
765 ParseXMLFileSAX dataFileParser = new ParseXMLFileSAX( |
752 project, xmlFileLocation, projectResults); |
766 project, xmlFileLocation, projectResults); |
753 boolean error = dataFileParser.parse(); |
767 boolean error = dataFileParser.parse(); |
754 if (showErrorInfo && !error) { |
768 if (showErrorInfo && !error) { |
755 fileOpenHistory.removeFileName(usedFile); |
769 fileOpenHistory.removeFileName(usedFile); |
765 refreshView(); |
779 refreshView(); |
766 } |
780 } |
767 |
781 |
768 updateChangeDetailState(projectRef); |
782 updateChangeDetailState(projectRef); |
769 |
783 |
770 // //this only generates statistics and this feature is |
|
771 // currently disabled |
|
772 // if( !monitor.isCanceled() ) { |
|
773 // |
|
774 // IPreferenceStore store = Activator.getPreferences(); |
|
775 // boolean generateStatistic = |
|
776 // store.getBoolean(Constants.CREATE_STATISTIC); |
|
777 // //used file data file create statistic also |
|
778 // if( generateStatistic && UseAtool.checkFileType(usedFile) |
|
779 // == Constants.DATAFILE_TRACE ) |
|
780 // { |
|
781 // monitor.setTaskName(Constants.STATISTICS_GENERATING_PROG_TITLE); |
|
782 // |
|
783 // ReadFile fileReader = new ReadFile(); |
|
784 // boolean error = fileReader.readFile(usedFile); |
|
785 // if( error && statisticView != null) { |
|
786 // AbstractList<ProcessInfo> processes = |
|
787 // fileReader.getStatistic(); |
|
788 // statisticView.setData( project, processes); |
|
789 // fileReader.finish(); |
|
790 // } |
|
791 // |
|
792 // } |
|
793 // } |
|
794 if (!monitor.isCanceled()) { |
784 if (!monitor.isCanceled()) { |
795 |
|
796 // create the job for loading the graph model |
785 // create the job for loading the graph model |
797 // but only schedule it when the user gets to the graph |
786 // but only schedule it when the user gets to the graph |
798 // tab |
787 // tab |
799 graphLoadJob = new GraphLoadJob(usedFile); |
788 graphLoadJob = new GraphLoadJob(cleanDatFileLocation); |
800 graphLoadJob.setUser(true);// set progress bar |
789 graphLoadJob.setUser(true);// set progress bar |
801 graphLoadJob.setPriority(Job.LONG); |
790 graphLoadJob.setPriority(Job.LONG); |
802 |
791 |
803 // run the following in UI thread, since widgets get |
792 // run the following in UI thread, since widgets get |
804 // accessed |
793 // accessed |
805 PlatformUI.getWorkbench().getDisplay().syncExec( |
794 PlatformUI.getWorkbench().getDisplay().syncExec( |
806 new Runnable() { |
795 new Runnable() { |
807 public void run() { |
796 public void run() { |
808 if (((CTabFolder) chart.getParent()) |
797 if (((CTabFolder) chart.getParent()) |
809 .getSelection() != null && ((CTabFolder) chart.getParent()) |
798 .getSelection() != null |
810 .getSelection().getControl() == chart) { |
799 && ((CTabFolder) chart |
|
800 .getParent()) |
|
801 .getSelection() |
|
802 .getControl() == chart) { |
811 // chart tab is currently selected |
803 // chart tab is currently selected |
812 // so we can run the load job |
804 // so we can run the load job |
813 // straight away |
805 // straight away |
814 graphLoadJob.schedule(); |
806 graphLoadJob.schedule(); |
815 } |
807 } |
820 return new Status(IStatus.OK, Constants.ANALYZE_CONSOLE_ID, |
812 return new Status(IStatus.OK, Constants.ANALYZE_CONSOLE_ID, |
821 IStatus.OK, |
813 IStatus.OK, |
822 Constants.PROGRESSDIALOG_ANALYZE_COMPLETE, null); |
814 Constants.PROGRESSDIALOG_ANALYZE_COMPLETE, null); |
823 } |
815 } |
824 }; |
816 }; |
825 |
817 |
826 if (graphLoadJob != null && graphLoadJob.getState() == Job.RUNNING) { |
818 if (graphLoadJob != null && graphLoadJob.getState() == Job.RUNNING) { |
827 graphLoadJob.cancel(); |
819 graphLoadJob.cancel(); |
828 } |
820 } |
829 graphLoadJob = null; |
821 graphLoadJob = null; |
830 |
822 |
831 analyzeJob.setUser(true); |
823 analyzeJob.setUser(true); |
832 analyzeJob.setPriority(Job.LONG); |
824 analyzeJob.setPriority(Job.LONG); |
833 analyzeJob.schedule(); |
825 analyzeJob.schedule(); |
834 |
826 |
835 } else { // if existing job is running display info to user |
827 } else { |
|
828 // if existing job is running display info to user |
836 showMessage(Constants.INFO_ALLREADY_RUNNING); |
829 showMessage(Constants.INFO_ALLREADY_RUNNING); |
837 } |
830 } |
838 } |
831 } |
839 |
832 |
840 /** |
833 /** |
882 } else { |
875 } else { |
883 // set selection to correct item |
876 // set selection to correct item |
884 runView.setSelection(new StructuredSelection( |
877 runView.setSelection(new StructuredSelection( |
885 activeTreeItem), true); |
878 activeTreeItem), true); |
886 } |
879 } |
887 |
|
888 } |
880 } |
889 |
881 |
890 if (callstackView != null) { |
882 if (callstackView != null) { |
891 // update view callstack view content |
883 // update view callstack view content |
892 callstackView.setInput(getCallStack(activeTreeItem)); |
884 callstackView.setInput(getCallStack(activeTreeItem)); |
893 |
885 |
894 // expand all the trees on call stack view |
886 // expand all the trees on call stack view |
895 callstackView.expandAll(); |
887 callstackView.expandAll(); |
896 |
888 |
897 } |
889 } |
898 |
|
899 // change tooltip |
890 // change tooltip |
900 changeReportActionTooltip(); |
891 changeReportActionTooltip(); |
901 |
|
902 } |
892 } |
903 }); |
893 }); |
904 |
|
905 } |
894 } |
906 |
895 |
907 /** |
896 /** |
908 * Change logging mode. |
897 * Change logging mode. |
909 * |
898 * |
918 |
907 |
919 // get preference store |
908 // get preference store |
920 IPreferenceStore store = Activator.getPreferences(); |
909 IPreferenceStore store = Activator.getPreferences(); |
921 String usedLoggingMode = ""; |
910 String usedLoggingMode = ""; |
922 |
911 |
923 // if no loggingmode given get it from the AnalyzeTool preferences |
912 // if no logging mode given get it from the AnalyzeTool preferences |
924 if (loggingMode == null) { |
913 if (loggingMode == null) { |
925 usedLoggingMode = store.getString(Constants.LOGGING_MODE); |
914 usedLoggingMode = store.getString(Constants.LOGGING_MODE); |
926 } |
915 } |
927 // logging mode is given => so start to use it |
916 // logging mode is given => so start to use it |
928 else { |
917 else { |
929 store.setValue(Constants.LOGGING_MODE, loggingMode); |
918 store.setValue(Constants.LOGGING_MODE, loggingMode); |
930 usedLoggingMode = loggingMode; |
919 usedLoggingMode = loggingMode; |
931 } |
920 } |
932 |
921 |
933 // current logging mode is external change it to external |
922 if (Constants.LOGGING_S60.equals(usedLoggingMode)) { |
934 if (Constants.LOGGING_EXT.equals(usedLoggingMode)) { |
|
935 logTargetMenu.setImageDescriptor(Activator |
|
936 .getImageDescriptor(Constants.BUTTON_COMPUTER)); |
|
937 logTargetMenu |
|
938 .setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_EXT); |
|
939 if (loggingMode == null) { |
|
940 externalLogTargetAction.setChecked(true); |
|
941 s60LogTargetAction.setChecked(false); |
|
942 externalFastLogTargetAction.setChecked(false); |
|
943 askLogTargetAction.setChecked(false); |
|
944 } |
|
945 } |
|
946 // current logging mode is s60 change it to s60 |
|
947 else if (Constants.LOGGING_S60.equals(usedLoggingMode)) { |
|
948 |
923 |
949 logTargetMenu.setImageDescriptor(Activator |
924 logTargetMenu.setImageDescriptor(Activator |
950 .getImageDescriptor(Constants.BUTTON_CELLURAR)); |
925 .getImageDescriptor(Constants.BUTTON_CELLURAR)); |
951 logTargetMenu |
926 logTargetMenu |
952 .setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_S60); |
927 .setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_S60); |
953 if (loggingMode == null) { |
928 if (loggingMode == null) { |
954 externalLogTargetAction.setChecked(false); |
|
955 s60LogTargetAction.setChecked(true); |
929 s60LogTargetAction.setChecked(true); |
956 externalFastLogTargetAction.setChecked(false); |
930 externalFastLogTargetAction.setChecked(false); |
957 askLogTargetAction.setChecked(false); |
931 askLogTargetAction.setChecked(false); |
958 } |
932 } |
959 } |
933 } else if (Constants.LOGGING_EXT_FAST.equals(usedLoggingMode)) { |
960 |
|
961 else if (Constants.LOGGING_EXT_FAST.equals(usedLoggingMode)) { |
|
962 logTargetMenu.setImageDescriptor(Activator |
934 logTargetMenu.setImageDescriptor(Activator |
963 .getImageDescriptor(Constants.BUTTON_COMPUTER_FAST)); |
935 .getImageDescriptor(Constants.BUTTON_COMPUTER_FAST)); |
964 logTargetMenu |
936 logTargetMenu |
965 .setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_FAST); |
937 .setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_FAST); |
966 if (loggingMode == null) { |
938 if (loggingMode == null) { |
967 externalLogTargetAction.setChecked(false); |
|
968 s60LogTargetAction.setChecked(false); |
939 s60LogTargetAction.setChecked(false); |
969 externalFastLogTargetAction.setChecked(true); |
940 externalFastLogTargetAction.setChecked(true); |
970 askLogTargetAction.setChecked(false); |
941 askLogTargetAction.setChecked(false); |
971 } |
942 } |
972 } |
943 } |
975 logTargetMenu.setImageDescriptor(Activator |
946 logTargetMenu.setImageDescriptor(Activator |
976 .getImageDescriptor(Constants.BUTTON_ASK)); |
947 .getImageDescriptor(Constants.BUTTON_ASK)); |
977 logTargetMenu |
948 logTargetMenu |
978 .setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_ASK); |
949 .setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_ASK); |
979 if (loggingMode == null) { |
950 if (loggingMode == null) { |
980 externalLogTargetAction.setChecked(false); |
|
981 s60LogTargetAction.setChecked(false); |
951 s60LogTargetAction.setChecked(false); |
982 externalFastLogTargetAction.setChecked(false); |
952 externalFastLogTargetAction.setChecked(false); |
983 askLogTargetAction.setChecked(true); |
953 askLogTargetAction.setChecked(true); |
984 } |
954 } |
985 } |
955 } |
1174 * it. |
1141 * it. |
1175 */ |
1142 */ |
1176 @Override |
1143 @Override |
1177 public void createPartControl(Composite parent) { |
1144 public void createPartControl(Composite parent) { |
1178 |
1145 |
1179 // create new Tab |
1146 // create a new Tab |
1180 final CTabFolder mainFolder = new CTabFolder(parent, SWT.TOP); |
1147 final CTabFolder mainFolder = new CTabFolder(parent, SWT.TOP); |
1181 |
1148 |
1182 // create main view and add it tab |
1149 // create main view and add it tab |
1183 createMainView(mainFolder); |
1150 createMainView(mainFolder); |
1184 |
1151 |
1185 // create new statistic view |
|
1186 // createMemoryView( mainFolder ); |
|
1187 // create graph |
1152 // create graph |
1188 createGraphView(mainFolder); |
1153 createGraphView(mainFolder); |
1189 |
1154 |
1190 // set initial selection |
1155 // set initial selection |
1191 mainFolder.setSelection(mainTab); |
1156 mainFolder.setSelection(mainTab); |
1195 public void widgetDefaultSelected(SelectionEvent e) { |
1160 public void widgetDefaultSelected(SelectionEvent e) { |
1196 widgetSelected(e); |
1161 widgetSelected(e); |
1197 } |
1162 } |
1198 |
1163 |
1199 public void widgetSelected(SelectionEvent e) { |
1164 public void widgetSelected(SelectionEvent e) { |
1200 // if we changed to the graph tab and the graph load job isn't already running |
1165 // if we changed to the graph tab and the graph load job isn't |
|
1166 // already running |
1201 // schedule it now |
1167 // schedule it now |
1202 if (graphLoadJob != null |
1168 if (graphLoadJob != null |
1203 && graphLoadJob.getState() != Job.RUNNING |
1169 && graphLoadJob.getState() != Job.RUNNING |
1204 && mainFolder.getSelection() != null |
1170 && mainFolder.getSelection() != null |
1205 && mainFolder.getSelection().getControl() == chart) { |
1171 && mainFolder.getSelection().getControl() == chart) { |
1206 graphLoadJob.schedule(); |
1172 graphLoadJob.schedule(); |
1207 } |
1173 } |
1208 |
1174 |
1209 |
|
1210 if (mainFolder.getSelectionIndex() == 1) { |
1175 if (mainFolder.getSelectionIndex() == 1) { |
1211 changeDetails.setEnabled(false); |
1176 changeDetails.setEnabled(false); |
1212 } else { |
1177 } else { |
1213 changeDetails.setEnabled(true); |
1178 changeDetails.setEnabled(true); |
1214 |
|
1215 } |
1179 } |
1216 } |
1180 } |
1217 }); |
1181 }); |
1218 |
1182 |
1219 // stop any jobs that may be scheduled |
1183 // stop any jobs that may be scheduled |
1220 mainFolder.addDisposeListener(new DisposeListener(){ |
1184 mainFolder.addDisposeListener(new DisposeListener() { |
1221 public void widgetDisposed(DisposeEvent e) { |
1185 public void widgetDisposed(DisposeEvent e) { |
1222 if (graphLoadJob != null){ |
1186 if (graphLoadJob != null) { |
1223 graphLoadJob.cancel(); |
1187 graphLoadJob.cancel(); |
1224 graphLoadJob = null; |
1188 graphLoadJob = null; |
1225 } |
1189 } |
1226 if (analyzeJob != null){ |
1190 if (analyzeJob != null) { |
1227 analyzeJob.cancel(); |
1191 analyzeJob.cancel(); |
1228 analyzeJob = null; |
1192 analyzeJob = null; |
1229 } |
1193 } |
1230 } |
1194 } |
1231 }); |
1195 }); |
1232 |
|
1233 } |
1196 } |
1234 |
1197 |
1235 /** |
1198 /** |
1236 * Creates graph view and add it to graph tab |
1199 * Creates graph view and add it to graph tab |
1237 * |
1200 * |
1297 SashForm callstackForm = new SashForm(sashForm, SWT.VERTICAL); |
1259 SashForm callstackForm = new SashForm(sashForm, SWT.VERTICAL); |
1298 |
1260 |
1299 // set content and label providers |
1261 // set content and label providers |
1300 runView.setContentProvider(new ViewContentProvider()); |
1262 runView.setContentProvider(new ViewContentProvider()); |
1301 runView.setLabelProvider(new ViewLabelProvider()); |
1263 runView.setLabelProvider(new ViewLabelProvider()); |
1302 // runView.addFilter( new ATFilter() ); |
1264 |
1303 // get init content |
1265 // get init content |
1304 runView.setInput(getStartupContent()); |
1266 runView.setInput(getStartupContent()); |
1305 |
1267 |
1306 // add listener to provide selection change events |
1268 // add listener to provide selection change events |
1307 runView.addTreeListener(this); |
1269 runView.addTreeListener(this); |
1366 AnalyzeToolHelpContextIDs.ANALYZE_MAIN); |
1328 AnalyzeToolHelpContextIDs.ANALYZE_MAIN); |
1367 |
1329 |
1368 ResourcesPlugin.getWorkspace().addResourceChangeListener( |
1330 ResourcesPlugin.getWorkspace().addResourceChangeListener( |
1369 new ATResourceListener()); |
1331 new ATResourceListener()); |
1370 |
1332 |
1371 // get used command line engine version |
|
1372 String version = Util.getAtoolVersionNumber(Util |
|
1373 .getAtoolInstallFolder()); |
|
1374 |
|
1375 // compare current version to min version |
|
1376 int comp = Util.compareVersionNumber(Constants.CS_SUPPORT_MIN_VERSION, |
|
1377 version); |
|
1378 |
|
1379 IPreferenceStore store = Activator.getPreferences(); |
1333 IPreferenceStore store = Activator.getPreferences(); |
1380 // if current version is same or higher than required version => set |
1334 store.setValue(Constants.LOGGING_FAST_ENABLED, true); |
1381 // flag to true |
|
1382 if (comp == Constants.VERSION_NUMBERS_EQUALS |
|
1383 || comp == Constants.VERSION_NUMBERS_SECOND) { |
|
1384 store.setValue(Constants.LOGGING_FAST_ENABLED, true); |
|
1385 } else { |
|
1386 store.setValue(Constants.LOGGING_FAST_ENABLED, false); |
|
1387 } |
|
1388 |
1335 |
1389 // get default value for logging mode |
1336 // get default value for logging mode |
1390 preferenceChanged(); |
1337 preferenceChanged(); |
1391 } |
1338 } |
1392 |
1339 |
1398 * |
1345 * |
1399 * @param disable |
1346 * @param disable |
1400 * Boolean state of trace action |
1347 * Boolean state of trace action |
1401 */ |
1348 */ |
1402 public void disableTraceActions(final boolean disable) { |
1349 public void disableTraceActions(final boolean disable) { |
1403 |
|
1404 if (traceAction != null && disable) { |
1350 if (traceAction != null && disable) { |
1405 // enable trace action |
1351 // enable trace action |
1406 traceAction.setToolTipText(Constants.ACTION_START_TRACE); |
1352 traceAction.setToolTipText(Constants.ACTION_START_TRACE); |
1407 traceAction.setEnabled(disable); |
1353 traceAction.setEnabled(disable); |
1408 } else if (traceAction != null && !disable) { |
1354 } else if (traceAction != null && !disable) { |
1409 // disable trace action |
1355 // disable trace action |
1410 traceAction.setToolTipText(Constants.TRACE_NOT_FOUND); |
1356 traceAction.setToolTipText(Constants.TRACE_NOT_FOUND); |
1411 traceAction.setEnabled(disable); |
1357 traceAction.setEnabled(disable); |
1412 } |
1358 } |
1413 |
|
1414 traceActive = false; |
1359 traceActive = false; |
1415 } |
1360 } |
1416 |
1361 |
1417 /** |
1362 /** |
1418 * Fills context menu. |
1363 * Fills context menu. |
1419 * |
1364 * |
1420 * @param manager |
1365 * @param manager |
1421 * Menu manager |
1366 * Menu manager |
1422 */ |
1367 */ |
1423 private void fillContextMenu(IMenuManager manager) { |
1368 private void fillContextMenu(IMenuManager manager) { |
1424 |
|
1425 manager.add(buildWithAtool); |
1369 manager.add(buildWithAtool); |
1426 manager.add(new Separator()); |
1370 manager.add(new Separator()); |
1427 manager.add(traceAction); |
1371 manager.add(traceAction); |
1428 manager.add(startSubtest); |
1372 manager.add(startSubtest); |
1429 manager.add(stopSubtest); |
1373 manager.add(stopSubtest); |
1468 private void fillLocalToolBar(IToolBarManager manager) { |
1412 private void fillLocalToolBar(IToolBarManager manager) { |
1469 |
1413 |
1470 logTargetMenu = new DropDownMenu(Constants.ACTION_SAVE, this, false, |
1414 logTargetMenu = new DropDownMenu(Constants.ACTION_SAVE, this, false, |
1471 false); |
1415 false); |
1472 makeLogTargetActions(); |
1416 makeLogTargetActions(); |
|
1417 logTargetMenu.addAction(externalFastLogTargetAction); |
1473 logTargetMenu.addAction(s60LogTargetAction); |
1418 logTargetMenu.addAction(s60LogTargetAction); |
1474 logTargetMenu.addAction(externalLogTargetAction); |
|
1475 logTargetMenu.addAction(externalFastLogTargetAction); |
|
1476 logTargetMenu.addAction(askLogTargetAction); |
1419 logTargetMenu.addAction(askLogTargetAction); |
1477 manager.add(logTargetMenu); |
1420 manager.add(logTargetMenu); |
1478 |
1421 |
1479 manager.add(buildWithAtool); |
1422 manager.add(buildWithAtool); |
1480 manager.add(new Separator()); |
1423 manager.add(new Separator()); |
1611 IProject tempProject = projects[i]; |
1554 IProject tempProject = projects[i]; |
1612 if (tempProject.isOpen()) { |
1555 if (tempProject.isOpen()) { |
1613 tempProject.accept(visitor); |
1556 tempProject.accept(visitor); |
1614 } |
1557 } |
1615 } |
1558 } |
1616 |
|
1617 } else { // project is selected |
1559 } else { // project is selected |
1618 // if project is open => accept resource visitor |
1560 // if project is open => accept resource visitor |
1619 if (projectRef.isOpen()) { |
1561 if (projectRef.isOpen()) { |
1620 projectRef.accept(visitor); |
1562 projectRef.accept(visitor); |
1621 } |
1563 } |
1622 } |
1564 } |
1623 } catch (CoreException e) { |
1565 } catch (CoreException e) { |
1624 e.printStackTrace(); |
1566 e.printStackTrace(); |
1625 |
|
1626 } |
1567 } |
1627 } |
1568 } |
1628 |
1569 |
1629 /** |
1570 /** |
1630 * Gets project results. |
1571 * Gets project results. |
1750 // get active item |
1690 // get active item |
1751 // active must ask from the TreeHelper class |
1691 // active must ask from the TreeHelper class |
1752 // because it can be filtered out when creating new tree model |
1692 // because it can be filtered out when creating new tree model |
1753 activeTreeItem = helper.getActiveItem(); |
1693 activeTreeItem = helper.getActiveItem(); |
1754 testRuns.addChild(oneRunTree); |
1694 testRuns.addChild(oneRunTree); |
1755 |
1695 } |
1756 } |
|
1757 |
|
1758 } catch (java.lang.NullPointerException npe) { |
1696 } catch (java.lang.NullPointerException npe) { |
1759 npe.printStackTrace(); |
1697 npe.printStackTrace(); |
1760 return null; |
1698 return null; |
1761 } |
1699 } |
1762 |
|
1763 // expand to runs level |
1700 // expand to runs level |
1764 runView.setAutoExpandLevel(2); |
1701 runView.setAutoExpandLevel(2); |
1765 |
1702 |
1766 return invisibleRoot; |
1703 return invisibleRoot; |
1767 } |
1704 } |
2206 s60LogTargetAction |
2140 s60LogTargetAction |
2207 .setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_S60); |
2141 .setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_S60); |
2208 s60LogTargetAction.setImageDescriptor(Activator |
2142 s60LogTargetAction.setImageDescriptor(Activator |
2209 .getImageDescriptor(Constants.BUTTON_CELLURAR)); |
2143 .getImageDescriptor(Constants.BUTTON_CELLURAR)); |
2210 |
2144 |
2211 externalLogTargetAction = new Action(Constants.LOGGING_EXT, |
|
2212 IAction.AS_RADIO_BUTTON) { |
|
2213 @Override |
|
2214 public void run() { |
|
2215 changeLogTarget(Constants.LOGGING_EXT); |
|
2216 } |
|
2217 }; |
|
2218 externalLogTargetAction.setText(Constants.PREFS_EXT); |
|
2219 externalLogTargetAction |
|
2220 .setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_EXT); |
|
2221 externalLogTargetAction.setImageDescriptor(Activator |
|
2222 .getImageDescriptor(Constants.BUTTON_COMPUTER)); |
|
2223 |
|
2224 externalFastLogTargetAction = new Action(Constants.LOGGING_EXT_FAST, |
2145 externalFastLogTargetAction = new Action(Constants.LOGGING_EXT_FAST, |
2225 IAction.AS_RADIO_BUTTON) { |
2146 IAction.AS_RADIO_BUTTON) { |
2226 @Override |
2147 @Override |
2227 public void run() { |
2148 public void run() { |
2228 changeLogTarget(Constants.LOGGING_EXT_FAST); |
2149 changeLogTarget(Constants.LOGGING_EXT_FAST); |
2492 names[0] = "*.dat"; |
2409 names[0] = "*.dat"; |
2493 names[1] = "*.*"; |
2410 names[1] = "*.*"; |
2494 |
2411 |
2495 Shell shell = null; |
2412 Shell shell = null; |
2496 |
2413 |
2497 // get shell from teh active view |
2414 // get shell from the active view |
2498 if (runView != null) { |
2415 if (runView != null) { |
2499 shell = runView.getControl().getShell(); |
2416 shell = runView.getControl().getShell(); |
2500 } |
2417 } |
2501 |
2418 |
2502 // if for some reason shell is null => leave |
2419 // if for some reason shell is null => leave |
2503 if (shell == null) { |
2420 if (shell == null) { |
2504 return success; |
2421 return success; |
2505 } |
2422 } |
2506 |
2423 |
2507 // ask user where to save xml report file |
2424 // ask user where to save XML report file |
2508 folder = Util.fileSaveDialog(Constants.DIALOG_SAVE_TRACE, names, |
2425 folder = Util.fileSaveDialog(Constants.DIALOG_SAVE_TRACE, names, |
2509 shell); |
2426 shell); |
2510 } |
2427 } |
2511 |
2428 |
2512 // no folder selected |
2429 // no folder selected |
2973 // close any active subtests |
2884 // close any active subtests |
2974 if (!startedSubtest.isEmpty()) { |
2885 if (!startedSubtest.isEmpty()) { |
2975 for (int j = 0; j < startedSubtest.size(); j++) { |
2886 for (int j = 0; j < startedSubtest.size(); j++) { |
2976 ActiveSubtests oneSubtest = startedSubtest.get(j); |
2887 ActiveSubtests oneSubtest = startedSubtest.get(j); |
2977 parser.parse(Constants.PREFIX + " " + oneSubtest.getProcessID() |
2888 parser.parse(Constants.PREFIX + " " + oneSubtest.getProcessID() |
2978 + " TEST_END" + " 0000 " + oneSubtest.getName()); |
2889 + " TSE 0000 " + oneSubtest.getName()); |
2979 } |
2890 } |
2980 startedSubtest.clear(); |
2891 startedSubtest.clear(); |
2981 } |
2892 } |
2982 |
2893 |
2983 // tell parser to finish => write data to file |
2894 // tell parser to finish => write data to file |
3012 } else { |
2923 } else { |
3013 // only one subtest no need to ask for users |
2924 // only one subtest no need to ask for users |
3014 if (startedSubtest.size() == 1) { |
2925 if (startedSubtest.size() == 1) { |
3015 ActiveSubtests oneSubtest = startedSubtest.get(0); |
2926 ActiveSubtests oneSubtest = startedSubtest.get(0); |
3016 parser.parse(Constants.PREFIX + " " + oneSubtest.getProcessID() |
2927 parser.parse(Constants.PREFIX + " " + oneSubtest.getProcessID() |
3017 + " TEST_END" + " 0000 " + oneSubtest.getName()); |
2928 + " TSE 0000 " + oneSubtest.getName()); |
3018 updateSubtestInfoText(Constants.SUBTEST_ENDED |
2929 updateSubtestInfoText(Constants.SUBTEST_ENDED |
3019 + oneSubtest.getTargetName() + Constants.ENRULE |
2930 + oneSubtest.getTargetName() + Constants.ENRULE |
3020 + oneSubtest.getName()); |
2931 + oneSubtest.getName()); |
3021 startedSubtest.remove(0); |
2932 startedSubtest.remove(0); |
3022 stopSubtest.setEnabled(false); |
2933 stopSubtest.setEnabled(false); |
3046 |
2957 |
3047 // if user selected subtest name and current subtest equals |
2958 // if user selected subtest name and current subtest equals |
3048 if (splittedText[2].equals(oneSubtest.getName())) { |
2959 if (splittedText[2].equals(oneSubtest.getName())) { |
3049 // write subtest end tag to data file |
2960 // write subtest end tag to data file |
3050 parser.parse(Constants.PREFIX + " " |
2961 parser.parse(Constants.PREFIX + " " |
3051 + oneSubtest.getProcessID() + " TEST_END" |
2962 + oneSubtest.getProcessID() + " TSE 0000 " |
3052 + " 0000 " + oneSubtest.getName()); |
2963 + oneSubtest.getName()); |
3053 updateSubtestInfoText(Constants.SUBTEST_ENDED |
2964 updateSubtestInfoText(Constants.SUBTEST_ENDED |
3054 + oneSubtest.getTargetName() + Constants.ENRULE |
2965 + oneSubtest.getTargetName() + Constants.ENRULE |
3055 + oneSubtest.getName()); |
2966 + oneSubtest.getName()); |
3056 // remove current subtest from active subtest |
2967 // remove current subtest from active subtest |
3057 // AbstractList |
2968 // AbstractList |
3058 startedSubtest.remove(k); |
2969 startedSubtest.remove(k); |
3059 break; |
2970 break; |
3060 } |
2971 } |
3061 } |
2972 } |
3062 |
|
3063 if (startedSubtest.isEmpty()) { |
2973 if (startedSubtest.isEmpty()) { |
3064 stopSubtest.setEnabled(false); |
2974 stopSubtest.setEnabled(false); |
3065 } |
2975 } |
3066 } |
2976 } |
3067 } |
2977 } |
3436 DeferredCallstackManager callstackManager = new DeferredCallstackManager( |
3338 DeferredCallstackManager callstackManager = new DeferredCallstackManager( |
3437 datFileLocation); |
3339 datFileLocation); |
3438 callstackManager.setProcesses(processes); |
3340 callstackManager.setProcesses(processes); |
3439 model.setCallstackManager(callstackManager); |
3341 model.setCallstackManager(callstackManager); |
3440 } else { |
3342 } else { |
3441 model.setCallstackManager(new SimpleCallstackManager()); |
3343 model |
|
3344 .setCallstackManager(new SimpleCallstackManager()); |
3442 } |
3345 } |
3443 } |
3346 } |
3444 if (!monitor.isCanceled()) { |
3347 if (!monitor.isCanceled()) { |
3445 chart.setInput(project, model); |
3348 chart.setInput(project, model); |
3446 model.addProcesses(processes); |
3349 model.addProcesses(processes); |
3447 } |
3350 } |
3448 fileReader.finish(); |
3351 fileReader.finish(); |
3449 } |
3352 } |
3450 |
|
3451 } catch (OutOfMemoryError oome) { |
3353 } catch (OutOfMemoryError oome) { |
3452 Activator |
3354 Activator |
3453 .getDefault() |
3355 .getDefault() |
3454 .logInfo(IStatus.ERROR, IStatus.ERROR, |
3356 .logInfo(IStatus.ERROR, IStatus.ERROR, |
3455 "Can not allocate enough memory for the memory usage graph model."); |
3357 "Can not allocate enough memory for the memory usage graph model."); |