List of usage examples for org.eclipse.jface.preference IPreferenceStore getInt
int getInt(String name);
From source file:com.nokia.s60tools.testdrop.ui.preferences.TestDropPreferences.java
License:Open Source License
/** * Gets data which is saved to the preference store *///from ww w .ja va 2 s. c o m private void getPrefStoreValues() { IPreferenceStore prefStore = TestDropPlugin.getPrefStore(); boolean enableHardware = false; enableHardware = prefStore.getBoolean(TestDropPreferenceConstants.TEST_DROP_ENABLE_HARDWARE); enableHardwareTestDropCheck.setSelection(enableHardware); hostText.setEnabled(enableHardware); portText.setEnabled(enableHardware); usernameText.setEnabled(enableHardware); passwordText.setEnabled(enableHardware); confirmPasswordText.setEnabled(enableHardware); testServerConnectionButton.setEnabled(enableHardware); testDropImportButton.setEnabled(enableHardware); testDropPathText.setEnabled(enableHardware && !testDropImportButton.getSelection()); testDropPathBrowseButton.setEnabled(enableHardware && !testDropImportButton.getSelection()); hostText.setText(prefStore.getString(TestDropPreferenceConstants.TEST_DROP_CONNECTION_HOST)); int port = prefStore.getInt(TestDropPreferenceConstants.TEST_DROP_CONNECTION_PORT); if (port != 0) { portText.setText(String.valueOf(port)); } usernameText.setText(prefStore.getString(TestDropPreferenceConstants.TEST_DROP_CONNECTION_USERNAME)); passwordText.setText(prefStore.getString(TestDropPreferenceConstants.TEST_DROP_CONNECTION_PASSWORD)); confirmPasswordText.setText(prefStore.getString(TestDropPreferenceConstants.TEST_DROP_CONNECTION_PASSWORD)); String path = prefStore.getString(TestDropPreferenceConstants.TEST_DROP_PATH); boolean importUsed = prefStore.getBoolean(TestDropPreferenceConstants.TEST_DROP_IMPORT); if (path.length() == 0 && !importUsed) { testDropImportButton.setSelection(true); } else if (path.length() > 0 && !importUsed) { testDropImportButton.setSelection(false); testDropPathText.setEnabled(true); testDropPathText.setText(path); testDropPathBrowseButton.setEnabled(true); } else if (path.length() > 0 && importUsed) { testDropPathText.setText(path); } else if (!importUsed) { testDropPathText.setText(path); testDropPathText.setEnabled(true); testDropPathBrowseButton.setEnabled(true); testDropImportButton.setSelection(false); } String stored = prefStore.getString(TestDropPreferenceConstants.TEST_DROP_SHOW_TEST_RESULT); int count = testResultViewCombo.getItemCount(); boolean found = false; for (int i = 0; i < count; i++) { if (testResultViewCombo.getItem(i).equals(stored)) { testResultViewCombo.select(i); found = true; break; } } if (!found) { testResultViewCombo.select(0); } testResultPathText.setText(prefStore.getString(TestDropPreferenceConstants.TEST_DROP_TEST_RESULT_PATH)); String mode = prefStore.getString(TestDropPreferenceConstants.TEST_DROP_DIALOG_SHOW_MODE); if (mode.equals(DIALOG_SHOW_MODE_ALWAYS)) { alwaysButton.setSelection(true); String cache = prefStore.getString(TestDropPreferenceConstants.TEST_DROP_TARGET_DEVICE_CACHE); int itemCount = targetDeviceListCacheCombo.getItemCount(); for (int i = 0; i < itemCount; i++) { if (targetDeviceListCacheCombo.getItem(i).equals(cache)) { targetDeviceListCacheCombo.select(i); break; } } } else if (mode.equals(DIALOG_SHOW_MODE_DEFAULT)) { alwaysButton.setSelection(false); defaultButton.setSelection(true); setImage.setEnabled(true); targetDeviceListCombo.setEnabled(true); try { getTargetDeviceList(); } catch (Exception ex) { ex.printStackTrace(); } String selectedTagetDevice = prefStore .getString(TestDropPreferenceConstants.TEST_DROP_SELECTED_TARGET_DEVICE); int itemCount = targetDeviceListCombo.getItemCount(); boolean targetDeviceFound = false; for (int i = 0; i < itemCount; i++) { if (targetDeviceListCombo.getItem(i).equals(selectedTagetDevice)) { targetDeviceListCombo.select(i); targetDeviceFound = true; dialogModel.setSelectedMasterDeviceIndex(i); break; } } if (!targetDeviceFound) { targetDeviceListCombo.select(0); LogExceptionHandler.showErrorDialog( Messages.getString("TestDropPreferences.cannotResolveSelectedTargetDeviceException")); } String imageList = prefStore .getString(TestDropPreferenceConstants.TEST_DROP_TARGET_DEVICE_FLASH_IMAGE_LIST); List<File> images = new ArrayList<File>(); if (imageList.length() > 0) { while (imageList.indexOf(";") != -1) { String image = imageList.substring(0, imageList.indexOf(";")); imageList = imageList.substring(image.length() + 1); images.add(new File(image)); } if (imageList.length() > 0) { images.add(new File(imageList)); } } if (images.size() > 0) { dialogModel.getSelectedMasterDevice().setImages(images); StartUp.setDialogModel(dialogModel); } } }
From source file:com.nokia.s60tools.testdrop.util.StartUp.java
License:Open Source License
/** * Checks validity in connection properties * /* w w w .jav a 2 s . c o m*/ * @return true if connection property is valid otherwise false */ private static boolean isValidConnectionProperties() { IPreferenceStore prefStore = TestDropPlugin.getPrefStore(); String host = prefStore.getString(TestDropPreferenceConstants.TEST_DROP_CONNECTION_HOST); int port = prefStore.getInt(TestDropPreferenceConstants.TEST_DROP_CONNECTION_PORT); if (port == 0) { return false; } String username = prefStore.getString(TestDropPreferenceConstants.TEST_DROP_CONNECTION_USERNAME); String password = prefStore.getString(TestDropPreferenceConstants.TEST_DROP_CONNECTION_PASSWORD); String method = null; Path dropPath = null; String path = prefStore.getString(TestDropPreferenceConstants.TEST_DROP_PATH); boolean importUsed = prefStore.getBoolean(TestDropPreferenceConstants.TEST_DROP_IMPORT); if (importUsed) { method = HttpConnection.POST_METHOD; } else { method = HttpConnection.GET_METHOD; dropPath = new Path(path); } if (host.length() == 0 || username.length() == 0) { return false; } else { connectionProperty = new ConnectionPropertyValue(host, port, username, password, null, method, dropPath); return true; } }
From source file:com.nokia.sdt.symbian.dm.WorkspaceSourceFormatting.java
License:Open Source License
/** * Read CDT editor settings for information about tabbing and indentation. *//*from w w w .j a v a 2 s .c o m*/ private void rereadSettings() { IPreferenceStore cprefs = CUIPlugin.getDefault().getCombinedPreferenceStore(); usingTabs = !cprefs.getBoolean(SPACES_FOR_TABS); indentSpaces = cprefs.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH); endOfLine = runtimePreferences.get(Platform.PREF_LINE_SEPARATOR, null); if (endOfLine == null) endOfLine = System.getProperty("line.separator"); //$NON-NLS-1$ // NOTE: do not support MacOS-style line endings since // CDT is utterly unprepared to deal with these, // and crashes everywhere if (endOfLine.equals("\r")) { //$NON-NLS-1$ endOfLine = "\n"; //$NON-NLS-1$ Message msg = new Message(IMessage.WARNING, new MessageLocation(ResourcesPlugin.getWorkspace().getRoot().getLocation()), "WorkspaceSourceFormatting.IgnoringMacOSLineEndingSetting", //$NON-NLS-1$ Messages.getString("WorkspaceSourceFormatting.IgnoringMacOSLineEndingSetting"), //$NON-NLS-1$ new String[0]); MessageReporting.emitMessage(msg); } prefsEndOfLine = endOfLine; }
From source file:com.nokia.testfw.stf.scripteditor.editors.ScriptEditorConfiguration.java
License:Open Source License
/** * Creates Script Editor configuration//from w ww.j ava2 s . c om */ public ScriptEditorConfiguration() { assistant = new ContentAssistant(); reconciler = new PresentationReconciler(); scriptScanner = new ScriptScanner(); repairer = new DefaultDamagerRepairer(scriptScanner); scripterAssistProcessor = new ScripterAssistProcessor(); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); assistant.enableAutoActivation(store.getBoolean(PreferenceConstants.AUTO_ACTIVATION)); assistant.setAutoActivationDelay(store.getInt(PreferenceConstants.AUTO_ACTIVATION_DELAY)); }
From source file:com.nokia.tools.s60.views.GalleryPage.java
License:Open Source License
/** * Constructs the page with the specific gallery adapter. * /*from w w w.j av a 2 s . c o m*/ * @param adapter * the gallery adapter that is used for notifying the gallery * changed event. */ public GalleryPage(IGalleryAdapter adapter) { IPreferenceStore store = S60WorkspacePlugin.getDefault().getPreferenceStore(); mode = store.getInt(IS60IDEConstants.PREF_GALLERY_MODE); this.adapter = adapter; adapter.addGalleryListener(this); selectionListeners = new HashSet<ISelectionChangedListener>(8); controller = new JobController(); controller.start(); }
From source file:com.nokia.tools.s60.views.GalleryPage.java
License:Open Source License
/** * @return the style, can be either FIT_PAGE or MAXIMUM_STRETCH. *///w w w . j av a 2s . com public int getType() { if (overview != null && !overview.isDisposed()) { GalleryLayout layout = (GalleryLayout) overview.getLayout(); if (null != layout) return layout.getType(); } IPreferenceStore store = S60WorkspacePlugin.getDefault().getPreferenceStore(); return store.getInt(IS60IDEConstants.PREF_GALLERY_LAYOUT_TYPE); }
From source file:com.nokia.tools.screen.ui.dialogs.PathHandlingConfig.java
License:Open Source License
public static PathHandlingConfig load() { IPreferenceStore iPreferenceStore = UtilsPlugin.getDefault().getPreferenceStore(); PathHandlingConfig cfg = new PathHandlingConfig(); // Defaults/*from w w w .j a v a2s . com*/ iPreferenceStore.setDefault(PREF_USE_PREDEFINED, false); iPreferenceStore.setDefault(PREF_RECENT_COUNT, 5); cfg.usePredefined = iPreferenceStore.getBoolean(PREF_USE_PREDEFINED); cfg.recentCount = iPreferenceStore.getInt(PREF_RECENT_COUNT); int defCount = iPreferenceStore.getInt(PREF_PREDEFINED_COUNT); int recCount = iPreferenceStore.getInt(PREF_RECENT_COUNT); cfg.predefinedPathList = new ArrayList<String>(); for (int i = 0; i < defCount; i++) { String path = iPreferenceStore.getString(PREF_ADD_PREDEFINED + (i)); if (path.length() > 0 && new File(path).exists()) { cfg.predefinedPathList.add(path); } } cfg.recentPathList = new ArrayList<String>(); for (int i = 0; i < recCount; i++) { String path = iPreferenceStore.getString(PREF_ADD_RECENTLY + (i)); if (path.length() > 0 && new File(path).exists()) { cfg.recentPathList.add(path); } } return cfg; }
From source file:com.nokia.tools.theme.s60.cstore.ComponentPoolConfig.java
License:Open Source License
public static ComponentPoolConfig load() { IPreferenceStore iPreferenceStore = UtilsPlugin.getDefault().getPreferenceStore(); ComponentPoolConfig cfg = new ComponentPoolConfig(); iPreferenceStore.setDefault(PREF_ADD_EXAMPLES, true); cfg.addExampleThemes = iPreferenceStore.getBoolean(PREF_ADD_EXAMPLES); cfg.addOpenThemes = iPreferenceStore.getBoolean(PREF_ADD_OPEN_TH); cfg.addWorkspaceTheme = iPreferenceStore.getBoolean(PREF_ADD_WSPACE_TH); cfg.addCustomThemes = iPreferenceStore.getBoolean(PREF_ADD_CUSTOM_TH); int userCount = iPreferenceStore.getInt(PREF_ADD_USERTHEMECOUNT); cfg.userThemeList = new ArrayList<String>(); for (int a = 0; a < userCount; a++) { String path = iPreferenceStore.getString(PREF_ADD_USERTHEME_BASE + (a)); if (path.length() > 0 && new File(path).exists()) { cfg.userThemeList.add(path); }/*from ww w. ja v a 2s . c om*/ } return cfg; }
From source file:com.nokia.tools.theme.ui.dialogs.ThemeResourceSelectionPage.java
License:Open Source License
private void initSuggestionsAndHistory() { IPreferenceStore iPreferenceStore = UtilsPlugin.getDefault().getPreferenceStore(); int historyCount = iPreferenceStore.getInt(IScreenConstants.PREF_FILTER_HISTORY_COUNT); for (int i = 0; i < historyCount; i++) { String history = iPreferenceStore.getString(IScreenConstants.PREF_ADD_FILTER_HISTORY + (i)); suggestionsAndHistory.add(history); }/* www . j av a2 s.c om*/ }
From source file:com.nokia.tools.ui.dialog.PathHandlingConfig.java
License:Open Source License
public static PathHandlingConfig load() { IPreferenceStore iPreferenceStore = Activator.getDefault().getPreferenceStore(); PathHandlingConfig cfg = new PathHandlingConfig(); // Defaults/* ww w . java 2 s . c om*/ iPreferenceStore.setDefault(PREF_USE_PREDEFINED, false); iPreferenceStore.setDefault(PREF_RECENT_COUNT, 5); cfg.usePredefined = iPreferenceStore.getBoolean(PREF_USE_PREDEFINED); cfg.recentCount = iPreferenceStore.getInt(PREF_RECENT_COUNT); int defCount = iPreferenceStore.getInt(PREF_PREDEFINED_COUNT); int recCount = iPreferenceStore.getInt(PREF_RECENT_COUNT); cfg.predefinedPathList = new ArrayList<String>(); for (int i = 0; i < defCount; i++) { String path = iPreferenceStore.getString(PREF_ADD_PREDEFINED + (i)); if (path.length() > 0 && new File(path).exists()) { cfg.predefinedPathList.add(path); } } cfg.recentPathList = new ArrayList<String>(); for (int i = 0; i < recCount; i++) { String path = iPreferenceStore.getString(PREF_ADD_RECENTLY + (i)); if (path.length() > 0 && new File(path).exists()) { cfg.recentPathList.add(path); } } return cfg; }