Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Get default IEditorDescriptor
Get default IEditorDescriptor [message #309922] Mon, 13 November 2006 03:43 Go to next message
Eclipse UserFriend
Hi all,

I want to programmatically open a file. I found in Eclipse APi all i need
but i still have a problem for files which don't have default editor.

The method
PlatformUI.getWorkbench().getEditorRegistry().findEditor(IEd itorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
returns me the default system editor. But i don't want to use this editor
but the default Eclipse editor which is the one used when i double click
on my file with an unknown extension. Is there an APi to get this
IEditorDescriptor ??

Don't hesitate to aks more details,

Thanks

Manu
Re: Get default IEditorDescriptor [message #309924 is a reply to message #309922] Mon, 13 November 2006 03:46 Go to previous messageGo to next message
Eclipse UserFriend
I have one "dangerous to point of view" solution


IEditorDescriptor desc =
PlatformUI.getWorkbench().getEditorRegistry().getDefaultEdit or(file.getName());
if (desc == null)
desc =
PlatformUI.getWorkbench().getEditorRegistry().getDefaultEdit or( "defaultEditor.txt");

What do you think about this solution ?

Manu
Re: Get default IEditorDescriptor [message #309941 is a reply to message #309924] Mon, 13 November 2006 08:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hkaest.mro.man.de

"Manu" wrote:

> IEditorDescriptor desc =
> PlatformUI.getWorkbench().getEditorRegistry().getDefaultEdit or(file.getName());
> if (desc == null)
> desc =
> PlatformUI.getWorkbench().getEditorRegistry().getDefaultEdit or( "defaultEditor.txt");
> What do you think about this solution ?

You can use the ID for the default editor:

String editorID = EditorsUI.DEFAULT_TEXT_EDITOR_ID

in

IWorkbenchPage#openEditor( IEditorInput input, String editorId)


Harald
Re: Get default IEditorDescriptor [message #309958 is a reply to message #309941] Mon, 13 November 2006 11:06 Go to previous message
Eclipse UserFriend
Thanks
Previous Topic:automatic detection of platform => what Eclipse package, what Java package
Next Topic:How to monitor a launch in 3.0
Goto Forum:
  


Current Time: Sat Jul 19 03:13:40 EDT 2025

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

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

Back to the top