List of usage examples for org.eclipse.jface.preference IPreferenceStore getBoolean
boolean getBoolean(String name);
From source file:com.nokia.s60tools.analyzetool.global.Util.java
License:Open Source License
/** * Gets atool.exe installation folder which is specified on preferences * page.//from w ww . j av a2s . com * * @return Atool.exe installation folder */ public static String getAtoolInstallFolder() { // get preference store IPreferenceStore store = Activator.getPreferences(); // create new string buffer StringBuffer atoolInstallFolder = new StringBuffer(); boolean useInternal = store.getBoolean(Constants.USE_INTERNAL); // append atool.exe installation folder String folder = store.getString(Constants.ATOOL_FOLDER); if (useInternal) { atoolInstallFolder.append(getDefaultAtoolLocation()); } else if (("").equals(folder)) { store.setValue(Constants.USE_INTERNAL, true); atoolInstallFolder.append(getDefaultAtoolLocation()); } else if (folder.equals(Constants.DEFAULT_ATOOL_FOLDER)) { File file = new File(Constants.DEFAULT_ATOOL_FOLDER); if (file.exists()) { atoolInstallFolder.append(Constants.DEFAULT_ATOOL_FOLDER); } else { store.setValue(Constants.USE_INTERNAL, true); atoolInstallFolder.append(getDefaultAtoolLocation()); } } else { atoolInstallFolder.append(folder); } // append atool.exe to installation path atoolInstallFolder.append("\\atool.exe"); return atoolInstallFolder.toString(); }
From source file:com.nokia.s60tools.analyzetool.global.Util.java
License:Open Source License
/** * Check is atool.exe verbose output checked. * //w ww. j av a2 s. c om * @return True verbose output is checked otherwise False */ public static boolean verboseAtoolOutput() { IPreferenceStore store = Activator.getPreferences(); return store.getBoolean(Constants.ATOOL_VERBOSE); }
From source file:com.nokia.s60tools.analyzetool.preferences.AnalyzeToolPreferencePage.java
License:Open Source License
/** * Checks preferences initial values if logging mode is not set to S60 * disables S60 data file name selections. *///w w w . j av a 2 s .c om public final void checkInitValues() { IPreferenceStore store = Activator.getPreferences(); // get stored atool folder String atoolFolder = store.getString(Constants.ATOOL_FOLDER); atoolVerLabel.setText(Constants.PREFS_ATOOL_VER_NOT_FOUND); // if atool folder is set to point default atool location if (atoolFolder.equals(Constants.DEFAULT_ATOOL_FOLDER)) { // check that stored atool location exists File file = new File(atoolFolder); if (file.exists()) { // if exists use this location and update // preference page buttons useDefaultLocation.setSelection(false); store.setValue(Constants.USE_INTERNAL, false); } else { // location could not found => use internal atool useDefaultLocation.setSelection(true); store.setValue(Constants.USE_INTERNAL, true); } } else { boolean useDef = store.getBoolean(Constants.USE_INTERNAL); useDefaultLocation.setSelection(useDef); } // get atool.exe path and set it atool.exe path field String atoolPath = store.getString(Constants.USER_SELECTED_FOLDER); atoolDirText.setText(atoolPath); // update preference page buttons handleDefaultLocationChange(); // get logging mode and update buttons String fileMode = store.getString(Constants.LOGGING_MODE); setGroupButtons(fileMode); logPathText.setText(store.getString(Constants.DEVICE_LOG_FILE_PATH)); fileNameText.setText(store.getString(Constants.DEVICE_LOG_FILE_NAME)); logPathText.setText(store.getString(Constants.DEVICE_LOG_FILE_PATH)); fileNameText.setText(store.getString(Constants.DEVICE_LOG_FILE_NAME)); verboseButton.setSelection(store.getBoolean(Constants.ATOOL_VERBOSE)); // get stored callstack size int callstackSize = store.getInt(Constants.CALLSTACK_SIZE); if (callstackSize == 0) { zeroButton.setSelection(true); spinner.setEnabled(false); } else if (callstackSize == 40) { fortyButton.setSelection(true); spinner.setEnabled(false); } else if (callstackSize == 100) { hundredButton.setSelection(true); spinner.setEnabled(false); } else { // if callstack size is set to custom area // enable spinner and set stored callstack size customButton.setSelection(true); spinner.setEnabled(true); spinner.setSelection(callstackSize); } }
From source file:com.nokia.s60tools.analyzetool.ui.MainView.java
License:Open Source License
/** * Change logging mode.//from ww w . j a v a2s.c om * * @param loggingMode * Used logging mode */ public final void changeLogTarget(final String loggingMode) { if (logTargetMenu == null) { return; } // get preference store IPreferenceStore store = Activator.getPreferences(); String usedLoggingMode = ""; // if no logging mode given get it from the AnalyzeTool preferences if (loggingMode == null) { usedLoggingMode = store.getString(Constants.LOGGING_MODE); } // logging mode is given => so start to use it else { store.setValue(Constants.LOGGING_MODE, loggingMode); usedLoggingMode = loggingMode; } if (Constants.LOGGING_S60.equals(usedLoggingMode)) { logTargetMenu.setImageDescriptor(Activator.getImageDescriptor(Constants.BUTTON_CELLURAR)); logTargetMenu.setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_S60); if (loggingMode == null) { s60LogTargetAction.setChecked(true); externalFastLogTargetAction.setChecked(false); askLogTargetAction.setChecked(false); } } else if (Constants.LOGGING_EXT_FAST.equals(usedLoggingMode)) { logTargetMenu.setImageDescriptor(Activator.getImageDescriptor(Constants.BUTTON_COMPUTER_FAST)); logTargetMenu.setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_FAST); if (loggingMode == null) { s60LogTargetAction.setChecked(false); externalFastLogTargetAction.setChecked(true); askLogTargetAction.setChecked(false); } } // current logging mode is "ask_always" else { logTargetMenu.setImageDescriptor(Activator.getImageDescriptor(Constants.BUTTON_ASK)); logTargetMenu.setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_ASK); if (loggingMode == null) { s60LogTargetAction.setChecked(false); externalFastLogTargetAction.setChecked(false); askLogTargetAction.setChecked(true); } } // if the fast data gathering mode is enabled by the preference page => // enable also toolbar option // else disable fast data gathering mode externalFastLogTargetAction.setEnabled(store.getBoolean(Constants.LOGGING_FAST_ENABLED)); }
From source file:com.nokia.s60tools.compatibilityanalyser.model.HeaderAnalyserEngine.java
License:Open Source License
/** * This method gets invoked if user selects Filter option. * This method reads the selecetd KnownIssues configuration from the preferences * and writes the KnownIssues path in the given configuration file. * @param report specifies name of the report being filtered. *//*from w ww . jav a 2s . co m*/ private void prepareKnownIssuesPath() { IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore(); LastUsedKnownissues issuesData = new LastUsedKnownissues(); String knownIssuesPath = null; try { if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_ISSUES)) { String[] issuesArr = issuesData.getPreviousValues(LastUsedKnownissues.ValueTypes.LOCAL_ISSUES_PATH); totalIssueFiles = issuesArr.length; if (issuesArr != null && issuesArr.length != 0) { String all = issuesArr[0]; for (int i = 1; i < issuesArr.length; i++) { all = all + ";" + issuesArr[i]; } knownIssuesPath = all; } } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_ISSUES)) { totalIssueFiles = 1; String corePath = CompatibilityAnalyserPlugin.getInstallPathOfToolsPlugin(); if (corePath == null || corePath.equalsIgnoreCase("")) { return; } else { File toolsFolder = new File(FileMethods.appendPathSeparator(corePath) + Messages.getString("HeaderAnalyserEngine.BCTools")); if (!toolsFolder.exists()) return; else knownIssuesPath = FileMethods.appendPathSeparator(toolsFolder.getAbsolutePath()) + Messages.getString("HeaderAnalyserEngine.data") + File.separator + Messages.getString("HeaderAnalyserEngine.knownissues.xml"); //$NON-NLS-3$ } } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_ISSUES)) { String[] issuesArr = issuesData.getPreviousValues(LastUsedKnownissues.ValueTypes.ISSUES_URL); totalIssueFiles = issuesArr.length; if (issuesArr != null && issuesArr.length != 0) { String all = issuesArr[0]; for (int i = 1; i < issuesArr.length; i++) { all = all + ";" + issuesArr[i]; } knownIssuesPath = all; } } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.LATEST_ISSUES)) { totalIssueFiles = 1; knownIssuesPath = prefStore.getString(CompatibilityAnalyserPreferencesConstants.KNOWNISSUES_URL); } FileOutputStream outStream = new FileOutputStream(configFile, true); outStream.write( (Messages.getString("HeaderAnalyserEngine.ISSUES_FILE") + knownIssuesPath + "\n").getBytes()); if (outStream != null) outStream.close(); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.nokia.s60tools.compatibilityanalyser.model.LibraryAnalyserEngine.java
License:Open Source License
/** * This method gets invoked after the Ordinal Analysis, if user selects Filter option. * This method filters the given report file. * This method reads the selecetd KnownIssues configuration from the preferences * and prepares the config file with Report Path and KnownIssues path. * @param report specifies name of the report being filtered. *///from w ww . j a v a 2 s .co m private void getKnonwIssuesData() { IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore(); LastUsedKnownissues issuesData = new LastUsedKnownissues(); String knownIssuesPath = null; try { if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_ISSUES)) { String[] issuesArr = issuesData.getPreviousValues(LastUsedKnownissues.ValueTypes.LOCAL_ISSUES_PATH); totalIssueFiles = issuesArr.length; if (issuesArr != null && issuesArr.length != 0) { String all = issuesArr[0]; for (int i = 1; i < issuesArr.length; i++) { all = all + ";" + issuesArr[i]; } knownIssuesPath = all; } } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_ISSUES)) { totalIssueFiles = 1; String corePath = CompatibilityAnalyserPlugin.getInstallPathOfToolsPlugin(); if (corePath == null || corePath.equalsIgnoreCase("")) { return; } else { File toolsFolder = new File(FileMethods.appendPathSeparator(corePath) + Messages.getString("LibraryAnalyserEngine.Bctools")); if (!toolsFolder.exists()) return; else knownIssuesPath = FileMethods.appendPathSeparator(toolsFolder.getAbsolutePath()) + Messages.getString("LibraryAnalyserEngine.data") + File.separator + Messages.getString("LibraryAnalyserEngine.knownissues.xml"); //$NON-NLS-3$ } } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_ISSUES)) { String[] issuesArr = issuesData.getPreviousValues(LastUsedKnownissues.ValueTypes.ISSUES_URL); totalIssueFiles = issuesArr.length; if (issuesArr != null && issuesArr.length != 0) { String all = issuesArr[0]; for (int i = 1; i < issuesArr.length; i++) { all = all + ";" + issuesArr[i]; } knownIssuesPath = all; } } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.LATEST_ISSUES)) { totalIssueFiles = 1; knownIssuesPath = prefStore.getString(CompatibilityAnalyserPreferencesConstants.KNOWNISSUES_URL); } FileOutputStream outStream = new FileOutputStream(configFile, true); outStream.write( (Messages.getString("LibraryAnalyserEngine.ISSUES_FILE") + knownIssuesPath + "\n").getBytes()); if (outStream != null) outStream.close(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.nokia.s60tools.compatibilityanalyser.model.ReportFilterEngine.java
License:Open Source License
/** * This method returns the path of the selected knownissues from the knownissues dialog. * i.e, If default is selected, returns the knownissues path from the core tools provided by the tool * And if the local issues is selected, returns the path provided in the combo * And if the web server issues is selected, returns the path of the issues files which is extracted from webserver * And if latest issues is selected, returns the path of the latest issues file which is extracted from webserver * @return string path of the issues file. *///from w ww.j a v a 2 s .com public String getKnownissuesPath() { LastUsedKnownissues issuesData = new LastUsedKnownissues(); IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore(); if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_ISSUES)) { String[] issuesArr = issuesData.getPreviousValues(LastUsedKnownissues.ValueTypes.LOCAL_ISSUES_PATH); if (issuesArr != null && issuesArr.length != 0) { String all = issuesArr[0]; for (int i = 1; i < issuesArr.length; i++) { all = all + ";" + issuesArr[i]; //$NON-NLS-1$ } data.knownissuesPath = all; } } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_ISSUES)) { String corePath = CompatibilityAnalyserPlugin.getInstallPathOfToolsPlugin(); data.knownissuesPath = corePath + File.separator + Messages.getString("ReportFilterEngine.Bctools") //$NON-NLS-1$ + File.separator + Messages.getString("ReportFilterEngine.data") + File.separator //$NON-NLS-1$ + Messages.getString("ReportFilterEngine.knownissues.xml"); //$NON-NLS-1$ } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_ISSUES)) { String[] issuesArr = issuesData.getPreviousValues(LastUsedKnownissues.ValueTypes.ISSUES_URL); if (issuesArr != null && issuesArr.length != 0) { String all = issuesArr[0]; for (int i = 1; i < issuesArr.length; i++) { all = all + ";" + issuesArr[i]; //$NON-NLS-1$ } data.knownissuesPath = all; } } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.LATEST_ISSUES)) { data.knownissuesPath = prefStore.getString(CompatibilityAnalyserPreferencesConstants.KNOWNISSUES_URL); } return data.knownissuesPath; }
From source file:com.nokia.s60tools.compatibilityanalyser.ui.dialogs.KnownissuesDilaog.java
License:Open Source License
private void getPrefsStoreValues() { IPreferenceStore store = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore(); radio1.setSelection(store.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_ISSUES)); radio2.setSelection(store.getBoolean(CompatibilityAnalyserPreferencesConstants.LATEST_ISSUES)); radio3.setSelection(store.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_ISSUES)); radio4.setSelection(store.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_ISSUES)); if (radio1.getSelection() == true) { list.setEnabled(false);//w ww . j ava 2s. c o m cmb.setEnabled(false); browse.setEnabled(false); remove.setEnabled(false); } if (radio2.getSelection() == true) { list.setEnabled(false); cmb.setEnabled(false); browse.setEnabled(false); remove.setEnabled(false); } if (radio3.getSelection() == true) { ArrayList<String> issuesList = new ArrayList<String>(); String status = CompatibilityAnalyserEngine.readMetadataFileFromWebServer(issuesUrl, Messages.getString("CompatibilityAnalyserEngine.knownissues_metadata"), issuesList); list.setEnabled(true); if (status == null) { radio3.setText(Messages.getString("KnownissuesDilaog.UseSelectedFromLocalFileSystem")); //$NON-NLS-1$ String[] items = issuesList.toArray(new String[0]); if (items != null) { list.setItems(items); list.setSelection(0); } ok.setEnabled(true); } else { radio3.setText(Messages.getString("KnownissuesDilaog.UseIssuesFromWebCouldNotFound")); //$NON-NLS-1$ radio3.getShell().layout(); ok.setEnabled(false); } cmb.setEnabled(false); browse.setEnabled(false); remove.setEnabled(false); } if (radio4.getSelection() == true) { list.setEnabled(false); cmb.setEnabled(true); browse.setEnabled(true); remove.setEnabled(true); if (cmb.getItemCount() != 0) ok.setEnabled(true); else ok.setEnabled(false); } }
From source file:com.nokia.s60tools.compatibilityanalyser.ui.editors.ComptAnalyserLauncher.java
License:Open Source License
private void runStaticAnalysis(CompatibilityAnalyserEngine engine) { ProductSdkData currentSdk = engine.getCurrentSdkData(); IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore(); if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_TOOLS)) { currentSdk.useDefaultCoreTools = true; currentSdk.useLocalCoreTools = false; currentSdk.useSdkCoreTools = false; currentSdk.useWebServerCoreTools = false; } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS)) { currentSdk.useDefaultCoreTools = false; currentSdk.useLocalCoreTools = true; currentSdk.useSdkCoreTools = false; currentSdk.useWebServerCoreTools = false; currentSdk.coreToolsPath = prefStore .getString(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS_PATH); } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS)) { currentSdk.useDefaultCoreTools = false; currentSdk.useLocalCoreTools = false; currentSdk.useSdkCoreTools = true; currentSdk.useWebServerCoreTools = false; currentSdk.coreToolsPath = prefStore .getString(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS_PATH); } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_TOOLS)) { currentSdk.useDefaultCoreTools = false; currentSdk.useLocalCoreTools = false; currentSdk.useSdkCoreTools = false; currentSdk.useWebServerCoreTools = true; currentSdk.urlPathofCoreTools = prefStore .getString(CompatibilityAnalyserPreferencesConstants.CORETOOLS_URL); }//from ww w . j av a 2 s. co m MainView mainView = MainView.showAndReturnYourself(); String currentDateTime = FileMethods.getDateTime(); FileMethods.createFolder( FileMethods.convertForwardToBackwardSlashes(CompatibilityAnalyserPlugin.stateLocation.toString()) + File.separator + currentDateTime); currentSdk.setconfigfolder( FileMethods.convertForwardToBackwardSlashes(CompatibilityAnalyserPlugin.stateLocation.toString()) + File.separator + currentDateTime); if (mainView != null) mainView.startAnalysis(engine); }
From source file:com.nokia.s60tools.compatibilityanalyser.ui.views.MainView.java
License:Open Source License
/** * Opens the analysis wizard./*from ww w. j a v a 2s. c o m*/ * */ public void showWizard() { //First Check if web server core tools are selected in preferences //If yes, check whether core tools are updated or not. IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore(); String urlInPref = prefStore.getString(CompatibilityAnalyserPreferencesConstants.CORETOOLS_URL); boolean webToolsSelected = prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_TOOLS); if (webToolsSelected && CompatibilityAnalyserEngine.isDownloadAndExtractionNeeded(urlInPref)) { //If not, ask for the confirmation boolean okPressed = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Compatibility Analyser", "Core components from Web server are in use.\nPress Ok to download them, or Cancel and change the settings in preferences page."); if (okPressed) { String status = CompatibilityAnalyserUtils.initiateDownloadingCoreTools(); if (status != null) { status = status + "\n\nNote: Using the different core tools may solve your problem."; MessageDialog.openError(tableviewer.getControl().getShell(), "Compatibility Analyser", status); return; } } else { return; } } //If the opened from the view, set false Runnable showWizardRunnable = new Runnable() { public void run() { WizardDialog wizDialog; CompatibilityAnalyserEngine engine = new CompatibilityAnalyserEngine(); AnalysisWizard wiz = new AnalysisWizard(engine); wiz.setNeedsProgressMonitor(true); wiz.setNeedsProgressMonitor(true); wizDialog = new WizardDialog(getViewSite().getShell(), wiz); wizDialog.create(); wizDialog.addPageChangedListener(wiz); wizDialog.getShell().setSize(wizDialog.getShell().getSize().x, wizDialog.getShell().getSize().y + 70); wizDialog.open(); } }; Display.getDefault().asyncExec(showWizardRunnable); }