|
From: Christopher W. <caw...@us...> - 2006-04-20 21:55:53
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10318/src/org/rubypeople/rdt/internal/ui/rubyeditor Modified Files: RubyAbstractEditor.java Log Message: add support for highlighting matching brackets (ticket #106) Index: RubyAbstractEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** RubyAbstractEditor.java 12 Apr 2006 21:26:25 -0000 1.25 --- RubyAbstractEditor.java 20 Apr 2006 21:55:42 -0000 1.26 *************** *** 31,34 **** --- 31,35 ---- import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.ChainedPreferenceStore; + import org.eclipse.ui.texteditor.SourceViewerDecorationSupport; import org.eclipse.ui.views.contentoutline.ContentOutline; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; *************** *** 48,52 **** --- 49,55 ---- import org.rubypeople.rdt.internal.ui.text.IRubyPartitions; import org.rubypeople.rdt.internal.ui.text.PreferencesAdapter; + import org.rubypeople.rdt.internal.ui.text.RubyPairMatcher; import org.rubypeople.rdt.ui.IWorkingCopyManager; + import org.rubypeople.rdt.ui.PreferenceConstants; import org.rubypeople.rdt.ui.text.RubySourceViewerConfiguration; import org.rubypeople.rdt.ui.text.RubyTextTools; *************** *** 64,67 **** --- 67,81 ---- private RubyOutlinePage fOutlinePage; + + /** Preference key for matching brackets */ + protected final static String MATCHING_BRACKETS= PreferenceConstants.EDITOR_MATCHING_BRACKETS; + /** Preference key for matching brackets color */ + protected final static String MATCHING_BRACKETS_COLOR= PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR; + + protected final static char[] BRACKETS= { '{', '}', '(', ')', '[', ']', '<', '>' }; + + /** The editor's bracket matcher */ + protected RubyPairMatcher fBracketMatcher= new RubyPairMatcher(BRACKETS); + /** * Creates and returns the preference store for this Ruby editor with the given input. *************** *** 97,100 **** --- 111,121 ---- } } + + protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) { + support.setCharacterPairMatcher(fBracketMatcher); + support.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR); + + super.configureSourceViewerDecorationSupport(support); + } /** |