mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 16:28:56 +00:00
Merge branch 'master' into task_230-Junit4Fragment2_added
This commit is contained in:
commit
4db60c8130
74 changed files with 679 additions and 374 deletions
5
.project
5
.project
|
@ -5,11 +5,6 @@
|
|||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
|
|
|
@ -9,7 +9,7 @@ buildscript {
|
|||
apply from: "${rootDir}/gradle/versions.gradle"
|
||||
repositories.jcenter()
|
||||
dependencies {
|
||||
classpath "org.xtext:xtext-gradle-plugin:$versions.xtend_plugin"
|
||||
classpath "org.xtext:xtext-gradle-plugin:$versions.xtext_gradle_plugin"
|
||||
classpath "io.typefox.gradle:gradle-p2gen:$versions.gradle_plugins"
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,10 @@ subprojects {
|
|||
apply from: "${rootDir}/gradle/java-compiler-settings.gradle"
|
||||
apply from: "${rootDir}/gradle/xtend-compiler-settings.gradle"
|
||||
apply from: "${rootDir}/gradle/maven-deployment.gradle"
|
||||
apply from: "${rootDir}/gradle/eclipse-project-layout.gradle"
|
||||
// The bootstrap project uses only the mwe2 source set
|
||||
if (!name.endsWith('bootstrap')) {
|
||||
apply from: "${rootDir}/gradle/eclipse-project-layout.gradle"
|
||||
}
|
||||
apply from: "${rootDir}/gradle/manifest-gen.gradle"
|
||||
apply from: "${rootDir}/gradle/validation.gradle"
|
||||
}
|
||||
|
|
|
@ -32,5 +32,5 @@ configurations {
|
|||
dependencies {
|
||||
xtendCompiler "org.eclipse.xtend:org.eclipse.xtend.core:$bootstrapXtendVersion"
|
||||
xtendCompiler "org.eclipse.xtext:org.eclipse.xtext.smap:$bootstrapXtendVersion"
|
||||
xtendCompiler "org.xtext:xtext-gradle-builder:$versions.xtend_plugin"
|
||||
xtendCompiler "org.xtext:xtext-gradle-builder:$versions.xtext_gradle_plugin"
|
||||
}
|
||||
|
|
|
@ -32,14 +32,18 @@ jar {
|
|||
from ('.') {
|
||||
include 'about*.*', 'plugin.xml', 'schema/**', 'model/**', 'plugin.properties'
|
||||
}
|
||||
if (isTestProject)
|
||||
from(sourceSets.test.output)
|
||||
if (isTestProject) {
|
||||
from sourceSets.test.output
|
||||
}
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
from ('.') {
|
||||
include 'about*.*'
|
||||
}
|
||||
if (isTestProject) {
|
||||
from sourceSets.test.allSource
|
||||
}
|
||||
}
|
||||
|
||||
if (isTestProject || name.contains('testlanguage')) {
|
||||
|
@ -56,7 +60,6 @@ if (isTestProject || name.contains('testlanguage')) {
|
|||
eclipse {
|
||||
classpath {
|
||||
plusConfigurations += [configurations.optional]
|
||||
plusConfigurations += [configurations.mwe2Runtime]
|
||||
file.whenMerged {
|
||||
entries.each { source ->
|
||||
if (source.kind == 'src' && source.path.endsWith('-gen') && !source.path.equals('xtend-gen') ) {
|
||||
|
|
|
@ -32,17 +32,11 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
|
|||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
mwe2 {}
|
||||
}
|
||||
|
||||
configurations {
|
||||
optional {
|
||||
description 'Dependencies required at build time, but not exported into meta data'
|
||||
extendsFrom compile
|
||||
}
|
||||
mwe2Compile.extendsFrom mainCompile
|
||||
mwe2Runtime.extendsFrom mainRuntime
|
||||
|
||||
// Put any unwanted transitive dependencies here, they will be excluded from all projects.
|
||||
all {
|
||||
|
|
37
gradle/mwe2-workflows.gradle
Normal file
37
gradle/mwe2-workflows.gradle
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Configuration of source sets, dependencies, and tasks for running MWE2 workflows.
|
||||
*/
|
||||
|
||||
sourceSets {
|
||||
mwe2 {}
|
||||
}
|
||||
|
||||
eclipse.classpath.plusConfigurations += [configurations.mwe2Runtime]
|
||||
|
||||
dependencies {
|
||||
if (!name.endsWith('bootstrap')) {
|
||||
mwe2Compile project(':org.eclipse.xtext.xtext.generator')
|
||||
}
|
||||
mwe2Runtime "org.eclipse.emf:org.eclipse.emf.mwe2.launch:$versions.emfMwe2"
|
||||
mwe2Runtime "org.eclipse.xtext:org.eclipse.xtext.common.types:$versions.xtext_bootstrap"
|
||||
mwe2Runtime "org.eclipse.xtext:org.eclipse.xtext.ecore:$versions.xtext_bootstrap"
|
||||
}
|
||||
|
||||
if (findProperty('compileXtend') == 'true') {
|
||||
generateMwe2Xtext.xtextClasspath = rootProject.configurations.getByName('xtendCompiler')
|
||||
}
|
||||
|
||||
class XtextGeneratorTask extends JavaExec {
|
||||
XtextGeneratorTask() {
|
||||
group = 'Build'
|
||||
main = 'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher'
|
||||
classpath = project.sourceSets.mwe2.runtimeClasspath
|
||||
}
|
||||
def setWorkflow(File workflowFile) {
|
||||
args = [workflowFile.path, "-p", "rootPath=${project.rootDir}"]
|
||||
inputs.file workflowFile
|
||||
description "Execute the MWE2 workflow ${workflowFile.name}"
|
||||
}
|
||||
}
|
||||
|
||||
ext.XtextGeneratorTask = XtextGeneratorTask
|
|
@ -8,7 +8,7 @@ ext.versions = [
|
|||
'xtext': version,
|
||||
'xtext_bootstrap': '2.11.0.beta2',
|
||||
'gradle_plugins': '0.1.0',
|
||||
'xtend_plugin': '1.0.14',
|
||||
'xtext_gradle_plugin': '1.0.15',
|
||||
'lsp4j': '0.1.0-SNAPSHOT',
|
||||
'log4j': '1.2.16',
|
||||
'equinoxCommon' : '3.8.0',
|
||||
|
|
|
@ -7,14 +7,17 @@ if (findProperty('compileXtend') == 'true') {
|
|||
gen.xtextClasspath = rootProject.configurations.getByName('xtendCompiler')
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
from (sourceSets.main.xtendOutputDir) {
|
||||
include '**/*._trace'
|
||||
}
|
||||
if (name.endsWith('tests')) {
|
||||
from (sourceSets.test.xtendOutputDir) {
|
||||
// Defer the sources jar configuration to later when the source sets are set up completely
|
||||
afterEvaluate {
|
||||
sourcesJar {
|
||||
from (sourceSets.main.xtendOutputDir) {
|
||||
include '**/*._trace'
|
||||
}
|
||||
if (name.endsWith('tests')) {
|
||||
from (sourceSets.test.xtendOutputDir) {
|
||||
include '**/*._trace'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="xtend-gen">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="testlang-src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="xtend-gen"/>
|
||||
<classpathentry kind="src" path="testlang-src"/>
|
||||
<classpathentry kind="src" path="testlang-src-gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
apply from: "${rootDir}/gradle/mwe2-workflows.gradle"
|
||||
|
||||
dependencies {
|
||||
compile project(':org.eclipse.xtext.ide')
|
||||
compile project(':org.eclipse.xtext.testing')
|
||||
|
@ -5,20 +7,6 @@ dependencies {
|
|||
compile project(':org.eclipse.xtext.testlanguages.ide')
|
||||
compile "junit:junit:$versions.junit"
|
||||
compile "org.eclipse.lsp4j:org.eclipse.lsp4j:$versions.lsp4j"
|
||||
mwe2Compile project(':org.eclipse.xtext.xtext.generator')
|
||||
mwe2Compile "org.eclipse.xtext:org.eclipse.xtext.common.types:$versions.xtext_bootstrap"
|
||||
mwe2Runtime "org.eclipse.emf:org.eclipse.emf.mwe2.launch:$versions.emfMwe2"
|
||||
}
|
||||
|
||||
task generateXtextLanguage(type: JavaExec) {
|
||||
main = 'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher'
|
||||
classpath = configurations.mwe2Runtime
|
||||
inputs.file "testlang-src/org/eclipse/xtext/ide/tests/testlanguage/GenerateTestLanguage.mwe2"
|
||||
inputs.file "testlang-src/org/eclipse/xtext/ide/tests/testlanguage/TestLanguage.xtext"
|
||||
outputs.dir "testlang-src-gen"
|
||||
args += "testlang-src/org/eclipse/xtext/ide/tests/testlanguage/GenerateTestLanguage.mwe2"
|
||||
args += "-p"
|
||||
args += "rootPath=/${projectDir}/.."
|
||||
}
|
||||
|
||||
sourceSets.test.java {
|
||||
|
@ -29,3 +17,9 @@ sourceSets.test.resources {
|
|||
srcDir 'testlang-src'
|
||||
srcDir 'testlang-src-gen'
|
||||
}
|
||||
|
||||
task generateTestLanguages(type: XtextGeneratorTask) {
|
||||
workflow = file('testlang-src/org/eclipse/xtext/ide/tests/testlanguage/GenerateTestLanguage.mwe2')
|
||||
inputs.file 'testlang-src/org/eclipse/xtext/ide/tests/testlanguage/TestLanguage.xtext'
|
||||
outputs.dir 'testlang-src-gen'
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
modelDirectory="/org.eclipse.xtext.ide.tests/testlang-src-gen" modelPluginID="org.eclipse.xtext.ide.tests"
|
||||
forceOverwrite="true" modelName="PartialContentAssistTestLanguage" updateClasspath="false"
|
||||
rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" complianceLevel="6.0"
|
||||
copyrightFields="false" runtimeVersion="2.11">
|
||||
copyrightFields="false" runtimeVersion="2.12">
|
||||
<genPackages prefix="PartialContentAssistTestLanguage" basePackage="org.eclipse.xtext.ide.tests.testlanguage"
|
||||
disposableProviderFactory="true" fileExtensions="partialcontentassisttestlang"
|
||||
ecorePackage="PartialContentAssistTestLanguage.ecore#/">
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2016 TypeFox GmbH (http://www.typefox.io) and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html"
|
||||
modelDirectory="/org.eclipse.xtext.ide.tests/testlang-src-gen" modelPluginID="org.eclipse.xtext.ide.tests"
|
||||
forceOverwrite="true" modelName="TestLanguage" updateClasspath="false" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
|
||||
complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.11">
|
||||
complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.12">
|
||||
<genPackages prefix="TestLanguage" basePackage="org.eclipse.xtext.ide.tests.testlanguage"
|
||||
disposableProviderFactory="true" fileExtensions="testlang" ecorePackage="TestLanguage.ecore#/">
|
||||
<genClasses ecoreClass="TestLanguage.ecore#//Model">
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="xtend-gen">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="xtend-gen"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
|
|
|
@ -115,7 +115,10 @@ class ProjectManager {
|
|||
}
|
||||
|
||||
def Resource getResource(URI uri) {
|
||||
resourceSet.getResource(uri, true)
|
||||
val resource = resourceSet.getResource(uri, true)
|
||||
// initialize
|
||||
resource.contents
|
||||
return resource
|
||||
}
|
||||
|
||||
def void reportProjectIssue(String message, String code, Severity severity) {
|
||||
|
|
|
@ -152,7 +152,9 @@ public class ProjectManager {
|
|||
}
|
||||
|
||||
public Resource getResource(final URI uri) {
|
||||
return this.resourceSet.getResource(uri, true);
|
||||
final Resource resource = this.resourceSet.getResource(uri, true);
|
||||
resource.getContents();
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void reportProjectIssue(final String message, final String code, final Severity severity) {
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="xtend-gen">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="tests">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="xtend-gen"/>
|
||||
<classpathentry kind="src" path="tests"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
|
|
|
@ -92,10 +92,14 @@ public class FormatterTestHelper {
|
|||
String document = req.getToBeFormatted().toString();
|
||||
XtextResource parsed = parse(document);
|
||||
if (req.isAllowSyntaxErrors()) {
|
||||
request.setExceptionHandler(ExceptionAcceptor.IGNORING);
|
||||
if (request.getExplicitExceptionHandler() == null) {
|
||||
request.setExceptionHandler(ExceptionAcceptor.IGNORING);
|
||||
}
|
||||
} else {
|
||||
assertNoSyntaxErrors(parsed);
|
||||
request.setExceptionHandler(ExceptionAcceptor.THROWING);
|
||||
if (request.getExplicitExceptionHandler() == null) {
|
||||
request.setExceptionHandler(ExceptionAcceptor.THROWING);
|
||||
}
|
||||
}
|
||||
request.setTextRegionAccess(createRegionAccess(parsed, req));
|
||||
if (request.getPreferences() == null)
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="src-gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="xtend-gen">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="xtend-gen"/>
|
||||
<classpathentry kind="src" path="src-gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
apply from: "${rootDir}/gradle/mwe2-workflows.gradle"
|
||||
|
||||
dependencies {
|
||||
compile project(':org.eclipse.xtext')
|
||||
compile project(':org.eclipse.xtext.testing')
|
||||
compile "org.eclipse.platform:org.eclipse.core.runtime:$versions.eclipseCore"
|
||||
mwe2Compile project(':org.eclipse.xtext.xtext.generator')
|
||||
mwe2Runtime "org.eclipse.xtext:org.eclipse.xtext.common.types:$versions.xtext_bootstrap"
|
||||
mwe2Runtime "org.eclipse.emf:org.eclipse.emf.mwe2.launch:$versions.emfMwe2"
|
||||
}
|
||||
|
||||
uploadArchives.enabled = false
|
||||
// Include the mwe2 and xtext files from the main source set when executing the workflow
|
||||
sourceSets.mwe2.runtimeClasspath += processResources.outputs.files
|
||||
|
||||
task generateTestLanguages(type: XtextGeneratorTask) {
|
||||
workflow = file('src/org/eclipse/xtext/testlanguages/GenerateTestLanguages.mwe2')
|
||||
outputs.dir 'src-gen'
|
||||
}
|
||||
|
|
|
@ -1,41 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="xtend-gen">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="xtend-gen"/>
|
||||
<classpathentry kind="src" path="src-gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="emf-gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="suites">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="generator/src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="suites"/>
|
||||
<classpathentry kind="src" path="generator/src"/>
|
||||
<classpathentry kind="src" path="generator/xtend-gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
repositories {
|
||||
flatDir {
|
||||
dirs 'lib'
|
||||
}
|
||||
}
|
||||
apply from: "${rootDir}/gradle/mwe2-workflows.gradle"
|
||||
|
||||
dependencies {
|
||||
compile project(':org.eclipse.xtext.testing')
|
||||
|
@ -12,19 +8,33 @@ dependencies {
|
|||
compile "junit:junit:$versions.junit"
|
||||
compile "org.eclipse.emf:org.eclipse.emf.common:$versions.emfCommon"
|
||||
compile "org.eclipse.emf:org.eclipse.emf.ecore.xmi:$versions.emfEcore"
|
||||
// From the 'lib' folder
|
||||
optional name: 'simple'
|
||||
mwe2Runtime "org.eclipse.xtext:org.eclipse.xtext.common.types:$versions.xtext_bootstrap"
|
||||
mwe2Runtime "org.eclipse.emf:org.eclipse.emf.mwe2.launch:$versions.emfMwe2"
|
||||
optional files('lib/simple.jar')
|
||||
// The MWE2 workflow depends on emf-gen, so we have to include it in the test dependencies
|
||||
testCompile sourceSets.mwe2.output
|
||||
}
|
||||
|
||||
sourceSets.test.java {
|
||||
srcDir 'suites'
|
||||
sourceSets.test {
|
||||
java.srcDirs = ['src', 'src-gen', 'suites']
|
||||
if (findProperty('compileXtend') != 'true') {
|
||||
java.srcDir 'xtend-gen'
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.mwe2.java {
|
||||
srcDir 'generator/src'
|
||||
srcDir 'generator/xtend-gen'
|
||||
sourceSets.mwe2 {
|
||||
java.srcDirs = ['generator/src', 'emf-gen']
|
||||
if (findProperty('compileXtend') == 'true') {
|
||||
xtendOutputDir = 'generator/xtend-gen'
|
||||
} else {
|
||||
java.srcDir 'generator/xtend-gen'
|
||||
}
|
||||
runtimeClasspath += processTestResources.outputs.files
|
||||
}
|
||||
jar.from sourceSets.mwe2.output
|
||||
sourcesJar.from sourceSets.mwe2.allSource
|
||||
|
||||
task generateTestLanguages(type: XtextGeneratorTask) {
|
||||
workflow = file('src/org/eclipse/xtext/GenerateAllTestLanguages.mwe2')
|
||||
outputs.dir 'src-gen'
|
||||
}
|
||||
|
||||
test {
|
||||
|
|
|
@ -11,25 +11,15 @@ import org.eclipse.emf.ecore.EClass;
|
|||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.emf.ecore.EcorePackage;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.EPackageImpl;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerNsURI.EcorePerNsURIFactory;
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerNsURI.EcorePerNsURIPackage;
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerNsURI.ExtendsNsURIEObject;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformPlugin.EcorePerPlatformPluginPackage;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformPlugin.impl.EcorePerPlatformPluginPackageImpl;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformResource.EcorePerPlatformResourcePackage;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformResource.impl.EcorePerPlatformResourcePackageImpl;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecoreReference.EcoreReferencePackage;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecoreReference.impl.EcoreReferencePackageImpl;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model <b>Package</b>.
|
||||
|
|
|
@ -11,26 +11,16 @@ import org.eclipse.emf.ecore.EClass;
|
|||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.emf.ecore.EcorePackage;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.EPackageImpl;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerNsURI.EcorePerNsURIPackage;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerNsURI.impl.EcorePerNsURIPackageImpl;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformPlugin.EcorePerPlatformPluginFactory;
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformPlugin.EcorePerPlatformPluginPackage;
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformPlugin.ExtendsEAttribute;
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformPlugin.ExtendsPluginEObject;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformResource.EcorePerPlatformResourcePackage;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformResource.impl.EcorePerPlatformResourcePackageImpl;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecoreReference.EcoreReferencePackage;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecoreReference.impl.EcoreReferencePackageImpl;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model <b>Package</b>.
|
||||
|
|
|
@ -11,25 +11,15 @@ import org.eclipse.emf.ecore.EClass;
|
|||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.emf.ecore.EReference;
|
||||
import org.eclipse.emf.ecore.EcorePackage;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.EPackageImpl;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerNsURI.EcorePerNsURIPackage;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerNsURI.impl.EcorePerNsURIPackageImpl;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformPlugin.EcorePerPlatformPluginPackage;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformPlugin.impl.EcorePerPlatformPluginPackageImpl;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformResource.EcorePerPlatformResourceFactory;
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformResource.EcorePerPlatformResourcePackage;
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformResource.ExtendsResourceEObject;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecoreReference.EcoreReferencePackage;
|
||||
|
||||
import org.eclipse.xtext.metamodelreferencing.tests.ecoreReference.impl.EcoreReferencePackageImpl;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* An implementation of the model <b>Package</b>.
|
||||
|
|
|
@ -886,4 +886,27 @@
|
|||
class="org.eclipse.xtext.generator.ecore.genmodelaccess.noLiterals.NoLiteralsPackage"
|
||||
genModel="src/org/eclipse/xtext/generator/ecore/GenModelAccessTest.genmodel"/>
|
||||
</extension>
|
||||
<extension point="org.eclipse.emf.ecore.generated_package">
|
||||
<!-- @generated EcoreReferences -->
|
||||
<package
|
||||
uri="http://www.eclipse.org/2011/tmf/xtext/ecorePerNsURI"
|
||||
class="org.eclipse.xtext.metamodelreferencing.tests.ecorePerNsURI.EcorePerNsURIPackage"
|
||||
genModel="src/org/eclipse/xtext/metamodelreferencing/tests/EcoreReferences.genmodel"/>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.emf.ecore.generated_package">
|
||||
<!-- @generated EcoreReferences -->
|
||||
<package
|
||||
uri="http://www.eclipse.org/2011/tmf/xtext/ecorePerPlatformPlugin"
|
||||
class="org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformPlugin.EcorePerPlatformPluginPackage"
|
||||
genModel="src/org/eclipse/xtext/metamodelreferencing/tests/EcoreReferences.genmodel"/>
|
||||
</extension>
|
||||
|
||||
<extension point="org.eclipse.emf.ecore.generated_package">
|
||||
<!-- @generated EcoreReferences -->
|
||||
<package
|
||||
uri="http://www.eclipse.org/2011/tmf/xtext/ecorePerPlatformResource"
|
||||
class="org.eclipse.xtext.metamodelreferencing.tests.ecorePerPlatformResource.EcorePerPlatformResourcePackage"
|
||||
genModel="src/org/eclipse/xtext/metamodelreferencing/tests/EcoreReferences.genmodel"/>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -62,14 +62,14 @@ public class ExUnorderedGroupsTestLanguageSyntacticSequencer extends AbstractSyn
|
|||
/**
|
||||
* Ambiguous syntax:
|
||||
* (
|
||||
* '5' |
|
||||
* '6' |
|
||||
* '3' |
|
||||
* '11' |
|
||||
* '7' |
|
||||
* '4' |
|
||||
* '10' |
|
||||
* 'bug302585'
|
||||
* 'bug302585' |
|
||||
* '4' |
|
||||
* '6' |
|
||||
* '5' |
|
||||
* '11' |
|
||||
* '7'
|
||||
* )
|
||||
*
|
||||
* This ambiguous syntax occurs at:
|
||||
|
|
|
@ -63,13 +63,13 @@ public class SimpleUnorderedGroupsTestLanguageSyntacticSequencer extends Abstrac
|
|||
* Ambiguous syntax:
|
||||
* (
|
||||
* '3' |
|
||||
* '5' |
|
||||
* '11' |
|
||||
* '4' |
|
||||
* '10' |
|
||||
* 'bug302585' |
|
||||
* '6' |
|
||||
* '7'
|
||||
* '10' |
|
||||
* '7' |
|
||||
* '4' |
|
||||
* '5' |
|
||||
* 'bug302585' |
|
||||
* '11'
|
||||
* )
|
||||
*
|
||||
* This ambiguous syntax occurs at:
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.formatting2.internal
|
||||
|
||||
import com.google.inject.Inject
|
||||
import org.eclipse.xtext.formatting2.internal.formattertestlanguage.IDList
|
||||
import org.eclipse.xtext.formatting2.internal.tests.FormatterTestLanguageInjectorProvider
|
||||
import org.eclipse.xtext.testing.InjectWith
|
||||
import org.eclipse.xtext.testing.XtextRunner
|
||||
import org.eclipse.xtext.util.Wrapper
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@RunWith(XtextRunner)
|
||||
@InjectWith(FormatterTestLanguageInjectorProvider)
|
||||
class FormattingConflictTest {
|
||||
@Inject extension GenericFormatterTester
|
||||
|
||||
// @Inject extension FormatterTestLanguageGrammarAccess
|
||||
@Test def void enableDebugTracingTrue() {
|
||||
val wrapper = new Wrapper<Throwable>
|
||||
val execution = new Wrapper<Integer>(0)
|
||||
assertFormatted[
|
||||
toBeFormatted = '''
|
||||
idlist a
|
||||
'''
|
||||
formatter = [ IDList model, extension regions, extension document |
|
||||
execution.set(execution.get + 1)
|
||||
model.regionFor.keyword("idlist").append[space = " "]
|
||||
model.regionFor.keyword("idlist").append[space = "\t"]
|
||||
]
|
||||
request.enableDebugTracing = true
|
||||
request.exceptionHandler = [ e |
|
||||
wrapper.set(e)
|
||||
]
|
||||
]
|
||||
val exception = wrapper.get as ConflictingRegionsException
|
||||
Assert.assertEquals(1, execution.get)
|
||||
Assert.assertEquals(2, exception.traces.size)
|
||||
}
|
||||
|
||||
@Test def void enableDebugTracingFalse() {
|
||||
val wrapper = new Wrapper<Throwable>
|
||||
val execution = new Wrapper<Integer>(0)
|
||||
assertFormatted[
|
||||
toBeFormatted = '''
|
||||
idlist a
|
||||
'''
|
||||
formatter = [ IDList model, extension regions, extension document |
|
||||
execution.set(execution.get + 1)
|
||||
model.regionFor.keyword("idlist").append[space = " "]
|
||||
model.regionFor.keyword("idlist").append[space = "\t"]
|
||||
]
|
||||
request.enableDebugTracing = false
|
||||
request.exceptionHandler = [ e |
|
||||
wrapper.set(e)
|
||||
]
|
||||
]
|
||||
val exception = wrapper.get as ConflictingRegionsException
|
||||
Assert.assertEquals(2, execution.get)
|
||||
Assert.assertEquals(2, exception.traces.size)
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,7 @@ import static org.junit.Assert.*
|
|||
class RegionSetTest {
|
||||
|
||||
def private void test(CharSequence expectation, (TestableTextSegmentSet)=>void test) {
|
||||
val set = new TestableTextSegmentSet(new ArrayListTextSegmentSet(Functions.identity, Functions.toStringFunction))
|
||||
val set = new TestableTextSegmentSet(new ArrayListTextSegmentSet(Functions.identity, Functions.toStringFunction, true))
|
||||
try {
|
||||
test.apply(set)
|
||||
} catch (Throwable t) {
|
||||
|
|
|
@ -23,6 +23,10 @@ import org.eclipse.xtext.testing.validation.ValidationTestHelper
|
|||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess
|
||||
import org.eclipse.xtext.formatting2.regionaccess.IHiddenRegion
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISequentialRegion
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
|
@ -661,10 +665,28 @@ class RegionAccessBuilderTest {
|
|||
validationTestHelper.assertNoErrors(obj)
|
||||
val access1 = obj.createFromNodeModel
|
||||
val access2 = obj.serializeToRegions
|
||||
assertToStringDoesNotCrash(access1)
|
||||
assertToStringDoesNotCrash(access2)
|
||||
Assert.assertEquals(exp, new TextRegionAccessToString().withRegionAccess(access1).cfg() + "\n")
|
||||
Assert.assertEquals(exp, new TextRegionAccessToString().withRegionAccess(access2).cfg() + "\n")
|
||||
}
|
||||
|
||||
private def assertToStringDoesNotCrash(ITextRegionAccess access) {
|
||||
var current = access.regionForRootEObject.previousHiddenRegion as ISequentialRegion
|
||||
while (current !== null) {
|
||||
Assert.assertNotNull(current.toString)
|
||||
switch current {
|
||||
IHiddenRegion: {
|
||||
current = current.nextSemanticRegion
|
||||
}
|
||||
ISemanticRegion: {
|
||||
Assert.assertNotNull(current.EObjectRegion.toString)
|
||||
current = current.nextHiddenRegion
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def TextRegionAccessToString cfg(TextRegionAccessToString toStr) {
|
||||
toStr.hideColumnExplanation().withTextWidth(10)
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ dependencies {
|
|||
mwe2 "org.eclipse.emf:org.eclipse.emf.mwe2.launch:2.9.0.201605261059"
|
||||
mwe2 "org.eclipse.xtext:org.eclipse.xtext.common.types:${xtextVersion}"
|
||||
mwe2 "org.eclipse.xtext:org.eclipse.xtext.xtext.generator:${xtextVersion}"
|
||||
mwe2 "org.eclipse.xtext:xtext-antlr-generator:[2.1.1, 3)"
|
||||
}
|
||||
|
||||
task generateXtextLanguage(type: JavaExec) {
|
||||
|
|
|
@ -56,6 +56,11 @@
|
|||
<artifactId>org.eclipse.xtext.xbase</artifactId>
|
||||
<version>${xtextVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.xtext</groupId>
|
||||
<artifactId>xtext-antlr-generator</artifactId>
|
||||
<version>[2.1.1, 3)</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
|
|
@ -15,6 +15,7 @@ dependencies {
|
|||
mwe2 "org.eclipse.emf:org.eclipse.emf.mwe2.launch:2.9.0.201605261059"
|
||||
mwe2 "org.eclipse.xtext:org.eclipse.xtext.common.types:${xtextVersion}"
|
||||
mwe2 "org.eclipse.xtext:org.eclipse.xtext.xtext.generator:${xtextVersion}"
|
||||
mwe2 "org.eclipse.xtext:xtext-antlr-generator:[2.1.1, 3)"
|
||||
}
|
||||
|
||||
task generateXtextLanguage(type: JavaExec) {
|
||||
|
|
|
@ -56,6 +56,11 @@
|
|||
<artifactId>org.eclipse.xtext.xbase</artifactId>
|
||||
<version>${xtextVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.xtext</groupId>
|
||||
<artifactId>xtext-antlr-generator</artifactId>
|
||||
<version>[2.1.1, 3)</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
|
|
@ -56,6 +56,11 @@
|
|||
<artifactId>org.eclipse.xtext.xbase</artifactId>
|
||||
<version>${xtextVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.xtext</groupId>
|
||||
<artifactId>xtext-antlr-generator</artifactId>
|
||||
<version>[2.1.1, 3)</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
/**
|
||||
* Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.xtext.formatting2.internal;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.formatting2.FormatterRequest;
|
||||
import org.eclipse.xtext.formatting2.IFormattableDocument;
|
||||
import org.eclipse.xtext.formatting2.IHiddenRegionFormatter;
|
||||
import org.eclipse.xtext.formatting2.internal.ConflictingRegionsException;
|
||||
import org.eclipse.xtext.formatting2.internal.GenericFormatter;
|
||||
import org.eclipse.xtext.formatting2.internal.GenericFormatterTestRequest;
|
||||
import org.eclipse.xtext.formatting2.internal.GenericFormatterTester;
|
||||
import org.eclipse.xtext.formatting2.internal.formattertestlanguage.IDList;
|
||||
import org.eclipse.xtext.formatting2.internal.tests.FormatterTestLanguageInjectorProvider;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionExtensions;
|
||||
import org.eclipse.xtext.testing.InjectWith;
|
||||
import org.eclipse.xtext.testing.XtextRunner;
|
||||
import org.eclipse.xtext.util.IAcceptor;
|
||||
import org.eclipse.xtext.util.Wrapper;
|
||||
import org.eclipse.xtext.xbase.lib.Extension;
|
||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
@RunWith(XtextRunner.class)
|
||||
@InjectWith(FormatterTestLanguageInjectorProvider.class)
|
||||
@SuppressWarnings("all")
|
||||
public class FormattingConflictTest {
|
||||
@Inject
|
||||
@Extension
|
||||
private GenericFormatterTester _genericFormatterTester;
|
||||
|
||||
@Test
|
||||
public void enableDebugTracingTrue() {
|
||||
final Wrapper<Throwable> wrapper = new Wrapper<Throwable>();
|
||||
final Wrapper<Integer> execution = new Wrapper<Integer>(Integer.valueOf(0));
|
||||
final Procedure1<GenericFormatterTestRequest> _function = (GenericFormatterTestRequest it) -> {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("idlist a");
|
||||
_builder.newLine();
|
||||
it.setToBeFormatted(_builder);
|
||||
final GenericFormatter<IDList> _function_1 = new GenericFormatter<IDList>() {
|
||||
@Override
|
||||
protected void format(final IDList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) {
|
||||
Integer _get = execution.get();
|
||||
int _plus = ((_get).intValue() + 1);
|
||||
execution.set(Integer.valueOf(_plus));
|
||||
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.setSpace(" ");
|
||||
};
|
||||
document.append(regions.regionFor(model).keyword("idlist"), _function);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.setSpace("\t");
|
||||
};
|
||||
document.append(regions.regionFor(model).keyword("idlist"), _function_1);
|
||||
}
|
||||
};
|
||||
it.setFormatter(_function_1);
|
||||
FormatterRequest _request = it.getRequest();
|
||||
_request.setEnableDebugTracing(true);
|
||||
FormatterRequest _request_1 = it.getRequest();
|
||||
final IAcceptor<Exception> _function_2 = (Exception e) -> {
|
||||
wrapper.set(e);
|
||||
};
|
||||
_request_1.setExceptionHandler(_function_2);
|
||||
};
|
||||
this._genericFormatterTester.assertFormatted(_function);
|
||||
Throwable _get = wrapper.get();
|
||||
final ConflictingRegionsException exception = ((ConflictingRegionsException) _get);
|
||||
Assert.assertEquals(1, (execution.get()).intValue());
|
||||
Assert.assertEquals(2, exception.getTraces().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void enableDebugTracingFalse() {
|
||||
final Wrapper<Throwable> wrapper = new Wrapper<Throwable>();
|
||||
final Wrapper<Integer> execution = new Wrapper<Integer>(Integer.valueOf(0));
|
||||
final Procedure1<GenericFormatterTestRequest> _function = (GenericFormatterTestRequest it) -> {
|
||||
StringConcatenation _builder = new StringConcatenation();
|
||||
_builder.append("idlist a");
|
||||
_builder.newLine();
|
||||
it.setToBeFormatted(_builder);
|
||||
final GenericFormatter<IDList> _function_1 = new GenericFormatter<IDList>() {
|
||||
@Override
|
||||
protected void format(final IDList model, @Extension final ITextRegionExtensions regions, @Extension final IFormattableDocument document) {
|
||||
Integer _get = execution.get();
|
||||
int _plus = ((_get).intValue() + 1);
|
||||
execution.set(Integer.valueOf(_plus));
|
||||
final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.setSpace(" ");
|
||||
};
|
||||
document.append(regions.regionFor(model).keyword("idlist"), _function);
|
||||
final Procedure1<IHiddenRegionFormatter> _function_1 = (IHiddenRegionFormatter it_1) -> {
|
||||
it_1.setSpace("\t");
|
||||
};
|
||||
document.append(regions.regionFor(model).keyword("idlist"), _function_1);
|
||||
}
|
||||
};
|
||||
it.setFormatter(_function_1);
|
||||
FormatterRequest _request = it.getRequest();
|
||||
_request.setEnableDebugTracing(false);
|
||||
FormatterRequest _request_1 = it.getRequest();
|
||||
final IAcceptor<Exception> _function_2 = (Exception e) -> {
|
||||
wrapper.set(e);
|
||||
};
|
||||
_request_1.setExceptionHandler(_function_2);
|
||||
};
|
||||
this._genericFormatterTester.assertFormatted(_function);
|
||||
Throwable _get = wrapper.get();
|
||||
final ConflictingRegionsException exception = ((ConflictingRegionsException) _get);
|
||||
Assert.assertEquals(2, (execution.get()).intValue());
|
||||
Assert.assertEquals(2, exception.getTraces().size());
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@ public class RegionSetTest {
|
|||
private void test(final CharSequence expectation, final Procedure1<? super TestableTextSegmentSet> test) {
|
||||
Function<ITextSegment, ITextSegment> _identity = Functions.<ITextSegment>identity();
|
||||
Function<Object, String> _stringFunction = Functions.toStringFunction();
|
||||
ArrayListTextSegmentSet<ITextSegment> _arrayListTextSegmentSet = new ArrayListTextSegmentSet<ITextSegment>(_identity, _stringFunction);
|
||||
ArrayListTextSegmentSet<ITextSegment> _arrayListTextSegmentSet = new ArrayListTextSegmentSet<ITextSegment>(_identity, _stringFunction, true);
|
||||
final TestableTextSegmentSet set = new TestableTextSegmentSet(_arrayListTextSegmentSet);
|
||||
try {
|
||||
test.apply(set);
|
||||
|
|
|
@ -13,6 +13,9 @@ import org.eclipse.emf.ecore.EObject;
|
|||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.formatting2.debug.TextRegionAccessToString;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.IHiddenRegion;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ISequentialRegion;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.TextRegionAccessBuilder;
|
||||
import org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root;
|
||||
|
@ -1433,6 +1436,8 @@ public class RegionAccessBuilderTest {
|
|||
this.validationTestHelper.assertNoErrors(obj);
|
||||
final ITextRegionAccess access1 = this.createFromNodeModel(obj);
|
||||
final ITextRegionAccess access2 = this.serializer.serializeToRegions(obj);
|
||||
this.assertToStringDoesNotCrash(access1);
|
||||
this.assertToStringDoesNotCrash(access2);
|
||||
TextRegionAccessToString _cfg = this.cfg(new TextRegionAccessToString().withRegionAccess(access1));
|
||||
String _plus = (_cfg + "\n");
|
||||
Assert.assertEquals(exp, _plus);
|
||||
|
@ -1444,6 +1449,28 @@ public class RegionAccessBuilderTest {
|
|||
}
|
||||
}
|
||||
|
||||
private void assertToStringDoesNotCrash(final ITextRegionAccess access) {
|
||||
IHiddenRegion _previousHiddenRegion = access.regionForRootEObject().getPreviousHiddenRegion();
|
||||
ISequentialRegion current = ((ISequentialRegion) _previousHiddenRegion);
|
||||
while ((current != null)) {
|
||||
{
|
||||
Assert.assertNotNull(current.toString());
|
||||
boolean _matched = false;
|
||||
if (current instanceof IHiddenRegion) {
|
||||
_matched=true;
|
||||
current = ((IHiddenRegion)current).getNextSemanticRegion();
|
||||
}
|
||||
if (!_matched) {
|
||||
if (current instanceof ISemanticRegion) {
|
||||
_matched=true;
|
||||
Assert.assertNotNull(((ISemanticRegion)current).getEObjectRegion().toString());
|
||||
current = ((ISemanticRegion)current).getNextHiddenRegion();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TextRegionAccessToString cfg(final TextRegionAccessToString toStr) {
|
||||
return toStr.hideColumnExplanation().withTextWidth(10);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="xtend-gen">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="xtend-gen"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
|
|
|
@ -30,6 +30,10 @@ class XtextVersion {
|
|||
'2.9.0.201605261059'
|
||||
}
|
||||
|
||||
def getAntlrGeneratorVersion() {
|
||||
'[2.1.1, 3)'
|
||||
}
|
||||
|
||||
def getXtendGradlePluginVersion() {
|
||||
xtextGradlePluginVersion
|
||||
}
|
||||
|
|
|
@ -53,6 +53,10 @@ public class XtextVersion {
|
|||
return "2.9.0.201605261059";
|
||||
}
|
||||
|
||||
public String getAntlrGeneratorVersion() {
|
||||
return "[2.1.1, 3)";
|
||||
}
|
||||
|
||||
public String getXtendGradlePluginVersion() {
|
||||
return this.getXtextGradlePluginVersion();
|
||||
}
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="xtend-gen">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="xtend-gen"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
1
org.eclipse.xtext.xtext.bootstrap/.gitignore
vendored
Normal file
1
org.eclipse.xtext.xtext.bootstrap/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.antlr-generator-*.jar
|
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
|
|
|
@ -1,26 +1,45 @@
|
|||
/*
|
||||
* Bootstrap project for the Xtext language. It contains an MWE2 generator workflow with
|
||||
* dedicated configuration code. The workflow generates into the core and generic ide projects
|
||||
* as well as the Eclipse and IDEA integration projects, which are defined in different
|
||||
* source repositories. The path to these other repositories is assumed to be ../xtext-eclipse
|
||||
* and ../xtext-idea, respectively.
|
||||
*/
|
||||
|
||||
apply from: "${rootDir}/gradle/mwe2-workflows.gradle"
|
||||
|
||||
dependencies {
|
||||
// We cannot use the projects within the workspace, as we would have
|
||||
// to compile them before generating the code, so we need to stick to the bootstrapping version.
|
||||
// Buildship, however, links the workspace projects anyway (as yet).
|
||||
// Buildship, however, links the workspace projects anyway if a composite build is used.
|
||||
compile "org.eclipse.xtext:org.eclipse.xtext:$versions.xtext_bootstrap"
|
||||
compile "org.eclipse.xtext:org.eclipse.xtext.xtext.generator:$versions.xtext_bootstrap"
|
||||
|
||||
// Dependencies required for successfully executing the Xtext generation workflow
|
||||
mwe2Runtime "org.eclipse.emf:org.eclipse.emf.mwe2.launch:$versions.emfMwe2"
|
||||
mwe2Runtime "org.eclipse.xtext:org.eclipse.xtext.common.types:$versions.xtext_bootstrap"
|
||||
mwe2Runtime "org.eclipse.xtext:org.eclipse.xtext.ecore:$versions.xtext_bootstrap"
|
||||
}
|
||||
|
||||
// Call this task for generating the 'Xtext' language implementation.
|
||||
// The employed version of the Xtext generator is determined by '$versions.xtext_bootstrap', see above.
|
||||
task generateXtextLanguage(type: JavaExec) {
|
||||
main = 'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher'
|
||||
classpath = sourceSets.mwe2.runtimeClasspath
|
||||
args += "src/org/eclipse/xtext/xtext/bootstrap/GenerateXtext.mwe2"
|
||||
args += "-p"
|
||||
args += "rootPath=/${projectDir}/.."
|
||||
sourceSets.main.java.srcDirs = []
|
||||
sourceSets.main.resources.srcDirs = []
|
||||
sourceSets.test.java.srcDirs = []
|
||||
sourceSets.test.resources.srcDirs = []
|
||||
|
||||
sourceSets.mwe2 {
|
||||
java.srcDir 'src'
|
||||
if (findProperty('compileXtend') == 'true') {
|
||||
xtendOutputDir = 'xtend-gen'
|
||||
} else {
|
||||
java.srcDir 'xtend-gen'
|
||||
}
|
||||
}
|
||||
configurations.mwe2Compile.extendsFrom configurations.compile
|
||||
jar.from sourceSets.mwe2.output
|
||||
sourcesJar.from sourceSets.mwe2.allSource
|
||||
|
||||
task generateXtextLanguage(type: XtextGeneratorTask) {
|
||||
workflow = file('src/org/eclipse/xtext/xtext/bootstrap/GenerateXtext.mwe2')
|
||||
}
|
||||
|
||||
// The following setting would cause 'generateXtextLanguage' to be executed as part of 'build',
|
||||
// namely before compiling the classes of the 'main' sourceSet, which however is empty here.
|
||||
// classes.dependsOn(generateXtextLanguage)
|
||||
eclipse {
|
||||
project {
|
||||
natures 'org.eclipse.xtext.ui.shared.xtextNature'
|
||||
buildCommands.add(0,new org.gradle.plugins.ide.eclipse.model.BuildCommand('org.eclipse.xtext.ui.shared.xtextBuilder'))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="xtend-gen">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="xtend-gen"/>
|
||||
<classpathentry kind="src" path="src-gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
|
|
|
@ -737,7 +737,7 @@ class WebIntegrationFragment extends AbstractXtextGeneratorFragment {
|
|||
}
|
||||
|
||||
override destroy() {
|
||||
if (disposableRegistry != null) {
|
||||
if (disposableRegistry !== null) {
|
||||
disposableRegistry.dispose()
|
||||
disposableRegistry = null
|
||||
}
|
||||
|
|
|
@ -1749,7 +1749,7 @@ public class WebIntegrationFragment extends AbstractXtextGeneratorFragment {
|
|||
_builder.append("override destroy() {");
|
||||
_builder.newLine();
|
||||
_builder.append("\t\t");
|
||||
_builder.append("if (disposableRegistry != null) {");
|
||||
_builder.append("if (disposableRegistry !== null) {");
|
||||
_builder.newLine();
|
||||
_builder.append("\t\t\t");
|
||||
_builder.append("disposableRegistry.dispose()");
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="src-gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
|
|
|
@ -2,25 +2,23 @@
|
|||
<projectDescription>
|
||||
<name>org.eclipse.xtext.xtext.ide</name>
|
||||
<comment>Xtext Language generic IDE support.</comment>
|
||||
<projects/>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
|
||||
</natures>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<linkedResources/>
|
||||
</projectDescription>
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="xtend-gen">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**/*.java|**/*.xtend|**/*.xtendbin|**/*._trace" kind="src" path="resources">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="xtend-gen"/>
|
||||
<classpathentry excluding="**/*.java|**/*.xtend" kind="src" path="resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
|
|
|
@ -284,6 +284,7 @@ class RuntimeProjectDescriptor extends TestedProjectDescriptor {
|
|||
mwe2 "org.eclipse.emf:org.eclipse.emf.mwe2.launch:«config.xtextVersion.mweVersion»"
|
||||
mwe2 "org.eclipse.xtext:org.eclipse.xtext.common.types:${xtextVersion}"
|
||||
mwe2 "org.eclipse.xtext:org.eclipse.xtext.xtext.generator:${xtextVersion}"
|
||||
mwe2 "org.eclipse.xtext:xtext-antlr-generator:«config.xtextVersion.antlrGeneratorVersion»"
|
||||
«IF fromExistingEcoreModels»
|
||||
mwe2 "org.eclipse.xtext:org.eclipse.xtext.generator:${xtextVersion}"
|
||||
mwe2 "org.eclipse.xpand:org.eclipse.xpand:2.0.0"
|
||||
|
@ -375,6 +376,11 @@ class RuntimeProjectDescriptor extends TestedProjectDescriptor {
|
|||
<artifactId>org.eclipse.xtext.xbase</artifactId>
|
||||
<version>${xtextVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.xtext</groupId>
|
||||
<artifactId>xtext-antlr-generator</artifactId>
|
||||
<version>«config.xtextVersion.antlrGeneratorVersion»</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
«ENDIF»
|
||||
</plugin>
|
||||
|
|
|
@ -596,6 +596,12 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor {
|
|||
_builder.append("\t");
|
||||
_builder.append("mwe2 \"org.eclipse.xtext:org.eclipse.xtext.xtext.generator:${xtextVersion}\"");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("mwe2 \"org.eclipse.xtext:xtext-antlr-generator:");
|
||||
String _antlrGeneratorVersion = this.getConfig().getXtextVersion().getAntlrGeneratorVersion();
|
||||
_builder.append(_antlrGeneratorVersion, "\t");
|
||||
_builder.append("\"");
|
||||
_builder.newLineIfNotEmpty();
|
||||
{
|
||||
boolean _isFromExistingEcoreModels = this.isFromExistingEcoreModels();
|
||||
if (_isFromExistingEcoreModels) {
|
||||
|
@ -915,6 +921,29 @@ public class RuntimeProjectDescriptor extends TestedProjectDescriptor {
|
|||
_builder.append("</dependency>");
|
||||
_builder.newLine();
|
||||
_builder.append("\t\t\t");
|
||||
_builder.append("\t");
|
||||
_builder.append("<dependency>");
|
||||
_builder.newLine();
|
||||
_builder.append("\t\t\t");
|
||||
_builder.append("\t\t");
|
||||
_builder.append("<groupId>org.eclipse.xtext</groupId>");
|
||||
_builder.newLine();
|
||||
_builder.append("\t\t\t");
|
||||
_builder.append("\t\t");
|
||||
_builder.append("<artifactId>xtext-antlr-generator</artifactId>");
|
||||
_builder.newLine();
|
||||
_builder.append("\t\t\t");
|
||||
_builder.append("\t\t");
|
||||
_builder.append("<version>");
|
||||
String _antlrGeneratorVersion = this.getConfig().getXtextVersion().getAntlrGeneratorVersion();
|
||||
_builder.append(_antlrGeneratorVersion, "\t\t\t\t\t");
|
||||
_builder.append("</version>");
|
||||
_builder.newLineIfNotEmpty();
|
||||
_builder.append("\t\t\t");
|
||||
_builder.append("\t");
|
||||
_builder.append("</dependency>");
|
||||
_builder.newLine();
|
||||
_builder.append("\t\t\t");
|
||||
_builder.append("</dependencies>");
|
||||
_builder.newLine();
|
||||
}
|
||||
|
|
|
@ -1,32 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="xtend-gen">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="xtend-gen"/>
|
||||
<classpathentry kind="src" path="src-gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="emf-gen">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="packrat">
|
||||
<attributes>
|
||||
<attribute name="FROM_GRADLE_MODEL" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry including="**/*.java|**/*.xtend" kind="src" path="packrat"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -15,11 +15,6 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.xtext.formatting2.internal.HiddenRegionFormatting;
|
|||
import org.eclipse.xtext.formatting2.internal.HiddenRegionFormattingMerger;
|
||||
import org.eclipse.xtext.formatting2.internal.HiddenRegionReplacer;
|
||||
import org.eclipse.xtext.formatting2.internal.MultilineCommentReplacer;
|
||||
import org.eclipse.xtext.formatting2.internal.RegionTraceMissingException;
|
||||
import org.eclipse.xtext.formatting2.internal.RootDocument;
|
||||
import org.eclipse.xtext.formatting2.internal.SingleHiddenRegionFormatter;
|
||||
import org.eclipse.xtext.formatting2.internal.SinglelineCodeCommentReplacer;
|
||||
|
@ -264,9 +265,13 @@ public abstract class AbstractFormatter2 implements IFormatter2 {
|
|||
public final List<ITextReplacement> format(FormatterRequest request) {
|
||||
try {
|
||||
initialize(request);
|
||||
IFormattableDocument document = createFormattableRootDocument();
|
||||
XtextResource xtextResource = request.getTextRegionAccess().getResource();
|
||||
format(xtextResource, document);
|
||||
IFormattableDocument document = createFormattableRootDocument();
|
||||
try {
|
||||
format(xtextResource, document);
|
||||
} catch (RegionTraceMissingException e) {
|
||||
document = handleTraceMissing(document, e);
|
||||
}
|
||||
List<ITextReplacement> rendered = document.renderToTextReplacements();
|
||||
List<ITextReplacement> postprocessed = postProcess(document, rendered);
|
||||
return postprocessed;
|
||||
|
@ -275,6 +280,17 @@ public abstract class AbstractFormatter2 implements IFormatter2 {
|
|||
}
|
||||
}
|
||||
|
||||
protected IFormattableDocument handleTraceMissing(IFormattableDocument problematic, RegionTraceMissingException e) {
|
||||
if (request.isEnableDebugTracing()) {
|
||||
return problematic;
|
||||
}
|
||||
request.setEnableDebugTracing(true);
|
||||
XtextResource xtextResource = request.getTextRegionAccess().getResource();
|
||||
IFormattableDocument document = createFormattableRootDocument();
|
||||
format(xtextResource, document);
|
||||
return document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement this method to create a language-specific formatter.
|
||||
*
|
||||
|
|
|
@ -206,6 +206,10 @@ public class FormatterRequest {
|
|||
return ExceptionAcceptor.LOGGING;
|
||||
return exceptionHandler;
|
||||
}
|
||||
|
||||
public IAcceptor<Exception> getExplicitExceptionHandler() {
|
||||
return exceptionHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #exceptionHandler
|
||||
|
@ -214,4 +218,23 @@ public class FormatterRequest {
|
|||
this.exceptionHandler = problemHandler;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable creation of Java stack traces to diagnose conflicting formatting
|
||||
* instructions.
|
||||
*
|
||||
* This option is disabled for performance reasons. It is safe to leave it
|
||||
* disabled, because in case a conflict happens, the formatter will
|
||||
* automatically enable this flag and format again. The second pass of the
|
||||
* formatter will then lead to the desired debug information.
|
||||
**/
|
||||
private boolean enableDebugTracing = false;
|
||||
|
||||
public boolean isEnableDebugTracing() {
|
||||
return enableDebugTracing;
|
||||
}
|
||||
|
||||
public void setEnableDebugTracing(boolean enableDebugTracing) {
|
||||
this.enableDebugTracing = enableDebugTracing;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,8 +79,8 @@ public class TextRegionAccessToString {
|
|||
private static final String HIDDEN_PADDED = Strings.padEnd(HIDDEN, TITLE_WIDTH, ' ');
|
||||
private static final String SEMANTIC_PADDED = Strings.padEnd("S", TITLE_WIDTH, ' ');
|
||||
|
||||
private Function<AbstractElement, String> grammarToString = new GrammarElementTitleSwitch().showRule().showAssignments()
|
||||
.showQualified();
|
||||
private Function<AbstractElement, String> grammarToString = new GrammarElementTitleSwitch().showRule()
|
||||
.showAssignments().showQualified();
|
||||
|
||||
private boolean hideColumnExplanation = false;
|
||||
|
||||
|
@ -180,7 +180,23 @@ public class TextRegionAccessToString {
|
|||
}
|
||||
for (String error : errors)
|
||||
result.add(error, false);
|
||||
int indentation = 0;
|
||||
int indentation = 0, min = 0;
|
||||
for (ITextSegment region : list) {
|
||||
if (region instanceof IHiddenRegion) {
|
||||
Collection<IEObjectRegion> found = hiddens.get((IHiddenRegion) region);
|
||||
for (IEObjectRegion obj : found) {
|
||||
boolean p = obj.getNextHiddenRegion().equals(region);
|
||||
boolean n = obj.getPreviousHiddenRegion().equals(region);
|
||||
if (p)
|
||||
indentation--;
|
||||
else if (n)
|
||||
indentation++;
|
||||
if (indentation < min)
|
||||
min = indentation;
|
||||
}
|
||||
}
|
||||
}
|
||||
indentation = min < 0 ? min * -1 : 0;
|
||||
for (ITextSegment region : list) {
|
||||
List<IEObjectRegion> previous = Lists.newArrayList();
|
||||
List<IEObjectRegion> next = Lists.newArrayList();
|
||||
|
|
|
@ -27,14 +27,20 @@ public class ArrayListTextSegmentSet<T> extends TextSegmentSet<T> {
|
|||
|
||||
private final List<T> contents = Lists.newArrayList();
|
||||
|
||||
public ArrayListTextSegmentSet(Function<? super T, ? extends ITextSegment> region, Function<? super T, String> title) {
|
||||
public ArrayListTextSegmentSet(Function<? super T, ? extends ITextSegment> region,
|
||||
Function<? super T, String> title) {
|
||||
super(region, title);
|
||||
}
|
||||
|
||||
public ArrayListTextSegmentSet(Function<? super T, ? extends ITextSegment> region,
|
||||
Function<? super T, String> title, boolean trace) {
|
||||
super(region, title, trace);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(T segment, IMerger<T> merger) throws ConflictingRegionsException {
|
||||
public void add(T segment, IMerger<T> merger) throws ConflictingRegionsException, RegionTraceMissingException {
|
||||
Preconditions.checkNotNull(segment);
|
||||
getTraces().put(segment, new RegionTrace(getTitle(segment), getRegion(segment)));
|
||||
trace(segment);
|
||||
if (contents.isEmpty()) {
|
||||
contents.add(segment);
|
||||
} else {
|
||||
|
@ -52,7 +58,8 @@ public class ArrayListTextSegmentSet<T> extends TextSegmentSet<T> {
|
|||
return searchResult >= 0 ? contents.get(searchResult) : null;
|
||||
}
|
||||
|
||||
protected void insertAtIndex(T segment, int newIndex, IMerger<T> merger) throws ConflictingRegionsException {
|
||||
protected void insertAtIndex(T segment, int newIndex, IMerger<T> merger)
|
||||
throws ConflictingRegionsException, RegionTraceMissingException {
|
||||
List<T> conflicting = null;
|
||||
int low = newIndex;
|
||||
while (--low >= 0) {
|
||||
|
@ -75,7 +82,7 @@ public class ArrayListTextSegmentSet<T> extends TextSegmentSet<T> {
|
|||
break;
|
||||
}
|
||||
if (conflicting == null) {
|
||||
getTraces().put(segment, new RegionTrace(getTitle(segment), getRegion(segment)));
|
||||
trace(segment);
|
||||
contents.add(newIndex, segment);
|
||||
} else {
|
||||
conflicting.add(0, segment);
|
||||
|
@ -84,7 +91,7 @@ public class ArrayListTextSegmentSet<T> extends TextSegmentSet<T> {
|
|||
if (merged != null) {
|
||||
for (int i = high - 1; i > low; i--)
|
||||
contents.remove(i);
|
||||
getTraces().put(merged, new RegionTrace(getTitle(merged), getRegion(merged)));
|
||||
trace(merged);
|
||||
contents.add(low + 1, merged);
|
||||
} else {
|
||||
int segmentLengh = getRegion(segment).getLength();
|
||||
|
@ -95,7 +102,7 @@ public class ArrayListTextSegmentSet<T> extends TextSegmentSet<T> {
|
|||
for (int i = high - 1; i > low; i--)
|
||||
contents.remove(i);
|
||||
if (segmentLengh > totalLength) {
|
||||
getTraces().put(segment, new RegionTrace(getTitle(segment), getRegion(segment)));
|
||||
trace(segment);
|
||||
contents.add(low + 1, segment);
|
||||
}
|
||||
handleConflict(conflicting, null);
|
||||
|
@ -113,13 +120,14 @@ public class ArrayListTextSegmentSet<T> extends TextSegmentSet<T> {
|
|||
return Iterables.unmodifiableIterable(contents).iterator();
|
||||
}
|
||||
|
||||
protected void replaceExistingEntry(T segment, int index, IMerger<T> merger) throws ConflictingRegionsException {
|
||||
protected void replaceExistingEntry(T segment, int index, IMerger<T> merger)
|
||||
throws ConflictingRegionsException, RegionTraceMissingException {
|
||||
T existing = contents.get(index);
|
||||
List<T> conflicting = ImmutableList.of(segment, existing);
|
||||
try {
|
||||
T merged = merger != null ? merger.merge(conflicting) : null;
|
||||
if (merged != null) {
|
||||
getTraces().put(merged, new RegionTrace(getTitle(merged), getRegion(merged)));
|
||||
trace(merged);
|
||||
contents.set(index, merged);
|
||||
} else {
|
||||
contents.remove(index);
|
||||
|
|
|
@ -49,11 +49,16 @@ import com.google.common.collect.Sets;
|
|||
*/
|
||||
public abstract class FormattableDocument implements IFormattableDocument {
|
||||
|
||||
private final TextSegmentSet<ITextReplacer> replacers;
|
||||
private TextSegmentSet<ITextReplacer> replacers = null;
|
||||
|
||||
protected FormattableDocument() {
|
||||
super();
|
||||
this.replacers = createTextReplacerSet();
|
||||
}
|
||||
|
||||
protected TextSegmentSet<ITextReplacer> getReplacers() {
|
||||
if (replacers == null)
|
||||
replacers = createTextReplacerSet();
|
||||
return replacers;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,14 +68,13 @@ public abstract class FormattableDocument implements IFormattableDocument {
|
|||
ITextSegment frameRegion = getRegion();
|
||||
String replacerTitle = replacer.getClass().getSimpleName();
|
||||
ITextSegment replacerRegion = replacer.getRegion();
|
||||
@SuppressWarnings("unchecked")
|
||||
RegionsOutsideFrameException exception = new RegionsOutsideFrameException(frameTitle, frameRegion,
|
||||
Tuples.create(replacerTitle, replacerRegion));
|
||||
getRequest().getExceptionHandler().accept(exception);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
replacers.add(replacer, getFormatter().createTextReplacerMerger());
|
||||
getReplacers().add(replacer, getFormatter().createTextReplacerMerger());
|
||||
} catch (ConflictingRegionsException e) {
|
||||
getRequest().getExceptionHandler().accept(e);
|
||||
}
|
||||
|
@ -122,7 +126,7 @@ public abstract class FormattableDocument implements IFormattableDocument {
|
|||
ITextReplacerContext wrappable = null;
|
||||
Set<ITextReplacer> wrapped = Sets.newHashSet();
|
||||
LinkedList<ITextReplacer> queue = new LinkedList<ITextReplacer>();
|
||||
for (ITextReplacer replacer : replacers) {
|
||||
for (ITextReplacer replacer : getReplacers()) {
|
||||
queue.add(replacer);
|
||||
}
|
||||
while (!queue.isEmpty()) {
|
||||
|
@ -136,7 +140,7 @@ public abstract class FormattableDocument implements IFormattableDocument {
|
|||
// then doesn't
|
||||
while (context != wrappable) {
|
||||
ITextReplacer r = context.getReplacer();
|
||||
if (r != null && replacers.get(r) == r) {
|
||||
if (r != null && getReplacers().get(r) == r) {
|
||||
queue.addFirst(r);
|
||||
}
|
||||
context = context.getPreviousContext();
|
||||
|
@ -179,7 +183,7 @@ public abstract class FormattableDocument implements IFormattableDocument {
|
|||
.apply(((HiddenRegionReplacer) input).getFormatting());
|
||||
return input.getClass().getSimpleName();
|
||||
}
|
||||
});
|
||||
}, getRequest().isEnableDebugTracing());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -188,6 +192,8 @@ public abstract class FormattableDocument implements IFormattableDocument {
|
|||
if (formatter.shouldFormat(obj, this)) {
|
||||
try {
|
||||
formatter.format(obj, this);
|
||||
} catch (RegionTraceMissingException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
IAcceptor<Exception> handler = getRequest().getExceptionHandler();
|
||||
handler.accept(e);
|
||||
|
@ -350,7 +356,7 @@ public abstract class FormattableDocument implements IFormattableDocument {
|
|||
TextRegionsToString toString = new TextRegionsToString();
|
||||
toString.setFrame(this.getRegion());
|
||||
toString.setTitle(getClass().getSimpleName() + " with ITextReplacers");
|
||||
for (ITextReplacer repl : replacers)
|
||||
for (ITextReplacer repl : getReplacers())
|
||||
toString.add(repl.getRegion(), repl.getClass().getSimpleName() + ": " + repl.toString());
|
||||
return toString.toString();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2017 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.formatting2.internal;
|
||||
|
||||
/**
|
||||
* @author Moritz Eysholdt - Initial contribution and API
|
||||
*/
|
||||
public class RegionTraceMissingException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -1151660462702454003L;
|
||||
|
||||
public RegionTraceMissingException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
|
@ -66,7 +66,7 @@ public class TextReplacerContext implements ITextReplacerContext {
|
|||
public String apply(ITextReplacement input) {
|
||||
return input.getReplacementText();
|
||||
}
|
||||
});
|
||||
}, getDocument().getRequest().isEnableDebugTracing());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -223,7 +223,6 @@ public class TextReplacerContext implements ITextReplacerContext {
|
|||
String frameTitle = replacer.getClass().getSimpleName();
|
||||
ITextSegment frameRegion = replacer.getRegion();
|
||||
String replacerTitle = replacement.getReplacementText();
|
||||
@SuppressWarnings("unchecked")
|
||||
RegionsOutsideFrameException exception = new RegionsOutsideFrameException(frameTitle, frameRegion,
|
||||
Tuples.create(replacerTitle, (ITextSegment) replacement));
|
||||
request.getExceptionHandler().accept(exception);
|
||||
|
|
|
@ -24,15 +24,21 @@ public abstract class TextSegmentSet<T> implements Iterable<T> {
|
|||
|
||||
private final Function<? super T, ? extends ITextSegment> regionGetter;
|
||||
private final Function<? super T, String> titleGetter;
|
||||
private final IdentityHashMap<T, RegionTrace> traces = new IdentityHashMap<T, RegionTrace>();
|
||||
private final IdentityHashMap<T, RegionTrace> traces;
|
||||
|
||||
public TextSegmentSet(Function<? super T, ? extends ITextSegment> region, Function<? super T, String> title) {
|
||||
this(region, title, true);
|
||||
}
|
||||
|
||||
public TextSegmentSet(Function<? super T, ? extends ITextSegment> region, Function<? super T, String> title,
|
||||
boolean trace) {
|
||||
super();
|
||||
this.regionGetter = region;
|
||||
this.titleGetter = title;
|
||||
this.traces = trace ? new IdentityHashMap<T, RegionTrace>() : null;
|
||||
}
|
||||
|
||||
public void add(T segment) throws ConflictingRegionsException {
|
||||
public void add(T segment) throws ConflictingRegionsException, RegionTraceMissingException {
|
||||
add(segment, null);
|
||||
}
|
||||
|
||||
|
@ -52,11 +58,22 @@ public abstract class TextSegmentSet<T> implements Iterable<T> {
|
|||
return titleGetter.apply(t);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public IdentityHashMap<T, RegionTrace> getTraces() {
|
||||
return traces;
|
||||
}
|
||||
|
||||
protected void handleConflict(List<T> conflicts, Exception cause) throws ConflictingRegionsException {
|
||||
protected void trace(T segment) {
|
||||
if (traces != null) {
|
||||
traces.put(segment, new RegionTrace(getTitle(segment), getRegion(segment)));
|
||||
}
|
||||
}
|
||||
|
||||
protected void handleConflict(List<T> conflicts, Exception cause)
|
||||
throws ConflictingRegionsException, RegionTraceMissingException {
|
||||
if (traces == null) {
|
||||
throw new RegionTraceMissingException(cause);
|
||||
}
|
||||
List<RegionTrace> causes = Lists.newArrayList();
|
||||
for (T t : conflicts) {
|
||||
RegionTrace exception = traces.get(t);
|
||||
|
|
|
@ -211,7 +211,13 @@ public class GrammarElementTitleSwitch extends XtextSwitch<String> implements Fu
|
|||
|
||||
@Override
|
||||
public String caseRuleCall(RuleCall object) {
|
||||
return addCrossRefOrAssignemnt(object.getRule().getName(), object) + card(object);
|
||||
AbstractRule rule = object.getRule();
|
||||
String ruleName;
|
||||
if (rule != null && !rule.eIsProxy())
|
||||
ruleName = rule.getName();
|
||||
else
|
||||
ruleName = "unresolved_rule";
|
||||
return addCrossRefOrAssignemnt(ruleName, object) + card(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue