Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Could I create jdt projects in the workspace as result of a xtext generator ?
Could I create jdt projects in the workspace as result of a xtext generator ? [message #951682] Sat, 20 October 2012 23:36 Go to next message
Cristiano Gavião is currently offline Cristiano GaviãoFriend
Messages: 279
Registered: July 2009
Senior Member
Hi,

I'm researching for a new dsl, to see if is possible and would like some tips from the list.

I'm thinking in a grammar like this:
Model:
	'baseDir' basedir = STRING
	components+=Component*;
	
Component:
	'component' name=ID
        '{'
	  'Bundle-SymbolicName' symb=STRING 
        '}'
;



component comp1{
  Bundle-SymbolicName "my.bundle.project"
}




The idea is to create one project in the workspace for each Component in model, maybe using JDT.

Could someone tell me if this would be possible and what route to follow?

regards
Re: Could I create jdt projects in the workspace as result of a xtext generator ? [message #953851 is a reply to message #951682] Mon, 22 October 2012 15:30 Go to previous messageGo to next message
Cristiano Gavião is currently offline Cristiano GaviãoFriend
Messages: 279
Registered: July 2009
Senior Member
Well just found that EMF's Xcore does something that I'm looking for... It creates the UI and Test projects on the workspace based on some configuration in the main xcore model project...

But I couldn't discover yet how and where it triggers that creation...
Re: Could I create jdt projects in the workspace as result of a xtext generator ? [message #961547 is a reply to message #951682] Sun, 28 October 2012 11:11 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1770
Registered: July 2009
Location: Firenze, Italy
Senior Member
So you would like to create, from the generator, other projects right?
You can create projects programmatically with eclipse APIs; xtext.junit*
plugins offer some utility methods to create projects programmatically
even more easily.

I'm using these utility methods in some UI tests
(http://sourceforge.net/p/xsemantics/code/ci/68395a1c0bed6fa2f3cdf7a0220a49d4f27c98ae/tree/examples/it.xsemantics.example.lambda.tests/src/it/xsemantics/example/lambda/tests/ui/LambdaIntegrationTest.java)

here's a snippet

import static org.eclipse.xtext.ui.junit.util.IResourcesSetupUtil.addNature;
import static
org.eclipse.xtext.ui.junit.util.IResourcesSetupUtil.cleanWorkspace;
import static
org.eclipse.xtext.ui.junit.util.IResourcesSetupUtil.createFile;
import static
org.eclipse.xtext.ui.junit.util.IResourcesSetupUtil.waitForAutoBuild;
import static
org.eclipse.xtext.ui.junit.util.JavaProjectSetupUtil.addSourceFolder;
import static
org.eclipse.xtext.ui.junit.util.JavaProjectSetupUtil.createJavaProject;

....

@Test
public void testValidSimpleLambdaProgram() throws Exception {
createJavaProjectWithRootSrc("foo");
IFile file = createFile("foo/src/foo.lambda", "lambda x. x");
waitForAutoBuild();
assertNoErrorMarkers(file);
}

....

private IJavaProject createJavaProjectWithRootSrc(String string)
throws CoreException {
IJavaProject project = createJavaProject(string);
addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
addSourceFolder(project, "src");
return project;
}

hope this helps
Lorenzo

On 10/21/2012 01:36 AM, Cristiano Gaviao wrote:
> Hi,
>
> I'm researching for a new dsl, to see if is possible and would like some
> tips from the list.
>
> I'm thinking in a grammar like this:
>
> Model:
> 'baseDir' basedir = STRING
> components+=Component*;
>
> Component:
> 'component' name=ID
> '{'
> 'Bundle-SymbolicName' symb=STRING '}'
> ;
>
>
>
>
> component comp1{
> Bundle-SymbolicName "my.bundle.project"
> }
>
>
>
>
> The idea is to create one project in the workspace for each Component in
> model, maybe using JDT.
>
> Could someone tell me if this would be possible and what route to follow?
> regards


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Previous Topic:Packages should be imported by their namespace URI.
Next Topic:Proposal for Jvm subtypes
Goto Forum:
  


Current Time: Thu Oct 01 23:38:59 GMT 2020

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

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

Back to the top