Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » RCP - IWorkbenchPage.openEditor()
RCP - IWorkbenchPage.openEditor() [message #192019] Tue, 10 February 2004 11:44 Go to next message
Eclipse UserFriend
Originally posted by: steve.walton.us.ibm.com

Having trouble creating an IEditorInput and hoping someone can shed some
light. In an RCP application you are not supposed to use
org.eclipse.core.resources (this is a "tip" from Ed Burnette) but when
using IWorkbenchPage.openEditor() you need an IEditorInput which needs
an IFile in its constructor. IFile is in core.resources and further
need to use ResourcesPlugin.getWorkspace().getRoot().getFile() in order
to create an instance of an IFile.

Am I missing something?

Use case - user selects a file to open (using
org.eclipse.swt.widgets.FileDialog), this returns a "String fullPath".
Given this fullPath I want to create an IEditorInput for
IWorkbenchPage.openEditor().

If I ignore the tip and include core.resources in the launch
configuration "plug-ins and fragments", trying to access ResourcesPlugin
throws an "NoClassDefFound" exception.
Re: RCP - IWorkbenchPage.openEditor() [message #192042 is a reply to message #192019] Tue, 10 February 2004 12:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: thomas_maeder.ch.ibm.com

Who says you need an IFile to create an IEditorInput? Look at
ExternalClassFileEditorInput, for example.

Thomas

Steve Walton wrote:
> Having trouble creating an IEditorInput and hoping someone can shed some
> light. In an RCP application you are not supposed to use
> org.eclipse.core.resources (this is a "tip" from Ed Burnette) but when
> using IWorkbenchPage.openEditor() you need an IEditorInput which needs
> an IFile in its constructor. IFile is in core.resources and further
> need to use ResourcesPlugin.getWorkspace().getRoot().getFile() in order
> to create an instance of an IFile.
>
> Am I missing something?
>
> Use case - user selects a file to open (using
> org.eclipse.swt.widgets.FileDialog), this returns a "String fullPath".
> Given this fullPath I want to create an IEditorInput for
> IWorkbenchPage.openEditor().
>
> If I ignore the tip and include core.resources in the launch
> configuration "plug-ins and fragments", trying to access ResourcesPlugin
> throws an "NoClassDefFound" exception.
>
Re: RCP - IWorkbenchPage.openEditor() [message #192129 is a reply to message #192042] Tue, 10 February 2004 14:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: steve.walton.us.ibm.com

Thomas Mäder wrote:
Sorry but I need a hammer...
org.eclipse.jdt.internal.ui.javaeditor.ExternalClassFileEdit orInput has
one constructor and its parameter is an IFile. Help me understand.

> Who says you need an IFile to create an IEditorInput? Look at
> ExternalClassFileEditorInput, for example.
>
> Thomas
>
> Steve Walton wrote:
>
>> Having trouble creating an IEditorInput and hoping someone can shed
>> some light. In an RCP application you are not supposed to use
>> org.eclipse.core.resources (this is a "tip" from Ed Burnette) but when
>> using IWorkbenchPage.openEditor() you need an IEditorInput which needs
>> an IFile in its constructor. IFile is in core.resources and further
>> need to use ResourcesPlugin.getWorkspace().getRoot().getFile() in
>> order to create an instance of an IFile.
>>
>> Am I missing something?
>>
>> Use case - user selects a file to open (using
>> org.eclipse.swt.widgets.FileDialog), this returns a "String fullPath".
>> Given this fullPath I want to create an IEditorInput for
>> IWorkbenchPage.openEditor().
>>
>> If I ignore the tip and include core.resources in the launch
>> configuration "plug-ins and fragments", trying to access
>> ResourcesPlugin throws an "NoClassDefFound" exception.
>>
Re: RCP - IWorkbenchPage.openEditor() [message #192180 is a reply to message #192129] Tue, 10 February 2004 15:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: IanPLang.yahoo.com

I am just starting to play with RCP but here is my educated guess:
ExternalClassFileEditorInput is part of the JDT which is a plug-in that
expects the full IDE support of Eclipse. RCP is for non IDE apps and so
you cannot make use of things that expect IDE support.

I am sure there are many things that can be refactored into the part that
depends on IDE support and the part that does not. Hopefully that will be
an on going effort as people make requests.

IL

Steve Walton wrote:

> Thomas Mäder wrote:
> Sorry but I need a hammer...
> org.eclipse.jdt.internal.ui.javaeditor.ExternalClassFileEdit orInput has
> one constructor and its parameter is an IFile. Help me understand.

<snip>
Re: RCP - IWorkbenchPage.openEditor() [message #192476 is a reply to message #192129] Wed, 11 February 2004 06:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: thomas_maeder.ch.ibm.com

No, I need the hammer (to hit myself over the head). But if you look at
the subtype hierarchy of IEditorInput, you will find numerous other
editor inputs that do not require a IFile in their constructor.

Thomas

Steve Walton wrote:

> Sorry but I need a hammer...
> org.eclipse.jdt.internal.ui.javaeditor.ExternalClassFileEdit orInput has
> one constructor and its parameter is an IFile. Help me understand.
>
Re: RCP - IWorkbenchPage.openEditor() [message #194129 is a reply to message #192019] Fri, 13 February 2004 14:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: John_Arthorne.oti.com_

See, for example, IPathEditorInput.
--

Steve Walton wrote:
> Having trouble creating an IEditorInput and hoping someone can shed some
> light. In an RCP application you are not supposed to use
> org.eclipse.core.resources (this is a "tip" from Ed Burnette) but when
> using IWorkbenchPage.openEditor() you need an IEditorInput which needs
> an IFile in its constructor. IFile is in core.resources and further
> need to use ResourcesPlugin.getWorkspace().getRoot().getFile() in order
> to create an instance of an IFile.
>
> Am I missing something?
>
> Use case - user selects a file to open (using
> org.eclipse.swt.widgets.FileDialog), this returns a "String fullPath".
> Given this fullPath I want to create an IEditorInput for
> IWorkbenchPage.openEditor().
>
> If I ignore the tip and include core.resources in the launch
> configuration "plug-ins and fragments", trying to access ResourcesPlugin
> throws an "NoClassDefFound" exception.
>
Re: RCP - IWorkbenchPage.openEditor() [message #194964 is a reply to message #192019] Sun, 15 February 2004 16:08 Go to previous message
Eclipse UserFriend
Originally posted by: ed.burnette.REMOVE.THIS.sas.com

I should change that statement to say something like resources are an
"optional" part of the RCP. But like others have replied, you can make
editor inputs that don't depend on resources, it's just not as easy.

Your class error is probably the result of some dependent plug-in that
you're not including in the launch config. M7 has a little better support
for this.

--
Ed

"Steve Walton" <steve.walton@us.ibm.com> wrote in message
news:c0b1kl$ome$1@eclipse.org...
> Having trouble creating an IEditorInput and hoping someone can shed some
> light. In an RCP application you are not supposed to use
> org.eclipse.core.resources (this is a "tip" from Ed Burnette) but when
> using IWorkbenchPage.openEditor() you need an IEditorInput which needs
> an IFile in its constructor. IFile is in core.resources and further
> need to use ResourcesPlugin.getWorkspace().getRoot().getFile() in order
> to create an instance of an IFile.
>
> Am I missing something?
Previous Topic:Sample of develope plug-in
Next Topic:Error messages in RCP-project
Goto Forum:
  


Current Time: Tue Jul 22 14:46:09 EDT 2025

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

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

Back to the top