From: Christopher W. <caw...@us...> - 2006-04-21 21:06:59
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24269/src/org/rubypeople/rdt/internal/ui/rubyeditor Modified Files: RubyAbstractEditor.java RubyEditor.java Log Message: Fix template auto-insert and symbol syntax highlighting Index: RubyEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditor.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** RubyEditor.java 12 Apr 2006 21:26:25 -0000 1.42 --- RubyEditor.java 21 Apr 2006 21:06:47 -0000 1.43 *************** *** 45,48 **** --- 45,49 ---- import org.eclipse.jface.text.source.IAnnotationModel; import org.eclipse.jface.text.source.ICharacterPairMatcher; + import org.eclipse.jface.text.source.IOverviewRuler; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.ISourceViewerExtension2; *************** *** 675,689 **** } ! protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ! fAnnotationAccess = createAnnotationAccess(); ! fOverviewRuler = createOverviewRuler(getSharedColors()); ! ! IPreferenceStore store= getPreferenceStore(); ! ISourceViewer viewer = new RubySourceViewer(parent, ruler, getOverviewRuler(), ! isOverviewRulerVisible(), styles, store); ! // ensure decoration support has been created and configured. ! getSourceViewerDecorationSupport(viewer); ! return viewer; ! } /** --- 676,682 ---- } ! protected ISourceViewer createRubySourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean isOverviewRulerVisible, int styles, IPreferenceStore store) { ! return new AdaptedSourceViewer(parent, verticalRuler, overviewRuler, isOverviewRulerVisible, styles, store); ! } /** Index: RubyAbstractEditor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyAbstractEditor.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** RubyAbstractEditor.java 20 Apr 2006 21:55:42 -0000 1.26 --- RubyAbstractEditor.java 21 Apr 2006 21:06:47 -0000 1.27 *************** *** 12,16 **** --- 12,20 ---- import org.eclipse.jface.text.ITextViewerExtension5; import org.eclipse.jface.text.TextSelection; + import org.eclipse.jface.text.contentassist.ContentAssistant; + import org.eclipse.jface.text.contentassist.IContentAssistant; + import org.eclipse.jface.text.source.IOverviewRuler; import org.eclipse.jface.text.source.ISourceViewer; + import org.eclipse.jface.text.source.IVerticalRuler; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.ListenerList; *************** *** 22,25 **** --- 26,30 ---- import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.graphics.Point; + import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorInput; *************** *** 47,50 **** --- 52,56 ---- import org.rubypeople.rdt.core.formatter.DefaultCodeFormatterConstants; import org.rubypeople.rdt.internal.ui.RubyPlugin; + import org.rubypeople.rdt.internal.ui.text.ContentAssistPreference; import org.rubypeople.rdt.internal.ui.text.IRubyPartitions; import org.rubypeople.rdt.internal.ui.text.PreferencesAdapter; *************** *** 118,121 **** --- 124,143 ---- super.configureSourceViewerDecorationSupport(support); } + + protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { + fAnnotationAccess = createAnnotationAccess(); + fOverviewRuler = createOverviewRuler(getSharedColors()); + + IPreferenceStore store= getPreferenceStore(); + ISourceViewer viewer = createRubySourceViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles, store); + // ensure decoration support has been created and configured. + getSourceViewerDecorationSupport(viewer); + return viewer; + } + + protected ISourceViewer createRubySourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean isOverviewRulerVisible, int styles, IPreferenceStore store) { + return new RubySourceViewer(parent, verticalRuler, overviewRuler, + isOverviewRulerVisible, styles, store); + } /** *************** *** 209,213 **** try { ! ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer == null) return; --- 231,235 ---- try { ! AdaptedSourceViewer sourceViewer= (AdaptedSourceViewer) getSourceViewer(); if (sourceViewer == null) return; *************** *** 224,227 **** --- 246,254 ---- return; } + + IContentAssistant c= sourceViewer.getContentAssistant(); + if (c instanceof ContentAssistant) + ContentAssistPreference.changeConfiguration((ContentAssistant) c, getPreferenceStore(), event); + } finally { *************** *** 803,807 **** --- 830,847 ---- throw new UnsupportedOperationException(); } + } + + class AdaptedSourceViewer extends RubySourceViewer { + private List fTextConverters; + private boolean fIgnoreTextConverters= false; + + public AdaptedSourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles, IPreferenceStore store) { + super(parent, verticalRuler, overviewRuler, showAnnotationsOverview, styles, store); + } + + public IContentAssistant getContentAssistant() { + return fContentAssistant; + } } } \ No newline at end of file |