xtext

Cannot add libraries to xtext Project in Eclipse (returns error)

萝らか妹 提交于 2019-12-11 04:13:36
问题 Firstly, I created an xtext project using default values (with the simple Greetings grammar which comes as an example). I created then a .java file with some code (that can be seen below) and added it to the validation folder. I have loaded some jars to the build path as I would do in a normal Java Project. If I run my specific java file as a standalone it will load the libraries and run the code. The java file is quite simple: import org.semanticweb.owlapi.apibinding.OWLManager; import org

Trigger Eclipse's code formatter programmatically from a new file wizard

谁说我不能喝 提交于 2019-12-11 01:35:52
问题 I'm writing an Eclipse plugin with a wizard ( org.eclipse.jface.wizard.Wizard ) which creates a new file with a basic code template. To simplify the "piecing together" of the file contents, I plan to stuff everything into one long string, inject it into the file, and then call my custom Formatter (inherits org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter ) to clean up all the indentation and so on. Question is, how do I go about calling the formatter programmatically? In the

Cannot open workspace-external file in Xtext-based plugin

我的梦境 提交于 2019-12-11 01:27:36
问题 I'm developing an Eclipse Plugin with support for my DSL using the Xtext framework. When I try to open a file on my system with the matching file extension .gf — but which is not in my workspace — I get the following: 0 [main] ERROR org.eclipse.xtext.ui.editor.CompoundXtextEditorCallback - Was configured with another client or not configured at all. java.lang.IllegalStateException: Was configured with another client or not configured at all. at org.eclipse.xtext.ui.editor

ANTLR and Xtext integration for developing plugin

↘锁芯ラ 提交于 2019-12-11 00:18:43
问题 My current project is focusing on code generation from High-level specification. More specifically, developers write high-level specifications and compiler parses them and generates Java code. For parser, I have used ANTLR grammar and for code generation I have used StringTemplateFiles. For providing nice editor support (with syntax high lighting & coloring), I have used xText. Now, the real problem comes - how can I integrate xText editor support with ANTLR parser and code generator? I want

Error while building an xtext project with ant: Generation of the Grammar classes fails

强颜欢笑 提交于 2019-12-10 17:33:28
问题 I am developing an xtext plug-in project for an eclipse application for my Bachelor thesis. I want to do the 'Generate Xtext Artifacts' at runtime with an ant script executing the Mwe2Launcher class and do the generation in an temp folder. I wrote an Activator to create in the temp folder a project folder and copy the mwe2 file, my grammar file and the ant script. Executing the Ant script leads to this error: osgi> start 360 gen: [java] 0 INFO StandaloneSetup - Registering platform uri 'C:

Xtext 2.9 scope provider

假装没事ソ 提交于 2019-12-10 14:52:19
问题 Xtext 2.9 changed the way scope providers work and I don't understand how they work now. Let's say I have the following grammar: grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" Model: ((things+=Thing) | (refs+=Reference))* ; Thing: 'thing' name=ID '{' stuff += Stuff* '}' ; Stuff: 'stuff' name=ID ; Reference: 'reference' thing=[Thing] stuff=[Stuff] ; For the Reference clause to work, I need a scope provider

Advanced Custom Syntax Coloring for Aptana Studio 3 (.less)

杀马特。学长 韩版系。学妹 提交于 2019-12-09 16:21:46
问题 I would like to add syntax highlighting for .less for Aptana Studio 3. I found XText but it only seems to work with Eclipse. Apatana doesn't seem to give too many leads into how to do this on their forums, so does anyone have any experience working with creating custom syntax highlighting or know of a solution for including .less syntax detection and highlighting already? 回答1: If you just want syntax highlighting, you could get Aptana to treat .less files as .css files. To do this, open the

(A better way to) Get files within a project using Eclipse and XText

一曲冷凌霜 提交于 2019-12-08 19:21:36
问题 I'm writing an XText editor, and doing some semantic highlighting. Part of the language I'm parsing refers to files, which should exist in the project. I'd like to highlight based on whether these files are in the correct place. At the moment, I've got a very ugly solution, and I'm sure there's a better way: public void provideHighlightingFor( XtextResource resource, IHighlightedPositionAcceptor acceptor ) { ... String resStr = resource.getURI().toString(); String projName = resStr.replaceAll

Xtext - Check whether string is URL

前提是你 提交于 2019-12-08 09:23:39
问题 I'm completely new to Xtext so thanks in advance for your help. I have the following: terminal PATTERN_SRC : STRING '.png'; Pattern: name='pattern:' value=PATTERN_SRC; I want the user to code it like this: pattern: (URL to image ending with .png / .jpg / .gif) Currently I'm checking it like this but this does not work. Is there a nice way to solve this? Thanks in advance! 回答1: Sone remarks: Don't use the feature name . This is a reserved keyword for calculating unique names of an element in a

How to use rename refactoring as part of a quickfix?

淺唱寂寞╮ 提交于 2019-12-08 02:20:46
问题 I've added a quickfix option to my DSL in which I want to make some modifications to the document text - including renaming some element. I can change text in that element just fine, but I want to also rename all of its references - i.e. rename refactoring. How do I do that? Can I somehow trigger the built-in rename refactoring from inside a quickfix? Or alternatively, how do I go over all of the element's references and change them? 回答1: So, I found a way to programmatically trigger a rename