Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 18:48 Go to next message
James Ma is currently offline James MaFriend
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 Smile
Re: Opening my binary encoded files using XtextEditor [message #896444 is a reply to message #894850] Wed, 18 July 2012 12:13 Go to previous message
Jan Koehnlein is currently offline Jan KoehnleinFriend
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
Previous Topic:accessing features of a Java type
Next Topic:Creating a project that supply common terminals?
Goto Forum:
  


Current Time: Wed Apr 24 19:10:39 GMT 2024

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

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

Back to the top