Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8598837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:15:07+00:00 2026-06-12T01:15:07+00:00

Is there a way to load Files outside the workspace? This is what I

  • 0

Is there a way to load Files outside the workspace?
This is what I found:

IFile fileToBeOpened = ...;
IEditorInput editorInput = new FileEditorInput(fileToBeOpened);
IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
page.openEditor(editorInput, "org.eclipse.ui.DefaultTextEdtior");

The problem here is the first line. My files that I would like to edit are of the java.io.File type. But there is no way of converting this into an IFile instance. How can I pass my java.io.File as input for my Editor?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T01:15:09+00:00Added an answer on June 12, 2026 at 1:15 am

    To open an external file follow the instructions here
    http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_programmatically%3F

    import java.io.File;
    import org.eclipse.core.filesystem.EFS;
    import org.eclipse.core.filesystem.IFileStore;
    import org.eclipse.ui.PartInitException;
    import org.eclipse.ui.IWorkbenchPage;
    import org.eclipse.ui.PlatformUI;
    import org.eclipse.ui.ide.IDE;
    
    File fileToOpen = new File("externalfile.xml");
    
    if (fileToOpen.exists() && fileToOpen.isFile()) {
        IFileStore fileStore = EFS.getLocalFileSystem().getStore(fileToOpen.toURI());
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    
        try {
            IDE.openEditorOnFileStore( page, fileStore );
        } catch ( PartInitException e ) {
            //Put your exception handler here if you wish to
        }
    } else {
        //Do something if the file does not exist
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there a way to load css and/or javascript files from outside of the
Is there a way to load external CSS files, like we load JS file
Is there any way to load JavaScript from public folder before JavaScript-files from assets/javascript
is there way to load local files in iphone asynchronously? I load uiimages for
Is there any way to load URIs of sound files into a SoundPool? I
I was wondering is there any way to load geometry from those export files
Is there a way to load files that only match a specific string? For
Is there a way to load files stored inside JARs using getResourceAsStream from Tomcat
Is there any way to load the swf files directly without use of webview..
Is there a way to load different json files on demand(click), somehow changing the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.