Skip to main content



      Home
Home » Newcomers » Newcomers » Use a jface text editor in my application
Use a jface text editor in my application [message #267391] Mon, 29 December 2008 10:57 Go to next message
Eclipse UserFriend
Hi everyone. First of all sorry for my English.

I’m new at this and I was learning how to build my own jface text editor
like this one (http://www.realsolve.co.uk/site/tech/jface-text.php) or
this (http://www.jdg2e.com/ch26.jface.text/doc/index.html). I already know
how to do that but I wanted to know if it is possible to launch my text
editor whenever I want, not only when I go to my package explorer and
doble-click on a file and select the editor. Actually, I want to be able
to link the editor to a dialog in my application.

Can you please help me or tell me where can I find an example?

Thank you very much!
Re: Use a jface text editor in my application [message #267397 is a reply to message #267391] Mon, 29 December 2008 14:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 12/29/2008 10:57 AM, Arturo wrote:
> Hi everyone. First of all sorry for my English.
>
> I�m new at this and I was learning how to build my own jface text editor
> like this one (http://www.realsolve.co.uk/site/tech/jface-text.php) or
> this (http://www.jdg2e.com/ch26.jface.text/doc/index.html). I already
> know how to do that but I wanted to know if it is possible to launch my
> text editor whenever I want, not only when I go to my package explorer
> and doble-click on a file and select the editor. Actually, I want to be
> able to link the editor to a dialog in my application.
>
> Can you please help me or tell me where can I find an example?

I don't know of any examples off the top of my head, but to open an
editor you'll need to give it an IEditorInput of some kind (when you
open a file from a project, it is (usually) given an IFileEditorInput).

If you have a reference to an IFile, you can use
org.eclipse.ui.ide.IDE.openEditor(IWorkbenchPage, IFile, boolean)

[where the IWOrkbenchPage comes from
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage() ]


Hope this helps,
Eric
Re: Use a jface text editor in my application [message #267403 is a reply to message #267397] Mon, 29 December 2008 18:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eric. First of all thank you for answering!! I’ve been trying to do
what you said, but with any satisfactory result  I’ll try again
later. Anyway, I think that’s not what I’m looking for. That would open
the editor the same way as if I doble-click on a file in the Package
Explorer, wouldn’t it? I mean, in a Eclipse new tab.

In that case I need a file, but I want to edit just a text String. The
problem is that I need content assist, error marking, syntax highlight,
etc. Otherwise I would just use StyledText. For that I have to use that
text editor, but I need to embed it in a text Dialog with some GridData or
something like that.

I’ve been searching for some examples but I couldn’t get anything. Any
help is appreciated!

Thanks again!
Re: Use a jface text editor in my application [message #267409 is a reply to message #267403] Tue, 30 December 2008 09:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 12/29/2008 6:07 PM, Arturo wrote:
> Hi Eric. First of all thank you for answering!! I�ve been trying to do
> what you said, but with any satisfactory result  I�ll try again
> later. Anyway, I think that�s not what I�m looking for. That would open
> the editor the same way as if I doble-click on a file in the Package
> Explorer, wouldn�t it? I mean, in a Eclipse new tab.
>
> In that case I need a file, but I want to edit just a text String. The
> problem is that I need content assist, error marking, syntax highlight,
> etc. Otherwise I would just use StyledText. For that I have to use that
> text editor, but I need to embed it in a text Dialog with some GridData
> or something like that.
>
> I�ve been searching for some examples but I couldn�t get anything. Any
> help is appreciated!

You're right, my suggestion about using the IDE class will launch your
editor, not embed it into a dialog. For that, you might want to look at
the code for the Display view in the JDT debugger. It is a Java editor
with content-assist and other features, like what you describe. Looking
at the code for that view might give you some idea how to do what you want.

Hope this helps,
Eric
Re: Use a jface text editor in my application [message #267468 is a reply to message #267409] Mon, 05 January 2009 09:56 Go to previous message
Eclipse UserFriend
Eric Rizzo wrote:
> On 12/29/2008 6:07 PM, Arturo wrote:
>> Hi Eric. First of all thank you for answering!! I�ve been trying to do
>> what you said, but with any satisfactory result  I�ll try again
>> later. Anyway, I think that�s not what I�m looking for. That would open
>> the editor the same way as if I doble-click on a file in the Package
>> Explorer, wouldn�t it? I mean, in a Eclipse new tab.
>>
>> In that case I need a file, but I want to edit just a text String. The
>> problem is that I need content assist, error marking, syntax highlight,
>> etc. Otherwise I would just use StyledText. For that I have to use that
>> text editor, but I need to embed it in a text Dialog with some GridData
>> or something like that.
>>
>> I�ve been searching for some examples but I couldn�t get anything. Any
>> help is appreciated!
>
> You're right, my suggestion about using the IDE class will launch your
> editor, not embed it into a dialog. For that, you might want to look
> at the code for the Display view in the JDT debugger. It is a Java
> editor with content-assist and other features, like what you describe.
Actually it's not an editor but a source viewer.

Dani
> Looking at the code for that view might give you some idea how to do
> what you want.
>
> Hope this helps,
> Eric
>
Previous Topic:Too many open files
Next Topic:Can't debug Qt program
Goto Forum:
  


Current Time: Tue Jul 22 15:37:03 EDT 2025

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

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

Back to the top