diff options
-rw-r--r-- | src/core/lombok/eclipse/EclipseAST.java | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/core/lombok/eclipse/EclipseAST.java b/src/core/lombok/eclipse/EclipseAST.java index 14d5726a..2e11d5e1 100644 --- a/src/core/lombok/eclipse/EclipseAST.java +++ b/src/core/lombok/eclipse/EclipseAST.java @@ -28,17 +28,13 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import lombok.Lombok; import lombok.core.AST; import lombok.core.LombokImmutableList; -import org.eclipse.core.internal.resources.Project; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.internal.compiler.CompilationResult; import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; @@ -52,8 +48,6 @@ import org.eclipse.jdt.internal.compiler.ast.Initializer; import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; import org.eclipse.jdt.internal.compiler.ast.Statement; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; -import org.eclipse.jdt.internal.core.JavaElement; -import org.eclipse.jdt.internal.core.JavaProject; /** * Wraps around Eclipse's internal AST view to add useful features as well as the ability to visit parents from children, @@ -190,37 +184,6 @@ public class EclipseAST extends AST<EclipseAST, EclipseNode, ASTNode> { return ast.compilationResult.fileName == null ? null : new String(ast.compilationResult.fileName); } - private static final Pattern PROJECT_NAME_FROM_FILEPATH = Pattern.compile("^/([^/]+)/(.*)$"); - - /** - * Returns the JavaProject object (eclipse's abstraction of the project) associated with the source file that is represented by this AST. - */ - public JavaProject getProject() { - CompilationUnitDeclaration cud = (CompilationUnitDeclaration) top().get(); - - if (cud.compilationResult().getCompilationUnit() instanceof JavaElement) { - JavaElement icu = (JavaElement) cud.compilationResult.compilationUnit; - return (JavaProject) icu.getJavaProject(); - } - - char[] fn = cud.compilationResult().getFileName(); - - Matcher m = PROJECT_NAME_FROM_FILEPATH.matcher(new String(fn)); - if (m.matches()) { - String projName = m.group(1); - return getProject0(projName); - } - - return null; - } - - private static JavaProject getProject0(String projectName) { - Project depProjWrapper = (Project) ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - if (depProjWrapper == null) return null; - if (!JavaProject.hasJavaNature(depProjWrapper)) return null; - return (JavaProject) JavaCore.create(depProjWrapper); - } - /** * Call this method to move an EclipseAST generated for a diet parse to rebuild itself for the full parse - * with filled in method bodies and such. Also propagates problems and errors, which in diet parse |