[Pydev-cvs] org.python.pydev/src/org/python/pydev/editor/codefolding PySourceViewer.java,NONE,1.1 Py
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2004-09-23 18:00:40
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codefolding In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5252/src/org/python/pydev/editor/codefolding Modified Files: PyEditProjection.java Added Files: PySourceViewer.java Log Message: Making correction assistant on Ctrl+1 --- NEW FILE: PySourceViewer.java --- /* * Created on Sep 23, 2004 * * @author Fabio Zadrozny */ package org.python.pydev.editor.codefolding; import org.eclipse.jface.text.source.IOverviewRuler; import org.eclipse.jface.text.source.IVerticalRuler; import org.eclipse.jface.text.source.SourceViewerConfiguration; import org.eclipse.jface.text.source.projection.ProjectionViewer; import org.eclipse.swt.widgets.Composite; import org.python.pydev.editor.PyEdit; import org.python.pydev.editor.PyEditConfiguration; import org.python.pydev.editor.correctionassist.PyCorrectionAssistant; public class PySourceViewer extends ProjectionViewer { private PyEditProjection projection; private PyCorrectionAssistant fCorrectionAssistant; public PySourceViewer(Composite parent, IVerticalRuler ruler, IOverviewRuler overviewRuler, boolean showsAnnotationOverview, int styles, PyEditProjection projection) { super(parent, ruler, overviewRuler, showsAnnotationOverview, styles); this.projection = projection; } public void configure(SourceViewerConfiguration configuration) { super.configure(configuration); if (configuration instanceof PyEditConfiguration) { PyEditConfiguration pyConfiguration = (PyEditConfiguration) configuration; fCorrectionAssistant = pyConfiguration.getCorrectionAssistant(this); fCorrectionAssistant.install(this); } } /* (non-Javadoc) } * @see org.eclipse.jface.text.source.projection.ProjectionViewer#canDoOperation(int) */ public boolean canDoOperation(int operation) { if(operation == PyEdit.CORRECTIONASSIST_PROPOSALS){ return true; } return super.canDoOperation(operation); } /* (non-Javadoc) * @see org.eclipse.jface.text.source.projection.ProjectionViewer#doOperation(int) */ public void doOperation(int operation) { super.doOperation(operation); if (getTextWidget() == null) return; switch (operation) { case PyEdit.CORRECTIONASSIST_PROPOSALS: String msg= fCorrectionAssistant.showPossibleCompletions(); projection.setStatusLineErrorMessage(msg); return; } } } Index: PyEditProjection.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/codefolding/PyEditProjection.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyEditProjection.java 22 Jul 2004 13:27:31 -0000 1.4 --- PyEditProjection.java 23 Sep 2004 17:59:58 -0000 1.5 *************** *** 9,12 **** --- 9,13 ---- import org.eclipse.jface.text.IInformationControl; import org.eclipse.jface.text.IInformationControlCreator; + import org.eclipse.jface.text.source.IOverviewRuler; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.IVerticalRuler; *************** *** 16,19 **** --- 17,22 ---- import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.editors.text.TextEditor; + import org.eclipse.ui.texteditor.IEditorStatusLine; + import org.python.pydev.editor.correctionassist.PyCorrectionAssistant; import org.python.pydev.parser.IParserListener; import org.python.pydev.plugin.PydevPrefs; *************** *** 30,33 **** --- 33,37 ---- private ProjectionSupport fProjectionSupport; + private PyCorrectionAssistant fCorrectionAssistant; public static final int PROP_FOLDING_CHANGED = -999; *************** *** 42,47 **** protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ! return new ProjectionViewer(parent, ruler, getOverviewRuler(), true, ! styles); } --- 46,50 ---- protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) { ! return new PySourceViewer(parent, ruler, getOverviewRuler(), true, styles, this); } *************** *** 95,98 **** --- 98,112 ---- } + /** + * Sets the given message as error message to this editor's status line. + * + * @param msg message to be set + */ + public void setStatusLineErrorMessage(String msg) { + IEditorStatusLine statusLine= (IEditorStatusLine) getAdapter(IEditorStatusLine.class); + if (statusLine != null) + statusLine.setMessage(true, msg, null); + } + } \ No newline at end of file |