Move anonymous class to separate file
This commit is contained in:
+5
-14
@@ -24,10 +24,10 @@ import com.intellij.psi.*;
|
|||||||
import com.intellij.psi.impl.compiled.ClsClassImpl;
|
import com.intellij.psi.impl.compiled.ClsClassImpl;
|
||||||
import com.intellij.psi.impl.compiled.ClsEnumConstantImpl;
|
import com.intellij.psi.impl.compiled.ClsEnumConstantImpl;
|
||||||
import com.intellij.psi.impl.compiled.ClsFieldImpl;
|
import com.intellij.psi.impl.compiled.ClsFieldImpl;
|
||||||
import com.intellij.psi.impl.compiled.ClsMethodImpl;
|
|
||||||
import com.intellij.psi.impl.java.stubs.*;
|
import com.intellij.psi.impl.java.stubs.*;
|
||||||
import com.intellij.psi.stubs.StubBase;
|
import com.intellij.psi.stubs.StubBase;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.jet.asJava.wrappers.JetClsMethodImpl;
|
||||||
|
|
||||||
class ClsWrapperStubPsiFactory extends StubPsiFactory {
|
class ClsWrapperStubPsiFactory extends StubPsiFactory {
|
||||||
public static final Key<PsiElement> ORIGIN_ELEMENT = Key.create("ORIGIN_ELEMENT");
|
public static final Key<PsiElement> ORIGIN_ELEMENT = Key.create("ORIGIN_ELEMENT");
|
||||||
@@ -99,20 +99,11 @@ class ClsWrapperStubPsiFactory extends StubPsiFactory {
|
|||||||
@Override
|
@Override
|
||||||
public PsiMethod createMethod(PsiMethodStub stub) {
|
public PsiMethod createMethod(PsiMethodStub stub) {
|
||||||
final PsiElement origin = ((StubBase) stub).getUserData(ORIGIN_ELEMENT);
|
final PsiElement origin = ((StubBase) stub).getUserData(ORIGIN_ELEMENT);
|
||||||
if (origin == null) return delegate.createMethod(stub);
|
if (origin == null) {
|
||||||
|
return delegate.createMethod(stub);
|
||||||
|
}
|
||||||
|
|
||||||
return new ClsMethodImpl(stub) {
|
return new JetClsMethodImpl(stub, origin);
|
||||||
@Override
|
|
||||||
public PsiElement getMirror() {
|
|
||||||
return origin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public PsiElement getNavigationElement() {
|
|
||||||
return origin;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2012 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.jet.asJava.wrappers;
|
||||||
|
|
||||||
|
import com.intellij.psi.PsiElement;
|
||||||
|
import com.intellij.psi.impl.compiled.ClsMethodImpl;
|
||||||
|
import com.intellij.psi.impl.java.stubs.PsiMethodStub;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class JetClsMethodImpl extends ClsMethodImpl {
|
||||||
|
@NotNull
|
||||||
|
private final PsiElement origin;
|
||||||
|
|
||||||
|
public JetClsMethodImpl(@NotNull PsiMethodStub stub, @NotNull PsiElement origin) {
|
||||||
|
super(stub);
|
||||||
|
this.origin = origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PsiElement getMirror() {
|
||||||
|
return origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public PsiElement getNavigationElement() {
|
||||||
|
return origin;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user