Search in sources :

Example 1 with PsiCall

use of com.intellij.psi.PsiCall in project intellij-community by JetBrains.

the class InlineToAnonymousClassTest method performAction.

private void performAction(final boolean inlineThisOnly, final boolean searchInNonJavaFiles) {
    PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
    PsiCall callToInline = InlineToAnonymousClassHandler.findCallToInline(myEditor);
    PsiClass classToInline = (PsiClass) element;
    assertEquals(null, InlineToAnonymousClassHandler.getCannotInlineMessage(classToInline));
    final InlineToAnonymousClassProcessor processor = new InlineToAnonymousClassProcessor(getProject(), classToInline, callToInline, inlineThisOnly, false, searchInNonJavaFiles);
    UsageInfo[] usages = processor.findUsages();
    MultiMap<PsiElement, String> conflicts = processor.getConflicts(usages);
    assertEquals(0, conflicts.size());
    processor.run();
}
Also used : PsiCall(com.intellij.psi.PsiCall) PsiClass(com.intellij.psi.PsiClass) PsiElement(com.intellij.psi.PsiElement) UsageInfo(com.intellij.usageView.UsageInfo)

Example 2 with PsiCall

use of com.intellij.psi.PsiCall in project intellij-community by JetBrains.

the class InlineToAnonymousClassTest method doTestCanBeInvokedOnReference.

private void doTestCanBeInvokedOnReference(boolean canBeInvokedOnReference) throws Exception {
    configureByFile("/refactoring/inlineToAnonymousClass/" + getTestName(false) + ".java");
    PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
    PsiCall callToInline = InlineToAnonymousClassHandler.findCallToInline(myEditor);
    PsiClass classToInline = (PsiClass) element;
    assertEquals(null, InlineToAnonymousClassHandler.getCannotInlineMessage(classToInline));
    final PsiClassType superType = InlineToAnonymousClassProcessor.getSuperType(classToInline);
    assertTrue(superType != null);
    assertEquals(canBeInvokedOnReference, InlineToAnonymousClassHandler.canBeInvokedOnReference(callToInline, superType));
}
Also used : PsiClassType(com.intellij.psi.PsiClassType) PsiCall(com.intellij.psi.PsiCall) PsiClass(com.intellij.psi.PsiClass) PsiElement(com.intellij.psi.PsiElement)

Aggregations

PsiCall (com.intellij.psi.PsiCall)2 PsiClass (com.intellij.psi.PsiClass)2 PsiElement (com.intellij.psi.PsiElement)2 PsiClassType (com.intellij.psi.PsiClassType)1 UsageInfo (com.intellij.usageView.UsageInfo)1