欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

How do I open an editor on a file outside the workspace?

程序员文章站 2022-04-24 15:35:58
...

Since 3.3 you can use the new EFS support to open an text editor on a file outside the workspace:

How do I open an editor on a file outside the workspace?   String name =   new  FileDialog(aShell, SWT.OPEN).open();
How do I open an editor on a file outside the workspace?   
if  (name  ==   null )
How do I open an editor on a file outside the workspace?      
return ;
How do I open an editor on a file outside the workspace?   IFileStore fileStore
=   EFS.getLocalFileSystem().getStore( new  Path(filterPath));
How do I open an editor on a file outside the workspace?   fileStore
=   fileStore.getChild(names[i]);
How do I open an editor on a file outside the workspace?How do I open an editor on a file outside the workspace?   
if  ( ! fileStore.fetchInfo().isDirectory()  &&  fileStore.fetchInfo().exists())  ... {
How do I open an editor on a file outside the workspace?     IWorkbenchPage page
=  window.getActivePage();
How do I open an editor on a file outside the workspace?How do I open an editor on a file outside the workspace?     
try ...{
How do I open an editor on a file outside the workspace?       IDE.openEditorOnFileStore(page, fileStore);
How do I open an editor on a file outside the workspace?How do I open an editor on a file outside the workspace?     }
 catch (PartInitException e) ...{
How do I open an editor on a file outside the workspace?How do I open an editor on a file outside the workspace?       
/**//* some code */
How do I open an editor on a file outside the workspace?     }

How do I open an editor on a file outside the workspace?
How do I open an editor on a file outside the workspace?

Alternatively, you can create a linked resource in an existing project, which points to a file elsewhere in the file system. This example snippet creates a project called “External Files,” and then prompts the user to select any file in the file system. The code then creates a linked resource in the project to that external file, allowing the platform to open the file in read/write mode in one of the standard editors:


  
How do I open an editor on a file outside the workspace?   IWorkspace ws  =  ResourcesPlugin.getWorkspace();
How do I open an editor on a file outside the workspace?   IProject project 
=  ws.getRoot().getProject( " External Files " );
How do I open an editor on a file outside the workspace?   
if  ( ! project.exists())
How do I open an editor on a file outside the workspace?      project.create(
null );
How do I open an editor on a file outside the workspace?   
if  ( ! project.isOpen())
How do I open an editor on a file outside the workspace?      project.open(
null );
How do I open an editor on a file outside the workspace?   Shell shell 
=  window.getShell();
How do I open an editor on a file outside the workspace?   String name 
=   new  FileDialog(shell, SWT.OPEN).open();
How do I open an editor on a file outside the workspace?   
if  (name  ==   null )
How do I open an editor on a file outside the workspace?      
return ;
How do I open an editor on a file outside the workspace?   IPath location 
=   new  Path(name);
How do I open an editor on a file outside the workspace?   IFile file 
=  project.getFile(location.lastSegment());
How do I open an editor on a file outside the workspace?   file.createLink(location, IResource.NONE, 
null );
How do I open an editor on a file outside the workspace?   IWorkbenchPage page 
=  window.getActivePage();
How do I open an editor on a file outside the workspace?   
if  (page  !=   null )
How do I open an editor on a file outside the workspace?      page.openEditor(file);
How do I open an editor on a file outside the workspace?
How do I open an editor on a file outside the workspace?

转载于:https://my.oschina.net/dollyn/blog/360618