Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Open IFile int the main window
Open IFile int the main window [message #325770] Tue, 26 February 2008 15:30 Go to next message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
Hello,

i have a tableviewer with some Ifiles as input. Now i wanted to open a
file by doubleclick this cell. How can i do this? i have allready the
listener and the IFile. I found code like this to open the editor:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(IFile);

but this method exist not in this way.

I think it is quite easy but i found nothing what really helped me.
Re: Open IFile int the main window [message #325772 is a reply to message #325770] Tue, 26 February 2008 15:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Jörg,

You'll need to create a FileEditorInput to what the IFile.


Jörg wrote:
> Hello,
>
> i have a tableviewer with some Ifiles as input. Now i wanted to open a
> file by doubleclick this cell. How can i do this? i have allready the
> listener and the IFile. I found code like this to open the editor:
>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(IFile);
>
>
> but this method exist not in this way.
>
> I think it is quite easy but i found nothing what really helped me.
Re: Open IFile int the main window [message #325775 is a reply to message #325772] Tue, 26 February 2008 15:59 Go to previous messageGo to next message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
May be its a stupid question but i didn't found the editorID for the
normal default Editor in the main frame of eclipse. Can you say me this?

Ed Merks schrieb:
> Jörg,
>
> You'll need to create a FileEditorInput to what the IFile.
>
>
> Jörg wrote:
>> Hello,
>>
>> i have a tableviewer with some Ifiles as input. Now i wanted to open a
>> file by doubleclick this cell. How can i do this? i have allready the
>> listener and the IFile. I found code like this to open the editor:
>>
>> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(IFile);
>>
>>
>> but this method exist not in this way.
>>
>> I think it is quite easy but i found nothing what really helped me.
Re: Open IFile int the main window [message #325776 is a reply to message #325775] Tue, 26 February 2008 17:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------040109090603040407020009
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

J
Re: Open IFile int the main window [message #325795 is a reply to message #325776] Wed, 27 February 2008 12:59 Go to previous messageGo to next message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
This helped allready a lot. How can i get the default editor based on
the IFile?

Ed Merks schrieb:
> Jörg,
>
> Normally you'd just let it open the default editor based on what's the
> default for the given IFile. Maybe you want this one.
>
> <extension
> point="org.eclipse.ui.editors">
> <editor
> name="%Editors.DefaultTextEditor"
> icon="$nl$/icons/full/obj16/file_obj.gif"
> class="org.eclipse.ui.editors.text.TextEditor"
>
> contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor "
> * id="org.eclipse.ui.DefaultTextEditor"*>
> <contentTypeBinding
> contentTypeId="org.eclipse.core.runtime.text"
> />
> </editor>
> </extension>
>
>
> Jörg wrote:
>> May be its a stupid question but i didn't found the editorID for the
>> normal default Editor in the main frame of eclipse. Can you say me this?
>>
>> Ed Merks schrieb:
>>> Jörg,
>>>
>>> You'll need to create a FileEditorInput to what the IFile.
>>>
>>>
>>> Jörg wrote:
>>>> Hello,
>>>>
>>>> i have a tableviewer with some Ifiles as input. Now i wanted to open
>>>> a file by doubleclick this cell. How can i do this? i have allready
>>>> the listener and the IFile. I found code like this to open the editor:
>>>>
>>>> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(IFile);
>>>>
>>>>
>>>> but this method exist not in this way.
>>>>
>>>> I think it is quite easy but i found nothing what really helped me.
>
Re: Open IFile int the main window [message #325796 is a reply to message #325795] Wed, 27 February 2008 13:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------090905040709080803010508
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

J
Re: Open IFile int the main window [message #325804 is a reply to message #325796] Wed, 27 February 2008 14:43 Go to previous message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
No the showed does that not automatically, but the last codeline helped
a lot. Thanks

Ed Merks schrieb:
> Jörg,
>
> I think what you showed does that automatically. This type of approach
> is more explicit:
>
> PlatformUI.getWorkbench().getEditorRegistry().getDefaultEdit or( "foo.txt");
>
>
> Jörg wrote:
>> This helped allready a lot. How can i get the default editor based on
>> the IFile?
>>
>> Ed Merks schrieb:
>>> Jörg,
>>>
>>> Normally you'd just let it open the default editor based on what's
>>> the default for the given IFile. Maybe you want this one.
>>>
>>> <extension
>>> point="org.eclipse.ui.editors">
>>> <editor
>>> name="%Editors.DefaultTextEditor"
>>> icon="$nl$/icons/full/obj16/file_obj.gif"
>>> class="org.eclipse.ui.editors.text.TextEditor"
>>>
>>> contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor "
>>>
>>> * id="org.eclipse.ui.DefaultTextEditor"*>
>>> <contentTypeBinding
>>> contentTypeId="org.eclipse.core.runtime.text"
>>> />
>>> </editor>
>>> </extension>
>>>
>>>
>>> Jörg wrote:
>>>> May be its a stupid question but i didn't found the editorID for the
>>>> normal default Editor in the main frame of eclipse. Can you say me
>>>> this?
>>>>
>>>> Ed Merks schrieb:
>>>>> Jörg,
>>>>>
>>>>> You'll need to create a FileEditorInput to what the IFile.
>>>>>
>>>>>
>>>>> Jörg wrote:
>>>>>> Hello,
>>>>>>
>>>>>> i have a tableviewer with some Ifiles as input. Now i wanted to
>>>>>> open a file by doubleclick this cell. How can i do this? i have
>>>>>> allready the listener and the IFile. I found code like this to
>>>>>> open the editor:
>>>>>>
>>>>>> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(IFile);
>>>>>>
>>>>>>
>>>>>> but this method exist not in this way.
>>>>>>
>>>>>> I think it is quite easy but i found nothing what really helped me.
>>>
>
Previous Topic:Activator.getURLConverter crashes ImageRegistry
Next Topic:EclipseCon - BoF - UI Component Programming Best Practices (SWT, Nebula, JFace, Databinding ...)
Goto Forum:
  


Current Time: Sat Jul 27 18:31:41 GMT 2024

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

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

Back to the top