Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Today's Messages (off)  | Unanswered Messages (on)

Forum: TMF (Xtext)
 Topic: A problem with ==, ||, and other
A problem with ==, ||, and other [message #1059458] Sat, 18 May 2013 18:33
Yoandri Saavedra is currently offline Yoandri Saavedra
Messages: 18
Registered: February 2013
Junior Member

My .text file is..
generate go "http://www.google.com/org/Go"

Model returns xbase::XExpression:
	{Model}
	(expressions+=XVariableDeclaration | expressions+=XExpression )*;
	
XPrimaryExpression returns xbase::XExpression:
	XConstructorCall |
	XBlockExpression |
	XSwitchExpression |
	XFeatureCall |
	XLiteral |
	
	XForLoopExpression |
	XWhileExpression |
	XDoWhileExpression |
	XThrowExpression |
	XReturnExpression |
	XTryCatchFinallyExpression |
	XParenthesizedExpression |
	
	XIfExpressionMy ||

	; 

XIfExpressionMy:
	'yeah' '(' if=XExpression ')'
	then+=XExpression
	(=>'oNo' else+=XExpression)?;


I try reuse XExpression.. but when I write
  yeah (true == true)
       var int y = 3
  oNo 
      var int x = 9

say error in ==, extraneous input
 Topic: xText: access on Java packages, classes and methods out from the ProposalProvider
xText: access on Java packages, classes and methods out from the ProposalProvider [message #1059234] Fri, 17 May 2013 08:40
thomas thomas is currently offline thomas thomas
Messages: 1
Registered: May 2013
Junior Member
I developed a DSL which I use together with standard java code. In my DSL I can write things like this:

package:  packagename;
method: void testMethod (int, double);


What I want to do is that the user of the DSL gets the package names and method signatures suggested by the ProposalProvider which are really existing in my project.

Example:
When my project only consists of one package e.g. "TestPackage", the user of the DSL should only get the "TestPackage" as a suggestion.

How can I access my Java project packages, classes or methods out from the complete{TypeName}_{FeatureName} method of the ProposalProvider?



 Topic: Referencing plug-in resources
Referencing plug-in resources [message #1059074] Thu, 16 May 2013 10:25
Roland S. is currently offline Roland S.
Messages: 34
Registered: September 2009
Member
Hi,

we developed a DSL with Xtext and created a product that ships with some documents in that language in a plug-in. If we turn on the pack flag so that the shipped plug-in is put into a jar file, we can add a dependency to that plug-in and reference elements inside the shipped documents. If the plug-in is unpacked after installation (the files are inside a folder in the plugins folder instead of a jar file), referencing the same elements does not work.

Do you have any hints how to avoid this limitation? Sadly we need to unpack some of the plug-ins.

Regards,
Roland
 Topic: IUnitOfWork and undo
IUnitOfWork and undo [message #1058921] Wed, 15 May 2013 14:46
Pawel Pogorzelski is currently offline Pawel Pogorzelski
Messages: 14
Registered: July 2009
Junior Member
Is it possible to wrap all the modifications performed within IUnitOfWork into one so the undo command rolls back all of them?

Cheers,
Pawel
 Topic: Integration of GMF and Xtext -> Problem with ResourceDescription
Integration of GMF and Xtext -> Problem with ResourceDescription [message #1058633] Tue, 14 May 2013 11:09
Phil H is currently offline Phil H
Messages: 63
Registered: November 2012
Member
Hi,

I'm trying to integrate GMF and Xtext at the moment. First I want to outline what I want to have, before I explain my problem.

In the GMF Editor you are able to create nodes, which should be reused by the Xtext grammar. In order to specify some constraints for the model, you can click on a specific node label which opens a xtext based cell editor.

To achieve this, the Xtext grammar reuse the existing ecore from the EMF/GMF project. Furthermore I created a custom Resource Description with an acording manager and service provider. The Resource Description filters the necessary objects, as you can see below:

protected List<IEObjectDescription> computeExportedObjects() {
   List<IEObjectDescription> exportedObjects = new ArrayList<IEObjectDescription>();
   Map<String, String> userData = new HashMap<String, String>();
   for (TreeIterator<EObject> iterator = resource.getAllContents(); iterator.hasNext();) {
      EObject eObject = iterator.next();
      if (eObject instanceof Feature) {
	String qualifiedName = ((Feature) eObject).getName();
          if (qualifiedName != null) {
		 exportedObjects.add(new EObjectDescription(qualifiedNameConverter.toQualifiedName(qualifiedName), eObject,userData));
         }
....


In the GMF Editor, I implemented the IXtextAwareEditPart interface in the corresponding edit part, which uses an XtextDirectEditManager and I also created a new DirectEditPolicy.

When I run the editor now, and reference the Objects in the xtext cell editor it seems to work. But when I add new model elements to my diagram, xtext dont get the reference to them. I need to save the whole diagram first in order that the computeExportedObjects() method is called again and the content assitant offers me the newly added elements.

Is there a way to get the exportedObjects updated every time when there a changes happen in the diagram (for example adding or deleting elements) ?? Because I've not much knowledge about xtext, it's hard for me to find a hook.

Cheers,
Phil



Current Time: Sat May 18 23:59:10 EDT 2013

Powered by FUDForum. Page generated in 0.02710 seconds