144 * Checks preferences initial values if logging mode is not set to S60 |
137 * Checks preferences initial values if logging mode is not set to S60 |
145 * disables S60 data file name selections. |
138 * disables S60 data file name selections. |
146 */ |
139 */ |
147 public final void checkInitValues() { |
140 public final void checkInitValues() { |
148 IPreferenceStore store = Activator.getPreferences(); |
141 IPreferenceStore store = Activator.getPreferences(); |
149 |
142 |
150 // get stored atool folder |
143 // get stored atool folder |
151 String atoolFolder = store.getString(Constants.ATOOL_FOLDER); |
144 String atoolFolder = store.getString(Constants.ATOOL_FOLDER); |
152 atoolVerLabel.setText(Constants.PREFS_ATOOL_VER_NOT_FOUND); |
145 atoolVerLabel.setText(Constants.PREFS_ATOOL_VER_NOT_FOUND); |
153 |
146 |
154 // if atool folder is set to point default atool location |
147 // if atool folder is set to point default atool location |
155 if (atoolFolder.equals(Constants.DEFAULT_ATOOL_FOLDER)) { |
148 if (atoolFolder.equals(Constants.DEFAULT_ATOOL_FOLDER)) { |
156 |
149 |
157 // check that stored atool location exists |
150 // check that stored atool location exists |
158 java.io.File file = new java.io.File(atoolFolder); |
151 File file = new File(atoolFolder); |
159 if (file.exists()) { // if exists use this location and update |
152 if (file.exists()) { // if exists use this location and update |
160 // preference page buttons |
153 // preference page buttons |
161 useDefaultLocation.setSelection(false); |
154 useDefaultLocation.setSelection(false); |
162 store.setValue(Constants.USE_INTERNAL, false); |
155 store.setValue(Constants.USE_INTERNAL, false); |
163 |
156 |
164 } else { // location could not found => use internal atool |
157 } else { // location could not found => use internal atool |
165 useDefaultLocation.setSelection(true); |
158 useDefaultLocation.setSelection(true); |
166 store.setValue(Constants.USE_INTERNAL, true); |
159 store.setValue(Constants.USE_INTERNAL, true); |
167 |
|
168 } |
160 } |
169 } else { |
161 } else { |
170 boolean useDef = store.getBoolean(Constants.USE_INTERNAL); |
162 boolean useDef = store.getBoolean(Constants.USE_INTERNAL); |
171 useDefaultLocation.setSelection(useDef); |
163 useDefaultLocation.setSelection(useDef); |
172 |
|
173 } |
164 } |
174 |
165 |
175 // get atool.exe path and set it atool.exe path field |
166 // get atool.exe path and set it atool.exe path field |
176 String atoolPath = store.getString(Constants.USER_SELECTED_FOLDER); |
167 String atoolPath = store.getString(Constants.USER_SELECTED_FOLDER); |
177 atoolDirText.setText(atoolPath); |
168 atoolDirText.setText(atoolPath); |
178 |
169 |
179 // update preference page buttons |
170 // update preference page buttons |
180 handleDefaultLocationChange(); |
171 handleDefaultLocationChange(); |
181 |
172 |
182 // update atool.exe version number |
|
183 if (useDefaultLocation.getSelection()) { |
|
184 updateAtoolVersion(null); |
|
185 } else { |
|
186 updateAtoolVersion(atoolDirText.getText()); |
|
187 } |
|
188 |
|
189 // get logging mode and update buttons |
173 // get logging mode and update buttons |
190 String fileMode = store.getString(Constants.LOGGING_MODE); |
174 String fileMode = store.getString(Constants.LOGGING_MODE); |
191 setGroupButtons(fileMode); |
175 setGroupButtons(fileMode); |
192 |
176 |
193 String loggingMode = store.getString(Constants.S60_LOG_FILE_MODE); |
177 logPathText.setText(store.getString(Constants.DEVICE_LOG_FILE_PATH)); |
194 if (loggingMode.equals(Constants.LOGGING_S60_USER_SPECIFIED)) { |
178 fileNameText.setText(store.getString(Constants.DEVICE_LOG_FILE_NAME)); |
195 processButton.setSelection(false); |
179 |
196 userButton.setSelection(true); |
180 logPathText.setText(store.getString(Constants.DEVICE_LOG_FILE_PATH)); |
197 } else { |
181 fileNameText.setText(store.getString(Constants.DEVICE_LOG_FILE_NAME)); |
198 processButton.setSelection(true); |
|
199 userButton.setSelection(false); |
|
200 } |
|
201 |
182 |
202 verboseButton.setSelection(store.getBoolean(Constants.ATOOL_VERBOSE)); |
183 verboseButton.setSelection(store.getBoolean(Constants.ATOOL_VERBOSE)); |
203 //generateStatistic.setSelection(store.getBoolean(Constants.CREATE_STATISTIC)); |
|
204 |
184 |
205 // get stored callstack size |
185 // get stored callstack size |
206 int callstackSize = store.getInt(Constants.CALLSTACK_SIZE); |
186 int callstackSize = store.getInt(Constants.CALLSTACK_SIZE); |
207 if (callstackSize == 0) { |
187 if (callstackSize == 0) { |
208 zeroButton.setSelection(true); |
188 zeroButton.setSelection(true); |
332 s60Button = new Button(groupGatheringMode, SWT.RADIO); |
304 s60Button = new Button(groupGatheringMode, SWT.RADIO); |
333 s60Button.setToolTipText(Constants.PREFS_S60_TOOLTIP); |
305 s60Button.setToolTipText(Constants.PREFS_S60_TOOLTIP); |
334 s60Button.setText(Constants.PREFS_S60); |
306 s60Button.setText(Constants.PREFS_S60); |
335 s60Button.addListener(SWT.Selection, this); |
307 s60Button.addListener(SWT.Selection, this); |
336 |
308 |
337 Composite compStoreMode = new Composite(groupGatheringMode, SWT.NULL); |
309 Composite compS60 = new Composite(groupGatheringMode, SWT.NULL); |
338 |
310 |
339 final GridLayout layoutStoreMode = new GridLayout(); |
311 final GridLayout layoutS60 = new GridLayout(); |
340 layoutStoreMode.marginLeft = 15; |
312 layoutS60.marginLeft = 15; |
341 layoutStoreMode.numColumns = 1; |
313 layoutS60.numColumns = 2; |
342 compStoreMode.setLayout(layoutStoreMode); |
314 compS60.setLayout(layoutS60); |
343 |
315 |
344 // use process name button |
316 // path label |
345 processButton = new Button(compStoreMode, SWT.RADIO); |
317 logPath = new Label(compS60, SWT.NONE); |
346 processButton.setToolTipText(Constants.PREFS_USE_PROCESS_NAME_TOOLTIP); |
318 logPath.setToolTipText("Log file path in the device."); |
347 processButton.setText(Constants.PREFS_USE_PROCESS_NAME); |
319 logPath.setText("Log file path:"); |
348 processButton.addListener(SWT.Selection, this); |
320 |
349 |
321 // path field |
350 // user specified button |
322 logPathText = new Text(compS60, SWT.BORDER); |
351 userButton = new Button(compStoreMode, SWT.RADIO); |
323 logPathText.setLayoutData(new GridData(280, SWT.DEFAULT)); |
352 userButton.setToolTipText(Constants.PREFS_USER_SPEC_TOOLTIP); |
324 logPathText.setText("C:\\logs\\atool\\"); |
353 userButton.setText(Constants.PREFS_USER_SPEC); |
325 |
354 userButton.addListener(SWT.Selection, this); |
326 // filename label |
|
327 fileName = new Label(compS60, SWT.NONE); |
|
328 fileName.setToolTipText("Log file name."); |
|
329 fileName.setText("Filename:"); |
|
330 |
|
331 // filename field |
|
332 fileNameText = new Text(compS60, SWT.BORDER); |
|
333 fileNameText.setLayoutData(new GridData(280, SWT.DEFAULT)); |
|
334 fileNameText.setText("%processname%.dat"); |
355 |
335 |
356 // ask always button |
336 // ask always button |
357 askButton = new Button(groupGatheringMode, SWT.RADIO); |
337 askButton = new Button(groupGatheringMode, SWT.RADIO); |
358 askButton.setToolTipText(Constants.PREFS_ASK_ALWAYS_TOOLTIP); |
338 askButton.setToolTipText(Constants.PREFS_ASK_ALWAYS_TOOLTIP); |
359 askButton.setText(Constants.PREFS_ASK_ALWAYS); |
339 askButton.setText(Constants.PREFS_ASK_ALWAYS); |
360 askButton.addListener(SWT.Selection, this); |
340 askButton.addListener(SWT.Selection, this); |
361 |
341 } |
362 } |
342 |
363 /** |
343 /** |
364 * Creates the field editors. Field editors are abstractions of the common |
344 * Creates the field editors. Field editors are abstractions of the common |
365 * GUI blocks needed to manipulate various types of preferences. Each field |
345 * GUI blocks needed to manipulate various types of preferences. Each field |
366 * editor knows how to save and restore itself. |
346 * editor knows how to save and restore itself. |
367 */ |
347 */ |
368 @Override |
348 @Override |
369 public final void createFieldEditors() { |
349 public final void createFieldEditors() { |
370 |
350 |
371 Composite composite = new Composite(getFieldEditorParent(), SWT.NULL); |
351 Composite composite = new Composite(getFieldEditorParent(), SWT.NULL); |
372 final GridLayout gridLayout = new GridLayout(); |
352 final GridLayout gridLayout = new GridLayout(); |
373 gridLayout.numColumns = 3; |
353 gridLayout.numColumns = 3; |
374 |
354 |
375 // set layoyt of this view |
355 // set layoyt of this view |
475 { Constants.PREFS_SHOW_TOPMOST, |
445 { Constants.PREFS_SHOW_TOPMOST, |
476 Constants.REPORT_TOPMOST } }, |
446 Constants.REPORT_TOPMOST } }, |
477 getFieldEditorParent(), true); |
447 getFieldEditorParent(), true); |
478 |
448 |
479 addField(reportLevels); |
449 addField(reportLevels); |
480 |
450 |
481 checkInitValues(); |
451 checkInitValues(); |
482 PlatformUI.getWorkbench().getHelpSystem().setHelp(super.getControl(), |
452 PlatformUI.getWorkbench().getHelpSystem().setHelp(super.getControl(), |
483 AnalyzeToolHelpContextIDs.ANALYZE_TOOL_VIEW_MEM_LEAKS); |
453 AnalyzeToolHelpContextIDs.ANALYZE_TOOL_VIEW_MEM_LEAKS); |
484 |
454 } |
485 } |
455 |
486 |
456 @Override |
487 /** |
457 protected void checkState() { |
488 * Handles atool.exe location selection changes Update corresponding buttons |
458 super.checkState(); |
489 * states. |
459 |
|
460 String path; |
|
461 |
|
462 if (useDefaultLocation.getSelection()) { |
|
463 path = null; |
|
464 } else { |
|
465 path = atoolDirText.getText(); |
|
466 } |
|
467 |
|
468 if (Util.getAtoolVersionNumber(path).equals( |
|
469 Constants.PREFS_ATOOL_VER_NOT_FOUND)) { |
|
470 setErrorMessage(Constants.PREFS_CLE_NOT_AVAILABLE); |
|
471 setValid(false); |
|
472 } else if (Util.compareVersionNumber(Util.getAtoolVersionNumber(path), |
|
473 Constants.MIN_CLE_SUPPORTED) == Constants.VERSION_NUMBERS_SECOND) { |
|
474 setErrorMessage(MessageFormat.format( |
|
475 Constants.PREFS_CLE_OLDER_THAN_MIN, |
|
476 Constants.MIN_CLE_SUPPORTED)); |
|
477 setValid(false); |
|
478 } else { |
|
479 setErrorMessage(null); |
|
480 setValid(true); |
|
481 } |
|
482 } |
|
483 |
|
484 /** |
|
485 * Handles atool.exe location selection changes. Update corresponding |
|
486 * buttons states. |
490 */ |
487 */ |
491 public final void handleDefaultLocationChange() { |
488 public final void handleDefaultLocationChange() { |
492 if (useDefaultLocation.getSelection()) { |
489 if (useDefaultLocation.getSelection()) { |
493 atoolDirText.setEnabled(false); |
490 atoolDirText.setEnabled(false); |
494 browseButton.setEnabled(false); |
491 browseButton.setEnabled(false); |
495 atoolDir.setEnabled(false); |
492 atoolDir.setEnabled(false); |
496 useUserSpecified.setSelection(false); |
493 useUserSpecified.setSelection(false); |
|
494 updateAtoolVersion(null); |
497 } else { |
495 } else { |
498 atoolDirText.setEnabled(true); |
496 atoolDirText.setEnabled(true); |
499 browseButton.setEnabled(true); |
497 browseButton.setEnabled(true); |
500 atoolDir.setEnabled(true); |
498 atoolDir.setEnabled(true); |
501 useUserSpecified.setSelection(true); |
499 useUserSpecified.setSelection(true); |
502 } |
500 updateAtoolVersion(atoolDirText.getText()); |
503 } |
501 } |
504 |
502 } |
|
503 |
505 /* |
504 /* |
506 * (non-Javadoc) |
505 * (non-Javadoc) |
507 * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) |
506 * |
|
507 * @see |
|
508 * org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets. |
|
509 * Event) |
508 */ |
510 */ |
509 public final void handleEvent(final Event event) { |
511 public final void handleEvent(final Event event) { |
510 if (event.widget == browseButton) { |
512 if (event.widget == browseButton) { |
511 openFolderDialog(); |
513 openFolderDialog(); |
512 } else if (event.widget == externalButton || event.widget == externalFastButton || event.widget == askButton ) { |
514 } else if (event.widget == externalFastButton |
513 userButton.setEnabled(false); |
515 || event.widget == askButton) { |
514 processButton.setEnabled(false); |
516 setFileModeEnabled(false); |
515 } else if (event.widget == s60Button) { |
517 } else if (event.widget == s60Button) { |
516 userButton.setEnabled(true); |
518 setFileModeEnabled(true); |
517 processButton.setEnabled(true); |
|
518 } else if (event.widget == useDefaultLocation |
519 } else if (event.widget == useDefaultLocation |
519 || event.widget == atoolDir) { |
520 || event.widget == atoolDir) { |
520 handleDefaultLocationChange(); |
521 handleDefaultLocationChange(); |
521 } else if (event.widget == refreshAtoolVersion) { |
|
522 if (useDefaultLocation.getSelection()) { |
|
523 updateAtoolVersion(null); |
|
524 } else { |
|
525 updateAtoolVersion(atoolDirText.getText()); |
|
526 } |
|
527 } else if (event.widget == zeroButton || event.widget == fortyButton |
522 } else if (event.widget == zeroButton || event.widget == fortyButton |
528 || event.widget == hundredButton) { |
523 || event.widget == hundredButton) { |
529 spinner.setEnabled(false); |
524 spinner.setEnabled(false); |
530 } else if (event.widget == customButton) { |
525 } else if (event.widget == customButton) { |
531 spinner.setEnabled(true); |
526 spinner.setEnabled(true); |
532 } |
527 } |
533 } |
528 } |
534 |
529 |
535 /* |
530 /* |
536 * (non-Javadoc) |
531 * (non-Javadoc) |
537 * |
532 * |
538 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) |
533 * @see |
|
534 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) |
539 */ |
535 */ |
540 public void init(final IWorkbench workbench) { |
536 public void init(final IWorkbench workbench) { |
541 // MethodDeclaration/Block[count(BlockStatement) = 0 and |
537 // MethodDeclaration/Block[count(BlockStatement) = 0 and |
542 // @containsComment = 'false'] |
538 // @containsComment = 'false'] |
543 } |
539 } |
551 folderDialog.setText(Constants.PREFS_SELECT_DIR); |
547 folderDialog.setText(Constants.PREFS_SELECT_DIR); |
552 folderDialog.setFilterPath(atoolDirText.getText()); |
548 folderDialog.setFilterPath(atoolDirText.getText()); |
553 String folderPath = folderDialog.open(); |
549 String folderPath = folderDialog.open(); |
554 if (folderPath != null) { |
550 if (folderPath != null) { |
555 atoolDirText.setText(folderPath); |
551 atoolDirText.setText(folderPath); |
|
552 updateAtoolVersion(atoolDirText.getText()); |
556 } |
553 } |
557 } |
554 } |
558 |
555 |
559 /** |
556 /** |
560 * Perform defaults for AnalyzeTool preferences. |
557 * Perform defaults for AnalyzeTool preferences. |
561 */ |
558 */ |
562 @Override |
559 @Override |
563 public final void performDefaults() { |
560 public final void performDefaults() { |
564 //check that AT prefs page is displayed |
561 setGroupButtons(Constants.LOGGING_EXT_FAST); |
565 //if( getControl() != null && getControl().isVisible() ) { |
562 atoolDirText.setText(Constants.DEFAULT_ATOOL_FOLDER); |
566 |
563 useDefaultLocation.setSelection(true); |
567 processButton.setSelection(true); |
564 handleDefaultLocationChange(); |
568 userButton.setSelection(false); |
565 verboseButton.setSelection(false); |
569 setGroupButtons(Constants.LOGGING_EXT); |
566 zeroButton.setSelection(false); |
570 |
567 fortyButton.setSelection(true); |
571 atoolDirText.setText(Constants.DEFAULT_ATOOL_FOLDER); |
568 hundredButton.setSelection(false); |
572 useDefaultLocation.setSelection(true); |
569 customButton.setSelection(false); |
573 handleDefaultLocationChange(); |
570 spinner.setEnabled(false); |
574 verboseButton.setSelection(false); |
571 |
575 zeroButton.setSelection(false); |
572 logPathText.setText("C:\\logs\\atool\\"); |
576 fortyButton.setSelection(true); |
573 fileNameText.setText("%processname%.dat"); |
577 hundredButton.setSelection(false); |
|
578 customButton.setSelection(false); |
|
579 spinner.setEnabled(false); |
|
580 |
|
581 //generateStatistic.setSelection(false); |
|
582 super.performDefaults(); |
|
583 //} |
|
584 } |
574 } |
585 |
575 |
586 /** |
576 /** |
587 * Stores selected values When user press "Ok" or "apply" button this method |
577 * Stores selected values When user press "Ok" or "apply" button this method |
588 * is called |
578 * is called |
589 */ |
579 */ |
590 @Override |
580 @Override |
591 public final boolean performOk() { |
581 public final boolean performOk() { |
592 |
582 |
593 //check that AT prefs page is displayed |
583 IPreferenceStore store = Activator.getPreferences(); |
594 //if( getControl() != null && getControl().isVisible() ) { |
584 |
595 IPreferenceStore store = Activator.getPreferences(); |
585 // use default location is selected |
596 String atoolFolder = atoolDirText.getText(); |
586 if (useDefaultLocation.getSelection()) { |
597 |
587 store.setValue(Constants.ATOOL_FOLDER, Util |
598 // use default location is selected |
588 .getDefaultAtoolLocation()); |
599 if (useDefaultLocation.getSelection()) { |
589 store.setValue(Constants.USE_INTERNAL, true); |
600 store.setValue(Constants.ATOOL_FOLDER, Util |
590 } |
601 .getDefaultAtoolLocation()); |
591 // using user specified atool.exe location and the folder contains |
602 store.setValue(Constants.USE_INTERNAL, true); |
592 // atool.exe |
603 } |
593 else { |
604 // using user specified atool.exe location and the folder contains |
594 store.setValue(Constants.ATOOL_FOLDER, atoolDirText.getText()); |
605 // atool.exe |
595 store.setValue(Constants.USER_SELECTED_FOLDER, atoolDirText |
606 else if (checkIfFolderExists(atoolFolder)) { |
596 .getText()); |
607 store.setValue(Constants.ATOOL_FOLDER, atoolFolder); |
597 store.setValue(Constants.USE_INTERNAL, false); |
608 store.setValue(Constants.USER_SELECTED_FOLDER, atoolFolder); |
598 } |
609 store.setValue(Constants.USE_INTERNAL, false); |
599 |
610 } |
600 // store logging mode |
611 // user selected folder does not contain atool.exe |
601 if (askButton.getSelection()) { |
612 // ask confirmation to use this folder anyway |
602 store.setValue(Constants.LOGGING_MODE, |
613 else { |
603 Constants.LOGGING_ASK_ALLWAYS); |
614 boolean ret = Util |
604 } else if (s60Button.getSelection()) { |
615 .openConfirmationDialog(Constants.CONFIRM_DIR_DOES_NOT_CONTAIN_ATOOL); |
605 store.setValue(Constants.LOGGING_MODE, Constants.LOGGING_S60); |
616 if (ret) { |
606 } else if (externalFastButton.getSelection()) { |
617 |
607 store.setValue(Constants.LOGGING_MODE, Constants.LOGGING_EXT_FAST); |
618 store.setValue(Constants.ATOOL_FOLDER, atoolFolder); |
608 } |
619 store.setValue(Constants.USER_SELECTED_FOLDER, atoolFolder); |
609 store.setValue(Constants.DEVICE_LOG_FILE_PATH, logPathText.getText()); |
620 store.setValue(Constants.USE_INTERNAL, false); |
610 store.setValue(Constants.DEVICE_LOG_FILE_NAME, fileNameText.getText()); |
621 } else { |
611 |
622 return false; |
612 // store value of verbose atool.exe output |
623 } |
613 store.setValue(Constants.ATOOL_VERBOSE, verboseButton.getSelection()); |
624 } |
614 |
625 |
615 // update preference value |
626 // store logging mode |
616 // this values is used later when UI creates/update toolbar options and |
627 if (askButton.getSelection()) { |
617 // when building project with "ask always" option |
628 store.setValue(Constants.LOGGING_MODE, |
618 if (externalFastButton.isEnabled()) { |
629 Constants.LOGGING_ASK_ALLWAYS); |
619 store.setValue(Constants.LOGGING_FAST_ENABLED, true); |
630 } else if (s60Button.getSelection()) { |
620 } else { |
631 store.setValue(Constants.LOGGING_MODE, Constants.LOGGING_S60); |
621 store.setValue(Constants.LOGGING_FAST_ENABLED, false); |
632 } else if( externalFastButton.getSelection() ) { |
622 } |
633 store.setValue(Constants.LOGGING_MODE, Constants.LOGGING_EXT_FAST); |
623 |
634 } else { |
624 // get callstack size |
635 store.setValue(Constants.LOGGING_MODE, Constants.LOGGING_EXT); |
625 int size = 0; |
636 } |
626 boolean userDefinedCSSize = false; |
637 |
627 if (zeroButton.getSelection() && zeroButton.isEnabled()) { |
638 // store log file option |
628 userDefinedCSSize = true; |
639 if (userButton.getSelection()) { |
629 } else if (fortyButton.getSelection() && fortyButton.isEnabled()) { |
640 store.setValue(Constants.S60_LOG_FILE_MODE, |
630 size = 40; |
641 Constants.LOGGING_S60_USER_SPECIFIED); |
631 userDefinedCSSize = true; |
642 } else { |
632 } else if (hundredButton.getSelection() && hundredButton.isEnabled()) { |
643 store.setValue(Constants.S60_LOG_FILE_MODE, |
633 size = 100; |
644 Constants.LOGGING_S60_PROCESS_NAME); |
634 userDefinedCSSize = true; |
645 } |
635 } else if (customButton.getSelection() && customButton.isEnabled()) { |
646 |
636 size = spinner.getSelection(); |
647 // store value of verbose atool.exe output |
637 userDefinedCSSize = true; |
648 store.setValue(Constants.ATOOL_VERBOSE, verboseButton.getSelection()); |
638 } |
649 |
639 |
650 // update preference value |
640 // store callstack size |
651 // this values is used later when UI creates/update toolbar options and when building project with "ask always" option |
641 store.setValue(Constants.USE_CALLSTACK_SIZE, userDefinedCSSize); |
652 if( externalFastButton.isEnabled() ) { |
642 store.setValue(Constants.CALLSTACK_SIZE, size); |
653 store.setValue(Constants.LOGGING_FAST_ENABLED, true); |
643 |
654 } |
644 // update view with new settings |
655 else { |
645 IActionListener listener = Activator.getActionListener(); |
656 store.setValue(Constants.LOGGING_FAST_ENABLED, false); |
646 if (listener != null) { |
657 } |
647 listener.preferenceChanged(); |
658 // store.setValue(Constants.CREATE_STATISTIC, |
648 } |
659 // generateStatistic.getSelection()); |
649 |
660 |
|
661 // get callstack size |
|
662 int size = 0; |
|
663 boolean userDefinedCSSize = false; |
|
664 if (zeroButton.getSelection() && zeroButton.isEnabled()) { |
|
665 userDefinedCSSize = true; |
|
666 } else if (fortyButton.getSelection() && fortyButton.isEnabled()) { |
|
667 size = 40; |
|
668 userDefinedCSSize = true; |
|
669 } else if (hundredButton.getSelection() && hundredButton.isEnabled()) { |
|
670 size = 100; |
|
671 userDefinedCSSize = true; |
|
672 } else if (customButton.getSelection() && customButton.isEnabled()) { |
|
673 size = spinner.getSelection(); |
|
674 userDefinedCSSize = true; |
|
675 } |
|
676 |
|
677 // store callstack size |
|
678 store.setValue(Constants.USE_CALLSTACK_SIZE, userDefinedCSSize); |
|
679 store.setValue(Constants.CALLSTACK_SIZE, size); |
|
680 |
|
681 // update view with new settings |
|
682 IActionListener listener = Activator.getActionListener(); |
|
683 if (listener != null) { |
|
684 listener.preferenceChanged(); |
|
685 } |
|
686 //} |
|
687 |
|
688 // store report detail level prefs |
650 // store report detail level prefs |
689 return super.performOk(); |
651 return super.performOk(); |
690 } |
652 } |
691 |
653 |
692 /** |
654 /** |
693 * Sets S60 file options visible. |
655 * Sets S60 file options visible. |
694 * |
656 * |
695 * @param enabled |
657 * @param enabled |
696 * Is buttons enabled. |
658 * Is buttons enabled. |
697 */ |
659 */ |
698 private void setFileModeEnabled(final boolean enabled) { |
660 private void setFileModeEnabled(final boolean enabled) { |
699 processButton.setEnabled(enabled); |
661 logPath.setEnabled(enabled); |
700 userButton.setEnabled(enabled); |
662 logPathText.setEnabled(enabled); |
|
663 fileName.setEnabled(enabled); |
|
664 fileNameText.setEnabled(enabled); |
701 } |
665 } |
702 |
666 |
703 /** |
667 /** |
704 * Changes logging mode buttons. |
668 * Changes logging mode buttons. |
705 * |
669 * |
706 * @param mode |
670 * @param mode |
707 * Which mode is used |
671 * Which mode is used |
708 */ |
672 */ |
709 private void setGroupButtons(final String mode) { |
673 private void setGroupButtons(final String mode) { |
710 if (mode.equals(Constants.LOGGING_S60)) { |
674 if (mode.equals(Constants.LOGGING_S60)) { |
711 externalButton.setSelection(false); |
|
712 externalFastButton.setSelection(false); |
675 externalFastButton.setSelection(false); |
713 s60Button.setSelection(true); |
676 s60Button.setSelection(true); |
714 askButton.setSelection(false); |
677 askButton.setSelection(false); |
715 setFileModeEnabled(true); |
678 setFileModeEnabled(true); |
716 } else if (mode.equals(Constants.LOGGING_ASK_ALLWAYS)) { |
679 } else if (mode.equals(Constants.LOGGING_ASK_ALLWAYS)) { |
717 externalButton.setSelection(false); |
|
718 externalFastButton.setSelection(false); |
680 externalFastButton.setSelection(false); |
719 s60Button.setSelection(false); |
681 s60Button.setSelection(false); |
720 askButton.setSelection(true); |
682 askButton.setSelection(true); |
721 setFileModeEnabled(false); |
683 setFileModeEnabled(false); |
722 } else if( mode.equals(Constants.LOGGING_EXT_FAST)) { |
684 } else if (mode.equals(Constants.LOGGING_EXT_FAST)) { |
723 externalButton.setSelection(false); |
|
724 externalFastButton.setSelection(true); |
685 externalFastButton.setSelection(true); |
725 s60Button.setSelection(false); |
686 s60Button.setSelection(false); |
726 askButton.setSelection(false); |
687 askButton.setSelection(false); |
727 setFileModeEnabled(false); |
688 setFileModeEnabled(false); |
728 } else { |
689 } |
729 externalButton.setSelection(true); |
690 // else { |
730 externalFastButton.setSelection(false); |
691 // externalButton.setSelection(true); |
731 s60Button.setSelection(false); |
692 // externalFastButton.setSelection(false); |
732 askButton.setSelection(false); |
693 // s60Button.setSelection(false); |
733 setFileModeEnabled(false); |
694 // askButton.setSelection(false); |
734 } |
695 // setFileModeEnabled(false); |
|
696 // } |
735 } |
697 } |
736 |
698 |
737 /** |
699 /** |
738 * Update atool.exe version number. |
700 * Update atool.exe version number. |
739 * |
701 * |
740 * @param path |
702 * @param path |
741 * Atool.exe location |
703 * Atool.exe location |
742 */ |
704 */ |
743 private void updateAtoolVersion(final String path) { |
705 private void updateAtoolVersion(final String path) { |
744 atoolVerLabel.setText(Util.getAtoolVersionNumber(path)); |
706 atoolVerLabel.setText(Util.getAtoolVersionNumber(path)); |
745 atoolVerLabel.update(); |
707 atoolVerLabel.update(); |
746 updateCSGroup(path); |
708 checkState(); |
747 } |
|
748 |
|
749 /** |
|
750 * Checks what version of command line is used, if the version is 1.7.4 or |
|
751 * higher enables callstack size selection otherwise disables callstack size |
|
752 * selection. |
|
753 * |
|
754 * @param path |
|
755 * Command line engine path |
|
756 */ |
|
757 private void updateCSGroup(final String path) { |
|
758 int compared = Constants.VERSION_NUMBERS_INVALID; |
|
759 |
|
760 // compare version numbers |
|
761 compared = Util.compareVersionNumber(Constants.CS_SUPPORT_MIN_VERSION, |
|
762 Util.getAtoolVersionNumber(path)); |
|
763 |
|
764 // if used command line version is 1.7.4 or higher enable callstack size |
|
765 // selection |
|
766 if (compared == Constants.VERSION_NUMBERS_SECOND |
|
767 || compared == Constants.VERSION_NUMBERS_EQUALS) { |
|
768 zeroButton.setEnabled(true); |
|
769 fortyButton.setEnabled(true); |
|
770 hundredButton.setEnabled(true); |
|
771 customButton.setEnabled(true); |
|
772 spinner.setEnabled(true); |
|
773 csSizeGroup.setToolTipText(""); |
|
774 externalFastButton.setEnabled(true); |
|
775 externalFastButton.setToolTipText(""); |
|
776 } else { |
|
777 zeroButton.setEnabled(false); |
|
778 fortyButton.setEnabled(false); |
|
779 hundredButton.setEnabled(false); |
|
780 customButton.setEnabled(false); |
|
781 spinner.setEnabled(false); |
|
782 csSizeGroup |
|
783 .setToolTipText(Constants.PREFS_CS_SIZE_DISABLED_TOOLTIP); |
|
784 |
|
785 if( externalFastButton.getSelection() ) { |
|
786 externalButton.setSelection(true); |
|
787 } |
|
788 externalFastButton.setSelection(false); |
|
789 externalFastButton.setEnabled(false); |
|
790 externalFastButton.setToolTipText(Constants.PREFS_CS_SIZE_DISABLED_TOOLTIP); |
|
791 |
|
792 |
|
793 } |
|
794 |
|
795 } |
709 } |
796 } |
710 } |