Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to fetch the default editor for some extension without popping it up?
How to fetch the default editor for some extension without popping it up? [message #279214] Thu, 13 January 2005 17:06 Go to next message
Eclipse UserFriend
Originally posted by: sigurdur.sveinsson.teamware.com

Hi,

I'm creating an editor to plug into eclipse 3.x and I want that editor to
include the default XSL editor for the Eclipse platform it runs in.

I fetch the ID of the default XSL editor like this:

--------
//("this" = class which extends MultiPageEditorPart )

IWorkbench workBench = this.getSite().getWorkbenchWindow().getWorkbench();
EditorDescriptor editorDescriptor =
(EditorDescriptor)workBench.getEditorRegistry()
.getDefaultEditor("test.xsl");

String editorID = editorDescriptor.getId();
IEditorInput input = new FileEditorInput(getXSLFile()); // holds the XSL
file

IEditorPart defaultXSLEditor = null;

try {
defaultXSLEditor = IDE.openEditor(getSite().getPage(), input,
editorID, false);
} catch(PartInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
--------

....and then I put the "defaultXSLEditor" on a composite and add that
composite as a Page to the MultiPageEditorPart using the
addPage(Composite) method and the default XSL editor appears on that
composite and I can type some stuff in it.



The problem is that IDE.openEditor(...) pops up the default XSL editor
beside my editor and the "defaultXSLEditor" I put on
the composite gets messed up when I close that editor.

So, my question is: how to get a IEditorPart with out popping it up in the
GUI so I can put it on the composite I want?

Kind regards,
Siggi

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Re: How to fetch the default editor for some extension without popping it up? [message #279273 is a reply to message #279214] Fri, 14 January 2005 16:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Chris_Laffra.ca.ibm.com

This is explained in http://www.eclipsefaq.org/chris/faq/html/faq217.html

Chris Laffra, http://eclipsefaq.org

"Sigur
Re: How to fetch the default editor for some extension without popping it up? [message #279425 is a reply to message #279273] Tue, 18 January 2005 14:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sigurdur.sveinsson.teamware.com

Hi Chris,

The FAQ #217 only covers how to create a Multi-page Editor using the
wizard...which I've already done.

What I would like to do is add the default XSL editor to one of the pages
of my editor.

The problem I'm having is that if I use "IDE.openEditor(...)" with the id
of the
default XSL editor (which I obtain like shown in my original message) the
default XSL editor
pops up beside my editor.


How can I get IEditorPart like IDE.openEditor(...) returns, that contains
the default editor for the ".xsl" extension,
without it popping up in the workbench so I can place it on whichever page
I like in my editor?

I don't want to create a new instance by using "IEditorPart editor = new
SomeDefaultXSLEditor()" and put
that "editor" on my page cause I want to use the XSL editor which the user
has defined as the editor to handle ".xsl" extension
and at coding time I can not know which editor that is.

Regards,
Siggi


On Fri, 14 Jan 2005 11:08:56 -0500, Chris Laffra <Chris_Laffra@ca.ibm.com>
wrote:

> This is explained in http://www.eclipsefaq.org/chris/faq/html/faq217.html
>
> Chris Laffra, http://eclipsefaq.org
>
> "Sigurður Ingi Sveinsson" <sigurdur.sveinsson@teamware.com> wrote in
> message
> news:opskjwg1t5avhyyu@arri.teamware.is...
>> Hi,
>>
>> I'm creating an editor to plug into eclipse 3.x and I want that editor
>> to
>> include the default XSL editor for the Eclipse platform it runs in.
>>
>> I fetch the ID of the default XSL editor like this:
>>
>> --------
>> //("this" = class which extends MultiPageEditorPart )
>>
>> IWorkbench workBench =
>> this.getSite().getWorkbenchWindow().getWorkbench();
>> EditorDescriptor editorDescriptor =
>> (EditorDescriptor)workBench.getEditorRegistry()
>>
> .getDefaultEditor("test.xsl");
>>
>> String editorID = editorDescriptor.getId();
>> IEditorInput input = new FileEditorInput(getXSLFile()); // holds the
>> XSL
>> file
>>
>> IEditorPart defaultXSLEditor = null;
>>
>> try {
>> defaultXSLEditor = IDE.openEditor(getSite().getPage(), input,
>> editorID, false);
>> } catch(PartInitException e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>> --------
>>
>> ...and then I put the "defaultXSLEditor" on a composite and add that
>> composite as a Page to the MultiPageEditorPart using the
>> addPage(Composite) method and the default XSL editor appears on that
>> composite and I can type some stuff in it.
>>
>>
>>
>> The problem is that IDE.openEditor(...) pops up the default XSL editor
>> beside my editor and the "defaultXSLEditor" I put on
>> the composite gets messed up when I close that editor.
>>
>> So, my question is: how to get a IEditorPart with out popping it up in
>> the
>> GUI so I can put it on the composite I want?
>>
>> Kind regards,
>> Siggi
>>
>> --
>> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
>



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Re: How to fetch the default editor for some extension without popping it up? [message #279441 is a reply to message #279425] Tue, 18 January 2005 15:19 Go to previous message
Eclipse UserFriend
Originally posted by: Chris_Laffra.ca.ibm.com

I thought the FAQ contained enough info. Rereading it, I guess it does not
:-)

What you would have to do is rehost the editor into one of your editor
panes.
See what IDE.openEditor(...) does, clone the code in there
(activating the plugin, and creating the editor by hand and call
createControl()
on it) and then hope you get the editor life-cycle of the nested editor
working
right.

You could study the Plugin manifest editor (in the PDE plugin) to see
how it deals with its internal editors?

Hope this helps more,

--
Chris Laffra, http://eclipsefaq.org


"Sigur
Previous Topic:system.out in console view
Next Topic:Exception
Goto Forum:
  


Current Time: Tue Mar 19 10:04:29 GMT 2024

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

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

Back to the top