Skip to content

Commit

Permalink
Upgrade to Xtext 2.17.
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Apr 5, 2019
2 parents 5c095d6 + f734300 commit dee2fc0
Show file tree
Hide file tree
Showing 66 changed files with 734 additions and 379 deletions.
Expand Up @@ -19,12 +19,8 @@
* limitations under the License.
*/


package io.sarl.examples.tests;

import static org.junit.Assert.*;
import static org.junit.Assert.assertNotNull;

import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
Expand Down Expand Up @@ -62,7 +58,7 @@
import io.sarl.tests.api.AbstractSarlTest;

/** Class for testing the examples.
*
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
Expand Down
5 changes: 3 additions & 2 deletions contribs/io.sarl.examples/pom.xml
Expand Up @@ -3,8 +3,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.sarl</groupId>
<artifactId>io.sarl.products.contribs</artifactId>
<version>0.9.0-SNAPSHOT</version>
<artifactId>io.sarl.tycho-parent-ui</artifactId>
<version>0.9.0-SNAPSHOT</version>
<relativePath>../../tycho-parent/tycho-parent-ui</relativePath>
</parent>

<groupId>io.sarl.examples</groupId>
Expand Down
Expand Up @@ -19,3 +19,4 @@ Require-Bundle: io.sarl.lang;bundle-version="0.9.0",
org.eclipse.xtend.core;bundle-version="2.17.0",
org.eclipse.core.runtime;bundle-version="3.15.200",
org.eclipse.core.resources;bundle-version="3.13.300"

Expand Up @@ -9,11 +9,14 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: io.sarl.pythongenerator.ui,
io.sarl.pythongenerator.ui.configuration,
io.sarl.pythongenerator.ui.preferences
io.sarl.pythongenerator.ui.generator,
io.sarl.pythongenerator.ui.preferences,
io.sarl.pythongenerator.ui.validator
Bundle-Activator: io.sarl.pythongenerator.ui.PyGeneratorUiPlugin
Require-Bundle: io.sarl.lang;bundle-version="0.9.0",
io.sarl.lang.ui;bundle-version="0.9.0",
io.sarl.pythongenerator.generator;bundle-version="0.9.0",
org.eclipse.xtext.ui;bundle-version="2.17.0",
org.eclipse.ui;bundle-version="3.112.0",
org.eclipse.core.runtime;bundle-version="3.15.200"

@@ -1,10 +1,12 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.sarl.pythongenerator</groupId>
<artifactId>io.sarl.pythongenerator</artifactId>
<version>0.9.0-SNAPSHOT</version>
<groupId>io.sarl</groupId>
<artifactId>io.sarl.tycho-parent-ui</artifactId>
<version>0.9.0-SNAPSHOT</version>
<relativePath>../../../tycho-parent/tycho-parent-ui</relativePath>
</parent>

<artifactId>io.sarl.pythongenerator.ui</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion formatting-styles/latex/sarl-beamer-listing.sty
Expand Up @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-beamer-listing}[2019/03/22]
\ProvidesPackage{sarl-beamer-listing}[2019/04/05]
\newif\ifusesarlcolors\usesarlcolorstrue
\DeclareOption{sarlcolors}{\global\usesarlcolorstrue}
\DeclareOption{nosarlcolors}{\global\usesarlcolorsfalse}
Expand Down
2 changes: 1 addition & 1 deletion formatting-styles/latex/sarl-colorized-listing.sty
Expand Up @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-colorized-listing}[2019/03/22]
\ProvidesPackage{sarl-colorized-listing}[2019/04/05]
\newif\ifusesarlcolors\usesarlcolorstrue
\DeclareOption{sarlcolors}{\global\usesarlcolorstrue}
\DeclareOption{nosarlcolors}{\global\usesarlcolorsfalse}
Expand Down
2 changes: 1 addition & 1 deletion formatting-styles/latex/sarl-listing.sty
Expand Up @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-listing}[2019/03/22]
\ProvidesPackage{sarl-listing}[2019/04/05]
\newif\ifusesarlcolors\usesarlcolorstrue
\DeclareOption{sarlcolors}{\global\usesarlcolorstrue}
\DeclareOption{nosarlcolors}{\global\usesarlcolorsfalse}
Expand Down
6 changes: 4 additions & 2 deletions main/coreplugins/io.sarl.eclipse/META-INF/MANIFEST.MF
Expand Up @@ -31,12 +31,12 @@ Require-Bundle: io.sarl.lang.ui;bundle-version="0.9.0";visibility:=reexport,
org.eclipse.ui.intro.quicklinks;bundle-version="1.0.300",
org.eclipse.ui.intro.universal;bundle-version="3.3.400",
org.arakhne.afc.core.vmutils;bundle-version="15.2.0",
com.google.gson;bundle-version="2.8.5",
com.google.inject;bundle-version="4.1.0"
com.google.gson;bundle-version="2.8.5"
Bundle-Activator: io.sarl.eclipse.SARLEclipsePlugin
Export-Package: io.sarl.eclipse,
io.sarl.eclipse.buildpath,
io.sarl.eclipse.explorer,
io.sarl.eclipse.launching,
io.sarl.eclipse.launching.config,
io.sarl.eclipse.launching.dialog,
io.sarl.eclipse.launching.runner,
Expand All @@ -49,6 +49,7 @@ Export-Package: io.sarl.eclipse,
io.sarl.eclipse.properties,
io.sarl.eclipse.runtime,
io.sarl.eclipse.splash,
io.sarl.eclipse.typehierarchy,
io.sarl.eclipse.util,
io.sarl.eclipse.wizards.elements,
io.sarl.eclipse.wizards.elements.aop.newagent,
Expand All @@ -62,5 +63,6 @@ Export-Package: io.sarl.eclipse,
io.sarl.eclipse.wizards.elements.oop.newinterface,
io.sarl.eclipse.wizards.newfile,
io.sarl.eclipse.wizards.newproject,
io.sarl.eclipse.wizards.sarlapp,
io.sarl.eclipse.wizards.sreinstall

5 changes: 3 additions & 2 deletions main/coreplugins/io.sarl.eclipse/pom.xml
Expand Up @@ -7,8 +7,9 @@

<parent>
<groupId>io.sarl</groupId>
<artifactId>io.sarl.plugins.core</artifactId>
<version>0.9.0-SNAPSHOT</version>
<artifactId>io.sarl.tycho-parent-ui</artifactId>
<version>0.9.0-SNAPSHOT</version>
<relativePath>../../../tycho-parent/tycho-parent-ui</relativePath>
</parent>

<build>
Expand Down
Expand Up @@ -602,6 +602,11 @@ Workflow {
provider = true
functionName = "configureCompilationUnitImpl"
}
runtime = {
bind = "org.eclipse.xtext.parser.antlr.IPartialParsingHelper"
to = "io.sarl.lang.compiler.SarlPartialParserHelper"
functionName = "bindIPartialParserHelper"
}

ui = {
bind = "io.sarl.lang.extralanguage.IExtraLanguageContributions"
Expand Down Expand Up @@ -684,6 +689,10 @@ Workflow {
bind = "org.eclipse.xtext.tasks.ITaskTagProvider"
to = "io.sarl.lang.ui.tasks.SarlTaskTagProvider"
}
ui = {
bind = "org.eclipse.xtext.tasks.ITaskFinder"
to = "io.sarl.lang.ui.tasks.SarlTaskFinder"
}
ui = {
bind = "org.eclipse.xtext.ui.editor.outline.impl.OutlineFilterAndSorter$IComparator"
to = "io.sarl.lang.ui.outline.SARLOutlineNodeComparator"
Expand Down Expand Up @@ -875,11 +884,6 @@ Workflow {
bind = "org.eclipse.xtext.xbase.conversion.XbaseValueConverterService$IntUnderscoreValueConverter"
to = "org.eclipse.xtend.core.conversion.IntUnderscoreValueConverter"
}
runtime = {
bind = "org.eclipse.xtext.parser.antlr.IPartialParsingHelper"
to = "org.eclipse.xtend.core.parser.XtendPartialParsingHelper"
functionName = "bindIPartialParserHelper"
}
runtime = {
bind = "org.eclipse.xtext.naming.IQualifiedNameProvider"
to = "org.eclipse.xtend.core.naming.XtendQualifiedNameProvider"
Expand Down
2 changes: 1 addition & 1 deletion main/coreplugins/io.sarl.lang.ui/build.properties
Expand Up @@ -6,8 +6,8 @@ bin.includes = META-INF/,\
plugin.xml,\
OSGI-INF/,\
templates/,\
src-templates/,\
about.ini,\
about.mappings,\
about.properties
jre.compilation.profile = JavaSE-1.8
jars.compile.order = .
8 changes: 5 additions & 3 deletions main/coreplugins/io.sarl.lang.ui/pom.xml
@@ -1,11 +1,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.sarl</groupId>
<artifactId>io.sarl.plugins.core</artifactId>
<version>0.9.0-SNAPSHOT</version>
<artifactId>io.sarl.tycho-parent-ui</artifactId>
<version>0.9.0-SNAPSHOT</version>
<relativePath>../../../tycho-parent/tycho-parent-ui</relativePath>
</parent>

<artifactId>io.sarl.lang.ui</artifactId>
Expand Down
Expand Up @@ -82,6 +82,7 @@
import io.sarl.lang.ui.preferences.SARLValidatorConfigurationBlock;
import io.sarl.lang.ui.quickfix.SARLQuickfixProvider;
import io.sarl.lang.ui.refactoring.rename.SARLRenameStrategyProvider;
import io.sarl.lang.ui.tasks.SarlTaskFinder;
import io.sarl.lang.ui.tasks.SarlTaskTagProvider;
import io.sarl.lang.ui.validation.SARLUIStrings;
import io.sarl.lang.ui.validation.SARLUIValidator;
Expand Down Expand Up @@ -157,6 +158,7 @@
import org.eclipse.xtext.resource.containers.IAllContainersState;
import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider;
import org.eclipse.xtext.service.SingletonBinding;
import org.eclipse.xtext.tasks.ITaskFinder;
import org.eclipse.xtext.tasks.ITaskTagProvider;
import org.eclipse.xtext.ui.IImageHelper;
import org.eclipse.xtext.ui.LanguageSpecific;
Expand Down Expand Up @@ -714,6 +716,11 @@ public Class<? extends XtendFieldBuilder> bindXtendFieldBuilder() {
return SarlFieldBuilder.class;
}

// contributed by io.sarl.lang.mwe2.binding.InjectionFragment2 [Bindings provided by SARL API]
public Class<? extends ITaskFinder> bindITaskFinder() {
return SarlTaskFinder.class;
}

// contributed by io.sarl.lang.mwe2.binding.InjectionFragment2 [Bindings provided by SARL API]
public void configureIPreferenceStoreInitializer(Binder binder) {
binder.bind(IPreferenceStoreInitializer.class).annotatedWith(Names.named("RefactoringPreferences")).to(SARLPreferenceStoreInitializer.class);
Expand Down
Expand Up @@ -79,6 +79,7 @@
* @mavenartifactid $ArtifactId$
* @see "https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#outline"
*/
@SuppressWarnings("checkstyle:classfanoutcomplexity")
public class SARLOutlineTreeProvider extends XbaseWithAnnotationsOutlineTreeProvider {

@Inject
Expand Down
@@ -0,0 +1,80 @@
/*
* $Id$
*
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright (C) 2014-2019 the original authors or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.sarl.lang.ui.tasks;

import com.google.common.base.Objects;
import com.google.inject.Inject;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.nodemodel.ILeafNode;
import org.eclipse.xtext.tasks.DefaultTaskFinder;
import org.eclipse.xtext.xbase.lib.Extension;

import io.sarl.lang.services.SARLGrammarAccess;

/** Finder for task tags.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
* @since 0.9
*/
public class SarlTaskFinder extends DefaultTaskFinder {

@Inject
@Extension
private SARLGrammarAccess grammarAccess;

@Override
protected boolean canContainTaskTags(final ILeafNode node) {
final boolean result = super.canContainTaskTags(node);
if (!result) {
return isRichComment(node);
}
return result;
}

@Override
protected String stripText(final ILeafNode node, final String text) {
final boolean isRichComment = isRichComment(node);
if (isRichComment) {
final char newLine = '\n';
final int index = text.indexOf(newLine);
if (index != -1) {
return text.substring(0, index);
}
return text;
}
return super.stripText(node, text);
}

private boolean isRichComment(final ILeafNode node) {
final EObject grammarElement = node.getGrammarElement();
if (grammarElement instanceof RuleCall) {
return Objects.equal(((RuleCall) node.getGrammarElement()).getRule(), this.grammarAccess.getCOMMENT_RICH_TEXT_ENDRule())
|| Objects.equal(((RuleCall) node.getGrammarElement()).getRule(), this.grammarAccess.getCOMMENT_RICH_TEXT_INBETWEENRule());
}
return false;
}

}
Expand Up @@ -74,6 +74,7 @@
import io.sarl.lang.compiler.SARLGeneratorConfigProvider;
import io.sarl.lang.compiler.SARLJvmGenerator;
import io.sarl.lang.compiler.SarlCompiler;
import io.sarl.lang.compiler.SarlPartialParserHelper;
import io.sarl.lang.controlflow.ExtendedSARLEarlyExitComputer;
import io.sarl.lang.controlflow.ISarlEarlyExitComputer;
import io.sarl.lang.controlflow.SARLEarlyExitComputer;
Expand Down Expand Up @@ -143,7 +144,6 @@
import org.eclipse.xtend.core.macro.declaration.IResourceChangeRegistry;
import org.eclipse.xtend.core.macro.declaration.NopResourceChangeRegistry;
import org.eclipse.xtend.core.naming.XtendQualifiedNameProvider;
import org.eclipse.xtend.core.parser.XtendPartialParsingHelper;
import org.eclipse.xtend.core.parser.antlr.XtendTokenSourceProvider;
import org.eclipse.xtend.core.resource.XtendLocationInFileProvider;
import org.eclipse.xtend.core.resource.XtendResourceDescriptionManager;
Expand Down Expand Up @@ -693,6 +693,11 @@ public Class<? extends IGenerator> bindIGenerator() {
return ExtraLanguageGeneratorSupport.class;
}

// contributed by io.sarl.lang.mwe2.binding.InjectionFragment2 [Bindings provided by SARL API]
public Class<? extends IPartialParsingHelper> bindIPartialParserHelper() {
return SarlPartialParserHelper.class;
}

// contributed by io.sarl.lang.mwe2.binding.InjectionFragment2 [Bindings provided by SARL API]
public Class<? extends IGeneratorConfigProvider> bindIGeneratorConfigProvider() {
return SARLGeneratorConfigProvider.class;
Expand Down Expand Up @@ -867,11 +872,6 @@ public Class<? extends HumanReadableTypeNames> bindHumanReadableTypeNames() {
return LocalClassAwareTypeNames.class;
}

// contributed by io.sarl.lang.mwe2.binding.InjectionFragment2 [Bindings required by extended Xtend API]
public Class<? extends IPartialParsingHelper> bindIPartialParserHelper() {
return XtendPartialParsingHelper.class;
}

// contributed by io.sarl.lang.mwe2.binding.InjectionFragment2 [Bindings required by extended Xtend API]
public Class<? extends ILocationInFileProvider> bindILocationInFileProvider() {
return XtendLocationInFileProvider.class;
Expand Down

0 comments on commit dee2fc0

Please sign in to comment.