[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: Open IFile int the main window

Jörg,

I think what you showed does that automatically.  This type of approach is more explicit:
PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor("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().getActivePage().openEditor(IFile);

but this method exist not in this way.

I think it is quite easy but i found nothing what really helped me.