Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 151420

Summary: Support to open files in eclipse editor (StorageEditorInput LocalFileStorage)
Product: [Eclipse Project] Platform Reporter: John J. Barton <johnjbarton>
Component: RuntimeAssignee: platform-runtime-inbox <platform-runtime-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3    
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description John J. Barton CLA 2006-07-21 12:00:52 EDT
In searching through the maze that is eclipse api, I could not find a seemingly trivial function: open a file in an editor. Eventually I read through the eclipse source and found that even the debugger has its own internal classes to implement this function.  Surely there must be a public part of the API that is equivalent to LocalFileStorage and StorageEditorInput from org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java??

1) If there is such a public API, then this bug report says: ProcessConsole should use the public API.
2) Else, there should be a public API.  In my case I had to write:
            IFile ifile = root.getFileForLocation(path);
            if (ifile == null) { // The file is not in the workspace
                File file = new File(fFilePath);
                  org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage lfs = new LocalFileStorage(file);
                input = new StorageEditorInput(lfs, file);

            } else {
                input = new FileEditorInput(ifile);
            }
And copy the source of StorageEditorInput into my code.
Comment 1 John Arthorne CLA 2006-07-21 12:11:55 EDT

*** This bug has been marked as a duplicate of 138655 ***