Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Opening a plain file in filesystem in org.eclipse.ui.DefaultTextEdtior(unable to feed the right IEditorInput to page.openEditor(something, "org.eclipse.ui.DefaultTextEdtior"); )
Opening a plain file in filesystem in org.eclipse.ui.DefaultTextEdtior [message #499129] Fri, 20 November 2009 00:57 Go to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 424
Registered: September 2009
Senior Member
Hi,
I feel rather stupid, but I'm completely unable to find a solution.

I am writing an application based on RCP.
At a certain point I need to open a text file in my local filesystem and let the user edit it. When the file is closed i resume processing.

I have my Perspective and several Views docked around the EditorArea.

I am able to compute the full path of the file that should be opened.

I am unable to open a stupid editor.

The latest of a zillion tries I did (found somewhere on the internet) reads:
	String path = "C:\\TEMP\\file.txt";
	IFileStore fileOnLocalDisk = EFS.getLocalFileSystem().getStore(path);
	FileStoreEditorInput editorInput = new FileStoreEditorInput(fileOnLocalDisk);
	IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	IWorkbenchPage page = window.getActivePage();
	page.openEditor(editorInput, "org.eclipse.ui.DefaultTextEdtior");

This does not compile because:
- EFS cannot be resolved
- IFileStore cannot be resolved to a type
- FileStoreEditorInput cannot be resolved to a type

Several similar attempts failed with similar errors. I seem unable to find anything under Package org.eclipse.core.filesystem and similia.

Tomorrow morning I will completely reinstall eclipse 3.5 in order to be sure I didn't do something stupid adding components and upgrading.

I simply cannot believe opening a text file in the default text editor is't a trivial task.
What am I doing wrong?

Please help me.
Mauro
Re: Opening a plain file in filesystem in org.eclipse.ui.DefaultTextEdtior [message #499141 is a reply to message #499129] Fri, 20 November 2009 05:04 Go to previous message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
Mauro Condarelli wrote:

> This does not compile because:
> - EFS cannot be resolved
> - IFileStore cannot be resolved to a type
> - FileStoreEditorInput cannot be resolved to a type

EFS & IFileStore are in o.e.core.filesystem plugin and
FileStoreEditorInput is o.e.ui.ide plugin. Add them to the dependencies

--
- Prakash

Platform UI Team, IBM
http://blog.eclipse-tips.com
Previous Topic:Classpath problem - getting error sending Email
Next Topic:Wizard dialog resize weirdiness
Goto Forum:
  


Current Time: Thu Dec 18 08:39:39 GMT 2014

Powered by FUDForum. Page generated in 0.17576 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software