Java Code Examples for org.eclipse.core.runtime.Preferences#getString()
The following examples show how to use
org.eclipse.core.runtime.Preferences#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: BaseUtils.java From http4e with Apache License 2.0 | 5 votes |
public static byte[] readFromPrefs( String prefName){ try { Plugin pl = (Plugin) CoreContext.getContext().getObject("p"); Preferences prefs = pl.getPluginPreferences(); String str64 = prefs.getString(prefName); byte[] data = Base64.decodeBase64(str64.getBytes("UTF8")); return data; } catch (UnsupportedEncodingException e) { ExceptionHandler.handle(e); } catch (Exception ignore) { ExceptionHandler.handle(ignore); } return null; }
Example 2
Source File: TextUMLPreferencePage.java From textuml with Eclipse Public License 1.0 | 5 votes |
private Object[] findCheckedElements() { Preferences preferences = TextUMLUIPlugin.getDefault().getPluginPreferences(); String rawString = preferences.getString(TextUMLUIPlugin.OPTIONS); List a = new ArrayList(); if (isNotEmpty(rawString)) { String[] selected = rawString.split(","); for (String optId : selected) { a.add(options.get(optId)); } } return a.toArray(); }
Example 3
Source File: PreferenceWrapper.java From birt with Eclipse Public License 1.0 | 5 votes |
public String getString( String name ) { if ( this.preferenceType == SPECIAL_TYPE && project != null ) { Preferences preference = prefs.getReportPreference( project ); if ( preference != null && preference.contains( name ) ) return preference.getString( name ); } return prefsStore.getString( name ); }
Example 4
Source File: MultiPageEditorContributor.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Gets the uima pref string. * * @param key the key * @param defaultValue the default value * @return the uima pref string */ private static String getUimaPrefString(String key, String defaultValue) { TAEConfiguratorPlugin plugin = TAEConfiguratorPlugin.getDefault(); Preferences prefs = plugin.getPluginPreferences(); boolean isDefault = prefs.isDefault(key); if (isDefault) prefs.setDefault(key, defaultValue); return prefs.getString(key); }
Example 5
Source File: OldMechanicPreferences.java From workspacemechanic with Eclipse Public License 1.0 | 4 votes |
/** * returns the value of given key as a string. */ public static String getString(String key) { Preferences prefs = getPreferences(); return prefs.getString(key); }
Example 6
Source File: ReportLauncherUtils.java From birt with Eclipse Public License 1.0 | 4 votes |
public static IPath getEclipseHome( ) { Preferences preferences = PDECore.getDefault( ).getPluginPreferences( ); return new Path( preferences.getString( ICoreConstants.PLATFORM_PATH ) ); }
Example 7
Source File: ContentAssistHistory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 3 votes |
/** * Loads a history from an XML encoded preference value. * * @param preferences the preferences to retrieve the history from * @param key the key under which the history is stored * @return the deserialized history, or <code>null</code> if there is nothing stored under the * given key * @throws CoreException if deserialization fails * @see #store(ContentAssistHistory, Preferences, String) on how to store a history such that it * can be read by this method */ public static ContentAssistHistory load(Preferences preferences, String key) throws CoreException { String value= preferences.getString(key); if (value != null && value.length() > 0) { return new ReaderWriter().load(new InputSource(new StringReader(value))); } return null; }