use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project xtext-xtend by eclipse.
the class AbstractProfileManager method hasProjectSpecificSettings.
public static boolean hasProjectSpecificSettings(IScopeContext context, KeySet[] keySets) {
for (int i = 0; i < keySets.length; i++) {
KeySet keySet = keySets[i];
IEclipsePreferences preferences = context.getNode(keySet.getNodeName());
for (final Iterator keyIter = keySet.getKeys().iterator(); keyIter.hasNext(); ) {
final String key = (String) keyIter.next();
Object val = preferences.get(key, null);
if (val != null) {
return true;
}
}
}
return false;
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project xtext-xtend by eclipse.
the class FormatterProfileStore method writeProfiles.
/*
* Eclipse 3.5 uses raw types thus we have to use them here, too
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void writeProfiles(Collection profiles, IScopeContext instanceScope) throws CoreException {
ByteArrayOutputStream stream = new ByteArrayOutputStream(2000);
try {
writeProfilesToStream(profiles, stream, ENCODING, profileVersionerCopy);
String val;
try {
val = stream.toString(ENCODING);
} catch (UnsupportedEncodingException e) {
val = stream.toString();
}
IEclipsePreferences uiPreferences = instanceScope.getNode(xtendNodeID);
uiPreferences.put(XTEND_PROFILES_KEY, val);
uiPreferences.putInt(profilesVersionKeyCopy, profileVersionerCopy.getCurrentVersion());
} finally {
try {
stream.close();
} catch (IOException e) {
/* ignore */
}
}
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project eclipse.platform.text by eclipse.
the class HighlightStrategy method install.
public void install(ITextViewer viewer) {
if (!(viewer instanceof ISourceViewer)) {
return;
}
IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(GENERIC_EDITOR_BUNDLE_ID);
preferences.addPreferenceChangeListener(this);
this.enabled = preferences.getBoolean(TOGGLE_HIGHLIGHT_PREFERENCE, true);
this.sourceViewer = (ISourceViewer) viewer;
this.sourceViewer.getTextWidget().addCaretListener(this);
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project eclipse.platform.text by eclipse.
the class DefaultWordHighlightStrategy method uninstall.
public void uninstall() {
if (sourceViewer != null) {
sourceViewer.getTextWidget().removeCaretListener(this);
}
IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(GenericEditorPlugin.BUNDLE_ID);
preferences.removePreferenceChangeListener(this);
}
use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project eclipse.platform.text by eclipse.
the class ToggleHighlight method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Command command = event.getCommand();
boolean oldValue = HandlerUtil.toggleCommandState(command);
IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(GenericEditorPlugin.BUNDLE_ID);
preferences.putBoolean(TOGGLE_HIGHLIGHT_PREFERENCE, !oldValue);
return null;
}
Aggregations