diff --git a/java/debugger/openapi/src/com/intellij/debugger/engine/TopLevelParentClassProvider.java b/java/debugger/openapi/src/com/intellij/debugger/engine/TopLevelParentClassProvider.java deleted file mode 100644 index 782bf3452e2e..000000000000 --- a/java/debugger/openapi/src/com/intellij/debugger/engine/TopLevelParentClassProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.debugger.engine; - -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.psi.PsiClass; -import com.intellij.psi.util.PsiTreeUtil; -import org.jetbrains.annotations.Nullable; - -/** - * @author Max Medvedev - */ -public abstract class TopLevelParentClassProvider { - private static final ExtensionPointName EP_NAME = - ExtensionPointName.create("com.intellij.topLevelClassProvider"); - - public static PsiClass getTopLevelParentClass(PsiClass psiClass) { - for (TopLevelParentClassProvider provider : EP_NAME.getExtensions()) { - final PsiClass custom = provider.getCustomTopLevelParentClass(psiClass); - if (custom != null) return custom; - } - - PsiClass enclosing = PsiTreeUtil.getParentOfType(psiClass, PsiClass.class, true); - while (enclosing != null) { - psiClass = enclosing; - enclosing = PsiTreeUtil.getParentOfType(enclosing, PsiClass.class, true); - } - return psiClass; - } - - @Nullable - protected abstract PsiClass getCustomTopLevelParentClass(PsiClass psiClass); - -} diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml index 12ecbda88d22..2141b63c15c3 100644 --- a/plugins/groovy/src/META-INF/plugin.xml +++ b/plugins/groovy/src/META-INF/plugin.xml @@ -393,8 +393,6 @@ - - diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyPositionManager.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyPositionManager.java index 8fa991357579..d7c6ab54ccd1 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyPositionManager.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyPositionManager.java @@ -53,7 +53,6 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefini import org.jetbrains.plugins.groovy.lang.stubs.GroovyShortNamesCache; import java.util.ArrayList; -import java.util.Collections; import java.util.List; public class GroovyPositionManager implements PositionManager { @@ -94,13 +93,16 @@ public class GroovyPositionManager implements PositionManager { } @Nullable - private static GrTypeDefinition findEnclosingTypeDefinition(SourcePosition position) { + private static PsiClass findEnclosingTypeDefinition(SourcePosition position) { PsiFile file = position.getFile(); if (!(file instanceof GroovyFileBase)) return null; PsiElement element = file.findElementAt(position.getOffset()); while (true) { - element = PsiTreeUtil.getParentOfType(element, GrTypeDefinition.class); - if (element == null || !((GrTypeDefinition)element).isAnonymous()) { + element = PsiTreeUtil.getParentOfType(element, GrTypeDefinition.class, GroovyFileBase.class); + if (element instanceof GroovyFileBase) { + return ((GroovyFileBase)element).getScriptClass(); + } + else if (element instanceof GrTypeDefinition && !((GrTypeDefinition)element).isAnonymous()) { return (GrTypeDefinition)element; } } @@ -132,7 +134,7 @@ public class GroovyPositionManager implements PositionManager { AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock(); try { - GrTypeDefinition typeDefinition = findEnclosingTypeDefinition(position); + PsiClass typeDefinition = findEnclosingTypeDefinition(position); if (typeDefinition != null) { return getClassNameForJvm(typeDefinition); } @@ -284,7 +286,7 @@ public class GroovyPositionManager implements PositionManager { } else { String enclosingName = findEnclosingName(position); - if (enclosingName == null) return Collections.emptyList(); + if (enclosingName == null) return null; final List outers = myDebugProcess.getVirtualMachineProxy().classesByName(enclosingName); final List result = new ArrayList(outers.size()); @@ -296,11 +298,11 @@ public class GroovyPositionManager implements PositionManager { } return result; } - return Collections.emptyList(); + return null; } }); - if (result == null || result.isEmpty()) throw new NoDataException(); + if (result == null) throw new NoDataException(); return result; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyTopLevelParentClassProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyTopLevelParentClassProvider.java deleted file mode 100644 index b1858a4d3e04..000000000000 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/debugger/GroovyTopLevelParentClassProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jetbrains.plugins.groovy.debugger; - -import com.intellij.debugger.engine.TopLevelParentClassProvider; -import com.intellij.psi.PsiAnonymousClass; -import com.intellij.psi.PsiClass; -import com.intellij.psi.PsiFile; -import com.intellij.psi.util.PsiTreeUtil; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; -import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition; - -/** - * @author Max Medvedev - */ -public class GroovyTopLevelParentClassProvider extends TopLevelParentClassProvider { - @Nullable - @Override - protected PsiClass getCustomTopLevelParentClass(PsiClass psiClass) { - if (!(psiClass instanceof GrTypeDefinition)) return null; - - PsiClass enclosing = PsiTreeUtil.getParentOfType(psiClass, PsiClass.class, true); - while (enclosing != null) { - psiClass = enclosing; - enclosing = PsiTreeUtil.getParentOfType(enclosing, PsiClass.class, true); - } - - if (psiClass instanceof PsiAnonymousClass) { - final PsiFile file = psiClass.getContainingFile(); - if (file instanceof GroovyFile) { - return ((GroovyFile)file).getScriptClass(); - } - } - - return psiClass; - } -} diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml index 369ac61c3c75..345ba31752d6 100644 --- a/resources/src/META-INF/IdeaPlugin.xml +++ b/resources/src/META-INF/IdeaPlugin.xml @@ -144,7 +144,6 @@ -