Skip to content

Commit 9ce49b3

Browse files
committed
EDIT: Removed unnecessary syntax.
1 parent 9a526ba commit 9ce49b3

10 files changed

Lines changed: 14 additions & 24 deletions

src/main/java/jce/codemanipulation/ecore/EcoreImportManipulator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private void addQualifiedNamesToTypeReferences(ICompilationUnit unit, String typ
6565
* imports.
6666
*/
6767
private void applyRetentionVisitor(ICompilationUnit unit, IImportDeclaration[] imports) throws JavaModelException {
68-
ASTVisitor visitor = new TypeRetentionVisitor(unit, imports, properties);
68+
ASTVisitor visitor = new TypeRetentionVisitor(unit, imports);
6969
ASTUtil.applyVisitorModifications(unit, visitor, monitor);
7070
}
7171

src/main/java/jce/codemanipulation/ecore/FactoryInitMethodCorrectionVisitor.xtend

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import org.eclipse.jdt.core.dom.ReturnStatement
99
* @author Heiko Klare
1010
*/
1111
class FactoryInitMethodCorrectionVisitor extends ASTVisitor {
12-
private static final String FACTORY_INIT_METHOD_NAME = "init";
12+
static final String FACTORY_INIT_METHOD_NAME = "init";
1313

1414
/**
1515
* Removes the namespace-URI-based factory determination logic from the original Ecore factories,
1616
* because they are are only used internally and are not registered globally.
1717
*/
18-
public override boolean visit(MethodDeclaration node) {
18+
override boolean visit(MethodDeclaration node) {
1919
if (node.name.toString == FACTORY_INIT_METHOD_NAME) {
2020
node.body.statements.removeIf[!(it instanceof ReturnStatement)]
2121
}

src/main/java/jce/codemanipulation/ecore/PackageImplFactoryCorrectionVisitor.xtend

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ import jce.util.PathHelper
2323
class PackageImplFactoryCorrectionVisitor extends ASTVisitor {
2424
public static val PACKAGE_IMPL_SUFFIX = "PackageImpl";
2525
public static val PACKAGE_SUFFIX = "Package";
26-
private static val FACTORY_SUFFIX = "Factory";
27-
private val String factoryName;
28-
private val ICompilationUnit compilationUnit;
29-
private val EcorificationProperties properties;
30-
private val PathHelper pathHelper;
26+
static val FACTORY_SUFFIX = "Factory";
27+
val String factoryName;
28+
val EcorificationProperties properties;
29+
val PathHelper pathHelper;
3130

3231
new(ICompilationUnit compilationUnit, EcorificationProperties properties) {
3332
this.properties = properties;
34-
this.compilationUnit = compilationUnit;
3533
this.pathHelper = new PathHelper(".")
3634
val compilationUnitName = pathHelper.cutLastSegment(compilationUnit.elementName);
3735
this.factoryName = if (compilationUnit.elementName.contains(PACKAGE_IMPL_SUFFIX)) {

src/main/java/jce/codemanipulation/ecore/PackageImplFactoryCorrector.xtend

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import static extension jce.util.EPackageUtil.*;
1818
* @author Heiko Klare
1919
*/
2020
class PackageImplFactoryCorrector extends AbstractCodeManipulator {
21-
private val extension PathHelper pathHelper;
22-
private val GeneratedEcoreMetamodel metamodel;
21+
val extension PathHelper pathHelper;
22+
val GeneratedEcoreMetamodel metamodel;
2323

2424
new(GeneratedEcoreMetamodel metamodel, EcorificationProperties properties) {
2525
super(properties.get(TextProperty.ECORE_PACKAGE), properties)

src/main/java/jce/codemanipulation/ecore/TypeRetentionVisitor.xtend

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class TypeRetentionVisitor extends ASTVisitor {
3131
final String currentPackage
3232
final IImportDeclaration[] imports
3333
final PathHelper pathHelper
34-
final EcorificationProperties properties
3534

3635
/**
3736
* Basic constructor. Creates the visitor.
@@ -40,9 +39,8 @@ class TypeRetentionVisitor extends ASTVisitor {
4039
* @param properties are the {@link EcorificationProperties}.
4140
* @throws JavaModelException if there is a problem with the {@link ICompilationUnit}.
4241
*/
43-
new(ICompilationUnit compilationUnit, IImportDeclaration[] imports, EcorificationProperties properties) throws JavaModelException {
42+
new(ICompilationUnit compilationUnit, IImportDeclaration[] imports) throws JavaModelException {
4443
super()
45-
this.properties = properties
4644
this.imports = imports
4745
currentPackage = compilationUnit.parent.elementName
4846
pathHelper = new PathHelper('.')

src/main/java/jce/generators/ClassGenerator.xtend

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ClassGenerator {
3232
/**
3333
* Creates an IFile from a project relative path, a file name and creates the file content.
3434
*/
35-
def public void createClass(String path, String name, String content, IProject project) {
35+
def void createClass(String path, String name, String content, IProject project) {
3636
var folder = project.getFolder(append(SOURCE_FOLDER.get, path))
3737
var file = folder.getFile(name)
3838
if(file.exists) {
@@ -46,7 +46,7 @@ class ClassGenerator {
4646
/**
4747
* Creates an {@link IFolder} in the project with a project relative path.
4848
*/
49-
def public void createFolder(String path, IProject project) {
49+
def void createFolder(String path, IProject project) {
5050
var IFolder folder = project.getFolder(path)
5151
if(!folder.exists) {
5252
folder.create(false, true, monitor)

src/main/java/jce/generators/ConstructorRepresentation.xtend

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import org.eclipse.xtend.lib.annotations.Accessors
1717
@Accessors(PUBLIC_GETTER)
1818
class ConstructorRepresentation {
1919
@Accessors(NONE) static final Logger logger = LogManager.getLogger(ConstructorRepresentation.getName)
20-
@Accessors(NONE) MethodDeclaration declaration
2120
@Accessors(NONE) List<SingleVariableDeclaration> parameters
2221
List<String> imports
2322
String content
@@ -27,7 +26,6 @@ class ConstructorRepresentation {
2726
* correlating compilation unit.
2827
*/
2928
new(MethodDeclaration declaration, ICompilationUnit unit) {
30-
this.declaration = declaration
3129
parameters = new LinkedList
3230
for (parameter : declaration.parameters) {
3331
addParameter(parameter)

src/main/java/jce/generators/EFactoryGenerator.xtend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class EFactoryGenerator extends ClassGenerator {
2424
/**
2525
* Creates a Ecore Factory in a package path with a specific name.
2626
*/
27-
def public void create(String path, List<String> packageTypes, IProject project) {
27+
def void create(String path, List<String> packageTypes, IProject project) {
2828
val currentPackage = path.replace(File.separatorChar, '.') // path to package declaration
2929
val packageName = currentPackage.getLastSegment.toFirstUpper
3030
val content = createFactoryContent(currentPackage, packageName, packageTypes)

src/main/java/jce/generators/EFactoryImplementationGenerator.xtend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class EFactoryImplementationGenerator extends ClassGenerator {
2424
/**
2525
* Creates a Ecore Factory in a package path with a specific name.
2626
*/
27-
def public void create(String path, List<String> packageTypes, IProject project) {
27+
def void create(String path, List<String> packageTypes, IProject project) {
2828
val currentPackage = path.replace(File.separatorChar, '.') // path to package declaration
2929
val interfacePackage = currentPackage.cutLastSegment
3030
val packageName = interfacePackage.getLastSegment.toFirstUpper

src/main/java/jce/generators/EcoreFactoryGenerator.xtend

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ import java.io.File
55
import jce.properties.EcorificationProperties
66
import jce.util.PathHelper
77
import jce.util.ResourceRefresher
8-
import jce.util.logging.MonitorFactory
98
import org.apache.log4j.LogManager
109
import org.apache.log4j.Logger
1110
import org.eclipse.core.resources.IProject
12-
import org.eclipse.core.runtime.IProgressMonitor
1311
import org.eclipse.emf.ecore.EPackage
1412

1513
import static jce.properties.TextProperty.ECORE_PACKAGE
@@ -26,7 +24,6 @@ final class EcoreFactoryGenerator {
2624
extension final EcorificationProperties properties
2725

2826
static final Logger logger = LogManager.getLogger(EcoreFactoryGenerator.getName)
29-
final IProgressMonitor monitor
3027
final EFactoryGenerator factoryGenerator
3128
final EFactoryImplementationGenerator factoryImplementationGenerator
3229

@@ -37,7 +34,6 @@ final class EcoreFactoryGenerator {
3734
this.properties = properties
3835
factoryGenerator = new EFactoryGenerator(properties)
3936
factoryImplementationGenerator = new EFactoryImplementationGenerator(properties)
40-
monitor = MonitorFactory.createProgressMonitor(logger, properties)
4137
pathUtil = new PathHelper(File.separatorChar)
4238
}
4339

0 commit comments

Comments
 (0)