use of com.intellij.psi.PsiClass in project smali by JesusFreke.
the class ClassReferenceTest method testJavaReferenceFromSmaliInDumbMode.
/**
* Test a reference to a java class from a smali class, while in dumb mode
*/
public void testJavaReferenceFromSmaliInDumbMode() throws Exception {
SmaliClassTypeElement typeElement = (SmaliClassTypeElement) configureByFileText(".class public Lblah; .super L<ref>java/lang/Object;", "blah.smali");
Assert.assertNotNull(typeElement);
Assert.assertEquals("Object", typeElement.getName());
DumbServiceImpl.getInstance(getProject()).setDumb(true);
PsiClass psiClass = typeElement.resolve();
Assert.assertNull(psiClass);
DumbServiceImpl.getInstance(getProject()).setDumb(false);
}
use of com.intellij.psi.PsiClass in project smali by JesusFreke.
the class ClassRenameTest method doRename.
private void doRename(String oldQualifiedName, String newName) throws Exception {
PsiClass testClass = myJavaFacade.findClass(oldQualifiedName, GlobalSearchScope.allScope(getProject()));
RenameProcessor processor = new RenameProcessor(getProject(), testClass, newName, false, false);
processor.run();
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
FileDocumentManager.getInstance().saveAllDocuments();
}
use of com.intellij.psi.PsiClass in project smali by JesusFreke.
the class FieldRenameTest method doRename.
private void doRename(String containingClass, String oldFieldName, String newFieldName) throws Exception {
PsiClass testClass = myJavaFacade.findClass(containingClass, GlobalSearchScope.allScope(getProject()));
PsiField field = testClass.findFieldByName(oldFieldName, false);
RenameProcessor processor = new RenameProcessor(getProject(), field, newFieldName, false, false);
processor.run();
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
FileDocumentManager.getInstance().saveAllDocuments();
}
use of com.intellij.psi.PsiClass in project smali by JesusFreke.
the class SmaliMethodReference method getContainingClass.
@Nullable
public PsiClass getContainingClass() {
SmaliClassTypeElement containingClassReference = getContainingType();
if (containingClassReference == null) {
return null;
}
PsiClass containingClass = containingClassReference.resolve();
if (containingClass == null) {
return null;
}
return containingClass;
}
use of com.intellij.psi.PsiClass in project intellij-community by JetBrains.
the class ClassObjectRenderer method getFullValueEvaluator.
@Nullable
@Override
public XFullValueEvaluator getFullValueEvaluator(final EvaluationContextImpl evaluationContext, final ValueDescriptorImpl valueDescriptor) {
return new JavaValue.JavaFullValueEvaluator(DebuggerBundle.message("message.node.navigate"), evaluationContext) {
@Override
public void evaluate(@NotNull XFullValueEvaluationCallback callback) {
Value value = valueDescriptor.getValue();
ClassType type = ((ClassType) value.type());
Method nameMethod = type.concreteMethodByName("getName", "()Ljava/lang/String;");
if (nameMethod != null) {
try {
final DebugProcessImpl process = evaluationContext.getDebugProcess();
Value res = process.invokeMethod(evaluationContext, (ObjectReference) value, nameMethod, Collections.emptyList());
if (res instanceof StringReference) {
callback.evaluated("");
final String line = ((StringReference) res).value();
ApplicationManager.getApplication().runReadAction(() -> {
final PsiClass psiClass = DebuggerUtils.findClass(line, valueDescriptor.getProject(), process.getSearchScope());
if (psiClass != null) {
DebuggerUIUtil.invokeLater(() -> psiClass.navigate(true));
}
});
}
} catch (EvaluateException e) {
LOG.info("Exception while getting type name", e);
}
}
}
@Override
public boolean isShowValuePopup() {
return false;
}
};
}
Aggregations