Search in sources :

Example 16 with ChainedPreferenceStore

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

the class ConfigTextEditor 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();
    ForwardingDocumentProvider forwardingProvider = new ForwardingDocumentProvider(PartitionScanner.CONFIG_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)

Example 17 with ChainedPreferenceStore

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

the class ASN1Editor 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.ASN1_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)

Example 18 with ChainedPreferenceStore

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

the class PreferenceStoreAccessTest method testChainedPreferenceStore.

@SuppressWarnings("deprecation")
@Test
public void testChainedPreferenceStore() {
    ScopedPreferenceStore configurationStore = new ScopedPreferenceStore(new ConfigurationScope(), LANGUAGE_ID);
    configurationStore.setValue("someInt", 12);
    configurationStore.setValue("anotherInt", 12);
    configurationStore.setDefault("thirdInt", 12);
    ScopedPreferenceStore instanceStore = new ScopedPreferenceStore(new InstanceScope(), LANGUAGE_ID);
    instanceStore.setValue("someInt", 13);
    instanceStore.setDefault("anotherInt", 13);
    ChainedPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] { instanceStore, configurationStore });
    assertEquals(13, chainedStore.getInt("someInt"));
    assertEquals(13, chainedStore.getInt("anotherInt"));
    assertEquals(12, chainedStore.getInt("thirdInt"));
}
Also used : InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) ScopedPreferenceStore(org.eclipse.ui.preferences.ScopedPreferenceStore) ConfigurationScope(org.eclipse.core.runtime.preferences.ConfigurationScope) 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