Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Associating and Opening Editors
Associating and Opening Editors [message #27539] Mon, 05 May 2003 09:26 Go to next message
Eclipse UserFriend
I would like to know how to accomplish the following:

1. How to associate an editor with an object type instead of a file
extension.

2. How to open an editor programatically.

All help is appreciated
Re: Associating and Opening Editors [message #27638 is a reply to message #27539] Mon, 05 May 2003 13:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chambery.us.ibm.com

Zheng Yi wrote:
> I would like to know how to accomplish the following:
>
> 1. How to associate an editor with an object type instead of a file
> extension.
>
> 2. How to open an editor programatically.

IWorkbenchPage activePage =
getActiveWorkbenchWindow().getActivePage();
activePage.closeEditor(oldTaskEditor, false);
// open new editor
IFile destination = root.getFile(newLocation);
activePage.openEditor(destination);
>
> All help is appreciated
>
>
Re: Associating and Opening Editors [message #28209 is a reply to message #27539] Tue, 06 May 2003 13:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cagatayk.stop.acm.org

Zheng Yi wrote:
> I would like to know how to accomplish the following:
>
> 1. How to associate an editor with an object type instead of a file
> extension.
>

Have a look at IEditorInput interface. By writing your own editor input,
you can open a custom editor on pretty much anything. You will still
have to open it programmatically though.

This is not a big limitation; you have your own object model that you
want to edit and chances are you also want to present this model to the
user in a custom view. For example, Package Explorer shows packages and
JAR file contents for Java projects. Once you have a custom view, you
can invoke your editor programatically, responding to user selections.

> 2. How to open an editor programatically.
>
> All help is appreciated
>
>
Re: Associating and Opening Editors [message #28327 is a reply to message #27638] Tue, 06 May 2003 14:12 Go to previous messageGo to next message
Eclipse UserFriend
What is the root object?

Is it possible to opent the editor and/or associate the editor with an
object type rather than a file.

Thanks for the help


"Todd Chambery" <chambery@us.ibm.com> wrote in message
news:b96mlb$4fa$1@rogue.oti.com...
>
>
> Zheng Yi wrote:
> > I would like to know how to accomplish the following:
> >
> > 1. How to associate an editor with an object type instead of a file
> > extension.
> >
> > 2. How to open an editor programatically.
>
> IWorkbenchPage activePage =
> getActiveWorkbenchWindow().getActivePage();
> activePage.closeEditor(oldTaskEditor, false);
> // open new editor
> IFile destination = root.getFile(newLocation);
> activePage.openEditor(destination);
> >
> > All help is appreciated
> >
> >
>
Re: Associating and Opening Editors [message #28549 is a reply to message #28209] Tue, 06 May 2003 22:15 Go to previous messageGo to next message
Eclipse UserFriend
Thanks. Do you know how that would affect the 'editors' section in the
plugin.xml? WOuld I still need and entry for this editor?


"Cagatay Kavukcuoglu" <cagatayk@stop.acm.org> wrote in message
news:b98r80$inr$1@rogue.oti.com...
> Zheng Yi wrote:
> > I would like to know how to accomplish the following:
> >
> > 1. How to associate an editor with an object type instead of a file
> > extension.
> >
>
> Have a look at IEditorInput interface. By writing your own editor input,
> you can open a custom editor on pretty much anything. You will still
> have to open it programmatically though.
>
> This is not a big limitation; you have your own object model that you
> want to edit and chances are you also want to present this model to the
> user in a custom view. For example, Package Explorer shows packages and
> JAR file contents for Java projects. Once you have a custom view, you
> can invoke your editor programatically, responding to user selections.
>
> > 2. How to open an editor programatically.
> >
> > All help is appreciated
> >
> >
>
Re: Associating and Opening Editors [message #28625 is a reply to message #28549] Wed, 07 May 2003 10:59 Go to previous message
Eclipse UserFriend
Originally posted by: cagatayk.stop.acm.org

Zheng Yi wrote:
> Thanks. Do you know how that would affect the 'editors' section in the
> plugin.xml? WOuld I still need and entry for this editor?
>

Yes, you would. However, you could omit the optional "extensions"
attribute to the "editor" element of the extension.

>
> "Cagatay Kavukcuoglu" <cagatayk@stop.acm.org> wrote in message
> news:b98r80$inr$1@rogue.oti.com...
>
>>Zheng Yi wrote:
>>
>>>I would like to know how to accomplish the following:
>>>
>>>1. How to associate an editor with an object type instead of a file
>>>extension.
>>>
>>
>>Have a look at IEditorInput interface. By writing your own editor input,
>>you can open a custom editor on pretty much anything. You will still
>>have to open it programmatically though.
>>
>>This is not a big limitation; you have your own object model that you
>>want to edit and chances are you also want to present this model to the
>>user in a custom view. For example, Package Explorer shows packages and
>>JAR file contents for Java projects. Once you have a custom view, you
>>can invoke your editor programatically, responding to user selections.
>>
>>
>>>2. How to open an editor programatically.
>>>
>>>All help is appreciated
>>>
>>>
>>
>
>
Previous Topic:MenuManagers and Sub-Menus
Next Topic:failed to import classes in default packages
Goto Forum:
  


Current Time: Wed May 14 00:02:29 EDT 2025

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

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

Back to the top