Java Code Examples for org.eclipse.jface.preference.IPreferenceStore#getString()
The following examples show how to use
org.eclipse.jface.preference.IPreferenceStore#getString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PreferenceInitializer.java From ermasterr with Apache License 2.0 | 6 votes |
public static DBSetting getDBSetting(final int no) { final IPreferenceStore store = ERDiagramActivator.getDefault().getPreferenceStore(); final String dbsystem = store.getString(PreferenceInitializer.DB_SETTING_DBSYSTEM + no); final String server = store.getString(PreferenceInitializer.DB_SETTING_SERVER + no); final int portNo = store.getInt(PreferenceInitializer.DB_SETTING_PORT + no); final String database = store.getString(PreferenceInitializer.DB_SETTING_DATABASE + no); final String user = store.getString(PreferenceInitializer.DB_SETTING_USER + no); final String password = store.getString(PreferenceInitializer.DB_SETTING_PASSWORD + no); final String useDefaultDriverString = store.getString(PreferenceInitializer.DB_SETTING_USE_DEFAULT_DRIVER + no); final String url = store.getString(PreferenceInitializer.DB_SETTING_URL + no); final String driverClassName = store.getString(PreferenceInitializer.DB_SETTING_DRIVER_CLASS_NAME + no); boolean useDefaultDriver = true; if ("false".equals(useDefaultDriverString) || StandardSQLDBManager.ID.equals(dbsystem)) { useDefaultDriver = false; } return new DBSetting(dbsystem, server, portNo, database, user, password, useDefaultDriver, url, driverClassName); }
Example 2
Source File: FindBugsPreferenceInitializer.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
public static UserPreferences createDefaultUserPreferences() { UserPreferences prefs = UserPreferences.createDefaultUserPreferences(); IPreferenceStore store = FindbugsPlugin.getDefault().getPreferenceStore(); String categoriesStr = store.getString(DISABLED_CATEGORIES); Set<String> ids = decodeIds(categoriesStr); for (String categoryId : ids) { prefs.getFilterSettings().removeCategory(categoryId); } prefs.setRunAtFullBuild(false); // Do not need, as per default the factory default is used if key is // missing // TODO later we can use custom workspace settings to disable detectors // here // Iterator<DetectorFactory> iterator = // DetectorFactoryCollection.instance().factoryIterator(); // while (iterator.hasNext()) { // DetectorFactory factory = iterator.next(); // prefs.enableDetector(factory, factory.isDefaultEnabled()); // } return prefs; }
Example 3
Source File: XbaseBuilderPreferenceAccess.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
public JavaVersion getJavaVersion(Object context, IPreferenceStore preferenceStore) { boolean useCompilerSource = preferenceStore.getBoolean(PREF_USE_COMPILER_SOURCE); if (useCompilerSource) { IJavaProject javaProject = JavaCore.create(context instanceof IProject ? (IProject) context : null); String compilerSource; if (javaProject != null && javaProject.exists() && javaProject.getProject().isAccessible()) { compilerSource = javaProject.getOption(JavaCore.COMPILER_SOURCE, true); } else { compilerSource = JavaCore.getOption(JavaCore.COMPILER_SOURCE); } return fromCompilerSourceLevel(compilerSource); } else { String stringValue = preferenceStore.getString(PREF_JAVA_VERSION); try { return JavaVersion.valueOf(stringValue); } catch (IllegalArgumentException exception) { // Fall back to default value } } return JavaVersion.JAVA5; }
Example 4
Source File: PreferenceInitializer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void initDefaultLocalesPreference(final IPreferenceStore bonitaPreferenceStore) { Locale defaultStudioLocal = Locale.getDefault(); boolean defaultLocalExists = false; for (final Locale locale : getStudioLocales()) { if (locale.getLanguage().equals(defaultStudioLocal.getLanguage())) { defaultStudioLocal = locale; defaultLocalExists = true; break; } } String defaultLocaleValue = bonitaPreferenceStore.getString(DEFAULT_STUDIO_LOCALE);// Default value is compute on the first the studio is run // only because Locale.getDefault() is based on osgi.nl // property if (defaultLocaleValue == null || defaultLocaleValue.isEmpty()) { bonitaPreferenceStore.setValue(DEFAULT_STUDIO_LOCALE, defaultLocalExists ? defaultStudioLocal.getLanguage() : Locale.ENGLISH.getLanguage()); defaultLocaleValue = bonitaPreferenceStore.getString(DEFAULT_STUDIO_LOCALE); } bonitaPreferenceStore.setDefault(CURRENT_UXP_LOCALE, defaultLocaleValue(defaultLocaleValue)); bonitaPreferenceStore.setDefault(CURRENT_STUDIO_LOCALE, defaultLocaleValue(defaultLocaleValue)); LocaleUtil.DEFAULT_LOCALE = Locale.forLanguageTag(defaultLocaleValue(defaultLocaleValue)); }
Example 5
Source File: ProfileManager.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
/** * Read all profiles from the given store to this profile manager * @param ips */ public void readFromStore(IPreferenceStore ips) { int allCount = ips.getInt(idInStore + ID_PROFILES_COUNT); for (int cnt=0; cnt < allCount; ++cnt) { try { String xml = ips.getString(idInStore + ID_PROFILE + cnt); StringReader reader = new StringReader(xml); XMLMemento memento = XMLMemento.createReadRoot(reader); IProfile ip = profileFactory.createFromMemento(memento); if (ip != null) { String name = ip.getName(); IProfile ipOld = getProfile(name); if (ipOld == null) { profiles.add(ip); } else { ipOld.copyFrom(ip); } } } catch (Exception e) { LogHelper.logError(e); } } setActiveProfileName(ips.getString(idInStore + ID_ACTIVE_PROFILE_NAME)); }
Example 6
Source File: IndentGuidePreferencePage.java From IndentGuide with MIT License | 6 votes |
private void loadPreferences() { final IPreferenceStore store = getPreferenceStore(); enabled.setSelection(store.getBoolean(PreferenceConstants.ENABLED)); lineAlpha.setSelection(store.getInt(PreferenceConstants.LINE_ALPHA)); int index = store.getInt(PreferenceConstants.LINE_STYLE) - 1; if (index < 0 || index >= styles.length) { index = 0; } lineStyle.setText(styles[index]); lineWidth.setSelection(store.getInt(PreferenceConstants.LINE_WIDTH)); lineShift.setSelection(store.getInt(PreferenceConstants.LINE_SHIFT)); colorFieldEditor.load(); drawLeftEnd.setSelection(store .getBoolean(PreferenceConstants.DRAW_LEFT_END)); drawBlankLine.setSelection(store .getBoolean(PreferenceConstants.DRAW_BLANK_LINE)); skipCommentBlock.setSelection(store .getBoolean(PreferenceConstants.SKIP_COMMENT_BLOCK)); enableControls(enabled.getSelection()); final String type = store.getString(PreferenceConstants.CONTENT_TYPES); final String types[] = type.split("\\|"); for (final TreeItem child : contentTypesTree.getItems()) { checkContentType(child, types); } }
Example 7
Source File: NewJavaProjectPreferencePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public static IClasspathEntry[] getDefaultJRELibrary() { IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); String str= store.getString(CLASSPATH_JRELIBRARY_LIST); int index= store.getInt(CLASSPATH_JRELIBRARY_INDEX); StringTokenizer tok= new StringTokenizer(str, ";"); //$NON-NLS-1$ while (tok.hasMoreTokens() && index > 0) { tok.nextToken(); index--; } if (tok.hasMoreTokens()) { IClasspathEntry[] res= decodeJRELibraryClasspathEntries(tok.nextToken()); if (res.length > 0) { return res; } } return new IClasspathEntry[] { getJREContainerEntry() }; }
Example 8
Source File: GamaActionBarAdvisor.java From gama with GNU General Public License v3.0 | 6 votes |
/** * Creates the feature-dependent actions for the menu bar. */ private void makeFeatureDependentActions(final IWorkbenchWindow aWindow) { // final AboutInfo[] infos = null; final IPreferenceStore prefs = IDEWorkbenchPlugin.getDefault().getPreferenceStore(); // Optimization: avoid obtaining the about infos if the platform state is // unchanged from last time. See bug 75130 for details. final String stateKey = "platformState"; //$NON-NLS-1$ final String prevState = prefs.getString(stateKey); final String currentState = String.valueOf(Platform.getStateStamp()); final boolean sameState = currentState.equals(prevState); if ( !sameState ) { prefs.putValue(stateKey, currentState); } }
Example 9
Source File: GhidraProjectCreatorPreferences.java From ghidra with Apache License 2.0 | 5 votes |
/** * Gets the set of Ghidra installation directories that's defined in the preferences. * * @return The set of Ghidra installation directories that's defined in the preferences. */ public static Set<File> getGhidraInstallDirs() { IPreferenceStore prefs = Activator.getDefault().getPreferenceStore(); String ghidraInstallDirPaths = prefs.getString(GHIDRA_INSTALL_PATHS); if (ghidraInstallDirPaths.isEmpty()) { return Collections.emptySet(); } return Arrays.stream(ghidraInstallDirPaths.split(File.pathSeparator)).map( p -> new File(p)).collect(Collectors.toSet()); }
Example 10
Source File: LoggerPreference.java From olca-app with Mozilla Public License 2.0 | 5 votes |
static Level getLogLevel() { IPreferenceStore store = getStore(); String levelId = store.getString(LOG_LEVEL); if (levelId == null) return Level.INFO; return getLevelForId(levelId); }
Example 11
Source File: QACommonFuction.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 获取当前可用的品质检查项。 * @return List<String> 存放每个检查项的 id ,如 QAConstant.QA_TagConsistence; */ public static List<String> getUseableQAItems(){ List<String> usebaleQAItemList = new ArrayList<String>(); final IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String useableQAItemStr = store.getString(QAConstant.PREF_useableQAItemStr); if (!useableQAItemStr.isEmpty()) { usebaleQAItemList = Arrays.asList(useableQAItemStr.split(";")); } return usebaleQAItemList; }
Example 12
Source File: BuildPathsBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static IPath getDefaultOutputLocation(IJavaProject jproj) { IPreferenceStore store= PreferenceConstants.getPreferenceStore(); if (store.getBoolean(PreferenceConstants.SRCBIN_FOLDERS_IN_NEWPROJ)) { String outputLocationName= store.getString(PreferenceConstants.SRCBIN_BINNAME); return jproj.getProject().getFullPath().append(outputLocationName); } else { return jproj.getProject().getFullPath(); } }
Example 13
Source File: EclipsePreferencesProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public IPreferenceValues getPreferenceValues(Resource context) { final IProject project = getProject(context); final IPreferenceStore store = project != null ? access.getContextPreferenceStore(project) : access.getPreferenceStore(); final Map<String, String> preferenceCache = Maps.newHashMap(); return new IPreferenceValues() { @Override public String getPreference(PreferenceKey key) { try { String id = key.getId(); String string = preferenceCache.get(id); if (string == null) { string = store.getString(id); preferenceCache.put(id, string); } return org.eclipse.jface.preference.IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(string) ? key.getDefaultValue() : string; } catch (Exception e) { log.error("Error getting preference for key '"+key.getId()+"'.", e); return key.getDefaultValue(); } } }; }
Example 14
Source File: SharedDefaultPreferences.java From n4js with Eclipse Public License 1.0 | 4 votes |
/** Checks all default preferences that are shared between all n4js products */ static public void testDefaultPreferences() { // org.eclipse.core.resources IPreferenceStore prefsCoreResources = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.core.resources"); boolean prefsCoreResources_refreshEnabled = prefsCoreResources.getBoolean("refresh.enabled"); String prefsCoreResources_encoding = prefsCoreResources.getString("encoding"); assertTrue(prefsCoreResources_refreshEnabled); assertEquals(prefsCoreResources_encoding, "UTF-8"); // org.eclipse.ui.editors IPreferenceStore prefsUiEditors = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.ui.editors"); boolean prefsUiEditors_spacesForTabs = prefsUiEditors.getBoolean("spacesForTabs"); assertTrue(prefsUiEditors_spacesForTabs); // org.eclipse.ui.ide IPreferenceStore prefsUiIde = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.ui.ide"); boolean prefsUiIde_REFRESH_WORKSPACE_ON_STARTUP = prefsUiIde.getBoolean("REFRESH_WORKSPACE_ON_STARTUP"); boolean prefsUiIde_tipsAndTricks = prefsUiIde.getBoolean("tipsAndTricks"); boolean prefsUiIde_EXIT_PROMPT_ON_CLOSE_LAST_WINDOW = prefsUiIde.getBoolean("EXIT_PROMPT_ON_CLOSE_LAST_WINDOW"); boolean prefsUiIde_WELCOME_DIALOG = prefsUiIde.getBoolean("WELCOME_DIALOG"); assertTrue(prefsUiIde_REFRESH_WORKSPACE_ON_STARTUP); assertFalse(prefsUiIde_tipsAndTricks); assertFalse(prefsUiIde_EXIT_PROMPT_ON_CLOSE_LAST_WINDOW); assertFalse(prefsUiIde_WELCOME_DIALOG); // org.eclipse.ui IPreferenceStore prefsUi = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.ui"); boolean prefsUi_showIntro = prefsUi.getBoolean("showIntro"); boolean prefsUi_SHOW_PROGRESS_ON_STARTUP = prefsUi.getBoolean("SHOW_PROGRESS_ON_STARTUP"); String prefsUi_defaultPerspectiveId = prefsUi.getString("defaultPerspectiveId"); boolean prefsUi_SHOW_TEXT_ON_PERSPECTIVE_BAR = prefsUi.getBoolean("SHOW_TEXT_ON_PERSPECTIVE_BAR"); String prefsUi_PERSPECTIVE_BAR_EXTRAS = prefsUi.getString("PERSPECTIVE_BAR_EXTRAS"); assertFalse(prefsUi_showIntro); assertTrue(prefsUi_SHOW_PROGRESS_ON_STARTUP); assertEquals(prefsUi_defaultPerspectiveId, "org.eclipse.n4js.product.N4JSPerspective"); assertFalse(prefsUi_SHOW_TEXT_ON_PERSPECTIVE_BAR); assertEquals(prefsUi_PERSPECTIVE_BAR_EXTRAS, "org.eclipse.n4js.product.N4JSPerspective,org.eclipse.egit.ui.GitRepositoryExploring"); }
Example 15
Source File: JavaElementLabelComposer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private String getPkgNamePatternForPackagesView() { IPreferenceStore store= PreferenceConstants.getPreferenceStore(); if (!store.getBoolean(PreferenceConstants.APPEARANCE_COMPRESS_PACKAGE_NAMES)) return ""; //$NON-NLS-1$ return store.getString(PreferenceConstants.APPEARANCE_PKG_NAME_PATTERN_FOR_PKG_VIEW); }
Example 16
Source File: TLCChainedPreferenceStore.java From tlaplus with MIT License | 4 votes |
public String getString(String name) { IPreferenceStore visibleStore= getVisibleStore(name); if (visibleStore != null) return visibleStore.getString(name); return STRING_DEFAULT_DEFAULT; }
Example 17
Source File: TimeGraphStyleUtil.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
/** * Load default values into the state item from a preference store * * @param presentationProvider * the presentation provider * @param stateItem * the state item */ public static void loadValue(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { IPreferenceStore store = getStore(); String oldFillColorKey = getPreferenceName(presentationProvider, stateItem, ITimeEventStyleStrings.fillColor()); String oldHeightFactorKey = getPreferenceName(presentationProvider, stateItem, ITimeEventStyleStrings.heightFactor()); String fillColorKey = getPreferenceName(presentationProvider, stateItem, StyleProperties.BACKGROUND_COLOR); String heightFactorKey = getPreferenceName(presentationProvider, stateItem, StyleProperties.HEIGHT); String widthKey = getPreferenceName(presentationProvider, stateItem, StyleProperties.WIDTH); Map<String, Object> styleMap = stateItem.getStyleMap(); String prefRgbColor = store.getString(fillColorKey); if (!prefRgbColor.isEmpty()) { styleMap.put(StyleProperties.BACKGROUND_COLOR, prefRgbColor); styleMap.put(StyleProperties.COLOR, prefRgbColor); } else { // Update the new value with the old String oldPrefRgbColor = store.getString(oldFillColorKey); if (!oldPrefRgbColor.isEmpty()) { RGBAColor prefRgba = RGBAColor.fromString(oldPrefRgbColor); if (prefRgba != null) { String hexColor = ColorUtils.toHexColor(prefRgba.getRed(), prefRgba.getGreen(), prefRgba.getBlue()); styleMap.put(StyleProperties.BACKGROUND_COLOR, hexColor); styleMap.put(StyleProperties.COLOR, hexColor); store.setValue(fillColorKey, hexColor); } } } store.setDefault(heightFactorKey, -1.0f); store.setDefault(oldHeightFactorKey, -1.0f); float prefHeightFactor = store.getFloat(heightFactorKey); if (prefHeightFactor != -1.0f) { styleMap.put(StyleProperties.HEIGHT, prefHeightFactor); } else { // Update the new value with the old prefHeightFactor = store.getFloat(oldHeightFactorKey); if (prefHeightFactor != -1.0f) { styleMap.put(StyleProperties.HEIGHT, prefHeightFactor); store.setValue(heightFactorKey, prefHeightFactor); } } store.setDefault(widthKey, -1); int prefWidth = store.getInt(widthKey); if (prefWidth != -1) { styleMap.put(StyleProperties.WIDTH, prefWidth); } }
Example 18
Source File: StartCompiler.java From uml2solidity with Eclipse Public License 1.0 | 4 votes |
public static void startCompiler(File outFile, List<String> src, IPreferenceStore store, CompilerCallback callback) { if (src == null || src.isEmpty()) return; String command = store.getString(PreferenceConstants.COMPILER_PROGRAMM); if (command == null || command.isEmpty()) return; ArrayList<String> list = new ArrayList<String>(); list.add(command); if (store.getBoolean(PreferenceConstants.COMPILER_BIN)) list.add("--bin"); if (store.getBoolean(PreferenceConstants.COMPILER_ABI)) list.add("--abi"); if (store.getBoolean(PreferenceConstants.COMPILER_AST)) list.add("--ast"); if (store.getBoolean(PreferenceConstants.COMPILER_AST_JSON)) list.add("--ast-json"); if (store.getBoolean(PreferenceConstants.COMPILER_ASM)) list.add("--asm"); if (store.getBoolean(PreferenceConstants.COMPILER_ASM_JSON)) list.add("--asm-json"); if (store.getBoolean(PreferenceConstants.COMPILER_INTERFACT)) list.add("--interface"); if (store.getBoolean(PreferenceConstants.COMPILER_USERDOC)) list.add("--userdoc"); if (store.getBoolean(PreferenceConstants.COMPILER_DEVDOC)) list.add("--devdoc"); if (store.getBoolean(PreferenceConstants.COMPILER_BIN_RUNTIME)) list.add("--bin-runtime"); if (store.getBoolean(PreferenceConstants.COMPILER_OPCODE)) list.add("--opcode"); if (store.getBoolean(PreferenceConstants.COMPILER_FORMAL)) list.add("--formal"); if (store.getBoolean(PreferenceConstants.COMPILER_HASHES)) list.add("--hashes"); if (store.getBoolean(PreferenceConstants.COMBINED_JSON)){ list.add("--combined-json"); list.add(store.getString(PreferenceConstants.COMBINED_JSON_OPTIONS)); } startCompiler(outFile, src, callback, list); }
Example 19
Source File: SVNPreferencesPage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
protected Object getValue(IPreferenceStore store, String key) { return store.getString(key); }
Example 20
Source File: Uml2Service.java From uml2solidity with Eclipse Public License 1.0 | 2 votes |
/** * Returns the directory for the abi generation. * * @param an * element * @return */ public static String getAbiDirectory(NamedElement clazz) { IPreferenceStore store = getStore(clazz); return store.getString(PreferenceConstants.GENERATE_ABI_TARGET); }