List of usage examples for org.eclipse.jface.preference IPreferenceStore setValue
void setValue(String name, boolean value);
From source file:com.nokia.carbide.cpp.sysdoc.internal.hover.preferences.PreferencesPageControllerTest.java
License:Open Source License
public void testDevLibInvalidChanged() throws Exception { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); store.setValue(HoverConstants.PREFERENCE_DEV_LIB_LOC, "Beee"); store.setValue(HoverConstants.PREFERENCE_DEV_LIB_LOC, "Booo"); store.setValue(HoverConstants.PREFERENCE_DEACTIVATE_HOVERING, false); Thread.sleep(1000);//from www.j a v a 2 s. c o m HoverManager.setActiveDevLibProperties(null); PreferencesPageController.getInstance().analyseRecentPropertyChanges(); Thread.sleep(1000); assertTrue(PreferencesPageController.getInstance().getChangedProperties().isEmpty()); assertNotNull(HoverManager.getActiveDevLibProperties()); }
From source file:com.nokia.carbide.cpp.sysdoc.internal.hover.preferences.PreferencesPageControllerTest.java
License:Open Source License
@Test public void testChangedProptery() throws Exception { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); boolean preVal = store.getBoolean(HoverConstants.PREFERENCE_DEACTIVATE_HOVERING); store.setValue(HoverConstants.PREFERENCE_DEACTIVATE_HOVERING, !preVal); Thread.sleep(1000);/*w ww. j ava 2 s .c o m*/ assertTrue(!PreferencesPageController.getInstance().getChangedProperties().isEmpty()); }
From source file:com.nokia.carbide.internal.bugdatacollector.ui.preferences.BugDataCollectorPreferencePage.java
License:Open Source License
@Override public boolean performOk() { IPreferenceStore store = BugDataCollectorPlugin.getPrefsStore(); store.setValue(BugDataCollectorPreferenceConstants.BR_USERNAME, emailText.getText().trim()); DesEncrypter encrypter = new DesEncrypter(); store.setValue(BugDataCollectorPreferenceConstants.BR_PASSWORD, encrypter.encrypt(passwordText.getText().trim())); store.setValue(BugDataCollectorPreferenceConstants.BR_SEND_SDK_INFO, sdkButton.getSelection()); store.setValue(BugDataCollectorPreferenceConstants.BR_SEND_DIAGNOSTIC_LOG, logButton.getSelection()); return super.performOk(); }
From source file:com.nokia.carbide.remoteconnections.RemoteConnectionsActivator.java
License:Open Source License
private void storeAgentRunningStates() { IPreferenceStore preferenceStore = getPreferenceStore(); for (IDeviceDiscoveryAgent agent : discoveryAgents) { String agentKey = AGENT_STATE_KEY_PREFIX + agent.getId(); if (!preferenceStore.contains(agentKey)) preferenceStore.setDefault(agentKey, true); preferenceStore.setValue(agentKey, agent.isRunning()); }/*from w w w. j av a2s. c o m*/ try { new InstanceScope().getNode(PLUGIN_ID).flush(); } catch (BackingStoreException e) { logError(e); } }
From source file:com.nokia.s60ct.gui.ApplicationWorkbenchWindowAdvisor.java
License:Open Source License
public void preWindowOpen() { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); configurer.setShowMenuBar(true);//from w w w .j a va 2s . c o m configurer.setShowCoolBar(true); configurer.setShowStatusLine(false); configurer.setTitle("S60 Configuration Tool"); configurer.setShellStyle(SWT.SHELL_TRIM); configurer.setShowPerspectiveBar(true); IPreferenceStore apiStore = PlatformUI.getPreferenceStore(); apiStore.setValue(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR, IWorkbenchPreferenceConstants.TOP_RIGHT); apiStore.setValue(IWorkbenchPreferenceConstants.SHOW_TEXT_ON_PERSPECTIVE_BAR, true); apiStore.setValue(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, "false"); apiStore.setValue(IWorkbenchPreferenceConstants.PERSPECTIVE_BAR_EXTRAS, PluginManager.INSTANCE.getAllPerspectivesID()); }
From source file:com.nokia.s60tools.analyzetool.builder.AnalyzeToolBuilder.java
License:Open Source License
/** * Cancels AnalyzeTool build.//from ww w. ja v a 2s . com * * @param monitor * Currently running progress monitor * @param continueBuild * False stops the whole build chain (including Carbide and other * builders) otherwise other than AnalyzeTool builds are executed * normally. */ public final void buildCancelled(final IProgressMonitor monitor, final boolean continueBuild) { IPreferenceStore store = Activator.getPreferences(); store.setValue(Constants.PREFS_BUILD_CANCELLED, true); // if user wants to continue build if (!continueBuild) { // write info to the Carbide console view getCarbideCommandLauncher().writeToConsole(Constants.BUILD_CANCELLED); // update monitor state monitor.setCanceled(true); monitor.done(); } boolean promptMPPChange = store.getBoolean(Constants.PREFS_PROMPT_MMP); boolean manageDeps = store.getBoolean(Constants.PREFS_MANAGE_DEPS); boolean useConcBuild = store.getBoolean(Constants.PREFS_CONC_BUILD); // build canceled set project preference back to normal IPreferenceStore cStore = CarbideBuilderPlugin.getDefault().getPreferenceStore(); cStore.setValue(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MMP_CHANGED_ACTION_PROMPT, promptMPPChange); cStore.setValue(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MANAGE_DEPENDENCIES, manageDeps); cStore.setValue(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_USE_CONCURRENT_BUILDING, useConcBuild); // CarbideCPPBuilder to forgot build state super.forgetLastBuiltState(); }
From source file:com.nokia.s60tools.analyzetool.builder.AnalyzeToolBuilder.java
License:Open Source License
/** * After the built is finished set preferences back to normal. * //from w ww. jav a 2 s . c o m * @param cpi * ICarbideProjectInfo refernece */ public final void runPostSteps(ICarbideProjectInfo cpi) { IPreferenceStore store = Activator.getPreferences(); boolean keepFilesSync = store.getBoolean(Constants.PREFS_KEEP_IN_SYNC); boolean promptMPPChange = store.getBoolean(Constants.PREFS_PROMPT_MMP); boolean manageDeps = store.getBoolean(Constants.PREFS_MANAGE_DEPS); boolean useConcBuild = store.getBoolean(Constants.PREFS_CONC_BUILD); // try to load ProjectUIPlugin class try { Class.forName("com.nokia.carbide.cpp.project.ui.utils.ProjectUIUtils"); // no need to keep project files in sync // this should fix the mmp selection dialog prompt com.nokia.carbide.cpp.project.ui.utils.ProjectUIUtils.setKeepProjectsInSync(keepFilesSync); } catch (ClassNotFoundException cnte) { // Do nothing by design } // set builder preference to not prompt mmp file change dialog IPreferenceStore cStore = CarbideBuilderPlugin.getDefault().getPreferenceStore(); // add existing/default values of Carbide builder settings cStore.setValue(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MMP_CHANGED_ACTION_PROMPT, promptMPPChange); cStore.setValue(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MANAGE_DEPENDENCIES, manageDeps); cStore.setValue(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_USE_CONCURRENT_BUILDING, useConcBuild); // try to remove -debug parameter from the build arguments list try { // get build configuration ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); // get build arguments info BuildArgumentsInfo info = config.getBuildArgumentsInfoCopy(); // get used platform String platform = config.getPlatformString(); String debug = "-debug"; String abldArgs = info.abldBuildArgs; // if platform is set to ARMV5 or GCCE if (platform.contains(Constants.BUILD_TARGET_ARMV5) || platform.contains(Constants.BUILD_TARGET_GCEE)) { // get "-debug" string index int index = abldArgs.indexOf(debug); // if abld build arguments contains only "-debug" parameter if (abldArgs.equals(debug)) { info.abldBuildArgs = ""; config.setBuildArgumentsInfo(info); } // remove just "-debug" word else if (abldArgs.contains(debug) && index != -1) { info.abldBuildArgs = abldArgs.substring(0, index) + abldArgs.substring(index + debug.length(), abldArgs.length()); config.setBuildArgumentsInfo(info); } } } catch (java.lang.NoSuchMethodError nsme) { // Do nothing by design // user might run AT with too old Carbide version } catch (Exception e) { e.printStackTrace(); } // after the build is finished => open the console view Util.openConsoleView(); }
From source file:com.nokia.s60tools.analyzetool.builder.AnalyzeToolBuilder.java
License:Open Source License
/** * Checks is atool.exe available and modifies Carbide preferences. * //from www .j a v a2s. c o m * @param launcher * Command launcher * @param monitor * Progress monitor * @param cpi * Carbide project info * @return True if all checks are OK, otherwise False */ protected final boolean runPreSteps(final CarbideCommandLauncher launcher, final IProgressMonitor monitor, final ICarbideProjectInfo cpi) { // set command launchers cmdLauncher = launcher; // check is atool.exe available if (!Util.isAtoolAvailable()) { launcher.writeToConsole(Constants.INFO_ATOOL_NOT_AVAILABLE); buildCancelled(monitor, false); Util.showMessageDialog(Constants.CLE_VERSION_MISMATCH, Constants.ERROR_ATOOL_NOT_AVAILABLE, SWT.ICON_ERROR); return false; } // check supported AnalyzeTool version String atoolVersion = Util.getAtoolVersionNumber(Util.getAtoolInstallFolder()); int compared = Util.compareVersionNumber(atoolVersion, Constants.MIN_CLE_SUPPORTED); if (compared == Constants.VERSION_NUMBERS_SECOND || compared == Constants.VERSION_NUMBERS_INVALID) { launcher.writeToConsole( MessageFormat.format(Constants.CLE_OLDER_THAN_MIN, Constants.MIN_CLE_SUPPORTED)); buildCancelled(monitor, false); Util.showMessageDialog(Constants.CLE_VERSION_MISMATCH, MessageFormat.format(Constants.CLE_OLDER_THAN_MIN, Constants.MIN_CLE_SUPPORTED), SWT.ICON_ERROR); return false; } /** * * Below is code a sample which are related to the AT-682, but it is * decided to let out from current release. String coreVersion = * Util.getAtoolCoreVersion(cpi.getProject()); compared = * Util.compareVersionNumber(coreVersion, atoolVersion); if( compared != * Constants.VERSION_NUMBERS_EQUALS ) { boolean retValue = * Util.openConfirmationDialog( * "AnalyzeTool command line engine and AnalyzeTool core version mismatch.\n" * + "This usually leads to problems.\n\nDo you want to continue?"); if( * !retValue ) { buildCancelled(monitor, false); return false; } } */ // remove existing error markers try { CarbideCPPBuilder.removeAllMarkers(cpi.getProject()); } catch (CoreException ce) { ce.printStackTrace(); return false; } // check used platform if (!checkPlatform(cpi)) { buildCancelled(monitor, Util.openConfirmationDialog(Constants.PLATFORM_NOT_SUPPORTED)); return false; } // check AnalyzeTool libraries final String libsCheck = Util.checkAtoolLibs(cpi); if (!libsCheck.equals(Constants.ATOOL_LIBS_OK)) { Util.showMessageDialog(Constants.DIALOG_TITLE, libsCheck, SWT.ICON_ERROR); buildCancelled(monitor, false); return false; } // use CarbideCPPBuilder to bldmake bldfiles for selected project String[] bldmakeArgs = { "bldfiles" }; CarbideCPPBuilder.invokeBldmakeCommand(cpi.getDefaultConfiguration(), launcher, bldmakeArgs, true); IPreferenceStore store = Activator.getPreferences(); // try to load ProjectUIPlugin class try { Class.forName("com.nokia.carbide.cpp.project.ui.ProjectUIPlugin"); // get keep project files in sync flag boolean keepFilesSync = com.nokia.carbide.cpp.project.ui.utils.ProjectUIUtils.keepProjectsInSync(); store.setValue(Constants.PREFS_KEEP_IN_SYNC, keepFilesSync); // no need to keep project files in sync // this should fix the mmp selection dialog prompt com.nokia.carbide.cpp.project.ui.utils.ProjectUIUtils.setKeepProjectsInSync(false); } catch (ClassNotFoundException cnfe) { // Do nothing by design } // set builder preference to not prompt mmp file change dialog IPreferenceStore cStore = CarbideBuilderPlugin.getDefault().getPreferenceStore(); // get existing values boolean promptMPPChange = cStore.getBoolean( com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MMP_CHANGED_ACTION_PROMPT); boolean manageDeps = cStore .getBoolean(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MANAGE_DEPENDENCIES); boolean useConcBuild = cStore .getBoolean(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_USE_CONCURRENT_BUILDING); // store existing values store.setValue(Constants.PREFS_PROMPT_MMP, promptMPPChange); store.setValue(Constants.PREFS_MANAGE_DEPS, manageDeps); store.setValue(Constants.PREFS_CONC_BUILD, useConcBuild); // add custom values for AnalyzeTool build cStore.setValue(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MMP_CHANGED_ACTION_PROMPT, false); cStore.setValue(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_MANAGE_DEPENDENCIES, false); cStore.setValue(com.nokia.carbide.cdt.builder.BuilderPreferenceConstants.PREF_USE_CONCURRENT_BUILDING, false); // try to add -debug parameter to the build arguments list try { // get selected build configuration ICarbideBuildConfiguration config = cpi.getDefaultConfiguration(); // get build arguments info BuildArgumentsInfo info = config.getBuildArgumentsInfoCopy(); // get selected platform String platform = cpi.getDefaultConfiguration().getPlatformString(); // if platform is ARMV5 or GCCE and the "-debug" parameter is not // set => we need set the parameter if ((platform.contains(Constants.BUILD_TARGET_ARMV5) || platform.contains(Constants.BUILD_TARGET_GCEE)) && !info.abldBuildArgs.contains("-debug")) { if (info.abldBuildArgs.length() > 0 && !info.abldBuildArgs.endsWith(" ")) { info.abldBuildArgs += " "; } info.abldBuildArgs += "-debug"; config.setBuildArgumentsInfo(info); } } // catch NoSuchMethodError because is it possible to use older versions // where this method is not available catch (java.lang.NoSuchMethodError nsme) { // Do nothing by design } return true; }
From source file:com.nokia.s60tools.analyzetool.builder.CustomPreBuilder.java
License:Open Source License
/** * Executes AnalyzeTool post actions when user builds projects. * /* w w w . ja va 2s .c o m*/ * @see com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder#build(int, * java.util.Map, org.eclipse.core.runtime.IProgressMonitor) */ @Override @SuppressWarnings("unchecked") protected IProject[] build(final int kind, final java.util.Map args, final IProgressMonitor monitor) { // clear used build parameters if (mmpFiles != null) { mmpFiles.clear(); } IPreferenceStore store = Activator.getPreferences(); store.setValue(Constants.PREFS_BUILD_CANCELLED, false); // get selected project reference final IProject project = super.getProject(); // get project info final ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project); final CarbideCommandLauncher launcher = new CarbideCommandLauncher(project, monitor, Constants.atoolParserIds, cpi.getINFWorkingDirectory()); launcher.showCommand(true); if (!runPreSteps(launcher, monitor, cpi)) { return null; } runBuild(Constants.ATOOL_INST, monitor, cpi, null); return new IProject[0]; }
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./* ww w . 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(); }