use of org.eclipse.core.runtime.preferences.InstanceScope in project webtools.sourceediting by eclipse.
the class NewXMLGenerator method applyLineDelimiter.
private String applyLineDelimiter(IFile file, String text) {
String systemLineSeparator = System.getProperty("line.separator");
// $NON-NLS-1$
String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, systemLineSeparator, new IScopeContext[] { new ProjectScope(file.getProject()), new InstanceScope() });
if (!systemLineSeparator.equals(lineDelimiter)) {
String convertedText = StringUtils.replace(text, "\r\n", "\n");
convertedText = StringUtils.replace(convertedText, "\r", "\n");
convertedText = StringUtils.replace(convertedText, "\n", lineDelimiter);
return convertedText;
}
return text;
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project webtools.sourceediting by eclipse.
the class XMLCorePreferencesTest method testPluginSetPreferences.
/**
* Tests setting preference values by setting preference value to be a
* certain value, then getting the preference value to verify it was set.
*/
public void testPluginSetPreferences() {
IEclipsePreferences node = new InstanceScope().getNode(XMLCorePlugin.getDefault().getBundle().getSymbolicName());
pluginSetPreferenceBoolean(node, XMLCorePreferenceNames.CLEAR_ALL_BLANK_LINES);
pluginSetPreferenceString(node, XMLCorePreferenceNames.INDENTATION_CHAR);
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project xtext-xtend by eclipse.
the class XtendPreferenceStoreAccess method getContextPreferenceStore.
@SuppressWarnings("all")
@Override
public IPreferenceStore getContextPreferenceStore(Object context) {
IProject project = getProject(context);
if (project == null)
return getPreferenceStore();
IPreferenceStore store = super.getContextPreferenceStore(context);
ProjectScope projectScope = new ProjectScope(project);
FixedScopedPreferenceStore jdtStore = new FixedScopedPreferenceStore(projectScope, JavaCore.PLUGIN_ID);
jdtStore.setSearchContexts(new IScopeContext[] { projectScope, new InstanceScope(), new ConfigurationScope() });
return new ChainedPreferenceStore(new IPreferenceStore[] { store, jdtStore, PreferenceConstants.getPreferenceStore() });
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project cubrid-manager by CUBRID.
the class NodeFilterManager method loadFilterSetting.
@SuppressWarnings("deprecation")
private void loadFilterSetting() {
synchronized (this) {
IEclipsePreferences preference = new InstanceScope().getNode(CommonUIPlugin.PLUGIN_ID);
String xmlString = preference.get(FILTER_XML_CONTENT, "");
if (StringUtil.isEmpty(xmlString)) {
LOGGER.warn("The preference.get(FILTER_XML_CONTENT) has a empty string.");
return;
}
try {
ByteArrayInputStream in = new ByteArrayInputStream(xmlString.getBytes("UTF-8"));
IXMLMemento memento = XMLMemento.loadMemento(in);
if (memento == null) {
LOGGER.error("XMLMemento.loadMemento(in) is a null.");
return;
}
IXMLMemento[] children = memento.getChildren("idFilter");
for (int i = 0; i < children.length; i++) {
String id = children[i].getString("id");
idFilterList.add(id);
}
children = memento.getChildren("idGrayFilter");
for (int i = 0; i < children.length; i++) {
String id = children[i].getString("id");
idGrayFilterList.add(id);
}
children = memento.getChildren("nameFilter");
for (int i = 0; i < children.length; i++) {
String pattern = children[i].getString("pattern");
nameFilterList.add(pattern);
}
} catch (UnsupportedEncodingException e) {
LOGGER.error("loadFilterSetting()", e);
}
}
}
use of org.eclipse.core.runtime.preferences.InstanceScope in project cubrid-manager by CUBRID.
the class CubridStatusMonitorInstance method removeSetting.
/**
* Remove the info of StatusMonInstanceData relevant to key from preference
*
* @param key the key relevant to saving instance of StatusMonInstanceData
*/
public void removeSetting(String key) {
synchronized (this) {
IEclipsePreferences preference = new InstanceScope().getNode(CubridManagerUIPlugin.PLUGIN_ID);
preference.remove(key);
try {
preference.flush();
} catch (BackingStoreException ex) {
LOGGER.error(ex.getMessage());
}
}
}
Aggregations