Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Opening my binary encoded files using XtextEditor(How to hook my BinaryFileOpener before XtextEditor gets the file's content?)
Opening my binary encoded files using XtextEditor [message #894850] Tue, 10 July 2012 14:48 Go to next message
Eclipse UserFriend
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 Smile
Re: Opening my binary encoded files using XtextEditor [message #896444 is a reply to message #894850] Wed, 18 July 2012 08:13 Go to previous message
Eclipse UserFriend
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
Previous Topic:accessing features of a Java type
Next Topic:Creating a project that supply common terminals?
Goto Forum:
  


Current Time: Wed Jul 23 13:49:12 EDT 2025

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

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

Back to the top