use of org.eclipse.ui.texteditor.ChainedPreferenceStore in project eclipse.platform.text by eclipse.
the class ChainedPreferenceStoreTest method testChainedStore1.
/**
* Assertion failed in ChainedPreferenceStore.handlePropertyChangeEvent(..)
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=52827
*/
@Test
public void testChainedStore1() {
IPreferenceStore store1 = new PreferenceStore();
IPreferenceStore store2 = new PreferenceStore();
IPreferenceStore chainedStore = new ChainedPreferenceStore(new IPreferenceStore[] { store1, store2 });
chainedStore.addPropertyChangeListener(fPropertyChangeListener);
// simulated removal with newValue != null
store1.firePropertyChangeEvent(PROPERTY, VALUE, DEFAULT_DEFAULT_VALUE);
chainedStore.removePropertyChangeListener(fPropertyChangeListener);
assertEquals(1, fEvents.size());
PropertyChangeEvent event = fEvents.get(0);
assertEquals(store1, event.getSource());
assertEquals(PROPERTY, event.getProperty());
assertEquals(VALUE, event.getOldValue());
assertEquals(DEFAULT_DEFAULT_VALUE, event.getNewValue());
}
use of org.eclipse.ui.texteditor.ChainedPreferenceStore in project eclipse.platform.text by eclipse.
the class ChainedPreferenceStoreTest method testChainedStore0.
/**
* [implementation] ChainedPreferenceStore
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=69419
*/
@Test
public void testChainedStore0() {
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 newValue != null
store1.firePropertyChangeEvent(PROPERTY, VALUE, DEFAULT_DEFAULT_VALUE);
chainedStore.removePropertyChangeListener(fPropertyChangeListener);
assertEquals(1, fEvents.size());
PropertyChangeEvent event = fEvents.get(0);
assertEquals(chainedStore, event.getSource());
assertEquals(PROPERTY, event.getProperty());
assertEquals(VALUE, event.getOldValue());
assertEquals(DEFAULT_VALUE, event.getNewValue());
}
use of org.eclipse.ui.texteditor.ChainedPreferenceStore in project erlide_eclipse by erlang.
the class ErlangSourceViewer method createErlangPreviewer.
public static SourceViewer createErlangPreviewer(final Composite parent, final IColorManager colorManager0, final IPreferenceStore topStore, final Map<TokenHighlight, HighlightStyle> colors0, final String content) {
// TODO we should move this method, to a utility class (or maybe create
// an ErlangPreviewSourceViewer class)
final IColorManager colorManager = colorManager0 != null ? colorManager0 : new ColorManager();
Map<TokenHighlight, HighlightStyle> colors;
if (colors0 == null) {
colors = Maps.newHashMap();
for (final TokenHighlight th : TokenHighlight.values()) {
colors.put(th, null);
}
} else {
colors = colors0;
}
final IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
final IPreferenceStore store = topStore == null ? new ChainedPreferenceStore(new IPreferenceStore[] { generalTextStore }) : new ChainedPreferenceStore(new IPreferenceStore[] { topStore, generalTextStore });
final SourceViewer viewer = new SourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
final IDocument document = new Document(content);
viewer.setDocument(document);
final ErlangDocumentSetupParticipant setupParticipant = new ErlangDocumentSetupParticipant();
setupParticipant.setup(document);
final ErlangSourceViewerConfiguration configuration = new SyntaxColorPreviewEditorConfiguration(store, colorManager);
viewer.configure(configuration);
final Font font = JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
viewer.getTextWidget().setFont(font);
new ErlangSourceViewerUpdater(viewer, configuration, store);
viewer.setEditable(false);
final Cursor arrowCursor = viewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
viewer.getTextWidget().setCursor(arrowCursor);
return viewer;
}
use of org.eclipse.ui.texteditor.ChainedPreferenceStore in project egit by eclipse.
the class DiffEditorPage method initializeEditor.
@Override
protected void initializeEditor() {
super.initializeEditor();
overviewStore = new ThemePreferenceStore();
setPreferenceStore(new ChainedPreferenceStore(new IPreferenceStore[] { overviewStore, EditorsUI.getPreferenceStore() }));
setDocumentProvider(new DiffDocumentProvider());
setSourceViewerConfiguration(new DiffViewer.Configuration(getPreferenceStore()) {
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
// Switch off spell-checking
return null;
}
});
}
use of org.eclipse.ui.texteditor.ChainedPreferenceStore in project webtools.sourceediting by eclipse.
the class StructuredTextEditor 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 });
}
Aggregations