Search in sources :

Example 1 with ClassPrepareRequestor

use of com.intellij.debugger.requests.ClassPrepareRequestor 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 2 with ClassPrepareRequestor

use of com.intellij.debugger.requests.ClassPrepareRequestor in project intellij-community by JetBrains.

the class GroovyPositionManager method createPrepareRequest.

@Override
public ClassPrepareRequest createPrepareRequest(@NotNull final ClassPrepareRequestor requestor, @NotNull final SourcePosition position) throws NoDataException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("createPrepareRequest: " + position);
    }
    checkGroovyFile(position);
    String qName = getOuterClassName(position);
    if (qName != null) {
        return myDebugProcess.getRequestsManager().createClassPrepareRequest(requestor, qName);
    }
    qName = findEnclosingName(position);
    if (qName == null)
        throw NoDataException.INSTANCE;
    ClassPrepareRequestor waitRequestor = new ClassPrepareRequestor() {

        @Override
        public void processClassPrepare(DebugProcess debuggerProcess, ReferenceType referenceType) {
            final CompoundPositionManager positionManager = ((DebugProcessImpl) debuggerProcess).getPositionManager();
            if (!positionManager.locationsOfLine(referenceType, position).isEmpty()) {
                requestor.processClassPrepare(debuggerProcess, referenceType);
            }
        }
    };
    return myDebugProcess.getRequestsManager().createClassPrepareRequest(waitRequestor, qName + "$*");
}
Also used : ClassPrepareRequestor(com.intellij.debugger.requests.ClassPrepareRequestor) DebugProcess(com.intellij.debugger.engine.DebugProcess) CompoundPositionManager(com.intellij.debugger.engine.CompoundPositionManager) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) ReferenceType(com.sun.jdi.ReferenceType)

Aggregations

DebugProcess (com.intellij.debugger.engine.DebugProcess)2 ClassPrepareRequestor (com.intellij.debugger.requests.ClassPrepareRequestor)2 ReferenceType (com.sun.jdi.ReferenceType)2 CompoundPositionManager (com.intellij.debugger.engine.CompoundPositionManager)1 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 Computable (com.intellij.openapi.util.Computable)1 SmaliFile (org.jf.smalidea.psi.impl.SmaliFile)1