|
From: Christopher W. <caw...@us...> - 2006-04-21 21:13:36
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28089/src/org/rubypeople/rdt/internal/ui/rubyeditor Modified Files: RubyAbstractEditor.java RubyEditor.java Log Message: make over the ruby editor preference page. Add options for smart typing features (like auto-closing brackets/strings) Index: RubyEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** RubyEditor.java 21 Apr 2006 21:06:47 -0000 1.43 --- RubyEditor.java 21 Apr 2006 21:13:29 -0000 1.44 *************** *** 91,95 **** import org.rubypeople.rdt.internal.ui.text.IRubyPartitions; import org.rubypeople.rdt.internal.ui.text.RubyHeuristicScanner; - import org.rubypeople.rdt.internal.ui.text.RubyPairMatcher; import org.rubypeople.rdt.internal.ui.text.Symbols; import org.rubypeople.rdt.ui.IWorkingCopyManager; --- 91,94 ---- *************** *** 102,111 **** public class RubyEditor extends RubyAbstractEditor { - - protected final static char[] BRACKETS= { '{', '}', '(', ')', '[', ']' }; protected RubyActionGroup actionGroup; private ProjectionSupport fProjectionSupport; /** * Mutex for the reconciler. See --- 101,113 ---- public class RubyEditor extends RubyAbstractEditor { protected RubyActionGroup actionGroup; private ProjectionSupport fProjectionSupport; + /** Preference key for automatically closing strings */ + private final static String CLOSE_STRINGS= PreferenceConstants.EDITOR_CLOSE_STRINGS; + /** Preference key for automatically closing brackets and parenthesis */ + private final static String CLOSE_BRACKETS= PreferenceConstants.EDITOR_CLOSE_BRACKETS; + /** * Mutex for the reconciler. See *************** *** 144,150 **** private ToggleFoldingRunner fFoldingRunner; - /** The editor's bracket matcher */ - protected RubyPairMatcher fBracketMatcher= new RubyPairMatcher(BRACKETS); - private BracketInserter fBracketInserter = new BracketInserter(); --- 146,149 ---- *************** *** 254,257 **** --- 253,261 ---- ISourceViewer sourceViewer = getSourceViewer(); if (sourceViewer instanceof ITextViewerExtension) { + IPreferenceStore preferenceStore= getPreferenceStore(); + boolean closeBrackets= preferenceStore.getBoolean(CLOSE_BRACKETS); + boolean closeStrings= preferenceStore.getBoolean(CLOSE_STRINGS); + fBracketInserter.setCloseBracketsEnabled(closeBrackets); + fBracketInserter.setCloseStringsEnabled(closeStrings); ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter); } *************** *** 523,528 **** * @see org.rubypeople.rdt.internal.ui.rubyeditor.RubyAbstractEditor#dispose() */ ! public void dispose() { ! super.dispose(); if (fProjectionModelUpdater != null) { --- 527,535 ---- * @see org.rubypeople.rdt.internal.ui.rubyeditor.RubyAbstractEditor#dispose() */ ! public void dispose() { ! ISourceViewer sourceViewer= getSourceViewer(); ! if (sourceViewer instanceof ITextViewerExtension) ! ((ITextViewerExtension) sourceViewer).removeVerifyKeyListener(fBracketInserter); ! if (fProjectionModelUpdater != null) { *************** *** 535,538 **** --- 542,546 ---- fProjectionSupport = null; } + super.dispose(); } *************** *** 650,653 **** --- 658,671 ---- } + if (CLOSE_BRACKETS.equals(property)) { + fBracketInserter.setCloseBracketsEnabled(getPreferenceStore().getBoolean(property)); + return; + } + + if (CLOSE_STRINGS.equals(property)) { + fBracketInserter.setCloseStringsEnabled(getPreferenceStore().getBoolean(property)); + return; + } + ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null) Index: RubyAbstractEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** RubyAbstractEditor.java 21 Apr 2006 21:06:47 -0000 1.27 --- RubyAbstractEditor.java 21 Apr 2006 21:13:29 -0000 1.28 *************** *** 79,83 **** protected final static String MATCHING_BRACKETS_COLOR= PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR; ! protected final static char[] BRACKETS= { '{', '}', '(', ')', '[', ']', '<', '>' }; /** The editor's bracket matcher */ --- 79,83 ---- protected final static String MATCHING_BRACKETS_COLOR= PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR; ! protected final static char[] BRACKETS= { '{', '}', '(', ')', '[', ']' }; /** The editor's bracket matcher */ |