Search in sources :

Example 6 with ReferenceType

use of com.sun.jdi.ReferenceType in project smali by JesusFreke.

the class SmaliPositionManager method createPrepareRequest.

@Override
public ClassPrepareRequest createPrepareRequest(@NotNull final ClassPrepareRequestor requestor, @NotNull final SourcePosition position) throws NoDataException {
    Computable<Boolean> isSmaliFile = new Computable<Boolean>() {

        @Override
        public Boolean compute() {
            return position.getFile() instanceof SmaliFile;
        }
    };
    ApplicationManager.getApplication().runReadAction(isSmaliFile);
    if (!isSmaliFile.compute()) {
        throw NoDataException.INSTANCE;
    }
    String className = getClassFromPosition(position);
    return debugProcess.getRequestsManager().createClassPrepareRequest(new ClassPrepareRequestor() {

        @Override
        public void processClassPrepare(DebugProcess debuggerProcess, ReferenceType referenceType) {
            requestor.processClassPrepare(debuggerProcess, referenceType);
        }
    }, className);
}
Also used : SmaliFile(org.jf.smalidea.psi.impl.SmaliFile) ClassPrepareRequestor(com.intellij.debugger.requests.ClassPrepareRequestor) DebugProcess(com.intellij.debugger.engine.DebugProcess) Computable(com.intellij.openapi.util.Computable) ReferenceType(com.sun.jdi.ReferenceType)

Example 7 with ReferenceType

use of com.sun.jdi.ReferenceType in project intellij-community by JetBrains.

the class ShowInstancesFromClassesViewAction method perform.

@Override
protected void perform(AnActionEvent e) {
    final Project project = e.getProject();
    final ReferenceType selectedClass = getSelectedClass(e);
    if (project != null && selectedClass != null) {
        final XDebugSession debugSession = XDebuggerManager.getInstance(project).getCurrentSession();
        if (debugSession != null) {
            new InstancesWindow(debugSession, limit -> selectedClass.instances(limit), selectedClass.name()).show();
        }
    }
}
Also used : ClassesTable(com.intellij.debugger.memory.ui.ClassesTable) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) ReferenceType(com.sun.jdi.ReferenceType) Project(com.intellij.openapi.project.Project) XDebuggerManager(com.intellij.xdebugger.XDebuggerManager) InstancesWindow(com.intellij.debugger.memory.ui.InstancesWindow) XDebugSession(com.intellij.xdebugger.XDebugSession) Project(com.intellij.openapi.project.Project) XDebugSession(com.intellij.xdebugger.XDebugSession) InstancesWindow(com.intellij.debugger.memory.ui.InstancesWindow) ReferenceType(com.sun.jdi.ReferenceType)

Example 8 with ReferenceType

use of com.sun.jdi.ReferenceType in project intellij-community by JetBrains.

the class ShowInstancesFromClassesViewAction method getInstancesCount.

@Override
protected int getInstancesCount(AnActionEvent e) {
    ClassesTable.ReferenceCountProvider countProvider = e.getData(ClassesTable.REF_COUNT_PROVIDER_KEY);
    ReferenceType selectedClass = getSelectedClass(e);
    if (countProvider == null || selectedClass == null) {
        return -1;
    }
    return countProvider.getTotalCount(selectedClass);
}
Also used : ClassesTable(com.intellij.debugger.memory.ui.ClassesTable) ReferenceType(com.sun.jdi.ReferenceType)

Example 9 with ReferenceType

use of com.sun.jdi.ReferenceType in project intellij-community by JetBrains.

the class ShowNewInstancesAction method perform.

@Override
protected void perform(AnActionEvent e) {
    final Project project = e.getProject();
    final ReferenceType selectedClass = getSelectedClass(e);
    final InstancesProvider provider = e.getData(ClassesTable.NEW_INSTANCES_PROVIDER_KEY);
    final XDebugSession session = project != null ? XDebuggerManager.getInstance(project).getCurrentSession() : null;
    if (selectedClass != null && provider != null && session != null) {
        new InstancesWindow(session, provider, selectedClass.name()).show();
    }
}
Also used : InstancesProvider(com.intellij.debugger.memory.utils.InstancesProvider) Project(com.intellij.openapi.project.Project) XDebugSession(com.intellij.xdebugger.XDebugSession) InstancesWindow(com.intellij.debugger.memory.ui.InstancesWindow) ReferenceType(com.sun.jdi.ReferenceType)

Example 10 with ReferenceType

use of com.sun.jdi.ReferenceType in project intellij-community by JetBrains.

the class ShowNewInstancesAction method isEnabled.

@Override
protected boolean isEnabled(AnActionEvent e) {
    final ReferenceType selectedClass = getSelectedClass(e);
    final InstancesProvider provider = e.getData(ClassesTable.NEW_INSTANCES_PROVIDER_KEY);
    final int count = getInstancesCount(e);
    return super.isEnabled(e) && selectedClass != null && provider != null && count > 0;
}
Also used : InstancesProvider(com.intellij.debugger.memory.utils.InstancesProvider) ReferenceType(com.sun.jdi.ReferenceType)

Aggregations

ReferenceType (com.sun.jdi.ReferenceType)40 Nullable (org.jetbrains.annotations.Nullable)9 Project (com.intellij.openapi.project.Project)8 Location (com.sun.jdi.Location)5 ObjectReference (com.sun.jdi.ObjectReference)5 AbsentInformationException (com.sun.jdi.AbsentInformationException)4 Method (com.sun.jdi.Method)4 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)3 ClassesTable (com.intellij.debugger.memory.ui.ClassesTable)3 InstancesWindow (com.intellij.debugger.memory.ui.InstancesWindow)3 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)3 XDebugSession (com.intellij.xdebugger.XDebugSession)3 SourcePosition (com.intellij.debugger.SourcePosition)2 DebugProcess (com.intellij.debugger.engine.DebugProcess)2 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)2 InstancesTracker (com.intellij.debugger.memory.component.InstancesTracker)2 InstancesProvider (com.intellij.debugger.memory.utils.InstancesProvider)2 ClassPrepareRequestor (com.intellij.debugger.requests.ClassPrepareRequestor)2 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)2 PsiClass (com.intellij.psi.PsiClass)2