Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Re: Referencing models defined in files outside of eclipse
Re: Referencing models defined in files outside of eclipse [message #730696] Wed, 28 September 2011 21:53
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
I have such a setup in cloudsmith/geppetto - a folder that is hidden (by
virtue of having a name starting with '.'). This project must have the
XtextNature set in order to be indexed, and it must be accessable (i.e.
open and "visible" (although hidden from the package explorer view, you
should be able to see it in the navigator view)).

Further, all projects that should have visibility into the hidden folder
must naturally have this declared - either via use of the Java Class
Path mechanism supported by Xtext, or via Project dependencies (also
supported by Xtext as an alternative). Or you need to come up with your
own scheme.

In cloudsmith/geppetto I choose to use Project dependencies (which I
configure using a build job that reads meta data embedded in the
projects). This works as a charm and required very little coding on my part.

Hope that helps. (The cloudsmith/geppetto code is at github). It deals
with other types of visibility issues as well (different types of
projects, preference based search paths, etc.). The project dependency
part should be reasonably general.

Regards
- henrik

On 9/28/11 11:41 PM, eecolor wrote:
> Hello,
>
> I must be missing something. For days now I have been stepping through
> the code of xText, reading the forum, setting breakpoints end trying stuff.
>
> I have an external folder that contains dsl files. This external folder
> will eventually be added to the project in the same style as JDT does
> (external class folder).
>
> As far as I can see I need to bind an IAllContainersState
> implementation. The one I have now looks like this:
>
>
> public class TestStateProjectState extends AbstractAllContainersState
> implements IAllContainersState {
>
> @Inject
> private WorkspaceProjectsStateHelper workspaceProjectsStateHelper;
>
> final protected URI getUri(IStorage file) {
> return super.getUri(file);
> }
>
> @Inject
> private ExternalFoldersManager externalFoldersManager;
>
> @Override
> protected String doInitHandle(URI uri) {
> return workspaceProjectsStateHelper.initHandle(uri);
> }
>
> @Override
> protected Collection<URI> doInitContainedURIs(String containerHandle) {
> if (containerHandle.equals("test"))
> {
> IPath path = new Path("D:/temp");
>
> final Collection<URI> containedURIs = new HashSet<URI>();
> try {
> IFolder folder = externalFoldersManager.createLinkFolder(path, false,
> new NullProgressMonitor());
>
> folder.accept(new IResourceVisitor() {
>
> @Override
> public boolean visit(IResource resource) throws CoreException {
> if (resource instanceof IFile)
> {
> URI uri = getUri((IFile) resource);
> containedURIs.add(uri);
> return false;
> }
> return true;
> }
> });
> } catch (CoreException e) {
> e.printStackTrace();
> }
>
> return containedURIs;
> } else
> {
> return workspaceProjectsStateHelper.initContainedURIs(containerHandle);
> }
> }
>
> @Override
> protected List<String> doInitVisibleHandles(String handle) {
> List<String> initVisibleHandles =
> workspaceProjectsStateHelper.initVisibleHandles(handle);
>
> if (!initVisibleHandles.contains("test"))
> {
> initVisibleHandles.add("test");
> }
> return initVisibleHandles;
> }
> }
>
>
> The ExternalFoldersManager is modeled after the one from JDT and creates
> an invisible project to store the locations as linked resources. Their
> uri looks like this:
> platform:/resource/.ee.xtext.test.external.folders/.link0/String.test
>
> The State is bound like this (in the ui project):
>
>
> public Provider<IAllContainersState> provideIAllContainersState() {
> return
> org.eclipse.xtext.ui.shared.Access.<IAllContainersState>provider(TestStateProjectState.class);
>
> }
>
>
> The mwe2 workflow has these lines:
>
>
> fragment = scoping.ImportNamespacesScopingFragment {}
> fragment = exporting.QualifiedNamesFragment {}
> fragment = builder.BuilderIntegrationFragment {}
>
>
> I do not want to use the JDT features.
>
> As far as I can tell no resource descriptions are being created. What am
> I missing? How can I tell the index to parse the files in this external
> folder?
Previous Topic:How to parse selected text in the XtextEditor
Next Topic:Unable to run Xtext parser from JBoss 3.2.7
Goto Forum:
  


Current Time: Thu Apr 25 06:09:37 GMT 2024

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

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

Back to the top