Search in sources :

Example 6 with ChainedPreferenceStore

use of org.eclipse.ui.texteditor.ChainedPreferenceStore in project webtools.sourceediting by eclipse.

the class AnnotationHoverProcessor method getPreferenceStore.

/**
 * Retreives the preference store If no preference store is currently
 * stored, retreive the appropriate preference store
 */
private IPreferenceStore getPreferenceStore() {
    if (fPreferenceStore == null) {
        IPreferenceStore sseEditorPrefs = SSEUIPlugin.getDefault().getPreferenceStore();
        IPreferenceStore baseEditorPrefs = EditorsUI.getPreferenceStore();
        fPreferenceStore = new ChainedPreferenceStore(new IPreferenceStore[] { sseEditorPrefs, baseEditorPrefs });
    }
    return fPreferenceStore;
}
Also used : ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 7 with ChainedPreferenceStore

use of org.eclipse.ui.texteditor.ChainedPreferenceStore 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() });
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) FixedScopedPreferenceStore(org.eclipse.xtext.ui.editor.preferences.FixedScopedPreferenceStore) IProject(org.eclipse.core.resources.IProject) ConfigurationScope(org.eclipse.core.runtime.preferences.ConfigurationScope)

Example 8 with ChainedPreferenceStore

use of org.eclipse.ui.texteditor.ChainedPreferenceStore in project xtext-eclipse by eclipse.

the class PreferenceStoreAccessImpl method getPreferenceStore.

@Override
public IPreferenceStore getPreferenceStore() {
    lazyInitialize();
    Activator activator = Activator.getDefault();
    if (activator != null)
        return new ChainedPreferenceStore(new IPreferenceStore[] { getWritablePreferenceStore(), activator.getPreferenceStore(), EditorsUI.getPreferenceStore() });
    return new ChainedPreferenceStore(new IPreferenceStore[] { getWritablePreferenceStore(), EditorsUI.getPreferenceStore() });
}
Also used : Activator(org.eclipse.xtext.ui.internal.Activator) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 9 with ChainedPreferenceStore

use of org.eclipse.ui.texteditor.ChainedPreferenceStore in project xtext-eclipse by eclipse.

the class PreferenceStoreAccessImpl method getContextPreferenceStore.

@Override
public IPreferenceStore getContextPreferenceStore(Object context) {
    lazyInitialize();
    // may be null on shutdown
    Activator activator = Activator.getDefault();
    if (activator != null)
        return new ChainedPreferenceStore(new IPreferenceStore[] { getWritablePreferenceStore(context), activator.getPreferenceStore(), EditorsUI.getPreferenceStore() });
    return new ChainedPreferenceStore(new IPreferenceStore[] { getWritablePreferenceStore(context), EditorsUI.getPreferenceStore() });
}
Also used : Activator(org.eclipse.xtext.ui.internal.Activator) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 10 with ChainedPreferenceStore

use of org.eclipse.ui.texteditor.ChainedPreferenceStore in project eclipse.platform.text by eclipse.

the class ChainedPreferenceStoreTest method testChainedStore3.

/**
 * Case where the initial implementation used to throw an IAE
 */
@Test
public void testChainedStore3() {
    IPreferenceStore store1 = new PreferenceStore();
    IPreferenceStore store2 = new PreferenceStore();
    IPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
    store2.setDefault(PROPERTY, DEFAULT_VALUE);
    chainedStore.addPropertyChangeListener(fPropertyChangeListener);
    // simulated removal with oldValue == null
    store1.firePropertyChangeEvent(PROPERTY, null, null);
    chainedStore.removePropertyChangeListener(fPropertyChangeListener);
    assertEquals(1, fEvents.size());
    PropertyChangeEvent event = fEvents.get(0);
    assertEquals(chainedStore, event.getSource());
    assertEquals(PROPERTY, event.getProperty());
    assertEquals(null, event.getOldValue());
    assertEquals(DEFAULT_VALUE, event.getNewValue());
}
Also used : PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) PreferenceStore(org.eclipse.jface.preference.PreferenceStore) Test(org.junit.Test)

Aggregations

ChainedPreferenceStore (org.eclipse.ui.texteditor.ChainedPreferenceStore)18 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)17 Test (org.junit.Test)5 PreferenceStore (org.eclipse.jface.preference.PreferenceStore)4 SourceViewerConfiguration (org.eclipse.jface.text.source.SourceViewerConfiguration)4 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)4 ColorManager (org.eclipse.titan.designer.editors.ColorManager)4 ForwardingDocumentProvider (org.eclipse.ui.editors.text.ForwardingDocumentProvider)4 TextFileDocumentProvider (org.eclipse.ui.editors.text.TextFileDocumentProvider)4 ConfigurationScope (org.eclipse.core.runtime.preferences.ConfigurationScope)3 InstanceScope (org.eclipse.core.runtime.preferences.InstanceScope)3 FixedScopedPreferenceStore (org.eclipse.xtext.ui.editor.preferences.FixedScopedPreferenceStore)2 Activator (org.eclipse.xtext.ui.internal.Activator)2 IProject (org.eclipse.core.resources.IProject)1 ProjectScope (org.eclipse.core.resources.ProjectScope)1 Document (org.eclipse.jface.text.Document)1 IDocument (org.eclipse.jface.text.IDocument)1 IReconciler (org.eclipse.jface.text.reconciler.IReconciler)1 ISourceViewer (org.eclipse.jface.text.source.ISourceViewer)1 SourceViewer (org.eclipse.jface.text.source.SourceViewer)1