Commit c4a914b1 authored by jayherron's avatar jayherron

Getting closer to adding a bracket-matcher

parent eeb54e38
package org.jayherron.trioeditor.editors;
import org.eclipse.jface.text.source.DefaultCharacterPairMatcher;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
public class TrioEditor extends TextEditor {
private ColorManager colorManager;
private final static char[] PAIRS = {'(',')','{','}','[',']'};
private DefaultCharacterPairMatcher pairsMatcher = new DefaultCharacterPairMatcher(PAIRS);
public TrioEditor() {
super();
// TODO How can I set spaces for tabs
//this.EDITOR_SPACES_FOR_TABS = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS;
//this.EDITOR_TAB_WIDTH = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH;
//this.getPreferenceStore().setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, true);
//this.getPreferenceStore().setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 2);
colorManager = new ColorManager();
setSourceViewerConfiguration(new TrioConfiguration(colorManager));
setDocumentProvider(new TrioDocumentProvider());
......@@ -17,7 +25,18 @@ public class TrioEditor extends TextEditor {
@Override
public void dispose() {
colorManager.dispose();
pairsMatcher.dispose();
super.dispose();
}
@Override
protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
support.setCharacterPairMatcher(pairsMatcher);
// We must set up a preference page to support this, because the default text editor does not...
//support.setMatchingCharacterPainterPreferenceKeys(JavaPreferences.EDITOR_MATCHING_BRACKETS,
// JsonPreferences.EDITOR_MATCHING_BRACKETS_COLOR);
super.configureSourceViewerDecorationSupport(support);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment