mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 16:28:56 +00:00
Merge pull request #1369 from eclipse/cd_moreXtend2Java
[eclipse/xtext#1629] ported more Xtend code to Java
This commit is contained in:
commit
1ebd765e0b
20 changed files with 363 additions and 584 deletions
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) 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.xtext.wizard;
|
||||
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
import org.eclipse.xtext.xtext.wizard.Outlet;
|
||||
import org.eclipse.xtext.xtext.wizard.ProjectDescriptor;
|
||||
|
||||
public abstract class AbstractFile {
|
||||
private final Outlet outlet;
|
||||
|
||||
private final String relativePath;
|
||||
|
||||
private final ProjectDescriptor project;
|
||||
|
||||
private final boolean executable;
|
||||
|
||||
public AbstractFile(Outlet outlet, String relativePath, ProjectDescriptor project, boolean executable) {
|
||||
super();
|
||||
this.outlet = outlet;
|
||||
this.relativePath = relativePath;
|
||||
this.project = project;
|
||||
this.executable = executable;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public Outlet getOutlet() {
|
||||
return this.outlet;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getRelativePath() {
|
||||
return this.relativePath;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public ProjectDescriptor getProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public boolean isExecutable() {
|
||||
return this.executable;
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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.xtext.wizard
|
||||
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
|
||||
|
||||
@FinalFieldsConstructor
|
||||
abstract class AbstractFile {
|
||||
@Accessors val Outlet outlet
|
||||
@Accessors val String relativePath
|
||||
@Accessors val ProjectDescriptor project
|
||||
@Accessors val boolean executable
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) 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.xtext.wizard;
|
||||
|
||||
import java.net.URL;
|
||||
import org.eclipse.xtext.xtext.wizard.AbstractFile;
|
||||
import org.eclipse.xtext.xtext.wizard.Outlet;
|
||||
import org.eclipse.xtext.xtext.wizard.ProjectDescriptor;
|
||||
|
||||
public class BinaryFile extends AbstractFile {
|
||||
private final URL content;
|
||||
|
||||
public URL getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public BinaryFile(Outlet outlet, String relativePath, ProjectDescriptor project, boolean executable, URL content) {
|
||||
super(outlet, relativePath, project, executable);
|
||||
this.content = content;
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package org.eclipse.xtext.xtext.wizard
|
||||
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
|
||||
import java.net.URL
|
||||
|
||||
@FinalFieldsConstructor
|
||||
class BinaryFile extends AbstractFile {
|
||||
|
||||
@Accessors val URL content
|
||||
|
||||
def URL getContent() {
|
||||
return content
|
||||
}
|
||||
}
|
|
@ -0,0 +1,158 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) 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.xtext.wizard;
|
||||
|
||||
import java.util.Set;
|
||||
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
|
||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
import org.eclipse.xtext.xtext.wizard.Scope;
|
||||
|
||||
public class ExternalDependency {
|
||||
public static class MavenCoordinates {
|
||||
private String groupId;
|
||||
|
||||
private String artifactId;
|
||||
|
||||
private String version;
|
||||
|
||||
public void setShortNotation(String shortNotation) {
|
||||
String[] parts = shortNotation.split(":");
|
||||
this.groupId = parts[0];
|
||||
this.artifactId = parts[1];
|
||||
this.version = parts[2];
|
||||
}
|
||||
|
||||
private Scope scope = Scope.COMPILE;
|
||||
|
||||
private boolean optional = false;
|
||||
|
||||
@Pure
|
||||
public String getGroupId() {
|
||||
return this.groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getArtifactId() {
|
||||
return this.artifactId;
|
||||
}
|
||||
|
||||
public void setArtifactId(String artifactId) {
|
||||
this.artifactId = artifactId;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public Scope getScope() {
|
||||
return this.scope;
|
||||
}
|
||||
|
||||
public void setScope(Scope scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public boolean isOptional() {
|
||||
return this.optional;
|
||||
}
|
||||
|
||||
public void setOptional(boolean optional) {
|
||||
this.optional = optional;
|
||||
}
|
||||
}
|
||||
|
||||
public static class P2Coordinates {
|
||||
private String bundleId;
|
||||
|
||||
private String version;
|
||||
|
||||
private Set<String> packages = CollectionLiterals.newHashSet();
|
||||
|
||||
@Pure
|
||||
public String getBundleId() {
|
||||
return this.bundleId;
|
||||
}
|
||||
|
||||
public void setBundleId(String bundleId) {
|
||||
this.bundleId = bundleId;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public Set<String> getPackages() {
|
||||
return this.packages;
|
||||
}
|
||||
|
||||
public void setPackages(Set<String> packages) {
|
||||
this.packages = packages;
|
||||
}
|
||||
}
|
||||
|
||||
public static ExternalDependency createXtextDependency(String xtextBundle) {
|
||||
ExternalDependency externalDependency = new ExternalDependency();
|
||||
externalDependency.p2.bundleId = xtextBundle;
|
||||
externalDependency.maven.groupId = "org.eclipse.xtext";
|
||||
externalDependency.maven.artifactId = xtextBundle;
|
||||
externalDependency.maven.version ="${xtextVersion}";
|
||||
return externalDependency;
|
||||
}
|
||||
|
||||
public static ExternalDependency createMavenDependency(String shortNotation) {
|
||||
ExternalDependency externalDependency = new ExternalDependency();
|
||||
externalDependency.maven.setShortNotation(shortNotation);
|
||||
return externalDependency;
|
||||
}
|
||||
|
||||
public static ExternalDependency createBundleDependency(final String bundleId) {
|
||||
ExternalDependency externalDependency = new ExternalDependency();
|
||||
externalDependency.p2.bundleId = bundleId;
|
||||
return externalDependency;
|
||||
}
|
||||
|
||||
private final ExternalDependency.MavenCoordinates maven = new ExternalDependency.MavenCoordinates();
|
||||
|
||||
private final ExternalDependency.P2Coordinates p2 = new ExternalDependency.P2Coordinates();
|
||||
|
||||
public void maven(Procedure1<? super ExternalDependency.MavenCoordinates> config) {
|
||||
config.apply(this.maven);
|
||||
}
|
||||
|
||||
public void p2(Procedure1<? super ExternalDependency.P2Coordinates> config) {
|
||||
config.apply(this.p2);
|
||||
}
|
||||
|
||||
@Pure
|
||||
public ExternalDependency.MavenCoordinates getMaven() {
|
||||
return this.maven;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public ExternalDependency.P2Coordinates getP2() {
|
||||
return this.p2;
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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.xtext.wizard
|
||||
|
||||
import java.util.Set
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
|
||||
@Accessors
|
||||
class ExternalDependency {
|
||||
static def createXtextDependency(String xtextBundle) {
|
||||
new ExternalDependency => [
|
||||
p2.bundleId = xtextBundle
|
||||
maven [
|
||||
groupId = "org.eclipse.xtext"
|
||||
artifactId = xtextBundle
|
||||
version = "${xtextVersion}"
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
static def createMavenDependency(String shortNotation) {
|
||||
new ExternalDependency => [
|
||||
maven.shortNotation = shortNotation
|
||||
]
|
||||
}
|
||||
|
||||
static def createBundleDependency(String bundleId) {
|
||||
new ExternalDependency => [
|
||||
p2.bundleId = bundleId
|
||||
]
|
||||
}
|
||||
|
||||
val maven = new MavenCoordinates
|
||||
val p2 = new P2Coordinates
|
||||
|
||||
def maven((MavenCoordinates)=>void config) {
|
||||
config.apply(maven)
|
||||
}
|
||||
|
||||
def p2((P2Coordinates)=>void config) {
|
||||
config.apply(p2)
|
||||
}
|
||||
|
||||
@Accessors
|
||||
static class MavenCoordinates {
|
||||
String groupId
|
||||
String artifactId
|
||||
String version
|
||||
def setShortNotation(String shortNotation) {
|
||||
val parts = shortNotation.split(":")
|
||||
groupId = parts.get(0)
|
||||
artifactId = parts.get(1)
|
||||
version = parts.get(2)
|
||||
}
|
||||
Scope scope = Scope.COMPILE
|
||||
boolean optional = false
|
||||
}
|
||||
|
||||
@Accessors
|
||||
static class P2Coordinates {
|
||||
String bundleId
|
||||
String version
|
||||
Set<String> packages = newHashSet
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) 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.xtext.wizard;
|
||||
|
||||
import org.eclipse.xtext.xtext.wizard.Outlet;
|
||||
import org.eclipse.xtext.xtext.wizard.ProjectDescriptor;
|
||||
import org.eclipse.xtext.xtext.wizard.TextFile;
|
||||
|
||||
public class PlainTextFile extends TextFile {
|
||||
private final CharSequence content;
|
||||
|
||||
public PlainTextFile(Outlet outlet, String relativePath, ProjectDescriptor project, CharSequence content,
|
||||
boolean executable) {
|
||||
super(outlet, relativePath, project, executable);
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContent() {
|
||||
return this.content.toString();
|
||||
}
|
||||
|
||||
public PlainTextFile(Outlet outlet, String relativePath, ProjectDescriptor project, CharSequence content) {
|
||||
super(outlet, relativePath, project);
|
||||
this.content = content;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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.xtext.wizard
|
||||
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
|
||||
|
||||
@FinalFieldsConstructor
|
||||
class PlainTextFile extends TextFile {
|
||||
@Accessors val CharSequence content
|
||||
|
||||
new(Outlet outlet, String relativePath, ProjectDescriptor project, CharSequence content, boolean executable) {
|
||||
super(outlet, relativePath, project, executable)
|
||||
this.content = content
|
||||
}
|
||||
|
||||
override String getContent() {
|
||||
content.toString
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) 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
|
||||
|
@ -9,7 +9,6 @@ package org.eclipse.xtext.xtext.wizard;
|
|||
|
||||
import org.eclipse.xtext.xtext.wizard.WizardConfiguration;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public interface ProjectsCreator {
|
||||
void createProjects(final WizardConfiguration config);
|
||||
void createProjects(WizardConfiguration config);
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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.xtext.wizard
|
||||
|
||||
interface ProjectsCreator {
|
||||
def void createProjects(WizardConfiguration config)
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/**
|
||||
* Copyright (c) 2018, 2020 itemis AG (http://www.itemis.eu) 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.xtext.wizard;
|
||||
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* @author Arne Deutsch - Initial contribution and API
|
||||
* @since 2.15
|
||||
*/
|
||||
public class SourceFolderDescriptor {
|
||||
private final String path;
|
||||
|
||||
private final boolean test;
|
||||
|
||||
public SourceFolderDescriptor(String path, boolean test) {
|
||||
super();
|
||||
this.path = path;
|
||||
this.test = test;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.path == null) ? 0 : this.path.hashCode());
|
||||
return prime * result + (this.test ? 1231 : 1237);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
SourceFolderDescriptor other = (SourceFolderDescriptor) obj;
|
||||
if (this.path == null) {
|
||||
if (other.path != null)
|
||||
return false;
|
||||
} else if (!this.path.equals(other.path))
|
||||
return false;
|
||||
if (other.test != this.test)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
public String toString() {
|
||||
ToStringBuilder b = new ToStringBuilder(this);
|
||||
b.add("path", this.path);
|
||||
b.add("test", this.test);
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public boolean isTest() {
|
||||
return this.test;
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2018 itemis AG (http://www.itemis.eu) 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.xtext.wizard
|
||||
|
||||
import org.eclipse.xtend.lib.annotations.Data
|
||||
|
||||
/**
|
||||
* @author Arne Deutsch - Initial contribution and API
|
||||
* @since 2.15
|
||||
*/
|
||||
@Data
|
||||
class SourceFolderDescriptor {
|
||||
val String path
|
||||
val boolean test
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) 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.xtext.wizard;
|
||||
|
||||
public abstract class TextFile extends AbstractFile {
|
||||
public TextFile(Outlet outlet, String relativePath, ProjectDescriptor project) {
|
||||
super(outlet, relativePath, project, false);
|
||||
}
|
||||
|
||||
public abstract String getContent();
|
||||
|
||||
public TextFile(Outlet outlet, String relativePath, ProjectDescriptor project, boolean executable) {
|
||||
super(outlet, relativePath, project, executable);
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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.xtext.wizard
|
||||
|
||||
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
|
||||
|
||||
@FinalFieldsConstructor
|
||||
abstract class TextFile extends AbstractFile {
|
||||
|
||||
new(Outlet outlet, String relativePath, ProjectDescriptor project) {
|
||||
super(outlet, relativePath, project, false)
|
||||
}
|
||||
|
||||
abstract def String getContent()
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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.xtext.wizard;
|
||||
|
||||
import org.eclipse.xtend.lib.annotations.Accessors;
|
||||
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
import org.eclipse.xtext.xtext.wizard.Outlet;
|
||||
import org.eclipse.xtext.xtext.wizard.ProjectDescriptor;
|
||||
|
||||
@FinalFieldsConstructor
|
||||
@SuppressWarnings("all")
|
||||
public abstract class AbstractFile {
|
||||
@Accessors
|
||||
private final Outlet outlet;
|
||||
|
||||
@Accessors
|
||||
private final String relativePath;
|
||||
|
||||
@Accessors
|
||||
private final ProjectDescriptor project;
|
||||
|
||||
@Accessors
|
||||
private final boolean executable;
|
||||
|
||||
public AbstractFile(final Outlet outlet, final String relativePath, final ProjectDescriptor project, final boolean executable) {
|
||||
super();
|
||||
this.outlet = outlet;
|
||||
this.relativePath = relativePath;
|
||||
this.project = project;
|
||||
this.executable = executable;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public Outlet getOutlet() {
|
||||
return this.outlet;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getRelativePath() {
|
||||
return this.relativePath;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public ProjectDescriptor getProject() {
|
||||
return this.project;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public boolean isExecutable() {
|
||||
return this.executable;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package org.eclipse.xtext.xtext.wizard;
|
||||
|
||||
import java.net.URL;
|
||||
import org.eclipse.xtend.lib.annotations.Accessors;
|
||||
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor;
|
||||
import org.eclipse.xtext.xtext.wizard.AbstractFile;
|
||||
import org.eclipse.xtext.xtext.wizard.Outlet;
|
||||
import org.eclipse.xtext.xtext.wizard.ProjectDescriptor;
|
||||
|
||||
@FinalFieldsConstructor
|
||||
@SuppressWarnings("all")
|
||||
public class BinaryFile extends AbstractFile {
|
||||
@Accessors
|
||||
private final URL content;
|
||||
|
||||
public URL getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public BinaryFile(final Outlet outlet, final String relativePath, final ProjectDescriptor project, final boolean executable, final URL content) {
|
||||
super(outlet, relativePath, project, executable);
|
||||
this.content = content;
|
||||
}
|
||||
}
|
|
@ -1,177 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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.xtext.wizard;
|
||||
|
||||
import java.util.Set;
|
||||
import org.eclipse.xtend.lib.annotations.Accessors;
|
||||
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
|
||||
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
|
||||
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
import org.eclipse.xtext.xtext.wizard.Scope;
|
||||
|
||||
@Accessors
|
||||
@SuppressWarnings("all")
|
||||
public class ExternalDependency {
|
||||
@Accessors
|
||||
public static class MavenCoordinates {
|
||||
private String groupId;
|
||||
|
||||
private String artifactId;
|
||||
|
||||
private String version;
|
||||
|
||||
public String setShortNotation(final String shortNotation) {
|
||||
String _xblockexpression = null;
|
||||
{
|
||||
final String[] parts = shortNotation.split(":");
|
||||
this.groupId = parts[0];
|
||||
this.artifactId = parts[1];
|
||||
_xblockexpression = this.version = parts[2];
|
||||
}
|
||||
return _xblockexpression;
|
||||
}
|
||||
|
||||
private Scope scope = Scope.COMPILE;
|
||||
|
||||
private boolean optional = false;
|
||||
|
||||
@Pure
|
||||
public String getGroupId() {
|
||||
return this.groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(final String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getArtifactId() {
|
||||
return this.artifactId;
|
||||
}
|
||||
|
||||
public void setArtifactId(final String artifactId) {
|
||||
this.artifactId = artifactId;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public void setVersion(final String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public Scope getScope() {
|
||||
return this.scope;
|
||||
}
|
||||
|
||||
public void setScope(final Scope scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public boolean isOptional() {
|
||||
return this.optional;
|
||||
}
|
||||
|
||||
public void setOptional(final boolean optional) {
|
||||
this.optional = optional;
|
||||
}
|
||||
}
|
||||
|
||||
@Accessors
|
||||
public static class P2Coordinates {
|
||||
private String bundleId;
|
||||
|
||||
private String version;
|
||||
|
||||
private Set<String> packages = CollectionLiterals.<String>newHashSet();
|
||||
|
||||
@Pure
|
||||
public String getBundleId() {
|
||||
return this.bundleId;
|
||||
}
|
||||
|
||||
public void setBundleId(final String bundleId) {
|
||||
this.bundleId = bundleId;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public void setVersion(final String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public Set<String> getPackages() {
|
||||
return this.packages;
|
||||
}
|
||||
|
||||
public void setPackages(final Set<String> packages) {
|
||||
this.packages = packages;
|
||||
}
|
||||
}
|
||||
|
||||
public static ExternalDependency createXtextDependency(final String xtextBundle) {
|
||||
ExternalDependency _externalDependency = new ExternalDependency();
|
||||
final Procedure1<ExternalDependency> _function = (ExternalDependency it) -> {
|
||||
it.p2.bundleId = xtextBundle;
|
||||
final Procedure1<ExternalDependency.MavenCoordinates> _function_1 = (ExternalDependency.MavenCoordinates it_1) -> {
|
||||
it_1.groupId = "org.eclipse.xtext";
|
||||
it_1.artifactId = xtextBundle;
|
||||
it_1.version = "${xtextVersion}";
|
||||
};
|
||||
it.maven(_function_1);
|
||||
};
|
||||
return ObjectExtensions.<ExternalDependency>operator_doubleArrow(_externalDependency, _function);
|
||||
}
|
||||
|
||||
public static ExternalDependency createMavenDependency(final String shortNotation) {
|
||||
ExternalDependency _externalDependency = new ExternalDependency();
|
||||
final Procedure1<ExternalDependency> _function = (ExternalDependency it) -> {
|
||||
it.maven.setShortNotation(shortNotation);
|
||||
};
|
||||
return ObjectExtensions.<ExternalDependency>operator_doubleArrow(_externalDependency, _function);
|
||||
}
|
||||
|
||||
public static ExternalDependency createBundleDependency(final String bundleId) {
|
||||
ExternalDependency _externalDependency = new ExternalDependency();
|
||||
final Procedure1<ExternalDependency> _function = (ExternalDependency it) -> {
|
||||
it.p2.bundleId = bundleId;
|
||||
};
|
||||
return ObjectExtensions.<ExternalDependency>operator_doubleArrow(_externalDependency, _function);
|
||||
}
|
||||
|
||||
private final ExternalDependency.MavenCoordinates maven = new ExternalDependency.MavenCoordinates();
|
||||
|
||||
private final ExternalDependency.P2Coordinates p2 = new ExternalDependency.P2Coordinates();
|
||||
|
||||
public void maven(final Procedure1<? super ExternalDependency.MavenCoordinates> config) {
|
||||
config.apply(this.maven);
|
||||
}
|
||||
|
||||
public void p2(final Procedure1<? super ExternalDependency.P2Coordinates> config) {
|
||||
config.apply(this.p2);
|
||||
}
|
||||
|
||||
@Pure
|
||||
public ExternalDependency.MavenCoordinates getMaven() {
|
||||
return this.maven;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public ExternalDependency.P2Coordinates getP2() {
|
||||
return this.p2;
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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.xtext.wizard;
|
||||
|
||||
import org.eclipse.xtend.lib.annotations.Accessors;
|
||||
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor;
|
||||
import org.eclipse.xtext.xtext.wizard.Outlet;
|
||||
import org.eclipse.xtext.xtext.wizard.ProjectDescriptor;
|
||||
import org.eclipse.xtext.xtext.wizard.TextFile;
|
||||
|
||||
@FinalFieldsConstructor
|
||||
@SuppressWarnings("all")
|
||||
public class PlainTextFile extends TextFile {
|
||||
@Accessors
|
||||
private final CharSequence content;
|
||||
|
||||
public PlainTextFile(final Outlet outlet, final String relativePath, final ProjectDescriptor project, final CharSequence content, final boolean executable) {
|
||||
super(outlet, relativePath, project, executable);
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContent() {
|
||||
return this.content.toString();
|
||||
}
|
||||
|
||||
public PlainTextFile(final Outlet outlet, final String relativePath, final ProjectDescriptor project, final CharSequence content) {
|
||||
super(outlet, relativePath, project);
|
||||
this.content = content;
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2018 itemis AG (http://www.itemis.eu) 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.xtext.wizard;
|
||||
|
||||
import org.eclipse.xtend.lib.annotations.Data;
|
||||
import org.eclipse.xtext.xbase.lib.Pure;
|
||||
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* @author Arne Deutsch - Initial contribution and API
|
||||
* @since 2.15
|
||||
*/
|
||||
@Data
|
||||
@SuppressWarnings("all")
|
||||
public class SourceFolderDescriptor {
|
||||
private final String path;
|
||||
|
||||
private final boolean test;
|
||||
|
||||
public SourceFolderDescriptor(final String path, final boolean test) {
|
||||
super();
|
||||
this.path = path;
|
||||
this.test = test;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.path== null) ? 0 : this.path.hashCode());
|
||||
return prime * result + (this.test ? 1231 : 1237);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
SourceFolderDescriptor other = (SourceFolderDescriptor) obj;
|
||||
if (this.path == null) {
|
||||
if (other.path != null)
|
||||
return false;
|
||||
} else if (!this.path.equals(other.path))
|
||||
return false;
|
||||
if (other.test != this.test)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Pure
|
||||
public String toString() {
|
||||
ToStringBuilder b = new ToStringBuilder(this);
|
||||
b.add("path", this.path);
|
||||
b.add("test", this.test);
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
@Pure
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
@Pure
|
||||
public boolean isTest() {
|
||||
return this.test;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) 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.xtext.wizard;
|
||||
|
||||
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor;
|
||||
import org.eclipse.xtext.xtext.wizard.AbstractFile;
|
||||
import org.eclipse.xtext.xtext.wizard.Outlet;
|
||||
import org.eclipse.xtext.xtext.wizard.ProjectDescriptor;
|
||||
|
||||
@FinalFieldsConstructor
|
||||
@SuppressWarnings("all")
|
||||
public abstract class TextFile extends AbstractFile {
|
||||
public TextFile(final Outlet outlet, final String relativePath, final ProjectDescriptor project) {
|
||||
super(outlet, relativePath, project, false);
|
||||
}
|
||||
|
||||
public abstract String getContent();
|
||||
|
||||
public TextFile(final Outlet outlet, final String relativePath, final ProjectDescriptor project, final boolean executable) {
|
||||
super(outlet, relativePath, project, executable);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue