mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
[eclipse/xtext#1679] ported more code to java
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
This commit is contained in:
parent
cd3bb8d895
commit
199efb4682
34 changed files with 217 additions and 735 deletions
|
@ -0,0 +1,27 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator;
|
||||
|
||||
/**
|
||||
* A fragment that generates a class that inherits from the generated class of
|
||||
* the super-grammar. This inheritance can be disabled with the
|
||||
* {@code inheritImplementation} property.
|
||||
*/
|
||||
public abstract class AbstractInheritingFragment extends AbstractStubGeneratingFragment {
|
||||
|
||||
private boolean inheritImplementation = true;
|
||||
|
||||
public boolean isInheritImplementation() {
|
||||
return inheritImplementation;
|
||||
}
|
||||
|
||||
public void setInheritImplementation(boolean inheritImplementation) {
|
||||
this.inheritImplementation = inheritImplementation;
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.AbstractStubGeneratingFragment
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
|
||||
/**
|
||||
* A fragment that generates a class that inherits from the generated class of the super-grammar.
|
||||
* This inheritance can be disabled with the {@code inheritImplementation} property.
|
||||
*/
|
||||
abstract class AbstractInheritingFragment extends AbstractStubGeneratingFragment {
|
||||
|
||||
@Accessors boolean inheritImplementation = true
|
||||
|
||||
}
|
|
@ -1,22 +1,22 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator
|
||||
package org.eclipse.xtext.xtext.generator;
|
||||
|
||||
import com.google.inject.Injector
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
* The Xtext generator uses dependency injection with <a href="https://github.com/google/guice">Guice</a>
|
||||
* for distributing the configuration to all its components. Instances of this interface can initialize
|
||||
* themselves with a Guice injector, e.g. by calling {@code injector.injectMembers(this)}.
|
||||
*/
|
||||
interface IGuiceAwareGeneratorComponent {
|
||||
public interface IGuiceAwareGeneratorComponent {
|
||||
|
||||
def void initialize(Injector injector)
|
||||
void initialize(Injector injector);
|
||||
|
||||
}
|
|
@ -1,21 +1,21 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator
|
||||
package org.eclipse.xtext.xtext.generator;
|
||||
|
||||
/**
|
||||
* A fragment that contributes to the {@link XtextGenerator}. Use {@link AbstractXtextGeneratorFragment}
|
||||
* for implementing new fragments.
|
||||
*/
|
||||
interface IXtextGeneratorFragment extends IGuiceAwareGeneratorComponent {
|
||||
public interface IXtextGeneratorFragment extends IGuiceAwareGeneratorComponent {
|
||||
|
||||
def void checkConfiguration(Issues issues)
|
||||
void checkConfiguration(Issues issues);
|
||||
|
||||
def void generate()
|
||||
void generate();
|
||||
|
||||
}
|
|
@ -6,43 +6,43 @@
|
|||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator
|
||||
package org.eclipse.xtext.xtext.generator;
|
||||
|
||||
import java.util.List
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet
|
||||
import org.eclipse.xtext.Grammar
|
||||
import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.StandaloneSetupAccess
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.xtext.Grammar;
|
||||
import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.StandaloneSetupAccess;
|
||||
|
||||
/**
|
||||
* Configuration for an Xtext language. Implemented by {@link XtextGeneratorLanguage}.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
interface IXtextGeneratorLanguage {
|
||||
public interface IXtextGeneratorLanguage {
|
||||
|
||||
def Grammar getGrammar()
|
||||
Grammar getGrammar();
|
||||
|
||||
def List<String> getFileExtensions()
|
||||
List<String> getFileExtensions();
|
||||
|
||||
def StandaloneSetupAccess getRuntimeGenSetup()
|
||||
StandaloneSetupAccess getRuntimeGenSetup();
|
||||
|
||||
def GuiceModuleAccess getRuntimeGenModule()
|
||||
GuiceModuleAccess getRuntimeGenModule();
|
||||
|
||||
def GuiceModuleAccess getIdeGenModule()
|
||||
GuiceModuleAccess getIdeGenModule();
|
||||
|
||||
def GuiceModuleAccess getEclipsePluginGenModule()
|
||||
GuiceModuleAccess getEclipsePluginGenModule();
|
||||
|
||||
def GuiceModuleAccess getIdeaGenModule()
|
||||
GuiceModuleAccess getIdeaGenModule();
|
||||
|
||||
def GuiceModuleAccess getWebGenModule()
|
||||
GuiceModuleAccess getWebGenModule();
|
||||
|
||||
def ResourceSet getResourceSet()
|
||||
ResourceSet getResourceSet();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link CodeConfig#isPreferXtendStubs()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
def boolean isGenerateXtendStubs()
|
||||
boolean isGenerateXtendStubs();
|
||||
|
||||
}
|
|
@ -1,24 +1,24 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator
|
||||
package org.eclipse.xtext.xtext.generator;
|
||||
|
||||
/**
|
||||
* Use this to report configuration problems during the {@link IXtextGeneratorFragment#checkConfiguration(Issues)} phase.
|
||||
*/
|
||||
interface Issues {
|
||||
public interface Issues {
|
||||
|
||||
def void addError(String message)
|
||||
void addError(String message);
|
||||
|
||||
def void addError(String message, Object source)
|
||||
void addError(String message, Object source);
|
||||
|
||||
def void addWarning(String message)
|
||||
void addWarning(String message);
|
||||
|
||||
def void addWarning(String message, Object source)
|
||||
void addWarning(String message, Object source);
|
||||
|
||||
}
|
|
@ -1,25 +1,25 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.model;
|
||||
|
||||
import com.google.inject.ImplementedBy;
|
||||
import org.eclipse.xtext.generator.IFileSystemAccess2;
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent;
|
||||
import org.eclipse.xtext.xtext.generator.model.XtextGeneratorFileSystemAccess;
|
||||
|
||||
/**
|
||||
* File system access for the Xtext generator.
|
||||
*/
|
||||
@ImplementedBy(XtextGeneratorFileSystemAccess.class)
|
||||
@SuppressWarnings("all")
|
||||
public interface IXtextGeneratorFileSystemAccess extends IFileSystemAccess2, IGuiceAwareGeneratorComponent {
|
||||
String getPath();
|
||||
|
||||
boolean isOverwrite();
|
||||
|
||||
String getPath();
|
||||
|
||||
boolean isOverwrite();
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.model
|
||||
|
||||
import com.google.inject.ImplementedBy
|
||||
import org.eclipse.xtext.generator.IFileSystemAccess2
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent
|
||||
|
||||
/**
|
||||
* File system access for the Xtext generator.
|
||||
*/
|
||||
@ImplementedBy(XtextGeneratorFileSystemAccess)
|
||||
interface IXtextGeneratorFileSystemAccess extends IFileSystemAccess2, IGuiceAwareGeneratorComponent {
|
||||
|
||||
def String getPath()
|
||||
|
||||
def boolean isOverwrite()
|
||||
|
||||
}
|
|
@ -1,17 +1,17 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.model.annotations
|
||||
package org.eclipse.xtext.xtext.generator.model.annotations;
|
||||
|
||||
import java.lang.annotation.Repeatable
|
||||
import org.eclipse.xtext.xtext.generator.XtextGenerator
|
||||
import org.eclipse.xtext.xtext.generator.model.JavaFileAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.TypeReference
|
||||
import java.lang.annotation.Repeatable;
|
||||
import org.eclipse.xtext.xtext.generator.XtextGenerator;
|
||||
import org.eclipse.xtext.xtext.generator.model.JavaFileAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.TypeReference;
|
||||
|
||||
/**
|
||||
* Class annotations can be added to the {@link XtextGenerator} workflow component in order
|
||||
|
@ -23,22 +23,22 @@ import org.eclipse.xtext.xtext.generator.model.TypeReference
|
|||
* <li>If the underlying Annotation is NOT {@link Repeatable} then {@link Object#equals(Object)} should return true for all instances and {@link Object#hashCode()} should return the same value for all instances</li>
|
||||
* </ul>
|
||||
*/
|
||||
interface IClassAnnotation {
|
||||
public interface IClassAnnotation {
|
||||
|
||||
/**
|
||||
* Convert the class annotation to a string suitable for use in Java code generation.
|
||||
*/
|
||||
def CharSequence generate()
|
||||
CharSequence generate();
|
||||
|
||||
/**
|
||||
* Determine whether this annotation should be applied to the given Java file.
|
||||
*/
|
||||
def boolean appliesTo(JavaFileAccess javaFile)
|
||||
boolean appliesTo(JavaFileAccess javaFile);
|
||||
|
||||
/**
|
||||
* Return the qualified name of the annotation interface for use in import declarations,
|
||||
* or {@code null} if no import is required.
|
||||
*/
|
||||
def TypeReference getAnnotationImport()
|
||||
TypeReference getAnnotationImport();
|
||||
|
||||
}
|
|
@ -1,25 +1,25 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.model.project;
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.model.ManifestAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig;
|
||||
|
||||
/**
|
||||
* Configuration of subprojects that can be used as Eclipse bundles.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface IBundleProjectConfig extends ISubProjectConfig {
|
||||
ManifestAccess getManifest();
|
||||
|
||||
PluginXmlAccess getPluginXml();
|
||||
|
||||
ManifestAccess getManifest();
|
||||
|
||||
PluginXmlAccess getPluginXml();
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.model.project
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.model.ManifestAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess
|
||||
|
||||
/**
|
||||
* Configuration of subprojects that can be used as Eclipse bundles.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
interface IBundleProjectConfig extends ISubProjectConfig {
|
||||
|
||||
def ManifestAccess getManifest()
|
||||
|
||||
def PluginXmlAccess getPluginXml()
|
||||
|
||||
}
|
|
@ -1,34 +1,34 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.model.project
|
||||
package org.eclipse.xtext.xtext.generator.model.project;
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
|
||||
|
||||
/**
|
||||
* Configuration of the runtime project, i.e. the main subproject containing the language definition.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
interface IRuntimeProjectConfig extends IBundleProjectConfig {
|
||||
public interface IRuntimeProjectConfig extends IBundleProjectConfig {
|
||||
|
||||
def IXtextGeneratorFileSystemAccess getEcoreModel()
|
||||
IXtextGeneratorFileSystemAccess getEcoreModel();
|
||||
|
||||
def String getEcoreModelFolder()
|
||||
String getEcoreModelFolder();
|
||||
|
||||
/**
|
||||
* @since 2.13
|
||||
*/
|
||||
def String getXbaseLibVersionLowerBound()
|
||||
String getXbaseLibVersionLowerBound();
|
||||
|
||||
/**
|
||||
* @since 2.13
|
||||
*/
|
||||
def String getXtendLibVersionLowerBound()
|
||||
String getXtendLibVersionLowerBound();
|
||||
|
||||
}
|
|
@ -1,35 +1,35 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.model.project
|
||||
package org.eclipse.xtext.xtext.generator.model.project;
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent;
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
|
||||
|
||||
/**
|
||||
* Configuration of subprojects.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
interface ISubProjectConfig extends IGuiceAwareGeneratorComponent {
|
||||
public interface ISubProjectConfig extends IGuiceAwareGeneratorComponent {
|
||||
|
||||
def boolean isEnabled()
|
||||
boolean isEnabled();
|
||||
|
||||
def String getName()
|
||||
String getName();
|
||||
|
||||
def IXtextGeneratorFileSystemAccess getRoot()
|
||||
IXtextGeneratorFileSystemAccess getRoot();
|
||||
|
||||
def IXtextGeneratorFileSystemAccess getMetaInf()
|
||||
IXtextGeneratorFileSystemAccess getMetaInf();
|
||||
|
||||
def IXtextGeneratorFileSystemAccess getSrc()
|
||||
IXtextGeneratorFileSystemAccess getSrc();
|
||||
|
||||
def IXtextGeneratorFileSystemAccess getSrcGen()
|
||||
IXtextGeneratorFileSystemAccess getSrcGen();
|
||||
|
||||
def IXtextGeneratorFileSystemAccess getIcons()
|
||||
IXtextGeneratorFileSystemAccess getIcons();
|
||||
|
||||
}
|
|
@ -1,22 +1,22 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.model.project
|
||||
package org.eclipse.xtext.xtext.generator.model.project;
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
|
||||
|
||||
/**
|
||||
* Configuration of the web project.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
interface IWebProjectConfig extends ISubProjectConfig {
|
||||
public interface IWebProjectConfig extends ISubProjectConfig {
|
||||
|
||||
def IXtextGeneratorFileSystemAccess getAssets()
|
||||
IXtextGeneratorFileSystemAccess getAssets();
|
||||
|
||||
}
|
|
@ -1,39 +1,39 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.model.project
|
||||
package org.eclipse.xtext.xtext.generator.model.project;
|
||||
|
||||
import java.util.List
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent
|
||||
import java.util.List;
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent;
|
||||
|
||||
/**
|
||||
* Configuration of the subprojects for one or more Xtext languages. Implemented by {@link XtextProjectConfig}.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
interface IXtextProjectConfig extends IGuiceAwareGeneratorComponent {
|
||||
public interface IXtextProjectConfig extends IGuiceAwareGeneratorComponent {
|
||||
|
||||
def IRuntimeProjectConfig getRuntime()
|
||||
IRuntimeProjectConfig getRuntime();
|
||||
|
||||
def IBundleProjectConfig getRuntimeTest()
|
||||
IBundleProjectConfig getRuntimeTest();
|
||||
|
||||
def IBundleProjectConfig getGenericIde()
|
||||
IBundleProjectConfig getGenericIde();
|
||||
|
||||
def IBundleProjectConfig getEclipsePlugin()
|
||||
IBundleProjectConfig getEclipsePlugin();
|
||||
|
||||
def IBundleProjectConfig getEclipsePluginTest()
|
||||
IBundleProjectConfig getEclipsePluginTest();
|
||||
|
||||
def ISubProjectConfig getIdeaPlugin()
|
||||
ISubProjectConfig getIdeaPlugin();
|
||||
|
||||
def IWebProjectConfig getWeb()
|
||||
IWebProjectConfig getWeb();
|
||||
|
||||
def List<? extends ISubProjectConfig> getEnabledProjects()
|
||||
List<? extends ISubProjectConfig> getEnabledProjects();
|
||||
|
||||
def List<? extends ISubProjectConfig> getTestProjects()
|
||||
List<? extends ISubProjectConfig> getTestProjects();
|
||||
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
/**
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.serializer;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
@ -13,14 +13,15 @@ import com.google.inject.Singleton;
|
|||
import org.eclipse.xtext.Grammar;
|
||||
import org.eclipse.xtext.xtext.RuleNames;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
@Singleton
|
||||
@SuppressWarnings("all")
|
||||
@Singleton
|
||||
public class InjectableRuleNames extends RuleNames {
|
||||
@Inject
|
||||
public InjectableRuleNames(final Grammar grammar) {
|
||||
super(grammar, false);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public InjectableRuleNames(Grammar grammar) {
|
||||
super(grammar, false);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.serializer
|
||||
|
||||
import com.google.inject.Inject
|
||||
import com.google.inject.Singleton
|
||||
import org.eclipse.xtext.Grammar
|
||||
import org.eclipse.xtext.xtext.RuleNames
|
||||
|
||||
/**
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
@Singleton class InjectableRuleNames extends RuleNames {
|
||||
|
||||
@Inject
|
||||
new(Grammar grammar) {
|
||||
super(grammar, false)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.util;
|
||||
|
||||
/**
|
||||
* A Boolean-valued option with default value for use in generator fragments.
|
||||
*/
|
||||
public class BooleanGeneratorOption {
|
||||
|
||||
private final boolean defaultValue;
|
||||
|
||||
private Boolean value;
|
||||
|
||||
public BooleanGeneratorOption() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public BooleanGeneratorOption(boolean defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public boolean get() {
|
||||
if (value != null) {
|
||||
return value;
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public void set(boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean isSet() {
|
||||
return value != null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.util
|
||||
|
||||
/**
|
||||
* A Boolean-valued option with default value for use in generator fragments.
|
||||
*/
|
||||
class BooleanGeneratorOption {
|
||||
|
||||
val boolean defaultValue
|
||||
|
||||
Boolean value
|
||||
|
||||
new() {
|
||||
this(false)
|
||||
}
|
||||
|
||||
new(boolean defaultValue) {
|
||||
this.defaultValue = defaultValue
|
||||
}
|
||||
|
||||
def boolean get() {
|
||||
value ?: defaultValue
|
||||
}
|
||||
|
||||
def void set(boolean value) {
|
||||
this.value = value
|
||||
}
|
||||
|
||||
def boolean isSet() {
|
||||
value !== null
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +1,50 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.util
|
||||
package org.eclipse.xtext.xtext.generator.util;
|
||||
|
||||
/**
|
||||
* An object-valued option with default value for use in generator fragments.
|
||||
*/
|
||||
class GeneratorOption <T> {
|
||||
public class GeneratorOption <T> {
|
||||
|
||||
val T defaultValue
|
||||
private final T defaultValue;
|
||||
|
||||
T value
|
||||
private T value;
|
||||
|
||||
/**
|
||||
* Create an option with no default value.
|
||||
*/
|
||||
new() {
|
||||
this.defaultValue = null
|
||||
public GeneratorOption() {
|
||||
this.defaultValue = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an option with a default value.
|
||||
*/
|
||||
new(T defaultValue) {
|
||||
this.defaultValue = defaultValue
|
||||
public GeneratorOption(T defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
def T get() {
|
||||
value ?: defaultValue
|
||||
public T get() {
|
||||
if (value != null) {
|
||||
return value;
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
def void set(T value) {
|
||||
this.value = value
|
||||
public void set(T value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
def boolean isSet() {
|
||||
value !== null
|
||||
public boolean isSet() {
|
||||
return value != null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +1,18 @@
|
|||
/**
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator.util
|
||||
package org.eclipse.xtext.xtext.generator.util;
|
||||
|
||||
import org.eclipse.xtext.Keyword
|
||||
import org.eclipse.xtext.TerminalRule
|
||||
import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil
|
||||
import org.eclipse.xtext.Keyword;
|
||||
import org.eclipse.xtext.TerminalRule;
|
||||
import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* Helper to identify synthetic terminal rules.
|
||||
|
@ -19,19 +21,20 @@ import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil
|
|||
*
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
class SyntheticTerminalDetector {
|
||||
public class SyntheticTerminalDetector {
|
||||
|
||||
/**
|
||||
* Answers {@code true} if the given terminal rule is synthetic. That is,
|
||||
* the tokens for this rule will not be produced by the generated Antlr lexer
|
||||
* but manually in a custom token source.
|
||||
*/
|
||||
def boolean isSyntheticTerminalRule(TerminalRule rule) {
|
||||
if (rule.alternatives instanceof Keyword) {
|
||||
var String value = (rule.alternatives as Keyword).value
|
||||
return 'synthetic:' + AntlrGrammarGenUtil.getOriginalElement(rule).name == value
|
||||
public boolean isSyntheticTerminalRule(TerminalRule rule) {
|
||||
if (rule.getAlternatives() instanceof Keyword) {
|
||||
String value = ((Keyword) rule.getAlternatives()).getValue();
|
||||
String sytheticValue = "synthetic:" + AntlrGrammarGenUtil.getOriginalElement(rule).getName();
|
||||
return Objects.equal(sytheticValue, value);
|
||||
}
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator;
|
||||
|
||||
import org.eclipse.xtend.lib.annotations.Accessors;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
import org.eclipse.xtext.xtext.generator.AbstractStubGeneratingFragment;
|
||||
|
||||
/**
|
||||
* A fragment that generates a class that inherits from the generated class of the super-grammar.
|
||||
* This inheritance can be disabled with the {@code inheritImplementation} property.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public abstract class AbstractInheritingFragment extends AbstractStubGeneratingFragment {
|
||||
@Accessors
|
||||
private boolean inheritImplementation = true;
|
||||
|
||||
@Pure
|
||||
public boolean isInheritImplementation() {
|
||||
return this.inheritImplementation;
|
||||
}
|
||||
|
||||
public void setInheritImplementation(final boolean inheritImplementation) {
|
||||
this.inheritImplementation = inheritImplementation;
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator;
|
||||
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
* The Xtext generator uses dependency injection with <a href="https://github.com/google/guice">Guice</a>
|
||||
* for distributing the configuration to all its components. Instances of this interface can initialize
|
||||
* themselves with a Guice injector, e.g. by calling {@code injector.injectMembers(this)}.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface IGuiceAwareGeneratorComponent {
|
||||
void initialize(final Injector injector);
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator;
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent;
|
||||
import org.eclipse.xtext.xtext.generator.Issues;
|
||||
|
||||
/**
|
||||
* A fragment that contributes to the {@link XtextGenerator}. Use {@link AbstractXtextGeneratorFragment}
|
||||
* for implementing new fragments.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface IXtextGeneratorFragment extends IGuiceAwareGeneratorComponent {
|
||||
void checkConfiguration(final Issues issues);
|
||||
|
||||
void generate();
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator;
|
||||
|
||||
import java.util.List;
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.xtext.Grammar;
|
||||
import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.StandaloneSetupAccess;
|
||||
|
||||
/**
|
||||
* Configuration for an Xtext language. Implemented by {@link XtextGeneratorLanguage}.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface IXtextGeneratorLanguage {
|
||||
Grammar getGrammar();
|
||||
|
||||
List<String> getFileExtensions();
|
||||
|
||||
StandaloneSetupAccess getRuntimeGenSetup();
|
||||
|
||||
GuiceModuleAccess getRuntimeGenModule();
|
||||
|
||||
GuiceModuleAccess getIdeGenModule();
|
||||
|
||||
GuiceModuleAccess getEclipsePluginGenModule();
|
||||
|
||||
GuiceModuleAccess getIdeaGenModule();
|
||||
|
||||
GuiceModuleAccess getWebGenModule();
|
||||
|
||||
ResourceSet getResourceSet();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link CodeConfig#isPreferXtendStubs()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isGenerateXtendStubs();
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator;
|
||||
|
||||
/**
|
||||
* Use this to report configuration problems during the {@link IXtextGeneratorFragment#checkConfiguration(Issues)} phase.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface Issues {
|
||||
void addError(final String message);
|
||||
|
||||
void addError(final String message, final Object source);
|
||||
|
||||
void addWarning(final String message);
|
||||
|
||||
void addWarning(final String message, final Object source);
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator.model.annotations;
|
||||
|
||||
import java.lang.annotation.Repeatable;
|
||||
import org.eclipse.xtext.xtext.generator.XtextGenerator;
|
||||
import org.eclipse.xtext.xtext.generator.model.JavaFileAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.TypeReference;
|
||||
|
||||
/**
|
||||
* Class annotations can be added to the {@link XtextGenerator} workflow component in order
|
||||
* to configure specific Java annotations to be added to each generated class.
|
||||
* <br/><br/>
|
||||
* Make sure that you implement {@link Object#equals(Object)} and {@link Object#hashCode()} to fulfill following contract
|
||||
* <ul>
|
||||
* <li>If the underlying Annotation is {@link Repeatable} then the methods should behave like in {@link Object}.</li>
|
||||
* <li>If the underlying Annotation is NOT {@link Repeatable} then {@link Object#equals(Object)} should return true for all instances and {@link Object#hashCode()} should return the same value for all instances</li>
|
||||
* </ul>
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface IClassAnnotation {
|
||||
/**
|
||||
* Convert the class annotation to a string suitable for use in Java code generation.
|
||||
*/
|
||||
CharSequence generate();
|
||||
|
||||
/**
|
||||
* Determine whether this annotation should be applied to the given Java file.
|
||||
*/
|
||||
boolean appliesTo(final JavaFileAccess javaFile);
|
||||
|
||||
/**
|
||||
* Return the qualified name of the annotation interface for use in import declarations,
|
||||
* or {@code null} if no import is required.
|
||||
*/
|
||||
TypeReference getAnnotationImport();
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator.model.project;
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig;
|
||||
|
||||
/**
|
||||
* Configuration of the runtime project, i.e. the main subproject containing the language definition.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface IRuntimeProjectConfig extends IBundleProjectConfig {
|
||||
IXtextGeneratorFileSystemAccess getEcoreModel();
|
||||
|
||||
String getEcoreModelFolder();
|
||||
|
||||
/**
|
||||
* @since 2.13
|
||||
*/
|
||||
String getXbaseLibVersionLowerBound();
|
||||
|
||||
/**
|
||||
* @since 2.13
|
||||
*/
|
||||
String getXtendLibVersionLowerBound();
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator.model.project;
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent;
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
|
||||
|
||||
/**
|
||||
* Configuration of subprojects.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface ISubProjectConfig extends IGuiceAwareGeneratorComponent {
|
||||
boolean isEnabled();
|
||||
|
||||
String getName();
|
||||
|
||||
IXtextGeneratorFileSystemAccess getRoot();
|
||||
|
||||
IXtextGeneratorFileSystemAccess getMetaInf();
|
||||
|
||||
IXtextGeneratorFileSystemAccess getSrc();
|
||||
|
||||
IXtextGeneratorFileSystemAccess getSrcGen();
|
||||
|
||||
IXtextGeneratorFileSystemAccess getIcons();
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator.model.project;
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig;
|
||||
|
||||
/**
|
||||
* Configuration of the web project.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface IWebProjectConfig extends ISubProjectConfig {
|
||||
IXtextGeneratorFileSystemAccess getAssets();
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator.model.project;
|
||||
|
||||
import java.util.List;
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent;
|
||||
import org.eclipse.xtext.xtext.generator.model.project.IBundleProjectConfig;
|
||||
import org.eclipse.xtext.xtext.generator.model.project.IRuntimeProjectConfig;
|
||||
import org.eclipse.xtext.xtext.generator.model.project.ISubProjectConfig;
|
||||
import org.eclipse.xtext.xtext.generator.model.project.IWebProjectConfig;
|
||||
|
||||
/**
|
||||
* Configuration of the subprojects for one or more Xtext languages. Implemented by {@link XtextProjectConfig}.
|
||||
*
|
||||
* @noimplement This interface should not be implemented by clients.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public interface IXtextProjectConfig extends IGuiceAwareGeneratorComponent {
|
||||
IRuntimeProjectConfig getRuntime();
|
||||
|
||||
IBundleProjectConfig getRuntimeTest();
|
||||
|
||||
IBundleProjectConfig getGenericIde();
|
||||
|
||||
IBundleProjectConfig getEclipsePlugin();
|
||||
|
||||
IBundleProjectConfig getEclipsePluginTest();
|
||||
|
||||
ISubProjectConfig getIdeaPlugin();
|
||||
|
||||
IWebProjectConfig getWeb();
|
||||
|
||||
List<? extends ISubProjectConfig> getEnabledProjects();
|
||||
|
||||
List<? extends ISubProjectConfig> getTestProjects();
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator.util;
|
||||
|
||||
/**
|
||||
* A Boolean-valued option with default value for use in generator fragments.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class BooleanGeneratorOption {
|
||||
private final boolean defaultValue;
|
||||
|
||||
private Boolean value;
|
||||
|
||||
public BooleanGeneratorOption() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public BooleanGeneratorOption(final boolean defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public boolean get() {
|
||||
Boolean _elvis = null;
|
||||
if (this.value != null) {
|
||||
_elvis = this.value;
|
||||
} else {
|
||||
_elvis = Boolean.valueOf(this.defaultValue);
|
||||
}
|
||||
return (boolean) _elvis;
|
||||
}
|
||||
|
||||
public void set(final boolean value) {
|
||||
this.value = Boolean.valueOf(value);
|
||||
}
|
||||
|
||||
public boolean isSet() {
|
||||
return (this.value != null);
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator.util;
|
||||
|
||||
/**
|
||||
* An object-valued option with default value for use in generator fragments.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class GeneratorOption<T extends Object> {
|
||||
private final T defaultValue;
|
||||
|
||||
private T value;
|
||||
|
||||
/**
|
||||
* Create an option with no default value.
|
||||
*/
|
||||
public GeneratorOption() {
|
||||
this.defaultValue = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an option with a default value.
|
||||
*/
|
||||
public GeneratorOption(final T defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public T get() {
|
||||
T _elvis = null;
|
||||
if (this.value != null) {
|
||||
_elvis = this.value;
|
||||
} else {
|
||||
_elvis = this.defaultValue;
|
||||
}
|
||||
return _elvis;
|
||||
}
|
||||
|
||||
public void set(final T value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean isSet() {
|
||||
return (this.value != null);
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.xtext.xtext.generator.util;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import org.eclipse.xtext.AbstractElement;
|
||||
import org.eclipse.xtext.Keyword;
|
||||
import org.eclipse.xtext.TerminalRule;
|
||||
import org.eclipse.xtext.xtext.generator.parser.antlr.AntlrGrammarGenUtil;
|
||||
|
||||
/**
|
||||
* Helper to identify synthetic terminal rules.
|
||||
* This implementation answers <code>true</code> for any terminal rule that has a body in the form
|
||||
* <code>terminal MY_TERMINAL: 'synthetic:MY_TERMINAL';</code>.
|
||||
*
|
||||
* @author Sebastian Zarnekow - Initial contribution and API
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
public class SyntheticTerminalDetector {
|
||||
/**
|
||||
* Answers {@code true} if the given terminal rule is synthetic. That is,
|
||||
* the tokens for this rule will not be produced by the generated Antlr lexer
|
||||
* but manually in a custom token source.
|
||||
*/
|
||||
public boolean isSyntheticTerminalRule(final TerminalRule rule) {
|
||||
AbstractElement _alternatives = rule.getAlternatives();
|
||||
if ((_alternatives instanceof Keyword)) {
|
||||
AbstractElement _alternatives_1 = rule.getAlternatives();
|
||||
String value = ((Keyword) _alternatives_1).getValue();
|
||||
String _name = AntlrGrammarGenUtil.<TerminalRule>getOriginalElement(rule).getName();
|
||||
String _plus = ("synthetic:" + _name);
|
||||
return Objects.equal(_plus, value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue