Modernize o.e.dltk.tcl.core.
* Move to Java 8.
* Enable warning, fix them and enable save actions.
Change-Id: Iaa0e455eca137022115744e17279c6d05e40aee2
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/.classpath b/tcl/plugins/org.eclipse.dltk.tcl.core/.classpath
index 004fa29..ec902e1 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/.classpath
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/.classpath
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="packages"/>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/.settings/org.eclipse.jdt.core.prefs b/tcl/plugins/org.eclipse.dltk.tcl.core/.settings/org.eclipse.jdt.core.prefs
index 4538b56..57a4ee5 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/.settings/org.eclipse.jdt.core.prefs
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,9 +1,8 @@
-#Thu Oct 21 16:33:20 CEST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -67,7 +66,7 @@
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
@@ -146,9 +145,12 @@
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/.settings/org.eclipse.jdt.ui.prefs b/tcl/plugins/org.eclipse.dltk.tcl.core/.settings/org.eclipse.jdt.ui.prefs
index 3d76cbc..2be769c 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/.settings/org.eclipse.jdt.ui.prefs
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,61 @@
-#Thu Oct 21 16:33:20 CEST 2010
eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
formatter_settings_version=11
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=true
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/META-INF/MANIFEST.MF b/tcl/plugins/org.eclipse.dltk.tcl.core/META-INF/MANIFEST.MF
index 97da403..7759b72 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/META-INF/MANIFEST.MF
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/META-INF/MANIFEST.MF
@@ -14,7 +14,7 @@
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.xmi,
org.eclipse.core.filesystem
-Eclipse-AutoStart: true
+Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.dltk.tcl.ast,
org.eclipse.dltk.tcl.ast.expressions,
org.eclipse.dltk.tcl.core,
@@ -38,4 +38,4 @@
org.eclipse.dltk.tcl.internal.parser.ext,
org.eclipse.dltk.tcl.internal.structure;x-internal:=true,
org.eclipse.dltk.tcl.structure
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/packages/org/eclipse/dltk/tcl/core/TclPackagesManager.java b/tcl/plugins/org.eclipse.dltk.tcl.core/packages/org/eclipse/dltk/tcl/core/TclPackagesManager.java
index 481951a..6f8dc4f 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/packages/org/eclipse/dltk/tcl/core/TclPackagesManager.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/packages/org/eclipse/dltk/tcl/core/TclPackagesManager.java
@@ -839,7 +839,7 @@
EList<TclModuleInfo> modules = info.getModules();
for (TclModuleInfo tclModuleInfo : modules) {
- TclModuleInfo copy = (TclModuleInfo) EcoreUtil.copy(tclModuleInfo);
+ TclModuleInfo copy = EcoreUtil.copy(tclModuleInfo);
results.add(copy);
}
return Collections.unmodifiableList(results);
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/TclNamespaceDeclaration.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/TclNamespaceDeclaration.java
index a8cbe99..c893f8b 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/TclNamespaceDeclaration.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/TclNamespaceDeclaration.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation 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.dltk.tcl.ast;
@@ -24,9 +23,10 @@
super(name, nameStart, nameEnd, start, end);
}
+ @Override
public FieldDeclaration[] getVariables() {
- List variableNames = new ArrayList();
- List variableDeclarations = new ArrayList();
+ List<String> variableNames = new ArrayList<>();
+ List<FieldDeclaration> variableDeclarations = new ArrayList<>();
List statements = this.getStatements();
Iterator i = statements.iterator();
while (i.hasNext()) {
@@ -46,7 +46,7 @@
}
}
}
- return (FieldDeclaration[]) variableDeclarations
+ return variableDeclarations
.toArray(new FieldDeclaration[variableDeclarations.size()]);
}
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/TclStatement.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/TclStatement.java
index 862a0d2..8df806c 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/TclStatement.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/TclStatement.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation 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.dltk.tcl.ast;
@@ -19,9 +18,9 @@
import org.eclipse.dltk.utils.CorePrinter;
public class TclStatement extends Statement {
- private List expressions;
+ private List<ASTNode> expressions;
- public TclStatement(List expressions) {
+ public TclStatement(List<ASTNode> expressions) {
if (!expressions.isEmpty()) {
// First
Expression first = (Expression) expressions.get(0);
@@ -36,7 +35,7 @@
this.expressions = expressions;
}
- public List getExpressions() {
+ public List<ASTNode> getExpressions() {
return this.expressions;
}
@@ -52,16 +51,18 @@
return this.expressions.size();
}
+ @Override
public int getKind() {
return TclConstants.TCL_STATEMENT;
}
+ @Override
public void traverse(ASTVisitor visitor) throws Exception {
if (visitor.visit(this)) {
if (this.expressions != null) {
int exprSize = this.expressions.size();
for (int i = 0; i < exprSize; i++) {
- ASTNode node = (ASTNode) this.expressions.get(i);
+ ASTNode node = this.expressions.get(i);
node.traverse(visitor);
}
}
@@ -69,24 +70,26 @@
}
}
+ @Override
public void printNode(CorePrinter output) {
if (this.expressions != null) {
output.formatPrintLn("");
- Iterator i = this.expressions.iterator();
+ Iterator<ASTNode> i = this.expressions.iterator();
while (i.hasNext()) {
- ASTNode node = (ASTNode) i.next();
+ ASTNode node = i.next();
node.printNode(output);
output.formatPrintLn(" ");
}
}
}
+ @Override
public String toString() {
String value = "";
if (this.expressions != null) {
- Iterator i = this.expressions.iterator();
+ Iterator<ASTNode> i = this.expressions.iterator();
while (i.hasNext()) {
- ASTNode node = (ASTNode) i.next();
+ ASTNode node = i.next();
value += node.toString();
value += " ";
}
@@ -95,7 +98,7 @@
return value;
}
- public void setExpressions(List asList) {
+ public void setExpressions(List<ASTNode> asList) {
this.expressions = asList;
}
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/expressions/TclBlockExpression.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/expressions/TclBlockExpression.java
index 82a6fae..cf1ecf7 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/expressions/TclBlockExpression.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/expressions/TclBlockExpression.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation 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
@@ -41,20 +41,24 @@
return processedArgument;
}
+ @Override
public int getKind() {
return TclConstants.TCL_BLOCK_EXPRESSION;
}
+ @Override
public void traverse(ASTVisitor visitor) throws Exception {
if (visitor.visit(this)) {
visitor.endvisit(this);
}
}
+ @Override
public void printNode(CorePrinter output) {
output.formatPrintLn("tcl block:" + this.fBlockContent);
}
+ @Override
public String toString() {
return "tcl block:" + this.fBlockContent;
}
@@ -76,15 +80,15 @@
return null;
}
- String content = this.fBlockContent.substring(1, this.fBlockContent
- .length() - 1);
+ String content = this.fBlockContent.substring(1,
+ this.fBlockContent.length() - 1);
ITclSourceParser parser = null;
parser = (ITclSourceParser) DLTKLanguageManager
.getSourceParser(TclNature.NATURE_ID);
parser.setProcessorsState(useProcessors);
parser.setOffset(this.sourceStart() + 1);
- ModuleDeclaration module = parser.parse(new ModuleSource(this.fileName,
- content), null);
+ ModuleDeclaration module = parser
+ .parse(new ModuleSource(this.fileName, content), null);
return module.getStatements();
}
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/expressions/TclExecuteExpression.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/expressions/TclExecuteExpression.java
index 92053c5..8c22236 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/expressions/TclExecuteExpression.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/ast/expressions/TclExecuteExpression.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation 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.dltk.tcl.ast.expressions;
@@ -31,10 +30,12 @@
this.fExecuteContent = content;
}
+ @Override
public int getKind() {
return TclConstants.TCL_EXECUTE_EXPRESSION;
}
+ @Override
public void traverse(ASTVisitor visitor) throws Exception {
if (visitor.visit(this)) {
List statements = this.parseExpression();
@@ -63,8 +64,8 @@
String content = null;
if (this.fExecuteContent.length() >= 2) {
- content = this.fExecuteContent.substring(1, this.fExecuteContent
- .length() - 1);
+ content = this.fExecuteContent.substring(1,
+ this.fExecuteContent.length() - 1);
} else {
return new ArrayList();
}
@@ -72,11 +73,12 @@
ITclSourceParser parser = (ITclSourceParser) DLTKLanguageManager
.getSourceParser(TclNature.NATURE_ID);
parser.setOffset(startFrom);
- ModuleDeclaration module = parser
- .parse(new ModuleSource(content), null);
+ ModuleDeclaration module = parser.parse(new ModuleSource(content),
+ null);
return module.getStatements();
}
+ @Override
public String toString() {
return this.fExecuteContent;
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclCatchStatement.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclCatchStatement.java
index 5dbb934..5b2c48c 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclCatchStatement.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclCatchStatement.java
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.dltk.ast.ASTNode;
import org.eclipse.dltk.ast.ASTVisitor;
import org.eclipse.dltk.ast.statements.Block;
import org.eclipse.dltk.ast.statements.Statement;
@@ -19,6 +20,7 @@
this.variable = variable;
}
+ @Override
public int getKind() {
return 0;
}
@@ -27,6 +29,7 @@
return this.variable;
}
+ @Override
public void traverse(ASTVisitor visitor) throws Exception {
if (visitor.visit(this)) {
if (this.block != null) {
@@ -38,11 +41,11 @@
}
}
- public List getStatements() {
+ public List<ASTNode> getStatements() {
if (this.block != null) {
return this.block.getStatements();
}
- return new ArrayList();
+ return new ArrayList<>();
}
@Override
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclForeachStatement.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclForeachStatement.java
index f0612b6..9fb86c4 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclForeachStatement.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclForeachStatement.java
@@ -18,16 +18,18 @@
super(start, end);
}
+ @Override
public int getKind() {
return S_FOREACH;
}
+ @Override
public void traverse(ASTVisitor visitor) throws Exception {
if (visitor.visit(this)) {
if (this.arguments != null) {
- for (Iterator iterator = this.arguments.iterator(); iterator
- .hasNext();) {
- ASTNode node = (ASTNode) iterator.next();
+ for (Iterator<ASTNode> iterator = this.arguments
+ .iterator(); iterator.hasNext();) {
+ ASTNode node = iterator.next();
node.traverse(visitor);
}
}
@@ -57,9 +59,9 @@
public void printNode(CorePrinter output) {
output.print("foreach ");
if (this.arguments != null) {
- for (Iterator iterator = this.arguments.iterator(); iterator
- .hasNext();) {
- ASTNode node = (ASTNode) iterator.next();
+ for (Iterator<ASTNode> iterator = this.arguments
+ .iterator(); iterator.hasNext();) {
+ ASTNode node = iterator.next();
node.printNode(output);
}
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclSwitchStatement.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclSwitchStatement.java
index 45a05aa..3e98979 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclSwitchStatement.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/core/ast/TclSwitchStatement.java
@@ -4,6 +4,7 @@
import org.eclipse.dltk.ast.ASTVisitor;
import org.eclipse.dltk.ast.statements.Block;
import org.eclipse.dltk.ast.statements.Statement;
+import org.eclipse.dltk.ast.statements.StatementConstants;
public class TclSwitchStatement extends Statement {
@@ -25,10 +26,12 @@
this.fPattern = string;
}
+ @Override
public int getKind() {
- return this.S_SWITCH;
+ return StatementConstants.S_SWITCH;
}
+ @Override
public void traverse(ASTVisitor visitor) throws Exception {
if (visitor.visit(this)) {
if (null != fPattern) {
@@ -48,6 +51,7 @@
public Block getAlternatives() {
return this.fAlternatives;
}
+
public void acceptBlock(Block bl) {
this.fAlternatives = bl;
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/TclCalleeProcessor.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/TclCalleeProcessor.java
index b3e9e4c..3ebdbdb 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/TclCalleeProcessor.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/TclCalleeProcessor.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation 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.dltk.tcl.internal.core;
@@ -50,8 +49,8 @@
// this.scope = scope;
}
- private class CaleeSourceElementRequestor extends
- SourceElementRequestorAdaptor {
+ private class CaleeSourceElementRequestor
+ extends SourceElementRequestorAdaptor {
@Override
public void acceptMethodReference(String methodName, int argCount,
int sourcePosition, int sourceEndPosition) {
@@ -63,14 +62,15 @@
e.printStackTrace();
}
}
- SimpleReference ref = new SimpleReference(off + sourcePosition, off
- + sourceEndPosition, methodName);
- IMethod[] methods = findMethods(methodName, argCount, off
- + sourcePosition);
+ SimpleReference ref = new SimpleReference(off + sourcePosition,
+ off + sourceEndPosition, methodName);
+ IMethod[] methods = findMethods(methodName, argCount,
+ off + sourcePosition);
fSearchResults.put(ref, methods);
}
}
+ @Override
public Map doOperation() {
try {
if (method.getSource() != null) {
@@ -97,7 +97,7 @@
public IMethod[] findMethods(final String methodName, int argCount,
int sourcePosition) {
- final List methods = new ArrayList();
+ final List<IModelElement> methods = new ArrayList<>();
ISourceModule module = this.method.getSourceModule();
try {
IModelElement[] elements = module.codeSelect(sourcePosition,
@@ -164,7 +164,7 @@
// }
// }
// };
- //
+ //
// try {
// String pattern = methodName;
// if( pattern.startsWith("::")) {
@@ -183,7 +183,7 @@
// e.printStackTrace();
// }
- return (IMethod[]) methods.toArray(new IMethod[methods.size()]);
+ return methods.toArray(new IMethod[methods.size()]);
}
protected void search(String patternString, int searchFor, int limitTo,
@@ -203,8 +203,8 @@
SearchPattern pattern = SearchPattern.createPattern(patternString,
searchFor, limitTo, matchRule, scope.getLanguageToolkit());
new SearchEngine().search(pattern,
- new SearchParticipant[] { SearchEngine
- .getDefaultSearchParticipant() }, scope, requestor,
- null);
+ new SearchParticipant[] {
+ SearchEngine.getDefaultSearchParticipant() },
+ scope, requestor, null);
}
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/TclExtensionManager.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/TclExtensionManager.java
index c7482f7..77b8e36 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/TclExtensionManager.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/TclExtensionManager.java
@@ -30,20 +30,19 @@
if (infos == null) {
return new ITclLanguageExtension[0];
}
- List extensions = new ArrayList();
+ List<ITclLanguageExtension> extensions = new ArrayList<>();
for (int i = 0; i < infos.length; i++) {
Object object = manager.getInitObject(infos[i]);
if (object instanceof ITclLanguageExtension) {
- extensions.add(object);
+ extensions.add((ITclLanguageExtension) object);
}
}
- return (ITclLanguageExtension[]) extensions
- .toArray(new ITclLanguageExtension[extensions.size()]);
+ return extensions.toArray(new ITclLanguageExtension[extensions.size()]);
}
public ISourceElementRequestVisitorExtension[] getSourceElementRequestoVisitorExtensions() {
ITclLanguageExtension[] extensions = getExtensions();
- List result = new ArrayList();
+ List<ISourceElementRequestVisitorExtension> result = new ArrayList<>();
for (int i = 0; i < extensions.length; i++) {
ISourceElementRequestVisitorExtension visitorExtension = extensions[i]
.createSourceElementRequestVisitorExtension();
@@ -51,14 +50,13 @@
result.add(visitorExtension);
}
}
- return (ISourceElementRequestVisitorExtension[]) result
- .toArray(new ISourceElementRequestVisitorExtension[result
- .size()]);
+ return result.toArray(
+ new ISourceElementRequestVisitorExtension[result.size()]);
}
public IMixinBuildVisitorExtension[] getMixinVisitorExtensions() {
ITclLanguageExtension[] extensions = getExtensions();
- List result = new ArrayList();
+ List<IMixinBuildVisitorExtension> result = new ArrayList<>();
for (int i = 0; i < extensions.length; i++) {
IMixinBuildVisitorExtension visitorExtension = extensions[i]
.createMixinBuildVisitorExtension();
@@ -66,13 +64,12 @@
result.add(visitorExtension);
}
}
- return (IMixinBuildVisitorExtension[]) result
- .toArray(new IMixinBuildVisitorExtension[result.size()]);
+ return result.toArray(new IMixinBuildVisitorExtension[result.size()]);
}
public IMatchLocatorExtension[] getMatchLocatorExtensions() {
ITclLanguageExtension[] extensions = getExtensions();
- List result = new ArrayList();
+ List<IMatchLocatorExtension> result = new ArrayList<>();
for (int i = 0; i < extensions.length; i++) {
IMatchLocatorExtension visitorExtension = extensions[i]
.createMatchLocatorExtension();
@@ -80,13 +77,12 @@
result.add(visitorExtension);
}
}
- return (IMatchLocatorExtension[]) result
- .toArray(new IMatchLocatorExtension[result.size()]);
+ return result.toArray(new IMatchLocatorExtension[result.size()]);
}
public ICompletionExtension[] getCompletionExtensions() {
ITclLanguageExtension[] extensions = getExtensions();
- List result = new ArrayList();
+ List<ICompletionExtension> result = new ArrayList<>();
for (int i = 0; i < extensions.length; i++) {
ICompletionExtension visitorExtension = extensions[i]
.createCompletionExtension();
@@ -94,13 +90,12 @@
result.add(visitorExtension);
}
}
- return (ICompletionExtension[]) result
- .toArray(new ICompletionExtension[result.size()]);
+ return result.toArray(new ICompletionExtension[result.size()]);
}
public ISelectionExtension[] getSelectionExtensions() {
ITclLanguageExtension[] extensions = getExtensions();
- List result = new ArrayList();
+ List<ISelectionExtension> result = new ArrayList<>();
for (int i = 0; i < extensions.length; i++) {
ISelectionExtension visitorExtension = extensions[i]
.createSelectionExtension();
@@ -108,7 +103,6 @@
result.add(visitorExtension);
}
}
- return (ISelectionExtension[]) result
- .toArray(new ISelectionExtension[result.size()]);
+ return result.toArray(new ISelectionExtension[result.size()]);
}
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclASTUtil.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclASTUtil.java
index 84e9010..5670f7a 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclASTUtil.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclASTUtil.java
@@ -1,11 +1,11 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation 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.dltk.tcl.internal.core.codeassist;
@@ -32,11 +32,11 @@
return ((MethodDeclaration) node).getStatements();
} else if (node instanceof Block) {
return ((Block) node).getStatements();
- }
- else {
+ } else {
final List innerBlockStatements = new ArrayList();
// Lets traverse to see inner blocks.
ASTVisitor visitor = new ASTVisitor() {
+ @Override
public boolean visit(Expression s) throws Exception {
if (s instanceof Block) {
List tStatements = ((Block) s).getStatements();
@@ -45,10 +45,12 @@
return false;
}
+ @Override
public boolean visit(MethodDeclaration s) throws Exception {
return false;
}
+ @Override
public boolean visit(TypeDeclaration s) throws Exception {
return false;
}
@@ -60,7 +62,7 @@
}
return innerBlockStatements;
}
-// return null;
+ // return null;
}
/**
@@ -88,10 +90,10 @@
if (DLTKCore.DEBUG_COMPLETION) {
if (node.sourceEnd() != newValueEnd
|| node.sourceStart() != newValueStart) {
-// System.out.println("Node Extended from:'"
-// + content.substring(node.sourceStart(), node
-// .sourceEnd()) + "'" + "to '"
-// + content.substring(newValueStart, newValueEnd) + "'");
+ // System.out.println("Node Extended from:'"
+ // + content.substring(node.sourceStart(), node
+ // .sourceEnd()) + "'" + "to '"
+ // + content.substring(newValueStart, newValueEnd) + "'");
}
}
node.setStart(newValueStart);
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclAssistParser.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclAssistParser.java
index a730059..a374226 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclAssistParser.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclAssistParser.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation 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.dltk.tcl.internal.core.codeassist;
@@ -41,17 +40,19 @@
this.parser = DLTKLanguageManager.getSourceParser(TclNature.NATURE_ID);
}
+ @Override
public ASTNode getAssistNodeParent() {
return assistNodeParent;
}
- protected void findElementsTo(List statements, ASTNode node, List elements) {
+ protected void findElementsTo(List<ASTNode> statements, ASTNode node,
+ List elements) {
if (statements == null) {
return;
}
- Iterator i = statements.iterator();
+ Iterator<ASTNode> i = statements.iterator();
while (i.hasNext()) {
- ASTNode n = (ASTNode) i.next();
+ ASTNode n = i.next();
if (n.equals(node)) {
elements.add(n);
return;
@@ -73,16 +74,18 @@
this.module = (ModuleDeclaration) astNodeParent;
}
elements.add(this.module);
- findElementsTo(TclASTUtil.getStatements(this.module),
- astNodeParent, elements);
+ findElementsTo(TclASTUtil.getStatements(this.module), astNodeParent,
+ elements);
}
return elements;
}
+ @Override
public void setSource(ModuleDeclaration unit) {
this.module = unit;
}
+ @Override
public ModuleDeclaration parse(IModuleSource sourceUnit) {
module = (ModuleDeclaration) this.parser.parse(sourceUnit, null);
module.rebuild();
@@ -92,6 +95,7 @@
return module;
}
+ @Override
public ModuleDeclaration getModule() {
return this.module;
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclResolver.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclResolver.java
index 10b6bc7..4a93398 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclResolver.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclResolver.java
@@ -38,7 +38,8 @@
private ISourceModule sourceModule;
public TclResolver(ISourceModule sourceModule,
- ModuleDeclaration moduleDeclaration, IResolveElementParent resolver) {
+ ModuleDeclaration moduleDeclaration,
+ IResolveElementParent resolver) {
this(sourceModule, moduleDeclaration);
this.resolver = resolver;
}
@@ -76,8 +77,8 @@
if (node instanceof MethodDeclaration) {
String oName = ((MethodDeclaration) node).getName();
if (oName.indexOf("::") != -1) {
- String pName = oName.substring(0, oName
- .lastIndexOf("::"));
+ String pName = oName.substring(0,
+ oName.lastIndexOf("::"));
pName = pName.replaceAll("::", "\\$");
if (pName.startsWith("$")) {
@@ -85,8 +86,9 @@
element = sourceModule;
} else {
try {
- element = findTypeFrom(sourceModule
- .getChildren(), "", pName, '$');
+ element = findTypeFrom(
+ sourceModule.getChildren(), "",
+ pName, '$');
} catch (ModelException e) {
if (DLTKCore.DEBUG) {
e.printStackTrace();
@@ -141,9 +143,10 @@
IModelElement e = findChildrenByName(typeName, element);
if (e == null && type.getName().startsWith("::")) {
try {
- e = (IModelElement) findTypeFrom(sourceModule
- .getChildren(), "", type.getName()
- .replaceAll("::", "\\$"), '$');
+ e = (IModelElement) findTypeFrom(
+ sourceModule.getChildren(), "",
+ type.getName().replaceAll("::", "\\$"),
+ '$');
} catch (ModelException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
@@ -158,12 +161,12 @@
} else if (nde instanceof MethodDeclaration) {
searchInMethod(node, element, nde, selectionElements);
} /*
- * else if (nde instanceof TclStatement) { TclStatement s =
- * (TclStatement) nde; Expression commandId = s.getAt(0); final
- * IParent e = element; if (commandId != null && commandId
- * instanceof SimpleReference) { String qname =
- * ((SimpleReference) commandId) .getName(); } }
- */
+ * else if (nde instanceof TclStatement) { TclStatement s =
+ * (TclStatement) nde; Expression commandId = s.getAt(0);
+ * final IParent e = element; if (commandId != null &&
+ * commandId instanceof SimpleReference) { String qname =
+ * ((SimpleReference) commandId) .getName(); } }
+ */
else {
final IParent e = element;
List statements2 = findExtractBlocks(nde);
@@ -275,20 +278,20 @@
return null;
}
- public void searchInMethod(final ASTNode node, IParent element,
- ASTNode nde, List selectionElements) {
+ public void searchInMethod(final ASTNode node, IParent element, ASTNode nde,
+ List selectionElements) {
MethodDeclaration method = (MethodDeclaration) nde;
String methodName = method.getName();
if (methodName.indexOf("::") != -1) {
- String pName = methodName
- .substring(0, methodName.lastIndexOf("::"));
+ String pName = methodName.substring(0,
+ methodName.lastIndexOf("::"));
pName = pName.replaceAll("::", "\\$");
if (pName.equals("$")) {
element = sourceModule;
} else {
try {
- element = TclResolver.findTypeFrom(sourceModule
- .getChildren(), "", pName, '$');
+ element = TclResolver.findTypeFrom(
+ sourceModule.getChildren(), "", pName, '$');
if (element == null) {
return;
}
@@ -309,8 +312,8 @@
element = sourceModule;
} else {
try {
- element = TclResolver.findTypeFrom(sourceModule
- .getChildren(), "", pName, '$');
+ element = TclResolver.findTypeFrom(
+ sourceModule.getChildren(), "", pName, '$');
if (element == null) {
return;
}
@@ -322,8 +325,7 @@
methodName = TclResolver.getNodeChildName(nde);
}
}
- IModelElement e = TclResolver.findChildrenByName(methodName,
- (IParent) element);
+ IModelElement e = TclResolver.findChildrenByName(methodName, element);
if (e != null && e instanceof IParent) {
List stats = ((MethodDeclaration) nde).getStatements();
searchAddElementsTo(stats, node, (IParent) e, selectionElements);
@@ -333,6 +335,7 @@
public static List findExtractBlocks(ASTNode node) {
final List statements2 = new ArrayList();
ASTVisitor visitor = new ASTVisitor() {
+ @Override
public boolean visit(Expression s) throws Exception {
if (s instanceof Block) {
statements2.addAll(((Block) s).getStatements());
@@ -424,7 +427,7 @@
/**
* Filter similar elements with "package require in current module"
- *
+ *
* @param elements
* @return
*/
@@ -439,8 +442,8 @@
// Obtain duplicate named elements
for (int i = 0; i < elements.length; i++) {
IModelElement element = elements[i];
- String fullyQualifiedName = TclParseUtil.getFQNFromModelElement(
- element, "::");
+ String fullyQualifiedName = TclParseUtil
+ .getFQNFromModelElement(element, "::");
if (similars.containsKey(fullyQualifiedName)) {
List similar = (List) similars.get(fullyQualifiedName);
similar.add(element);
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclSelectionEngine.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclSelectionEngine.java
index fdec013..16fec37 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclSelectionEngine.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/TclSelectionEngine.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation 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.dltk.tcl.internal.core.codeassist;
@@ -63,7 +62,7 @@
protected int actualSelectionEnd;
- protected List<IModelElement> selectionElements = new ArrayList<IModelElement>();
+ protected List<IModelElement> selectionElements = new ArrayList<>();
protected AssistParser parser = new AssistParser(new TclSelectionParser());
@@ -81,6 +80,7 @@
.getSelectionExtensions();
}
+ @Override
public IModelElement[] select(IModuleSource sourceUnit,
int selectionSourceStart, int selectionSourceEnd) {
sourceModule = (org.eclipse.dltk.core.ISourceModule) sourceUnit
@@ -98,7 +98,8 @@
System.out.println(content);
}
- if (!checkSelection(content, selectionSourceStart, selectionSourceEnd)) {
+ if (!checkSelection(content, selectionSourceStart,
+ selectionSourceEnd)) {
return new IModelElement[0];
}
@@ -110,8 +111,7 @@
}
try {
- ModuleDeclaration parsedUnit = (ModuleDeclaration) this.parser
- .parse(sourceUnit);
+ ModuleDeclaration parsedUnit = this.parser.parse(sourceUnit);
packageCollector = new TclBuildPathPackageCollector();
try {
parsedUnit.traverse(packageCollector);
@@ -137,8 +137,8 @@
System.out.println(e.getNode().toString());
if (this.parser.getAssistNodeParent() != null) {
System.out.print("COMPLETION - Parent Node : "); //$NON-NLS-1$
- System.out.println(this.parser
- .getAssistNodeParent());
+ System.out.println(
+ this.parser.getAssistNodeParent());
}
}
// if null then we found a problem in the completion
@@ -155,7 +155,7 @@
}
}
- return (IModelElement[]) selectionElements
+ return selectionElements
.toArray(new IModelElement[selectionElements.size()]);
}
@@ -225,8 +225,8 @@
}
} else if (astNode instanceof SelectionOnVariable) {
SelectionOnVariable completion = (SelectionOnVariable) astNode;
- findVariables(completion.getName(), astNodeParent, astNode
- .sourceStart());
+ findVariables(completion.getName(), astNodeParent,
+ astNode.sourceStart());
} else if (astNode instanceof SelectionOnAST) {
ASTNode node = ((SelectionOnAST) astNode).getNode();
for (int i = 0; i < this.extensions.length; i++) {
@@ -245,8 +245,8 @@
private void selectNamespaceImport(String name, String currentNamespace,
Set processed) {
String pattern = "@" + currentNamespace + "|*";
- String[] findKeys = TclMixinModel.getInstance().getMixin(
- getScriptProject()).findKeys(pattern);
+ String[] findKeys = TclMixinModel.getInstance()
+ .getMixin(getScriptProject()).findKeys(pattern);
Set keys = new HashSet();
for (int i = 0; i < findKeys.length; i++) {
if (keys.add(findKeys[i])) {
@@ -254,8 +254,9 @@
.parseKey(findKeys[i]);
if (importSt.getNamespace().equals(currentNamespace)) {
if (processed.add(importSt.getImportNsName())) {
- findMethodFromMixinNS(importSt.getImportNsName() + "::"
- + name, importSt.getImportNsName());
+ findMethodFromMixinNS(
+ importSt.getImportNsName() + "::" + name,
+ importSt.getImportNsName());
}
}
}
@@ -297,8 +298,8 @@
MethodDeclaration method = (MethodDeclaration) iterator.next();
if (method.getName().equals(callName.toString())) {
- IModelElement methodElement = TclResolver.findChildrenByName(
- method.getName(), (IParent) parent);
+ IModelElement methodElement = TclResolver
+ .findChildrenByName(method.getName(), (IParent) parent);
addSelectionElement(methodElement);
return true;
}
@@ -324,12 +325,13 @@
}
}
- protected void findVariables(String name, ASTNode parent, int beforePosition) {
+ protected void findVariables(String name, ASTNode parent,
+ int beforePosition) {
String originalName = name;
for (int i = 0; i < this.extensions.length; i++) {
- this.extensions[i]
- .findVariables(name, parent, beforePosition, this);
+ this.extensions[i].findVariables(name, parent, beforePosition,
+ this);
if (this.selectionElements.size() > 0) {
return;
}
@@ -351,8 +353,8 @@
checkVariableStatements(name, beforePosition, statements, "");
} else if (parent instanceof ModuleDeclaration) {
ModuleDeclaration module = (ModuleDeclaration) parent;
- checkVariableStatements(name, beforePosition, module
- .getStatements(), "");
+ checkVariableStatements(name, beforePosition,
+ module.getStatements(), "");
} else if (parent instanceof TypeDeclaration) {
TypeDeclaration type = (TypeDeclaration) parent;
checkVariableStatements(name, beforePosition, type.getStatements(),
@@ -386,8 +388,8 @@
type = this.sourceModule;
}
if (type != null && type instanceof IParent) {
- IModelElement field = TclResolver.findChildrenByName(
- varName, (IParent) type);
+ IModelElement field = TclResolver
+ .findChildrenByName(varName, (IParent) type);
if (field != null) {
addSelectionElement(field);
}
@@ -432,8 +434,9 @@
List levels = TclParseUtil.findLevelsTo(this.parser.getModule(),
parent);
String keyFromLevels = getKeyFromLevels(levels);
- findFieldMixin(keyFromLevels + IMixinRequestor.MIXIN_NAME_SEPARATOR
- + name, name);
+ findFieldMixin(
+ keyFromLevels + IMixinRequestor.MIXIN_NAME_SEPARATOR + name,
+ name);
}
}
@@ -443,12 +446,13 @@
}
protected void findFieldMixin(String pattern, String name) {
- IMixinElement[] find = TclMixinModel.getInstance().getMixin(
- this.sourceModule.getScriptProject()).find(pattern);
+ IMixinElement[] find = TclMixinModel.getInstance()
+ .getMixin(this.sourceModule.getScriptProject()).find(pattern);
for (int i = 0; i < find.length; i++) {
Object[] allObjects = find[i].getAllObjects();
for (int j = 0; j < allObjects.length; j++) {
- if (allObjects[j] != null && allObjects[j] instanceof TclField) {
+ if (allObjects[j] != null
+ && allObjects[j] instanceof TclField) {
TclField field = (TclField) allObjects[j];
if (name.equals(field.getName())) {
addSelectionElement(field.getModelElement());
@@ -460,9 +464,9 @@
}
public void findMethodMixin(String pattern, String name) {
- IMixinElement[] find = TclMixinModel.getInstance().getMixin(
- this.sourceModule.getScriptProject()).find(pattern);
- List selections = new ArrayList();
+ IMixinElement[] find = TclMixinModel.getInstance()
+ .getMixin(this.sourceModule.getScriptProject()).find(pattern);
+ List<IModelElement> selections = new ArrayList<>();
for (int i = 0; i < find.length; i++) {
Object[] allObjects = find[i].getAllObjects();
for (int j = 0; j < allObjects.length; j++) {
@@ -477,23 +481,23 @@
}
}
IModelElement result[] = TclResolver.complexFilter(
- (IModelElement[]) selections
- .toArray(new IModelElement[selections.size()]), this
- .getScriptProject(), this.packageCollector, true);
+ selections.toArray(new IModelElement[selections.size()]),
+ this.getScriptProject(), this.packageCollector, true);
for (int i = 0; i < result.length; i++) {
addSelectionElement(result[i]);
}
}
- public void findMethodMixinNS(String pattern, String name, String namespace) {
+ public void findMethodMixinNS(String pattern, String name,
+ String namespace) {
if (!namespace.startsWith("::")) {
namespace = "::" + namespace;
}
if (!namespace.endsWith("::")) {
namespace = namespace + "::";
}
- IMixinElement[] find = TclMixinModel.getInstance().getMixin(
- this.sourceModule.getScriptProject()).find(pattern);
+ IMixinElement[] find = TclMixinModel.getInstance()
+ .getMixin(this.sourceModule.getScriptProject()).find(pattern);
for (int i = 0; i < find.length; i++) {
Object[] allObjects = find[i].getAllObjects();
for (int j = 0; j < allObjects.length; j++) {
@@ -502,8 +506,8 @@
if (name.equals(field.getName())) {
IModelElement element = field.getModelElement();
- String fqn = TclParseUtil.getFQNFromModelElement(
- element, "::");
+ String fqn = TclParseUtil
+ .getFQNFromModelElement(element, "::");
if (fqn.startsWith(namespace)) {
String substring = fqn
.substring(namespace.length());
@@ -563,8 +567,8 @@
}
// TODO: Possible bug with adding to global namespace from
// inner namespace.
- checkVariableStatements(name, beforePosition, type
- .getStatements(), prefix + nn + "::");
+ checkVariableStatements(name, beforePosition,
+ type.getStatements(), prefix + nn + "::");
// checkVariableStatements(name, beforePosition, type
// .getStatements(), "");
}
@@ -601,8 +605,8 @@
}
protected void findLocalFunctions(String name, ASTNode parent) {
- List levels = TclParseUtil
- .findLevelsTo(this.parser.getModule(), parent);
+ List levels = TclParseUtil.findLevelsTo(this.parser.getModule(),
+ parent);
int len = levels.size();
ASTNode realParent = findRealParent(levels);
// At first search for namespace function
@@ -617,7 +621,8 @@
processFindLocalFunctions(name, levels, len);
}
- protected void processFindLocalFunctions(String name, List levels, int len) {
+ protected void processFindLocalFunctions(String name, List levels,
+ int len) {
List visited = new ArrayList();
for (int j = 0; j < len; ++j) {
ASTNode astNodeParent = (ASTNode) levels.get(len - 1 - j);
@@ -633,8 +638,8 @@
processMethods(name, statements, "", visited);
if (!name.startsWith("::")) {
- processMethods(decl.getName() + "::" + name,
- statements, "", visited);
+ processMethods(decl.getName() + "::" + name, statements,
+ "", visited);
}
if (selectionElements.size() > 0) {
return;
@@ -680,21 +685,23 @@
return;
}
}
- } else if (nde instanceof TypeDeclaration && !visited.contains(nde)) {
+ } else if (nde instanceof TypeDeclaration
+ && !visited.contains(nde)) {
List tStatements = ((TypeDeclaration) nde).getStatements();
visited.add(nde);
String ndeName = ((TypeDeclaration) nde).getName();
if (ndeName.startsWith("::")) {
processMethods(name, tStatements, ndeName + "::", visited);
} else {
- processMethods(name, tStatements, namePrefix + ndeName
- + "::", visited);
+ processMethods(name, tStatements,
+ namePrefix + ndeName + "::", visited);
}
} else {
// We need to visit blocked expressions to one level.
final String fname = name;
ASTVisitor visitor = new ASTVisitor() {
+ @Override
public boolean visit(Expression s) throws Exception {
if (s instanceof Block) {
List tStatements = ((Block) s).getStatements();
@@ -705,10 +712,12 @@
return false;
}
+ @Override
public boolean visit(MethodDeclaration s) throws Exception {
return false;
}
+ @Override
public boolean visit(TypeDeclaration s) throws Exception {
return false;
}
@@ -737,7 +746,7 @@
public IModelElement findElementFromNode(ASTNode nde) {
ModuleDeclaration module = parser.getModule();
List statements = module.getStatements();
- List<IModelElement> elements = new ArrayList<IModelElement>();
+ List<IModelElement> elements = new ArrayList<>();
new TclResolver(sourceModule, parser.getModule(), parentResolver)
.searchAddElementsTo(statements, nde, sourceModule, elements);
if (elements.size() == 1) {
@@ -746,13 +755,9 @@
return null;
}
- IResolveElementParent parentResolver = new IResolveElementParent() {
- public IModelElement findElementParent(ASTNode node, String name,
- IParent parent) {
- return TclSelectionEngine.this
- .findElementParent(node, name, parent);
- }
- };
+ IResolveElementParent parentResolver = (node, name,
+ parent) -> TclSelectionEngine.this.findElementParent(node, name,
+ parent);
protected IModelElement findElementParent(ASTNode node, String name,
IParent parent) {
@@ -852,9 +857,8 @@
}
}
// If contain tabs or spaces, then from start.
- if (!isVariable
- && (sub.indexOf(' ') != -1 || sub.indexOf('\t') != -1 || sub
- .indexOf('\n') != -1)) {
+ if (!isVariable && (sub.indexOf(' ') != -1 || sub.indexOf('\t') != -1
+ || sub.indexOf('\n') != -1)) {
if (cheat)
return checkSelection(source, selectionSourceEnd - 1,
selectionSourceEnd - 1);
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/completion/TclCompletionParser.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/completion/TclCompletionParser.java
index 7c2811d..429f3ae 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/completion/TclCompletionParser.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/core/codeassist/completion/TclCompletionParser.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation 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.dltk.tcl.internal.core.codeassist.completion;
@@ -51,6 +50,7 @@
/**
* Called then element could not be found.
*/
+ @Override
public void handleNotInElement(ASTNode node, int position) {
if (node != null && node.sourceStart() <= position
&& position <= node.sourceEnd()) {
@@ -93,16 +93,18 @@
}
}
- public void parseBlockStatements(ASTNode node, ASTNode inNode, int position) {
+ @Override
+ public void parseBlockStatements(ASTNode node, ASTNode inNode,
+ int position) {
if (node instanceof TclStatement) {
TclStatement statement = (TclStatement) node;
- List expressions = statement.getExpressions();
+ List<ASTNode> expressions = statement.getExpressions();
int len = expressions.size();
boolean first = false;
String completionToken = null;
ASTNode completionNode = null;
for (int i = 0; i < len; ++i) {
- ASTNode n = (ASTNode) expressions.get(i);
+ ASTNode n = expressions.get(i);
if (n.sourceStart() <= position && n.sourceEnd() >= position
|| (node instanceof TclEmptyCompleteStatement)) {
if (i == 0) {
@@ -131,10 +133,10 @@
ASTNode nde = new CompletionOnKeywordArgumentOrFunctionArgument(
"", (TclStatement) node, keywords, position);
this.assistNodeParent = inNode;
- throw new CompletionNodeFound(nde, null/*
- * ((TypeDeclaration)
- * inNode).scope
- */);
+ throw new CompletionNodeFound(nde,
+ null/*
+ * ((TypeDeclaration) inNode).scope
+ */);
} else {
completionToken = "";
@@ -150,8 +152,9 @@
if (completionNode instanceof StringLiteral) {
int maxLen = position - completionNode.sourceStart();
int pos = maxLen;
- SimpleReference tok = OldTclParserUtils.extractVariableFromString(
- (StringLiteral) completionNode, pos);
+ SimpleReference tok = OldTclParserUtils
+ .extractVariableFromString(
+ (StringLiteral) completionNode, pos);
if (tok != null) {
this.assistNodeParent = inNode;
ASTNode nde = new CompletionOnVariable(tok.getName(), tok,
@@ -229,10 +232,11 @@
((ModuleDeclaration) inNode).scope);
} else if (inNode instanceof MethodDeclaration
&& completionNode != null && first) {
- String[] keywords = checkKeywords(completionToken, FUNCTION);
+ String[] keywords = checkKeywords(completionToken,
+ FUNCTION);
ASTNode nde = new CompletionOnKeywordOrFunction(
- completionToken, completionNode, TclParseUtil
- .getScopeParent(getModule(), node),
+ completionToken, completionNode,
+ TclParseUtil.getScopeParent(getModule(), node),
keywords);
this.assistNodeParent = inNode;
throw new CompletionNodeFound(nde,
@@ -244,10 +248,10 @@
ASTNode nde = new CompletionOnKeywordOrFunction(
completionToken, completionNode, node, keywords);
this.assistNodeParent = inNode;
- throw new CompletionNodeFound(nde, null/*
- * ((TypeDeclaration)
- * inNode).scope
- */);
+ throw new CompletionNodeFound(nde,
+ null/*
+ * ((TypeDeclaration) inNode).scope
+ */);
} else if (inNode instanceof TclExecuteExpression
&& completionNode != null && first) {
String[] keywords = checkKeywords(completionToken,
@@ -255,10 +259,10 @@
ASTNode nde = new CompletionOnKeywordOrFunction(
completionToken, completionNode, node, keywords);
this.assistNodeParent = inNode;
- throw new CompletionNodeFound(nde, null/*
- * ((TypeDeclaration)
- * inNode).scope
- */);
+ throw new CompletionNodeFound(nde,
+ null/*
+ * ((TypeDeclaration) inNode).scope
+ */);
} else {
if (completionNode != null) {
String[] keywords = checkKeywords(completionToken,
@@ -268,11 +272,10 @@
completionToken, completionNode,
(TclStatement) node, keywords);
this.assistNodeParent = inNode;
- throw new CompletionNodeFound(nde, null/*
- * ((TypeDeclaration
- * )
- * inNode).scope
- */);
+ throw new CompletionNodeFound(nde,
+ null/*
+ * ((TypeDeclaration ) inNode).scope
+ */);
} else {
String[] keywords = checkKeywords(completionToken,
MODULE);
@@ -283,11 +286,10 @@
completionToken, (TclStatement) node, keywords,
position);
this.assistNodeParent = inNode;
- throw new CompletionNodeFound(nde, null/*
- * ((TypeDeclaration
- * )
- * inNode).scope
- */);
+ throw new CompletionNodeFound(nde,
+ null/*
+ * ((TypeDeclaration ) inNode).scope
+ */);
}
}
}
@@ -334,6 +336,7 @@
this.module = module;
}
+ @Override
public boolean visit(Statement s) throws Exception {
if (s.sourceStart() <= position && s.sourceEnd() >= position) {
for (int i = 0; i < extensions.length; i++) {
@@ -350,17 +353,17 @@
&& position <= decl.getNameEnd()) {
ASTNode inNode = TclParseUtil.getScopeParent(module, s);
assistNodeParent = inNode;
- throw new CompletionNodeFound(decl, null/*
- * ((TypeDeclaration
- * )
- * inNode).scope
- */);
+ throw new CompletionNodeFound(decl,
+ null/*
+ * ((TypeDeclaration ) inNode).scope
+ */);
}
}
}
return super.visit(s);
}
+ @Override
public boolean visit(Expression s) throws Exception {
if (s.sourceStart() <= position && s.sourceEnd() >= position) {
if (s instanceof TclBlockExpression) {
@@ -385,6 +388,7 @@
return super.visit(s);
}
+ @Override
public boolean endvisit(Expression s) throws Exception {
if (s instanceof Block && s.sourceStart() <= position
&& s.sourceEnd() >= position) {
@@ -417,8 +421,8 @@
}
}
- private boolean checkVariableWithoutDollarCompletion(
- TclStatement statement, int position) {
+ private boolean checkVariableWithoutDollarCompletion(TclStatement statement,
+ int position) {
// TODO: Add more compecated check.
Expression e = statement.getAt(0);
if (e instanceof SimpleReference) {
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/OldTclParserUtils.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/OldTclParserUtils.java
index 86f2639..3d56489 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/OldTclParserUtils.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/OldTclParserUtils.java
@@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
-
+
*******************************************************************************/
package org.eclipse.dltk.tcl.internal.parser;
@@ -57,13 +57,15 @@
ASTNode node = (ASTNode) elements.get(0);
Expression initializer = null;
if (elements.size() > 1) {
- if (elements.get(1) instanceof Expression) {
+ if (elements
+ .get(1) instanceof Expression) {
initializer = (Expression) elements
.get(1);
}
}
if (node instanceof TclStatement
- && ((TclStatement) node).getCount() > 0) {
+ && ((TclStatement) node)
+ .getCount() > 0) {
TclStatement stat = ((TclStatement) node);
node = stat.getAt(0);
if (stat.getCount() > 1) {
@@ -73,8 +75,8 @@
if (node instanceof SimpleReference) {
Argument a = new Argument();
a.set((SimpleReference) node, null);
- a
- .setInitializationExpression(initializer);
+ a.setInitializationExpression(
+ initializer);
arguments.add(a);
} else if (node instanceof TclBlockExpression) {
String name = ((TclBlockExpression) node)
@@ -83,10 +85,10 @@
Argument a = new Argument();
a.setStart(node.sourceStart() + 1);
a.setEnd(node.sourceEnd() + 1);
- a.setArgumentName(nameFromBlock(name,
- '{', '}'));
- a
- .setInitializationExpression(initializer);
+ a.setArgumentName(
+ nameFromBlock(name, '{', '}'));
+ a.setInitializationExpression(
+ initializer);
arguments.add(a);
} else if (node instanceof StringLiteral) {
String name = ((StringLiteral) node)
@@ -95,10 +97,10 @@
Argument a = new Argument();
a.setStart(node.sourceStart() + 1);
a.setEnd(node.sourceEnd() + 1);
- a.setArgumentName(nameFromBlock(name,
- '"', '"'));
- a
- .setInitializationExpression(initializer);
+ a.setArgumentName(
+ nameFromBlock(name, '"', '"'));
+ a.setInitializationExpression(
+ initializer);
arguments.add(a);
} else if (node instanceof TclExecuteExpression) {
String name = ((TclExecuteExpression) node)
@@ -108,8 +110,8 @@
a.setStart(node.sourceStart() + 1);
a.setEnd(node.sourceEnd() + 1);
a.setArgumentName(name);
- a
- .setInitializationExpression(initializer);
+ a.setInitializationExpression(
+ initializer);
arguments.add(a);
}
}
@@ -176,7 +178,7 @@
return null;
}
- List names = new ArrayList();
+ List<String> names = new ArrayList<>();
for (int k = 0; k < variableName.size(); ++k) {
if (variableName.get(k) instanceof SimpleReference) {
@@ -203,7 +205,7 @@
if (names.size() == 0) {
return null;
}
- return (String[]) names.toArray(new String[names.size()]);
+ return names.toArray(new String[names.size()]);
}
public static String returnVariableCheck(TclStatement s, int position) {
@@ -248,8 +250,8 @@
public static SimpleReference extractVariableFromString(
StringLiteral literal, int pos) {
String content = nameFromBlock(literal.getValue(), '"', '"');
- return extractVariableFromString(literal.sourceStart(), literal
- .sourceEnd(), pos, content);
+ return extractVariableFromString(literal.sourceStart(),
+ literal.sourceEnd(), pos, content);
}
public static SimpleReference extractVariableFromString(int start, int end,
@@ -259,8 +261,8 @@
if (index != -1 && index < position) {
String sub = content.substring(index, position);
if (sub.indexOf(' ') == -1) {
- return new SimpleReference(start + index + 1, end + index + 1
- + sub.length(), sub);
+ return new SimpleReference(start + index + 1,
+ end + index + 1 + sub.length(), sub);
}
}
return null;
@@ -288,7 +290,8 @@
start = 0;
}
if (start + 1 < content.length()
- && (content.charAt(start) == '$' && content.charAt(start + 1) == '{')
+ && (content.charAt(start) == '$'
+ && content.charAt(start + 1) == '{')
|| (start < content.length() && content.charAt(start) == '{')) {
while (content.charAt(end) != '}' && content.charAt(end) != '\\'
&& end < content.length())
@@ -456,7 +459,7 @@
public static FieldDeclaration[] returnVariableDeclarations(
TclStatement statement) {
- List fields = new ArrayList();
+ List<FieldDeclaration> fields = new ArrayList<>();
String[] vars = OldTclParserUtils.returnVariable(statement);
if (vars != null) {
@@ -478,8 +481,7 @@
nEnd));
}
}
- return (FieldDeclaration[]) fields.toArray(new FieldDeclaration[fields
- .size()]);
+ return fields.toArray(new FieldDeclaration[fields.size()]);
}
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/TclASTBuilder.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/TclASTBuilder.java
index 608483e..6349776 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/TclASTBuilder.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/TclASTBuilder.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation 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.dltk.tcl.internal.parser;
@@ -20,9 +19,9 @@
import org.eclipse.dltk.tcl.core.TclParseUtil;
/**
- *
+ *
* @author haiodo
- *
+ *
*/
public class TclASTBuilder {
public static final int TYPE_MODULE = 0;
@@ -81,8 +80,8 @@
name = name.replaceAll("(::)+", "::");
String[] split = TclParseUtil.tclSplit(name);
methodDeclaration.setName(split[split.length - 1]);
- TypeDeclaration type = searchCreateTypeDeclaration(
- unit, split, method, 0);
+ TypeDeclaration type = searchCreateTypeDeclaration(unit,
+ split, method, 0);
if (type != null) {
unit.getStatements().remove(methodDeclaration);
unit.getFunctionList().remove(methodDeclaration);
@@ -96,8 +95,8 @@
}
private static TypeDeclaration searchCreateTypeDeclaration(
- TclModuleDeclaration unit, String[] split,
- MethodDeclaration method, int offset) {
+ TclModuleDeclaration unit, String[] split, MethodDeclaration method,
+ int offset) {
if (split.length - 1 <= offset) {
return null;
}
@@ -110,9 +109,9 @@
}
}
// not found, lets create one new.
- TypeDeclaration decl = new TypeDeclaration(typeName, method
- .getNameStart(), method.getNameEnd(), method.sourceStart(),
- method.sourceEnd());
+ TypeDeclaration decl = new TypeDeclaration(typeName,
+ method.getNameStart(), method.getNameEnd(),
+ method.sourceStart(), method.sourceEnd());
unit.addStatement(decl);
unit.getTypeList().add(decl);
return searchCreateTypeDeclaration(decl, split, method, offset + 1);
@@ -133,9 +132,9 @@
}
}
// not found, lets create one new.
- TypeDeclaration decl = new TypeDeclaration(typeName, method
- .getNameStart(), method.getNameEnd(), method.sourceStart(),
- method.sourceEnd());
+ TypeDeclaration decl = new TypeDeclaration(typeName,
+ method.getNameStart(), method.getNameEnd(),
+ method.sourceStart(), method.sourceEnd());
typeDeclaration.getStatements().add(decl);
typeDeclaration.getTypeList().add(decl);
return searchCreateTypeDeclaration(decl, split, method, offset + 1);
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/ext/CommandManager.java b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/ext/CommandManager.java
index 914e0f0..06570cc 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/ext/CommandManager.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.core/src/org/eclipse/dltk/tcl/internal/parser/ext/CommandManager.java
@@ -18,8 +18,8 @@
+ ".tclCommandDetector";
private static final String CLASS_ATTR = "class";
- private static class SimpleExtensionManager extends
- PriorityDLTKExtensionManager {
+ private static class SimpleExtensionManager
+ extends PriorityDLTKExtensionManager {
public SimpleExtensionManager(String extensionPoint) {
super(extensionPoint, ID_ATTR);
}
@@ -27,7 +27,7 @@
public Object getInitObject(ElementInfo ext) {
try {
if (ext != null) {
- IConfigurationElement cfg = (IConfigurationElement) ext.config;
+ IConfigurationElement cfg = ext.config;
return createObject(cfg);
}
} catch (CoreException e) {