Changeset 3374 for devel-tools/trunk


Ignore:
Timestamp:
Feb 5, 2008, 11:57:19 AM (13 years ago)
Author:
yura
Message:
Location:
devel-tools/trunk/eclipse/org.refal.plus.rfpdt.editor/src/org/refal/plus/rfpdt/editor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.plus.rfpdt.editor/src/org/refal/plus/rfpdt/editor/RfpSourceViewerConfiguration.java

    r3359 r3374  
    1919    private final RfpEditor editor;
    2020
    21     public RfpSourceViewerConfiguration (RfpEditor rfpEditor, IPreferenceStore store) {
     21    public RfpSourceViewerConfiguration (RfpEditor editor, IPreferenceStore store) {
    2222        super(store);
    2323        doubleClickStrategy = new RfpDoubleClickStrategy();
    2424        autoIngentStrategy = new RfpAutoIndentStrategy(store);
    25         editor = rfpEditor;
     25        this.editor = editor;
    2626    }
    2727
     
    6767
    6868    public ITextHover getTextHover (ISourceViewer sourceViewer, String contentType) {
    69         return new RfpTextHover(sourceViewer);
     69        return new RfpTextHover(editor, sourceViewer);
    7070    }
    7171}
  • devel-tools/trunk/eclipse/org.refal.plus.rfpdt.editor/src/org/refal/plus/rfpdt/editor/RfpTextHover.java

    r3001 r3374  
    22
    33import org.eclipse.jface.text.DefaultTextHover;
    4 import org.eclipse.jface.text.source.Annotation;
     4import org.eclipse.jface.text.IRegion;
     5import org.eclipse.jface.text.ITextViewer;
    56import org.eclipse.jface.text.source.ISourceViewer;
    6 import org.eclipse.ui.texteditor.MarkerAnnotation;
     7import org.refal.plus.rfpdt.comp.ast.AstCall;
     8import org.refal.plus.rfpdt.comp.ast.AstDecl;
     9import org.refal.plus.rfpdt.comp.ast.AstFuncDef;
     10import org.refal.plus.rfpdt.comp.ast.AstImplem;
     11import org.refal.plus.rfpdt.comp.ast.AstNode;
     12import org.refal.plus.rfpdt.comp.ast.AstRef;
    713
    814public class RfpTextHover extends DefaultTextHover {
     15    private final RfpEditor editor;
    916
    10         public RfpTextHover(ISourceViewer sourceViewer)  {
    11                 super(sourceViewer);
    12         }
    13        
    14         protected boolean isIncluded(Annotation annotation) {
    15                 if (annotation instanceof MarkerAnnotation)
    16                         return true;
    17                 return false;
    18         }
     17    public RfpTextHover (RfpEditor editor, ISourceViewer sourceViewer) {
     18        super(sourceViewer);
     19        this.editor = editor;
     20    }
    1921
     22    public String getHoverInfo (ITextViewer textViewer, IRegion hoverRegion) {
     23        if (editor.rfpReconcilingStrategy == null)
     24            return null;
     25        AstImplem astImplem = editor.rfpReconcilingStrategy.getAstImplem();
     26        if (astImplem == null)
     27            return null;
     28        AstNode astNode = SearchVisitor.search(astImplem, hoverRegion.getOffset());
     29        AstDecl astDecl = null;
     30        if (astNode instanceof AstDecl)
     31            astDecl = (AstDecl) astNode;
     32        else if (astNode instanceof AstFuncDef)
     33            astDecl = ((AstFuncDef) astNode).funcDecl;
     34        else if (astNode instanceof AstRef)
     35            astDecl = ((AstRef) astNode).decl;
     36        else if (astNode instanceof AstCall)
     37            astDecl = ((AstCall) astNode).funcDecl;
     38        if (astDecl == null)
     39            return null;
     40        return astDecl.toString();
     41    }
    2042}
Note: See TracChangeset for help on using the changeset viewer.