Opening my binary encoded files using XtextEditor [message #894850] |
Tue, 10 July 2012 18:48 |
James Ma Messages: 3 Registered: June 2012 Location: United States |
Junior Member |
|
|
First of all I'd like to say I have created my DSL plugin and I'm currently serving alot of satisfied users, Xtext is truly an amazing framework.
I'd like to take a step further and implement a new feature of opening my binary encoded DSL files. I'm new at PDE and Xtext and I did some searching but to no concrete solution, I'd appreciate your help.
In my plugin, DSL files can be text encoded (.tt ext) or binary encoded (.bb ext). Currently, users can only open and view .tt files, but not .bb files. I want users to be also able to view binary encoded files.
I realize XtextEditor is the extension point for the plugin and I have to somehow hook the init(IEditorSite, IEditorInput) method to do this.
I envision implementing a way to detect the file extension (.bb) and if it is so, I would convert the content into text using my own APIs, and pass it back to XtextEditor to display as text just like a .tt file is opened.
Optimally, the user would be just opening the .bb file just like he is opening any other .tt file.
Is this possible? I would appreciate your feedback, thanks
|
|
|
Re: Opening my binary encoded files using XtextEditor [message #896444 is a reply to message #894850] |
Wed, 18 July 2012 12:13 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
Sounds like you need an EMF Resource implementation for the .bb files
doing the conversion on save/load, register a ResourceFactory for this
this and register the editor also to the .tt extension.
I'd propose digging for docs on org.eclipse.emf.ecore.resource.Resource
and Resource.Factory.
Am 10.07.12 20:48, schrieb James Ma:
> First of all I'd like to say I have created my DSL plugin and I'm
> currently serving alot of satisfied users, Xtext is truly an amazing
> framework.
>
>
> I'd like to take a step further and implement a new feature of opening
> my binary encoded DSL files. I'm new at PDE and Xtext and I did some
> searching but to no concrete solution, I'd appreciate your help.
>
> In my plugin, DSL files can be text encoded (.tt ext) or binary encoded
> (.bb ext). Currently, users can only open and view .tt files, but not
> .bb files. I want users to be also able to view binary encoded files.
>
> I realize XtextEditor is the extension point for the plugin and I have
> to somehow hook the init(IEditorSite, IEditorInput) method to do this.
>
> I envision implementing a way to detect the file extension (.bb) and if
> it is so, I would convert the content into text using my own APIs, and
> pass it back to XtextEditor to display as text just like a .tt file is
> opened.
>
> Optimally, the user would be just opening the .bb file just like he is
> opening any other .tt file.
>
> Is this possible? I would appreciate your feedback, thanks :)
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
Powered by
FUDForum. Page generated in 0.03346 seconds