Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EFS provider based on EMF model of resources
EFS provider based on EMF model of resources [message #1437746] Sat, 04 October 2014 23:45
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member

I've made an Eclipse File System implementation based on an EMF model of
resources, that I think is neat, but that I think could be more useful
with input from others....

Eclipse has a file system abstraction called EFS, upon which the
resource API is built. The resource API in turn is what most Eclipse
plugins use to access the host file system. There is of course a default
implementation based on the local file system, but you can plug in any
implementation, e.g. for accessing data using Webdav, FTP or inside a
Zip file, as if they were local files. To use an alternative EFS
implementation, you create a linked file, that refers to the provided
resource( structure)s using a URI. Once linked to, the resources look
like any other resources to both code that use the resources API or
users that browse with the navigator, project or package explorers.

My EMF-based EFS implementation includes an abstract resource class, and
concrete container (folder) and file classes from which you can create
hierarchies of folders and files. A file contains a content provider
that holds or computes the actual file contents and servers it as an
input stream (as used by EMF). The current implementation supports
providers that serves data from a byte array, a String, a URL or a
github repo (computes the URL for raw github content from the owner,
repo name and branch). You can also store back to the file, if it is
suppored by the provider (if not, the file should be marked read only,
to avoid illegal operations). I can imagine other, more specialized
content providers that compute the content, e.g. models of Java classes
may serve Java source.

My own use case is serving code examples from a Java course wiki, that
are a mixture of complete classes, (f)xml files, snippets and github
links, in a way that make them easy to work with, e.g. view, run and
copy into you own Java projects. From the html source (rendered by the
wiki engine), the code elements are extracted, the resource model is
generated, saved and link to. The nice thing is that all these resources
are seen by the Eclipse compiler, so even if e.g. an fxml resource is
virtual (only exists as a String feature value in the resource model) it
is copied to the bin folder and available to the application.

Do you see other use cases that could/should be supported?

Previous Topic:[Texo] generating a default value for an attribute
Next Topic:Detecting problem marker update completion
Goto Forum:

Current Time: Sun Jul 14 20:25:03 GMT 2024

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

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

Back to the top