List of usage examples for org.eclipse.jface.preference IPreferenceStore getString
String getString(String name);
From source file:com.nokia.carbide.cpp.sysdoc.internal.hover.preferences.PreferencesPageControllerTest.java
License:Open Source License
@Test public void testDevLibChanged() throws Exception { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String preVal = store.getString(HoverConstants.PREFERENCE_DEV_LIB_LOC); Set<DevLibProperties> devLibPropertiesSet = DevLibPluginController.getInstance().getDevLibPropertiesSet(); Iterator<DevLibProperties> iterator = devLibPropertiesSet.iterator(); String newVal = preVal;//ww w .j a va 2s . co m while (iterator.hasNext()) { DevLibProperties devLibProp = iterator.next(); if (devLibProp.getUserFriendlyName().equals(preVal)) { continue; } newVal = devLibProp.getUserFriendlyName(); break; } store.setValue(HoverConstants.PREFERENCE_DEV_LIB_LOC, newVal); store.setValue(HoverConstants.PREFERENCE_DEACTIVATE_HOVERING, false); Thread.sleep(1000); PreferencesPageController.getInstance().analyseRecentPropertyChanges(); Thread.sleep(1000); assertTrue(PreferencesPageController.getInstance().getChangedProperties().isEmpty()); assertTrue(HoverManager.getActiveDevLibProperties().getUserFriendlyName().equals(newVal)); }
From source file:com.nokia.carbide.internal.bugdatacollector.ui.preferences.BugDataCollectorPreferencePage.java
License:Open Source License
private void getPrefsStoreValues() { IPreferenceStore store = BugDataCollectorPlugin.getPrefsStore(); String username = store.getString(BugDataCollectorPreferenceConstants.BR_USERNAME); emailText.setText(username);// w w w .j av a 2 s.co m String password = store.getString(BugDataCollectorPreferenceConstants.BR_PASSWORD); DesEncrypter encrypter = new DesEncrypter(); passwordText.setText(encrypter.decrypt(password)); boolean sdk = store.getBoolean(BugDataCollectorPreferenceConstants.BR_SEND_SDK_INFO); sdkButton.setSelection(sdk); boolean diagnostic = store.getBoolean(BugDataCollectorPreferenceConstants.BR_SEND_DIAGNOSTIC_LOG); logButton.setSelection(diagnostic); }
From source file:com.nokia.carbide.internal.bugdatacollector.ui.preferences.BugDataCollectorPreferencePage.java
License:Open Source License
/** * Checks if username and password are set * @return true if username and password are set, false if not. *//* ww w. ja v a 2 s .c o m*/ public static boolean hasUsernameAndPassword() { IPreferenceStore store = BugDataCollectorPlugin.getPrefsStore(); String username = store.getString(BugDataCollectorPreferenceConstants.BR_USERNAME); String password = store.getString(BugDataCollectorPreferenceConstants.BR_PASSWORD); if (username != "" && password != "") //$NON-NLS-1$ //$NON-NLS-2$ return true; return false; }
From source file:com.nokia.carbide.internal.bugdatacollector.ui.preferences.BugDataCollectorPreferencePage.java
License:Open Source License
/** * Returns the username//from www . j av a 2s.c o m * @return username */ public static String getUsername() { IPreferenceStore store = BugDataCollectorPlugin.getPrefsStore(); return store.getString(BugDataCollectorPreferenceConstants.BR_USERNAME); }
From source file:com.nokia.carbide.internal.bugdatacollector.ui.preferences.BugDataCollectorPreferencePage.java
License:Open Source License
/** * Returns the decrypted password.//from w w w .j ava2s.co m * @return decrypted password. */ public static String getPassword() { IPreferenceStore store = BugDataCollectorPlugin.getPrefsStore(); String password = store.getString(BugDataCollectorPreferenceConstants.BR_PASSWORD); DesEncrypter encrypter = new DesEncrypter(); return encrypter.decrypt(password); }
From source file:com.nokia.carbide.search.system.internal.ui.SearchPreferencePage.java
License:Open Source License
public static String getDefaultPerspectiveId() { handleDeletedPerspectives();//w ww . j a v a2s .c om IPreferenceStore store = SearchPlugin.getDefault().getPreferenceStore(); String id = store.getString(DEFAULT_PERSPECTIVE); if (id == null || id.length() == 0 || id.equals(NO_DEFAULT_PERSPECTIVE)) return null; else if (PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id) == null) { store.putValue(DEFAULT_PERSPECTIVE, id); return null; } return id; }
From source file:com.nokia.s60tools.analyzetool.builder.AnalyzeToolBuilder.java
License:Open Source License
/** * Runs AnalyzeTool build.// w w w .j a va 2s.c om * * @param type * Type of execution. Possible types ATOOL_INST or ATOOL_UNINST * @param monitor * Progress monitor reference * @param cpi * ICarbideProjectInfo reference * @param files * List of user selected mmp files * @return True is no errors otherwise False */ protected final boolean runBuild(final String type, final IProgressMonitor monitor, final ICarbideProjectInfo cpi, final List<IFile> files) { // get preference store IPreferenceStore store = Activator.getPreferences(); // get active logging mode String loggingMode = store.getString(Constants.LOGGING_MODE); verbose = store.getBoolean(Constants.ATOOL_VERBOSE); // possible error code from command line engine int errorCode = Constants.COMMAND_LINE_ERROR_CODE.OK.getCode(); // if logging mode is set to "ask always" // ask for user used logging mode if (Constants.LOGGING_ASK_ALLWAYS.equals(loggingMode)) { String[] outputMode = Util.openOutputModeDialog(); // user press "Cancel" if (outputMode == null) { buildCancelled(monitor, true); return false; } // if user selects S60 log file and mode // and data file must ask for user else if (Constants.LOGGING_S60.equals(outputMode[0])) { String logPath = outputMode[1]; String logFileName = outputMode[2]; errorCode = executeAtool(logPath, logFileName, type, outputMode[0], files, cpi, monitor); } else { // no need to ask data file for the user => just build // with // user selected logging mode errorCode = executeAtool(null, null, type, outputMode[0], files, cpi, monitor); } } // if used logging mode is s60 // and data file name must ask for the user else if (Constants.LOGGING_S60.equals(loggingMode)) { String path = store.getString(Constants.DEVICE_LOG_FILE_PATH); String fileName = store.getString(Constants.DEVICE_LOG_FILE_NAME); errorCode = executeAtool(path, fileName, type, loggingMode, files, cpi, monitor); } // build with selected mode else { errorCode = executeAtool(null, null, type, loggingMode, files, cpi, monitor); } // no errors from command line engine if (errorCode == Constants.COMMAND_LINE_ERROR_CODE.OK.getCode()) { return true; } // if some error code is returned from command line engine display it to // user and cancel build Constants.COMMAND_LINE_ERROR_CODE error = Util.getErrorCode(errorCode); Util.displayCommandLineError(error); buildCancelled(monitor, false); return false; }
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 w w . j a v a 2 s . c om * * @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 available.//from w w w . j a va2 s . c o m * * @return True if atool.exe found otherwise False */ public static boolean isAtoolAvailable() { IPreferenceStore store = Activator.getPreferences(); String folderLocation = store.getString(Constants.ATOOL_FOLDER); if (folderLocation.length() > 0) { if (!folderLocation.endsWith("\\")) { folderLocation += "\\"; } IPath atoolPath = new Path(folderLocation + "atool.exe"); // if folder does not exists if (atoolPath.toFile().exists()) { return true; } } return false; }
From source file:com.nokia.s60tools.analyzetool.internal.ui.graph.AnalyzeToolGraph.java
License:Open Source License
/** * Draws the graph on the canvas. Intended to be called on a paint event. * //www . j a v a 2s .co m * @param graphics */ public void paint(final Graphics graphics) { if (optimisedDrawing && !userInformed) { userInformed = true; IPreferenceStore preferenceStore = Activator.getPreferences(); if (!preferenceStore.getString(PROMPT_KEY).equals(MessageDialogWithToggle.ALWAYS)) { String dilaogTitle = "Optimised Graph"; String message = "The process contains too many memory operations to display efficiently. To optimise, only leaks will be indicated on the graph."; String toggleMessage = "Don't show this again"; MessageDialogWithToggle.openInformation(getShell(), dilaogTitle, message, toggleMessage, false, preferenceStore, PROMPT_KEY); } } Rectangle visibleRect = graphics.getClip(new Rectangle()); YConverter yConverter = new YConverter(getClientArea().height, model.getHighestCumulatedMemoryAlloc()); if (model.getSelectedProcess() != null && model.getSelectedProcess().getAllocsFrees().size() > 0) { PointList pts = new PointList((model.getSelectedProcess().getAllocsFrees().size() * 2) - 1); Point prevPt = null; List<Point> dotLocations = new ArrayList<Point>(); List<Integer> colorDotLocations = new ArrayList<Integer>(); for (BaseInfo info : model.getSelectedProcess().getAllocsFrees()) { int x_point = (int) ((info.getTime() - model.getFirstProcessTime()) / getScale()); int y_point = yConverter.bytesToY(info.getTotalMem()); if (y_point < 0) { y_point = 0; } if (prevPt != null) { pts.addPoint(x_point, prevPt.y); } Point nextPt = new Point(x_point, y_point); if (visibleRect.contains(nextPt) && (isLeak(info) || (!optimisedDrawing && !dotLocations.contains(nextPt) && validInThreshold(info)))) { // for improved performance, only draw dots that are in // visible clip area // and don't draw a dot if there is one already, unless it's // a leak dotLocations.add(nextPt); colorDotLocations.add(getColorForAllocType(info)); } pts.addPoint(nextPt); prevPt = nextPt; } if (pts.size() > 0) { graphics.pushState(); graphics.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_DARK_YELLOW)); graphics.setLineWidthFloat(optimisedDrawing ? 0.5f : 2.0f); graphics.drawPolyline(pts); graphics.setLineWidthFloat(optimisedDrawing ? 0.5f : 1.0f); graphics.setAntialias(SWT.ON); graphics.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_RED)); graphics.setBackgroundColor(Display.getDefault().getSystemColor(SWT.COLOR_RED)); int colourCode = SWT.COLOR_RED; for (int j = 0; j < dotLocations.size(); j++) { Point dotLocation = dotLocations.get(j); if (!optimisedDrawing && colorDotLocations.get(j) != colourCode) { colourCode = colorDotLocations.get(j); graphics.setBackgroundColor(Display.getDefault().getSystemColor(colourCode)); } // paint the dot graphics.fillOval(dotLocation.x - 2, dotLocation.y - 2, 5, 5); if (!optimisedDrawing && colourCode == SWT.COLOR_RED) { // draw a red line graphics.drawLine(dotLocation.x, dotLocation.y, dotLocation.x, yConverter.bytesToY(0)); } } graphics.popState(); } } }