Skip to main content



      Home
Home » Newcomers » Newcomers » launch the text editor
launch the text editor [message #144260] Tue, 21 March 2006 13:44 Go to next message
Eclipse UserFriend
Originally posted by: jr_gz.hotmail.com

Hello everybody(sorry for my english), I would know how can I launch the
text editor of eclipse to work into a file.


I wonna launch the text editor of eclipse when I click into a file showed
in a jtree.

Does anyone know how can I do it, or a similar idea?

Thanks a lot

King Regards
Re: launch the text editor [message #144498 is a reply to message #144260] Wed, 22 March 2006 13:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jr_gz.hotmail.com

DosenŽt nobody know how launch the eclipseŽs editor?
Re: launch the text editor [message #144524 is a reply to message #144498] Wed, 22 March 2006 15:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: myersj.gmail.com

Add a file association for the file type you want to edit -
Window->Preferences->General->Editors->File Associations.
Add a file type that matches the file you want to open. Then associate
that type with the Text Editor.

- Jeff
Re: launch the text editor [message #144589 is a reply to message #144524] Thu, 23 March 2006 04:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jr_gz.hotmail.com

Sorry, but you donŽt understand me very well.

IŽm developing a plug-in that shows everyfiles of a directory in a
jtree(swing), and I wonna launch eclipseŽs text editor when I clicked in
one of theese files.


Thanks
Re: launch the text editor [message #144623 is a reply to message #144589] Thu, 23 March 2006 09:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: myersj.gmail.com

Is this an Eclipse plug-in? If so, why are you writing it in Swing?

Anyways, you can call:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(new
FileEditorInput(file), "org.eclipse.ui.DefaultTextEditor");

where file is the IFile for the file you selected in your tree.

Hope this helps,
- Jeff
Re: launch the text editor [message #145317 is a reply to message #144623] Tue, 28 March 2006 03:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jr_gz.hotmail.com

Hello and thanks by your answer.

I was using swing because I couldnŽt show the tree in a view, but IŽve
resolved this problem.

I think your solution is good, but I donŽt know how to use the IFile.
IFile are used for files in the worksapce, but if I wonna open a file out
of the workspace(i.e c:\prueba.txt), How could I use it?

IŽm beginner developing plug-ins and "IŽm very green" and I have lot of
problems.


Thanks a lot.
Re: launch the text editor [message #145319 is a reply to message #145317] Tue, 28 March 2006 05:11 Go to previous message
Eclipse UserFriend
Originally posted by: jr_gz.hotmail.com

Hello Jeff.

IŽve probed your solution but I found a problem. I tell you:

When I execute my plugin and I try to launch the text editor in this way

IWorkspace ws = ResourcesPlugin.getWorkspace(); //****
IProject project = ws.getRoot().getProject("External Files");

IPath location = new Path("C:\\jr.txt");
IFile file = project.getFile(location.lastSegment());

IEditorInput input=null;
input = new FileEditorInput(file);
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().

openEditor(input, "org.eclipse.ui.DefaultTextEditor");
} catch (PartInitException e) {
e.printStackTrace();
}

I recieve the next error,
Unhandled event loop exception
Reason:
Workspace is closed.

when the plugin execute the first instruction(****).

CouldnŽt I indicate to IFIle (file) the file that must open without use
project.getfile() since this is what produce the error?


Thanks a lot.
Previous Topic:Win 95 Install
Next Topic:GEF or GMF
Goto Forum:
  


Current Time: Sun Jun 08 16:02:03 EDT 2025

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

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

Back to the top