Changeset 3384 for devel-tools/trunk
- Timestamp:
- Feb 7, 2008, 2:44:46 PM (13 years ago)
- Location:
- devel-tools/trunk/eclipse/org.refal.plus.rfpdt.editor/src/org/refal/plus/rfpdt/editor
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel-tools/trunk/eclipse/org.refal.plus.rfpdt.editor/src/org/refal/plus/rfpdt/editor/RfpEditor.java
r3382 r3384 42 42 import org.refal.plus.rfpdt.comp.ast.AstFuncDef; 43 43 import org.refal.plus.rfpdt.comp.ast.AstImplem; 44 import org.refal.plus.rfpdt.comp.ast.AstName; 44 45 import org.refal.plus.rfpdt.comp.ast.AstNode; 45 46 import org.refal.plus.rfpdt.comp.ast.AstRef; 46 47 import org.refal.plus.rfpdt.comp.ast.AstVar; 48 import org.refal.plus.rfpdt.comp.ast.Searcher; 47 49 import org.refal.plus.rfpdt.editor.PresentationVisitor.StylePosition; 48 50 import org.refal.plus.rfpdt.editor.color.ColorManager; … … 71 73 72 74 private AstNode[] getNodeList (AstImplem astImplem, int offset) { 73 AstNode astNode = SearchVisitor.search(astImplem, offset); 74 if (astNode instanceof AstVar) { 75 AstVar astVar = ((AstVar) astNode).varDefinition; 75 ArrayList<AstNode> astNodeList = Searcher.search(astImplem, offset); 76 int size = astNodeList.size(); 77 AstVar astVar = null; 78 if (size > 0 && astNodeList.get(size-1) instanceof AstVar) 79 astVar = (AstVar) astNodeList.get(size-1); 80 else if (size > 1 && astNodeList.get(size-2) instanceof AstVar) 81 astVar = (AstVar) astNodeList.get(size-2); 82 if (astVar != null) { 83 astVar = astVar.varDefinition; 76 84 if (astVar == null || astVar.varUses == null) 77 85 return empty; 78 86 return astVar.varUses.toArray(new AstNode[astVar.varUses.size()]); 79 } else if (astNode instanceof AstFence) { 80 AstFence astFence = (AstFence) astNode; 87 } 88 else if (size > 0 && astNodeList.get(size-1) instanceof AstFence) { 89 AstFence astFence = (AstFence) astNodeList.get(size-1); 81 90 if (astFence.uses == null) 82 91 return empty; 83 92 return astFence.uses.toArray(new AstNode[astFence.uses.size()]); 84 } else if ( astNodeinstanceof AstCut) {85 AstFence astFence = ((AstCut) astNode ).fence;93 } else if (size > 0 && astNodeList.get(size-1) instanceof AstCut) { 94 AstFence astFence = ((AstCut) astNodeList.get(size-1)).fence; 86 95 if (astFence == null || astFence.uses == null) 87 96 return empty; 88 97 return astFence.uses.toArray(new AstNode[astFence.uses.size()]); 89 } else { 98 } else if (size > 1 && astNodeList.get(size-1) instanceof AstName){ 99 AstNode astNode = astNodeList.get(size-2); 90 100 AstDecl astDecl = null; 91 101 if (astNode instanceof AstDecl) … … 103 113 return astDecl.uses.toArray(new AstNode[astDecl.uses.size()]); 104 114 } 115 return null; 105 116 } 106 117 -
devel-tools/trunk/eclipse/org.refal.plus.rfpdt.editor/src/org/refal/plus/rfpdt/editor/RfpTextHover.java
r3379 r3384 1 1 package org.refal.plus.rfpdt.editor; 2 3 import java.util.ArrayList; 2 4 3 5 import org.eclipse.jface.text.DefaultTextHover; … … 8 10 import org.eclipse.ui.texteditor.MarkerAnnotation; 9 11 import org.refal.plus.rfpdt.comp.ast.AstImplem; 12 import org.refal.plus.rfpdt.comp.ast.AstName; 10 13 import org.refal.plus.rfpdt.comp.ast.AstNode; 11 14 import org.refal.plus.rfpdt.comp.ast.IHoverInfo; 15 import org.refal.plus.rfpdt.comp.ast.Searcher; 12 16 13 17 public class RfpTextHover extends DefaultTextHover { … … 28 32 if (astImplem == null) 29 33 return null; 30 AstNode astNode = SearchVisitor.search(astImplem, hoverRegion.getOffset()); 31 if (!(astNode instanceof IHoverInfo)) 32 return null; 33 return ((IHoverInfo) astNode).getHoverInfo(); 34 ArrayList<AstNode> astNodeList = Searcher.search(astImplem, hoverRegion.getOffset()); 35 int size = astNodeList.size(); 36 if (size > 1 && astNodeList.get(size-1) instanceof AstName && astNodeList.get(size-2) instanceof IHoverInfo) 37 return ((IHoverInfo) astNodeList.get(size-2) ).getHoverInfo(); 38 return null; 34 39 } 35 40
Note: See TracChangeset
for help on using the changeset viewer.