| Forum: TMF (Xtext) |
|---|
| Topic: Add my var in Quick Reference |
|---|
|
| Topic: XbaseScopeProvider in Xtext 2.4 |
|---|
|
| Topic: Maven errors question |
|---|
| Maven errors question [message #1060731] |
Tue, 28 May 2013 05:30 |
|
Hello folks
I was wondering if I could get some help with my maven setup?
I have been using this example as my base for building my maven setup, but since I only need the jar file and not a compilation I have modded the mydsl pom file.
When I extract it in eclipse as runnable jar with the option "Package required libraries into generated Jar" everything works fine, but when I build and run the jar with maven I get the following errors:
----------------------ERROR--------------------------------------
log4j:WARN No appenders could be found for logger (org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.eclipse.emf.common.util.WrappedException: java.lang.StringIndexOutOfBoundsException:
String index out of range: 369
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:182)
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReference(LazyLinkingResource.java:135
)
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReferences(LazyLinkingResource.java:11
4)
at org.eclipse.xtext.EcoreUtil2.resolveLazyCrossReferences(EcoreUtil2.java:510)
at org.eclipse.xtext.validation.ResourceValidatorImpl.resolveProxies(ResourceValidatorImpl.java:154)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:67)
at idainfront.iipax.dsl.generator.Generator.runGenerator(Generator.java:42)
at idainfront.iipax.dsl.generator.Main.main(Main.java:32)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 369
at java.lang.String.substring(Unknown Source)
at org.eclipse.xtext.nodemodel.impl.AbstractNode.getText(AbstractNode.java:95)
at org.eclipse.xtext.nodemodel.util.NodeModelUtils.getTokenText(NodeModelUtils.java:373)
at org.eclipse.xtext.linking.impl.LinkingHelper.getCrossRefNodeAsString(LinkingHelper.java:51)
at org.eclipse.xtext.linking.impl.DefaultLinkingService.getCrossRefNodeAsString(DefaultLinkingService.java:1
39)
at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(DefaultLinkingService.java:115)
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:198)
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:175)
... 7 more
I don't really know what files may help you I thought atleast I might post the pom for this file and the mydsl (which is iidsl for me) projects.
Generator pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>idainfront.iipax.maven</groupId>
<artifactId>idainfront.iipax.dsl.parent</artifactId>
<!-- You should change this and the MANIFEST.MF to your versioning scheme -->
<version>1.0.0-SNAPSHOT</version>
<relativePath>../idainfront.iipax.dsl.parent/pom.xml</relativePath>
</parent>
<artifactId>idainfront.iipax.dsl.generator</artifactId>
<packaging>jar</packaging>
<name>idainfront.iipax.dsl.IiDsl - Generator</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<forceCreation>true</forceCreation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>idainfront.iipax.dsl.generator.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>idainfront.iipax.maven</groupId>
<artifactId>idainfront.iipax.dsl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>idainfront.iipax.maven</groupId>
<artifactId>idainfront.iipax.dsl.standalone</artifactId>
<classifier>repackaged</classifier>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
</dependencies>
</project>
IiDSL pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>idainfront.iipax.maven</groupId>
<artifactId>idainfront.iipax.dsl.parent</artifactId>
<!-- You should change this and the MANIFEST.MF to your versioning scheme -->
<version>1.0.0-SNAPSHOT</version>
<relativePath>../idainfront.iipax.dsl.parent/pom.xml</relativePath>
</parent>
<artifactId>idainfront.iipax.dsl</artifactId>
<packaging>eclipse-plugin</packaging>
<name>idainfront.iipax.dsl.IiDsl - Grammar</name>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<!-- Do not clean the src-gen folder, therefore we remove all paths from
the default configuration in the parent pom. Note the combine.self="override"
statement -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration combine.self="override">
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.xtend</groupId>
<artifactId>xtend-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Hmm... might as well ask, but since I only want to compile a jar file from my main class which turns my dsl file into an xml file by using the generator, do I need to build all the projects they have in the xtext-maven-example or can I simplify it?
(Cinda new to maven )
Thanks for any help
Write you later / Mårten
|
|
|
|
| Re: Maven errors question [message #1060737 is a reply to message #1060735] |
Tue, 28 May 2013 05:49 |
|
Hi,
I should probably have mentioned it. But I did stumble over it, fell quite hard and no wiser when I got up 
I tried to remove the log4j and repackage them in the standalone but it didn't seem to help.
I guess I missed something so will look into it again.
Well, sorry for taking your time if the answer already was here 
Write you later / Mårten
|
|
|
|
| Re: Maven errors question [message #1060741 is a reply to message #1060740] |
Tue, 28 May 2013 06:09 |
|
Hi,
meh! Sorry for taking up your time. Seems I forgot to fix in the repackage.xml file.
Now I only have the log4j warning but... since it compiles I will take that when I have more time 
Sorry again, its like when you ask the teacher about something and just as you ask you find the answer.
Well, at least people here have good patience with me 
Have a good day
Write you later / Mårten
|
|
|
| Topic: New Target Language |
|---|
| Re: New Target Language [message #1060751 is a reply to message #1060642] |
Tue, 28 May 2013 07:06 |
anduril elendil Messages: 4 Registered: May 2013 |
Junior Member |
|
|
Hi,
do you have a link for a tutorial or something else? I wrote my first small grammer and would like to translate it to a xml file. But I can't find anything about how to do this. The only thing I found was XSD and XPAND in the documentation of Eclipse Indigo. How Can I do this with Xtend or do I have to use something else? Currently I use Eclipse Juno.
Thx
|
|
|
|
|
|
| Topic: Correct Indentation |
|---|
|
|
| Re: Correct Indentation [message #1060780 is a reply to message #1060730] |
Tue, 28 May 2013 08:25 |
Andrea Sindico Messages: 257 Registered: November 2010 |
Senior Member |

|
|
I have uncommented the three lines suggested in the default implementation of the AbstractDeclarativeFormatter
c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule());
but it says the getSL_COMMENTRule and getML_COMMENTRule() methods are undefined
am I missing something?
Follow me on Twitter @andreasindico
|
|
|
|
|
|
|
| Topic: Automatically adding Xtext nature to project |
|---|
| Automatically adding Xtext nature to project [message #1060791] |
Tue, 28 May 2013 08:46 |
Phil H Messages: 70 Registered: November 2012 |
Member |
|
|
Hi,
I'm using a GMF editor with xtext. In order to get xtext running corectly, it's necessary to add the xtext nature to the project. Is there way to do this automatically when I create a new gmf diagram. Therefor I'm using the following creation wizard:
<extension point="org.eclipse.ui.newWizards" id="creation-wizard">
<category
id="org.eclipse.ui.PLDev"
name="Prod">
</category>
<wizard
name="Prod"
icon="icons/PldWizard.png"
category="org.eclipse.ui.PLDev"
class="pld.diagram.part.PldCreationWizard"
id="pld.diagram.part.PldCreationWizardID">
<description>Creates a new Productline</description>
</wizard>
</extension>
Is there a chance to extend the creation wizard in order to add a xtext nature to the project?
|
|
|
|
|
| Topic: grammar ignore until next keyword |
|---|
| Re: grammar ignore until next keyword [message #1060827 is a reply to message #1060684] |
Tue, 28 May 2013 10:37 |
Henrik Lindberg Messages: 2431 Registered: July 2009 |
Senior Member |
|
|
On 2013-27-05 20:37, Stella Levin wrote:
> Hi Henrik, great thanks for reply. The problem is that the full grammar
> is VERY complicated, the statements are multi-line. I just want to
> create simplified editor, with basic keyword coloring and outline view.
> Why is it usually a very bad idea to state keywords as terminals? Why
> "terminal NOT_KWD" doesn't work as expected? Thanks again. Stella
You have overlapping terminals. You will probably never trigger NOT_KWD
terminal rule, because there are other terminal rules with higher
precedence.
Keywords work differently than terminals in the lexer; for rules such as
ID, if it matches a keyword the keyword token will be emitted. That will
not happen if you have the keyword as a terminal on its own. There are
also functionality tied to being a keyword as opposed to other types of
punctuation tokens. I.e. rule of thumb "do not use terminals for keywords".
If you want to be able to create a model (to show in the outline) you
naturally need to parse enough of the syntax. One way this can be done
is to write an external lexer that simplifies the task in the grammar.
Hope that helps.
Regards
- henrik
|
|
|
| Topic: How to define a 'synchronized' method using the model inferrer |
|---|
| How to define a 'synchronized' method using the model inferrer [message #1060821] |
Tue, 28 May 2013 10:05 |
Oren Mishali Messages: 11 Registered: March 2013 |
Junior Member |
|
|
Hi all,
I'm using the model inferrer in order to map elements in a model into Java methods. E.g., I have this code:
...
members += model.toMethod("foo", model.newTypeRef(Void::TYPE)) [
body = [ append('''...''') ]
...
Is it possible to define the above Java method as 'synchronized'? I hope it is...
Thanks!
Oren
|
|
|
| Re: How to define a 'synchronized' method using the model inferrer [message #1060831 is a reply to message #1060821] |
Tue, 28 May 2013 10:48 |
Lorenzo Bettini Messages: 1128 Registered: July 2009 |
Senior Member |
|
|
On 05/28/2013 04:05 PM, Oren Mishali wrote:
> Hi all,
> I'm using the model inferrer in order to map elements in a model into
> Java methods. E.g., I have this code:
>
>
> ..
> members += model.toMethod("foo", model.newTypeRef(Void::TYPE)) [
> body = [ append('''...''') ]
> ..
>
>
> Is it possible to define the above Java method as 'synchronized'? I hope
> it is...
Just inspect the JvmOperation and you can see the get/setSynchronized :)
members += model.toMethod("foo", model.newTypeRef(Void::TYPE)) [
body = [ append('''...''') ]
synchronized = true
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
|
|
|
| Topic: xtext project creation programmatically |
|---|
| xtext project creation programmatically [message #1060872] |
Tue, 28 May 2013 15:06 |
Vincent De Bry Messages: 5 Registered: May 2013 |
Junior Member |
|
|
Hello,
I would like to create Xtext projects (base + ui) programmatically.
I took a look at xtext project wizard but I cannot figure out which methods of which classes have to be used.
Do someone already had the same need and could provide me with an implementation example ?
Thanks
|
|
|
| Topic: Dependency injection in objects instantiated in custom code |
|---|
|
|
|
| Topic: Xtext Save Action |
|---|
|
|
|
|
| Re: Xtext Save Action [message #1060718 is a reply to message #1060715] |
Tue, 28 May 2013 04:44 |
junior developer Messages: 159 Registered: January 2013 |
Senior Member |
|
|
I want to do Create an element,its default fields are created automatically such as my grammar :
ContentType returns ContentType:
'ContentType'
name=QualifiedName
'{'
'guID' '=' guID=STRING
'displayName' '=' displayName=STRING
('description' '=' description=STRING)?
('group' '=' group=STRING)?
('parent' '=' parentContentType=[ContentType|QualifiedName])?
(ownedField+=Field (ownedField+=Field)*)?
'}';
Field returns Field:
LookUp | BooleanField | TextField | NumberField;
TextField returns TextField:
'Text' name=QualifiedName '{'
'guID' '=' guID=STRING
'displayName' '=' displayName=STRING
('required' '=' required=EBoolean)?
('unlimitedLenghtInDocumentLibraries' '=' unlimitedLenghtInDocumentLibraries=EBoolean)?
('description' '=' description=STRING)?
('group' '=' group=STRING)?
('default' '=' default=STRING)?
('displaySize' '=' displaySize=INT)?
('maxLength' '=' maxLength=INT)?
'}';
My grammar is below.When I create a contenttype ,ContentType's Fields are created automatically:ownedField+=Field (ownedField+=Field)*)?
When I create ContentType below Text Field is created automatically in the Xtext Editor.User may change its property onlly.I hope ,I can explain my problem.
Text text {
guID = "guID"
displayName="bollty u" required = true unlimitedLenghtInDocumentLibraries= false default = "Default"
}
[Updated on: Tue, 28 May 2013 04:45] Report message to a moderator
|
|
|
|
|
|
|
|
| Re: Xtext Save Action [message #1060752 is a reply to message #1060736] |
Tue, 28 May 2013 07:09 |
junior developer Messages: 159 Registered: January 2013 |
Senior Member |
|
|
Hi Christian,
I understand ,it is drived.I do not try XtextDocumentProvider.doSaveDocument.
I wrote code in the
public class EditorCallback extends NatureAddingEditorCallback {
public class EditorCallback extends NatureAddingEditorCallback {
@Override
I solved internal name and Displayname.When I save editor,qualifiedname is wrote in the displayname field and if qualifiedname has emtpt ,remove blanked and then rewrite fullname, and first blanked name is written in the displayname field.I solved my problem .All changes manupulation on the editor .I written my code in the
public void afterSave(XtextEditor editor) .
Now ,I want to drived process (create default field in the right place on the editor when one element is created).I may use XtextDocumentProvider.doSaveDocument.Hence when Xtextdocument is saved ,I will create default elements.Do you have offered an example?
|
|
|
|