Search in sources :

Example 11 with ChainedPreferenceStore

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

the class ChainedPreferenceStoreTest method testChainedStore2.

/**
 * Third case where the initial implementation used to have an assertion which would fail in this case
 */
@Test
public void testChainedStore2() {
    IPreferenceStore store1 = new PreferenceStore();
    IPreferenceStore store2 = new PreferenceStore();
    IPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
    store1.setValue(PROPERTY, VALUE);
    chainedStore.addPropertyChangeListener(fPropertyChangeListener);
    // simulated change with newValue == null
    store1.firePropertyChangeEvent(PROPERTY, DEFAULT_VALUE, null);
    chainedStore.removePropertyChangeListener(fPropertyChangeListener);
    assertEquals(1, fEvents.size());
    PropertyChangeEvent event = fEvents.get(0);
    assertEquals(store1, event.getSource());
    assertEquals(PROPERTY, event.getProperty());
    assertEquals(DEFAULT_VALUE, event.getOldValue());
    assertEquals(null, 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)

Example 12 with ChainedPreferenceStore

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

the class StructuredTextViewerConfiguration method createCombinedPreferenceStore.

/**
 * Create a preference store that combines the source editor preferences
 * with the base editor's preferences.
 *
 * @return IPreferenceStore
 */
private IPreferenceStore createCombinedPreferenceStore() {
    IPreferenceStore sseEditorPrefs = SSEUIPlugin.getDefault().getPreferenceStore();
    IPreferenceStore baseEditorPrefs = EditorsUI.getPreferenceStore();
    return new ChainedPreferenceStore(new IPreferenceStore[] { sseEditorPrefs, baseEditorPrefs });
}
Also used : ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 13 with ChainedPreferenceStore

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

the class XtendPreferenceStoreAccess method getPreferenceStore.

@SuppressWarnings("all")
@Override
public IPreferenceStore getPreferenceStore() {
    IPreferenceStore store = super.getPreferenceStore();
    FixedScopedPreferenceStore jdtStore = new FixedScopedPreferenceStore(new InstanceScope(), JavaCore.PLUGIN_ID);
    jdtStore.setSearchContexts(new IScopeContext[] { new InstanceScope(), new ConfigurationScope() });
    return new ChainedPreferenceStore(new IPreferenceStore[] { store, jdtStore, PreferenceConstants.getPreferenceStore() });
}
Also used : 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) ConfigurationScope(org.eclipse.core.runtime.preferences.ConfigurationScope)

Example 14 with ChainedPreferenceStore

use of org.eclipse.ui.texteditor.ChainedPreferenceStore in project titan.EclipsePlug-ins by eclipse.

the class TTCN3Editor method initializeEditor.

/**
 * Initialize the editor
 * <p>
 * This function is called by the constructor TTCN3Editor() before its first line of its body!
 */
@Override
protected void initializeEditor() {
    super.initializeEditor();
    IPreferenceStore[] stores = { getPreferenceStore(), Activator.getDefault().getPreferenceStore() };
    setPreferenceStore(new ChainedPreferenceStore(stores));
    colorManager = new ColorManager();
    configuration = new Configuration(colorManager, this);
    setSourceViewerConfiguration(configuration);
    ForwardingDocumentProvider forwardingProvider = new ForwardingDocumentProvider(PartitionScanner.TTCN3_PARTITIONING, new DocumentSetupParticipant(this), new TextFileDocumentProvider());
    setDocumentProvider(forwardingProvider);
    setEditorContextMenuId(EDITOR_CONTEXT);
    HeadlessStorage.setTabWidth(configuration.getTabWidth(getSourceViewer()));
}
Also used : SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) ForwardingDocumentProvider(org.eclipse.ui.editors.text.ForwardingDocumentProvider) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) ColorManager(org.eclipse.titan.designer.editors.ColorManager) TextFileDocumentProvider(org.eclipse.ui.editors.text.TextFileDocumentProvider)

Example 15 with ChainedPreferenceStore

use of org.eclipse.ui.texteditor.ChainedPreferenceStore in project titan.EclipsePlug-ins by eclipse.

the class TTCNPPEditor method initializeEditor.

@Override
protected void initializeEditor() {
    super.initializeEditor();
    IPreferenceStore[] stores = { getPreferenceStore(), Activator.getDefault().getPreferenceStore() };
    setPreferenceStore(new ChainedPreferenceStore(stores));
    colorManager = new ColorManager();
    configuration = new Configuration(colorManager, this);
    setSourceViewerConfiguration(configuration);
    DocumentSetupParticipant participant = new DocumentSetupParticipant(this);
    ForwardingDocumentProvider forwardingProvider = new ForwardingDocumentProvider(PartitionScanner.TTCNPP_PARTITIONING, participant, new TextFileDocumentProvider());
    setDocumentProvider(forwardingProvider);
    setEditorContextMenuId(EDITOR_CONTEXT);
}
Also used : SourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration) ForwardingDocumentProvider(org.eclipse.ui.editors.text.ForwardingDocumentProvider) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) ColorManager(org.eclipse.titan.designer.editors.ColorManager) TextFileDocumentProvider(org.eclipse.ui.editors.text.TextFileDocumentProvider)

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