Search in sources :

Example 16 with IEclipsePreferences

use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project eclipse.platform.text by eclipse.

the class HighlightStrategy method uninstall.

public void uninstall() {
    if (sourceViewer != null) {
        sourceViewer.getTextWidget().removeCaretListener(this);
    }
    IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(GENERIC_EDITOR_BUNDLE_ID);
    preferences.removePreferenceChangeListener(this);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences)

Example 17 with IEclipsePreferences

use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project eclipse.platform.text by eclipse.

the class HighlightStrategy method uninstall.

public void uninstall() {
    if (sourceViewer != null) {
        sourceViewer.getTextWidget().removeCaretListener(this);
    }
    IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(GENERIC_EDITOR_BUNDLE_ID);
    preferences.removePreferenceChangeListener(this);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences)

Example 18 with IEclipsePreferences

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);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer)

Example 19 with IEclipsePreferences

use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project eclipse.platform.text by eclipse.

the class DefaultWordHighlightStrategy method install.

public void install(ITextViewer viewer) {
    if (!(viewer instanceof ISourceViewer)) {
        return;
    }
    IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(GenericEditorPlugin.BUNDLE_ID);
    preferences.addPreferenceChangeListener(this);
    this.enabled = preferences.getBoolean(ToggleHighlight.TOGGLE_HIGHLIGHT_PREFERENCE, true);
    this.sourceViewer = (ISourceViewer) viewer;
    this.sourceViewer.getTextWidget().addCaretListener(this);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) ISourceViewer(org.eclipse.jface.text.source.ISourceViewer)

Example 20 with IEclipsePreferences

use of org.eclipse.core.runtime.preferences.IEclipsePreferences in project xtext-xtend by eclipse.

the class AbstractProfileManager method writeToPreferenceStore.

/**
 * Update all formatter settings with the settings of the specified profile.
 *
 * @param profile
 *            The profile to write to the preference store
 */
private void writeToPreferenceStore(Profile profile, IScopeContext context) {
    final Map profileOptions = profile.getSettings();
    for (int i = 0; i < fKeySets.length; i++) {
        updatePreferences(context.getNode(fKeySets[i].getNodeName()), fKeySets[i].getKeys(), profileOptions);
    }
    final IEclipsePreferences uiPrefs = context.getNode(getNodeId());
    if (uiPrefs.getInt(fProfileVersionKey, 0) != fProfileVersioner.getCurrentVersion()) {
        uiPrefs.putInt(fProfileVersionKey, fProfileVersioner.getCurrentVersion());
    }
    if (context.getName() == InstanceScope.SCOPE) {
        uiPrefs.put(fProfileKey, profile.getID());
    } else if (context.getName() == ProjectScope.SCOPE && !profile.isSharedProfile()) {
        uiPrefs.put(fProfileKey, profile.getID());
    }
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)79 BackingStoreException (org.osgi.service.prefs.BackingStoreException)15 Test (org.junit.Test)11 InstanceScope (org.eclipse.core.runtime.preferences.InstanceScope)9 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)9 IXMLMemento (com.cubrid.cubridmanager.core.common.xml.IXMLMemento)6 ProjectScope (org.eclipse.core.resources.ProjectScope)6 IScopeContext (org.eclipse.core.runtime.preferences.IScopeContext)6 After (org.junit.After)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 Iterator (java.util.Iterator)4 Map (java.util.Map)4 XMLMemento (com.cubrid.cubridmanager.core.common.xml.XMLMemento)3 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2