Changeset 3860 for devel-tools/trunk


Ignore:
Timestamp:
Jul 21, 2008, 9:07:04 PM (12 years ago)
Author:
orlov
Message:
  • Open declaration (cross-file).
Location:
devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt
Files:
2 edited

Legend:

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

    r3858 r3860  
    44import java.util.List;
    55
     6import org.eclipse.core.resources.IFile;
    67import org.eclipse.core.resources.IProject;
    78import org.eclipse.core.runtime.CoreException;
     
    4950import org.refal.rfpdt.ast.AstVar;
    5051import org.refal.rfpdt.ast.Searcher;
     52import org.refal.rfpdt.core.RfpCore;
     53import org.refal.rfpdt.core.RfpProject;
    5154import org.refal.rfpdt.editor.PresentationVisitor.StylePosition;
    5255import org.refal.rfpdt.editor.color.ColorManager;
     
    357360        return Searcher.search(astImplem, offset);
    358361    }
     362   
     363    public RfpProject getRfpProject () {
     364        return RfpCore.getRfpProject(((IFile) getEditorInput().getAdapter(IFile.class)).getProject());
     365    }
    359366}
  • devel-tools/trunk/eclipse/org.refal.rfpdt.ui/src/org/refal/rfpdt/ui/actions/OpenDeclarationAction.java

    r3859 r3860  
    33import java.util.List;
    44
     5import org.eclipse.core.resources.IFile;
    56import org.eclipse.jface.text.source.ISourceViewer;
     7import org.eclipse.ui.PartInitException;
     8import org.eclipse.ui.ide.IDE;
    69import org.refal.rfpdt.ast.AstCall;
    710import org.refal.rfpdt.ast.AstCut;
     
    1316import org.refal.rfpdt.ast.AstRef;
    1417import org.refal.rfpdt.ast.AstVar;
     18import org.refal.rfpdt.editor.RfpEditor;
    1519import org.refal.rfpdt.editor.RfpEditorMessages;
     20import org.refal.rfpdt.ui.RfpUI;
    1621
    1722public class OpenDeclarationAction extends RfpEditorActionDelegate {
     
    3439            return;
    3540        }
    36         int offset = astNode.pos.charStart;
    37         sourceViewer.setSelectedRange(offset, 0);
    38         sourceViewer.revealRange(offset, 0);
     41        try {
     42            String ext = astNode.pos.rfpResource.isInterface ? "rfi" : "rf";
     43            IFile file = editor.getRfpProject().getSource(astNode.pos.rfpResource.moduleName, ext);
     44            if (file == null)
     45                return;
     46            editor = (RfpEditor) IDE.openEditor(RfpUI.getActivePage(), file);
     47            sourceViewer = editor.sourceViewer();
     48            int offset = astNode.pos.charStart;
     49            sourceViewer.setSelectedRange(offset, 0);
     50            sourceViewer.revealRange(offset, 0);
     51        } catch (PartInitException e) {
     52            RfpUI.log(e);
     53        }
    3954    }
    4055
Note: See TracChangeset for help on using the changeset viewer.