弄了好几天,终于弄出来了。为了实现根据import递归扫描文本,必须获得绝对路径。
IEditorPart editor = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    IEditorInput input = editor.getEditorInput();  
    if (input instanceof IFileEditorInput)  
    {  
        IFile file = ((IFileEditorInput)input).getFile();  
     String filepath = ((IFile)file).getLocation().makeAbsolute().toFile().getAbsolutePath();
                    System.out.println("BBBBBBBBBBBBBBBBB   "+filepath);
    }
放在对键盘的响应中,当敲击键盘时获得当前编辑文档的绝对路径。
 
                    
                 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号