Java 类org.eclipse.debug.core.DebugException 实例源码

项目:gemoc-studio-modeldebugging    文件:DSLDebugTargetAdapterTests.java   
/**
 * Test {@link DSLDebugTargetAdapter#terminate()}.
 * 
 * @throws DebugException
 *             if fail
 */
@Test
public void terminate() throws DebugException {
    DebugTarget eDebugTarget = DebugPackage.eINSTANCE.getDebugFactory().createDebugTarget();
    eDebugTarget.setName("Debug target");
    final TestEventProcessor testEventProcessor = new TestEventProcessor();
    final DSLEclipseDebugIntegration integration = new DSLEclipseDebugIntegration("id", null,
            eDebugTarget, new ModelUpdater(), testEventProcessor);
    final DSLDebugTargetAdapter debugTarget = integration.getDebugTarget();

    debugTarget.terminate();

    assertEquals(1, testEventProcessor.getEvents().size());
    assertTrue(testEventProcessor.getEvents().get(0) instanceof TerminateRequest);
    assertEquals(null, ((TerminateRequest)testEventProcessor.getEvents().get(0)).getThreadName());
    assertEquals(DebugTargetState.TERMINATING, eDebugTarget.getState());
}
项目:gemoc-studio-modeldebugging    文件:DSLDebugTargetAdapterTests.java   
/**
 * Test {@link DSLDebugTargetAdapter#resume()}.
 * 
 * @throws DebugException
 *             if fail
 */
@Test
public void resume() throws DebugException {
    DebugTarget eDebugTarget = DebugPackage.eINSTANCE.getDebugFactory().createDebugTarget();
    eDebugTarget.setName("Debug target");
    final TestEventProcessor testEventProcessor = new TestEventProcessor();
    final DSLEclipseDebugIntegration integration = new DSLEclipseDebugIntegration("id", null,
            eDebugTarget, new ModelUpdater(), testEventProcessor);
    final DSLDebugTargetAdapter debugTarget = integration.getDebugTarget();

    debugTarget.resume();

    assertEquals(1, testEventProcessor.getEvents().size());
    assertTrue(testEventProcessor.getEvents().get(0) instanceof ResumeRequest);
    assertEquals(null, ((ResumeRequest)testEventProcessor.getEvents().get(0)).getThreadName());
}
项目:pandionj    文件:StackFrameModel.java   
private String valueSpecialChars(IJavaValue value) {
    try {
        if(value.getReferenceTypeName().equals("char"))
            return "'" + value.getValueString() + "'";

        if(value.getReferenceTypeName().equals(String.class.getName()))
            return "\"" + value.getValueString() + "\"";

        if(value instanceof IJavaObject) {
            if(((IJavaObject) value).isNull())
                return "null";
            else
                return runtime.getObject((IJavaObject) value, false, null).toString();
        }
        return value.getValueString();
    }
    catch (DebugException e) {
        e.printStackTrace();
        return null;
    }
}
项目:pandionj    文件:RuntimeModel.java   
public void setTerminated() {
    if(launch != null)
        try {
            launch.terminate();
        }
    catch (DebugException e) {
        //              e.printStackTrace();
    }

    terminated = true;
    for(StackFrameModel frame : callStack)
        frame.setObsolete();

    setChanged();
    notifyObservers(new Event<IStackFrameModel>(Event.Type.TERMINATION, null));
}
项目:pandionj    文件:StackFrameModel.java   
private String valueToString(IJavaValue value) {
    if(value instanceof IJavaArray) {
        try {
            IJavaArray array = (IJavaArray) value;
            IJavaValue[] values = array.getValues();
            String s = "";
            for(int i = 0; i < values.length; i++) {
                if(!s.isEmpty())
                    s += ", ";
                s += valueSpecialChars(values[i]);
            }
            return "{" + s + "}";
        }
        catch (DebugException e) {
            e.printStackTrace();
            return null;
        }
    }
    else
        return valueSpecialChars(value);
}
项目:gemoc-studio-modeldebugging    文件:DSLStackFrameAdapter.java   
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IStackFrame#getVariables()
 */
public IVariable[] getVariables() throws DebugException {
    final List<IVariable> res = new ArrayList<IVariable>();

    for (Variable variable : getHost().getVariables()) {
        synchronized(variable) {
            final IVariable var = (IVariable)factory.adapt(variable, IVariable.class);
            if (var != null) {
                res.add(var);
            } else {
                throw new IllegalStateException("can't addapt Variable to IVariable.");
            }
        }
    }

    return res.toArray(new IVariable[res.size()]);
}
项目:gemoc-studio-modeldebugging    文件:DSLArrayValue.java   
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IValue#getValueString()
 */
public String getValueString() throws DebugException {
    StringBuilder builder = new StringBuilder(BUFFER_SIZE);

    builder.append('[');
    if (variables.length > 0) {
        for (IVariable variable : variables) {
            builder = builder.append(variable.getValue().getValueString());
            builder = builder.append(", ");
        }
        builder = builder.delete(builder.length() - ", ".length(), builder.length());
    }
    builder.append(']');

    return builder.toString();
}
项目:pandionj    文件:ObjectModel.java   
public IArrayModel getArray(String fieldName) {
    try {
        IJavaFieldVariable field = getContent().getField(fieldName, false);
        if(field == null)
            throw new IllegalArgumentException(fieldName + " is not a field");

        //          if(!(field.getJavaType() instanceof IJavaArrayType))
        //              throw new IllegalArgumentException(fieldName + " is not an array field");

        IEntityModel t = references.get(fieldName).getModelTarget();
        return t instanceof IArrayModel ? (IArrayModel) t : null;
    } catch (DebugException e) {
        e.printStackTrace();
        return null;
    }
}
项目:pandionj    文件:ArrayModel.java   
@Override
public String toString() {
    int lim = Math.min(PandionJView.getMaxArrayLength(), elements.length);
    String els = "{";
    for(int i = 0; i < lim; i++) {
        if(i != 0)
            els += ", ";
        try {
            els += getElementString(i);
        } catch (DebugException e) {
            els = "?";
        }
    }
    if(lim < elements.length)
        els += ", ...";

    if(els.length() == 1)
        els += " ";

    els += "}";
    return els;
}
项目:pandionj    文件:ObjectModel.java   
private void traverseSiblings(IEntityModel e, ObjectModel parent, int index, Set<IEntityModel> set, SiblingVisitor v, int depth, String field, boolean visitNulls) throws DebugException {
    assert e != null;
    if(!set.contains(e)) {
        set.add(e);
        if(!(e instanceof NullModel) || visitNulls) {
            v.visit(e, parent, index, depth, field);
        }

        if(e instanceof ObjectModel) {
            ObjectModel obj = (ObjectModel) e;
            int i = 0;
            for(String siblingRef : refsOfSameType) {
                ReferenceModel refModel = obj.references.get(siblingRef);
                IEntityModel o = refModel.getModelTarget();
                traverseSiblings(o, obj, i++, set, v, depth+1, siblingRef, visitNulls);
            }
        }
    }
}
项目:pandionj    文件:StackFrameModel.java   
private String calcString() {
    try {
        IJavaVariable[] localVariables = frame.getLocalVariables();
        int nArgs = frame.getArgumentTypeNames().size();
        List<String> args = new ArrayList<>(localVariables.length);
        for(int i = 0; i < localVariables.length && i < nArgs ; i++) {
            if(PrimitiveType.isPrimitive(localVariables[i].getReferenceTypeName())) {
                IJavaValue value = (IJavaValue) localVariables[i].getValue();
                args.add(valueToString(value));
            }
            else
                args.add(localVariables[i].getName());
        }

        if(frame.isStaticInitializer())
            return frame.getDeclaringTypeName() + " (static initializer)";
        else if(frame.isConstructor())
            return "new " + toSimpleName(frame.getReferenceType().getName()) + "(" + String.join(", ", args) + ")";
        else {
            String ret = frame.getMethodName() + "(" + String.join(", ", args) + ")";
            if(returnValue != null)
                ret += " = " + returnValue;
            return ret;
        }
    } catch (DebugException e) {
        //          e.printStackTrace();
        return super.toString();
    }
}
项目:dsp4e    文件:DSPThread.java   
@Override
public IStackFrame getTopStackFrame() throws DebugException {
    if (frames == null) {
        calculateFrames();
    }
    return frames.get(0);
}
项目:pandionj    文件:ArrayModel.java   
public Dimension getMatrixDimension() {
    if(!isMatrix())
        throw new IllegalStateException("not a matrix");

    try {
        return new Dimension(getLength() == 0 ? 0 : ((IJavaArray) elements[0]).getLength(), getLength());
    } catch (DebugException e) {
        e.printStackTrace();
        getRuntimeModel().setTerminated();
    }
    return new Dimension(0, 0);
}
项目:gemoc-studio-modeldebugging    文件:DSLDebugTargetAdapterTests.java   
/**
 * Test {@link DSLDebugTargetAdapter#handleEvent(org.eclipse.gemoc.dsl.debug.ide.event.IDSLDebugEvent)}.
 * 
 * @throws DebugException
 *             if fail
 */
@Test
public void handleEventSpawnRunningThreadReply() throws DebugException {
    DebugTarget eDebugTarget = DebugPackage.eINSTANCE.getDebugFactory().createDebugTarget();
    eDebugTarget.setName("Debug target");
    final TestEventProcessor testEventProcessor = new TestEventProcessor();
    final DSLEclipseDebugIntegration integration = new DSLEclipseDebugIntegration("id", null,
            eDebugTarget, new ModelUpdater(), testEventProcessor);
    final DSLDebugTargetAdapter debugTarget = integration.getDebugTarget();
    TestDebugEventSetListener listener = new TestDebugEventSetListener();

    createThreads(eDebugTarget);
    debugTarget.getThreads(); // force adapter creation to avoid create event

    DebugPlugin.getDefault().addDebugEventListener(listener);
    final EObject context = DebugPackage.eINSTANCE.getDebugFactory().createVariable();
    try {
        debugTarget.handleEvent(new SpawnRunningThreadReply("thread", context));
        listener.waitForEvent();
    } finally {
        DebugPlugin.getDefault().removeDebugEventListener(listener);
    }

    assertEquals(9, eDebugTarget.getThreads().size());

    assertEquals(1, listener.getEventsList().size());
    DebugEvent[] events = listener.getEventsList().get(0);
    assertEquals(1, events.length);
    DebugEvent event = events[0];
    assertTrue(event.getSource() == debugTarget);
    assertEquals(DebugEvent.CHANGE, event.getKind());
    assertEquals(DebugEvent.CONTENT, event.getDetail());
}
项目:gemoc-studio-modeldebugging    文件:DSLDebugTargetAdapterTests.java   
/**
 * Test {@link DSLDebugTargetAdapter#handleEvent(org.eclipse.gemoc.dsl.debug.ide.event.IDSLDebugEvent)}.
 * 
 * @throws DebugException
 *             if fail
 */
@Test
public void handleEventResumingReply() throws DebugException {
    DebugTarget eDebugTarget = DebugPackage.eINSTANCE.getDebugFactory().createDebugTarget();
    eDebugTarget.setName("Debug target");
    final TestEventProcessor testEventProcessor = new TestEventProcessor();
    final DSLEclipseDebugIntegration integration = new DSLEclipseDebugIntegration("id", null,
            eDebugTarget, new ModelUpdater(), testEventProcessor);
    final DSLDebugTargetAdapter debugTarget = integration.getDebugTarget();
    TestDebugEventSetListener listener = new TestDebugEventSetListener();

    createThreads(eDebugTarget);
    debugTarget.getThreads(); // force adapter creation to avoid create event

    DebugPlugin.getDefault().addDebugEventListener(listener);
    try {
        debugTarget.handleEvent(new ResumingReply(eDebugTarget.getThreads().get(suspendedThreadIndex)
                .getName()));
        listener.waitForEvent();
    } finally {
        DebugPlugin.getDefault().removeDebugEventListener(listener);
    }

    assertEquals(2, listener.getEventsList().size());
    DebugEvent[] events = listener.getEventsList().get(0);
    assertEquals(1, events.length);
    DebugEvent event = events[0];
    assertTrue(event.getSource() == integration.getThread(eDebugTarget.getThreads().get(
            suspendedThreadIndex)));
    assertEquals(DebugEvent.RESUME, event.getKind());
    assertEquals(DebugEvent.CLIENT_REQUEST, event.getDetail());

    events = listener.getEventsList().get(1);
    assertEquals(1, events.length);
    event = events[0];
    assertTrue(event.getSource() == debugTarget);
    assertEquals(DebugEvent.CHANGE, event.getKind());
    assertEquals(DebugEvent.STATE, event.getDetail());
}
项目:gemoc-studio-modeldebugging    文件:DSLDebugTargetAdapterTests.java   
/**
 * Test {@link DSLDebugTargetAdapter#handleEvent(org.eclipse.gemoc.dsl.debug.ide.event.IDSLDebugEvent)}.
 * 
 * @throws DebugException
 *             if fail
 */
@Test
public void handleEventStepOverResumingReply() throws DebugException {
    DebugTarget eDebugTarget = DebugPackage.eINSTANCE.getDebugFactory().createDebugTarget();
    eDebugTarget.setName("Debug target");
    final TestEventProcessor testEventProcessor = new TestEventProcessor();
    final DSLEclipseDebugIntegration integration = new DSLEclipseDebugIntegration("id", null,
            eDebugTarget, new ModelUpdater(), testEventProcessor);
    final DSLDebugTargetAdapter debugTarget = integration.getDebugTarget();
    TestDebugEventSetListener listener = new TestDebugEventSetListener();

    createThreads(eDebugTarget);
    debugTarget.getThreads(); // force adapter creation to avoid create event

    DebugPlugin.getDefault().addDebugEventListener(listener);
    try {
        debugTarget.handleEvent(new StepOverResumingReply(eDebugTarget.getThreads().get(
                suspendedThreadIndex).getName()));
        listener.waitForEvent();
    } finally {
        DebugPlugin.getDefault().removeDebugEventListener(listener);
    }

    assertEquals(2, listener.getEventsList().size());
    DebugEvent[] events = listener.getEventsList().get(0);
    assertEquals(1, events.length);
    DebugEvent event = events[0];
    assertTrue(event.getSource() == integration.getThread(eDebugTarget.getThreads().get(
            suspendedThreadIndex)));
    assertEquals(DebugEvent.RESUME, event.getKind());
    assertEquals(DebugEvent.STEP_OVER, event.getDetail());

    events = listener.getEventsList().get(1);
    assertEquals(1, events.length);
    event = events[0];
    assertTrue(event.getSource() == debugTarget);
    assertEquals(DebugEvent.CHANGE, event.getKind());
    assertEquals(DebugEvent.STATE, event.getDetail());
}
项目:gemoc-studio-modeldebugging    文件:DSLDebugTargetAdapterTests.java   
/**
 * Test {@link DSLDebugTargetAdapter#handleEvent(org.eclipse.gemoc.dsl.debug.ide.event.IDSLDebugEvent)}.
 * 
 * @throws DebugException
 *             if fail
 */
@Test
public void handleEventVariableReply() throws DebugException {
    DebugTarget eDebugTarget = DebugPackage.eINSTANCE.getDebugFactory().createDebugTarget();
    eDebugTarget.setName("Debug target");
    final TestEventProcessor testEventProcessor = new TestEventProcessor();
    final DSLEclipseDebugIntegration integration = new DSLEclipseDebugIntegration("id", null,
            eDebugTarget, new ModelUpdater(), testEventProcessor);
    final DSLDebugTargetAdapter debugTarget = integration.getDebugTarget();
    TestDebugEventSetListener listener = new TestDebugEventSetListener();

    createThreads(eDebugTarget);
    debugTarget.getThreads(); // force adapter creation to avoid create event

    DebugPlugin.getDefault().addDebugEventListener(listener);
    try {
        debugTarget.handleEvent(new VariableReply(eDebugTarget.getThreads().get(suspendedThreadIndex)
                .getName(), eDebugTarget.getThreads().get(suspendedThreadIndex).getTopStackFrame()
                .getName(), "Object", "variable", null, false));
        listener.waitForEvent();
    } finally {
        DebugPlugin.getDefault().removeDebugEventListener(listener);
    }

    assertEquals(1, eDebugTarget.getThreads().get(suspendedThreadIndex).getTopStackFrame().getVariables()
            .size());

    assertEquals(1, listener.getEventsList().size());
    DebugEvent[] events = listener.getEventsList().get(0);
    assertEquals(1, events.length);
    DebugEvent event = events[0];
    assertTrue(event.getSource() == integration.getThread(eDebugTarget.getThreads().get(
            suspendedThreadIndex)));
    assertEquals(DebugEvent.CHANGE, event.getKind());
    assertEquals(DebugEvent.CONTENT, event.getDetail());
}
项目:gemoc-studio-modeldebugging    文件:DSLDebugTargetAdapterTests.java   
/**
 * Test {@link DSLDebugTargetAdapter#handleEvent(org.eclipse.gemoc.dsl.debug.ide.event.IDSLDebugEvent)}.
 * 
 * @throws DebugException
 *             if fail
 */
@Test
public void handleEventDeleteVariableReply() throws DebugException {
    DebugTarget eDebugTarget = DebugPackage.eINSTANCE.getDebugFactory().createDebugTarget();
    eDebugTarget.setName("Debug target");
    final TestEventProcessor testEventProcessor = new TestEventProcessor();
    final DSLEclipseDebugIntegration integration = new DSLEclipseDebugIntegration("id", null,
            eDebugTarget, new ModelUpdater(), testEventProcessor);
    final DSLDebugTargetAdapter debugTarget = integration.getDebugTarget();
    TestDebugEventSetListener listener = new TestDebugEventSetListener();

    createThreads(eDebugTarget);
    debugTarget.getThreads(); // force adapter creation to avoid create event

    ThreadUtils.setVariableReply(eDebugTarget.getThreads().get(suspendedThreadIndex).getTopStackFrame(),
            "Object", "variable", null, false);
    DebugPlugin.getDefault().addDebugEventListener(listener);
    try {
        debugTarget.handleEvent(new DeleteVariableReply(eDebugTarget.getThreads().get(
                suspendedThreadIndex).getName(), "variable"));
        listener.waitForEvent();
    } finally {
        DebugPlugin.getDefault().removeDebugEventListener(listener);
    }

    assertEquals(0, eDebugTarget.getThreads().get(suspendedThreadIndex).getTopStackFrame().getVariables()
            .size());

    assertEquals(1, listener.getEventsList().size());
    DebugEvent[] events = listener.getEventsList().get(0);
    assertEquals(1, events.length);
    DebugEvent event = events[0];
    assertTrue(event.getSource() == integration.getThread(eDebugTarget.getThreads().get(
            suspendedThreadIndex)));
    assertEquals(DebugEvent.CHANGE, event.getKind());
    assertEquals(DebugEvent.CONTENT, event.getDetail());
}
项目:gemoc-studio-modeldebugging    文件:DSLDebugTargetAdapterTests.java   
/**
 * Test {@link DSLDebugTargetAdapter#handleEvent(org.eclipse.gemoc.dsl.debug.ide.event.IDSLDebugEvent)}.
 * 
 * @throws DebugException
 *             if fail
 */
@Test
public void handleEventPushStackFrameReply() throws DebugException {
    DebugTarget eDebugTarget = DebugPackage.eINSTANCE.getDebugFactory().createDebugTarget();
    eDebugTarget.setName("Debug target");
    final TestEventProcessor testEventProcessor = new TestEventProcessor();
    final DSLEclipseDebugIntegration integration = new DSLEclipseDebugIntegration("id", null,
            eDebugTarget, new ModelUpdater(), testEventProcessor);
    final DSLDebugTargetAdapter debugTarget = integration.getDebugTarget();
    TestDebugEventSetListener listener = new TestDebugEventSetListener();

    createThreads(eDebugTarget);
    debugTarget.getThreads(); // force adapter creation to avoid create event

    final EObject context = DebugPackage.eINSTANCE.getDebugFactory().createVariable();
    final EObject instruction = DebugPackage.eINSTANCE.getDebugFactory().createVariable();
    DebugPlugin.getDefault().addDebugEventListener(listener);
    try {
        debugTarget.handleEvent(new PushStackFrameReply(eDebugTarget.getThreads().get(
                suspendedThreadIndex).getName(), "frame", context, instruction, false));
        listener.waitForEvent();
    } finally {
        DebugPlugin.getDefault().removeDebugEventListener(listener);
    }

    assertEquals("frame", eDebugTarget.getThreads().get(suspendedThreadIndex).getTopStackFrame()
            .getName());

    assertEquals(1, listener.getEventsList().size());
    DebugEvent[] events = listener.getEventsList().get(0);
    assertEquals(1, events.length);
    DebugEvent event = events[0];
    assertTrue(event.getSource() == integration.getThread(eDebugTarget.getThreads().get(
            suspendedThreadIndex)));
    assertEquals(DebugEvent.CHANGE, event.getKind());
    assertEquals(DebugEvent.CONTENT, event.getDetail());
}
项目:pandionj    文件:Activator.java   
static void stepOver(ExecutionEvent event) {
    if(launch != null) {
        try {
            for(IThread t : launch.getDebugTarget().getThreads())
                if(t.canStepOver())
                    t.stepOver();
        } catch (DebugException e) {
            e.printStackTrace();
        }
    }
    //      showView(event);
}
项目:pandionj    文件:ArrayModel.java   
public String getElementString(int i) throws DebugException {
//      if(primitiveType == null) {
            IReferenceModel ref = (IReferenceModel) elementsModel.get(i);
            IEntityModel target = ref.getModelTarget();
            if(target.isNull())
                return "null";
            else     if(target instanceof IObjectModel)
                return ((IObjectModel) target).getStringValue();
            else
                return target.toString();
//      }
//      else
//          return elements[i].getValueString();
    }
项目:pandionj    文件:PandionJView.java   
public <T> T executeInternal(PandionJUI.DebugOperation<T> r, T defaultValue) {
    try {
        return r.run();
    }
    catch(DebugException e) {
        e.printStackTrace();
        runtime.setTerminated();
        return null;
    }
}
项目:pandionj    文件:PandionJView.java   
private void handleFrames(IJavaThread thread) throws DebugException {
    assert thread != null;

    if(introScreen != null) {
        introScreen.dispose();
        introScreen = null;
    }

    if(thread.getLaunch() != launch) {
        launch = thread.getLaunch();
        runtime = new RuntimeModel();
        if(runtimeView != null)
            runtimeView.dispose();
        runtimeView = new RuntimeViewer(parent);
        runtimeView.setInput(runtime);
        runtimeView.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        runtimeView.requestLayout();
    }

    contextService.activateContext(PandionJConstants.CONTEXT_ID);

    runtime.update(thread);

    if(!runtime.isEmpty() && !runtime.isTerminated()) {
        StackFrameModel frame = runtime.getTopFrame();
        IFile sourceFile = frame.getSourceFile();
        int lineNumber = frame.getLineNumber();
        if(sourceFile != null && lineNumber != -1)
            ;//PandionJUI.navigateToLine(sourceFile, lineNumber);
    }
}
项目:pandionj    文件:Activator.java   
static void stepReturn(ExecutionEvent event) {
    if(launch != null) {
        try {
            for(IThread t : launch.getDebugTarget().getThreads())
                if(t.canStepReturn())
                    t.stepReturn();
        } catch (DebugException e) {
            e.printStackTrace();
        }
    }
    //      showView(event);
}
项目:pandionj    文件:Activator.java   
static void terminate(ExecutionEvent event) {
    if(launch != null) {
        try {
            IDebugTarget debugTarget = launch.getDebugTarget();
            if(debugTarget != null)
                debugTarget.terminate();
        } catch (DebugException e) {
            e.printStackTrace();
        }
    }
    //      showView(event);
}
项目:gemoc-studio-modeldebugging    文件:DSLVariableAdapter.java   
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
 */
public boolean verifyValue(String expression) throws DebugException {
    Object response = factory.getDebugger().handleEvent(
            new ValidateVariableValueRequest(ThreadUtils.getThread(getHost().getFrame()).getName(),
                    getHost().getFrame().getName(), getHost().getName(), expression));

    return Boolean.TRUE == response;
}
项目:pandionj    文件:ArrayModel.java   
private Object getValues(IJavaArray javaArray) {
    try {
        String compType = getComponentType(javaArray);
        int dimensions = getDimensions(javaArray);
        PrimitiveType primitive = PrimitiveType.match(compType);
        IJavaValue[] values = javaArray.getValues();
        Object array = null;
        if(primitive != null) {
            Class<?> type = primitive.getArrayClass(dimensions);
            array = Array.newInstance(type, values.length);
        }
        else
            array = Array.newInstance(Object.class, values.length);

        if(getDimensions(javaArray) == 1) {
            if(primitive == null) {
                for(int j = 0; j < values.length; j++)
                    if(!values[j].isNull())
                        Array.set(array, j, values[j].getValueString());
            }
            else {
                primitive.fillPrimitiveValues(array, values);
            }
        }   
        else {
            for(int i = 0; i < values.length; i++) {
                IJavaValue val = values[i];
                if(!val.isNull())
                    Array.set(array, i, getValues((IJavaArray) val));
            }
        }
        return array;
    }
    catch (DebugException e) {
        e.printStackTrace();
        getRuntimeModel().setTerminated();
        return new Object[0];
    }
}
项目:gemoc-studio-modeldebugging    文件:DSLThreadAdapter.java   
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IStep#stepInto()
 */
public void stepInto() throws DebugException {
    factory.getDebugger()
            .handleEvent(
                    new StepIntoRequest(getHost().getName(), getHost().getTopStackFrame()
                            .getCurrentInstruction()));
}
项目:pandionj    文件:Activator.java   
static void resume(ExecutionEvent event) {
    if(launch != null) {
        try {
            IDebugTarget debugTarget = launch.getDebugTarget();
            if(debugTarget != null)
                debugTarget.resume();
        } catch (DebugException e) {
            e.printStackTrace();
        }
    }
    //      showView(event);
}
项目:pandionj    文件:StackFrameModel.java   
public int getLineNumber() {
    try {
        return frame.getLineNumber();
    } catch (DebugException e) {
        e.printStackTrace();
        return -1;
    }
}
项目:pandionj    文件:StackFrameModel.java   
public void update() throws DebugException {
    handleVariables();
    step++;
    stepPointer = step;
    stepLines.put(step, lastLine);

    try {
        lastLine = frame.getLineNumber();
    } catch (DebugException e) {
        e.printStackTrace();
    }
    setChanged();
    notifyObservers(new IStackFrameModel.StackEvent<Object>(StackEvent.Type.STEP, step));
}
项目:dsp4e    文件:DSPVariable.java   
@Override
public boolean verifyValue(String expression) throws DebugException {
    // TODO
    return false;
}
项目:pandionj    文件:ValueModel.java   
public ValueModel(IJavaVariable variable, boolean isInstance, boolean isVisible, VariableInfo var, RuntimeModel runtime) throws DebugException {
    super(variable, isInstance, isVisible, runtime);
    assert variable.getValue() instanceof IJavaPrimitiveValue;
    init(var);
}
项目:dsp4e    文件:DSPStackFrame.java   
@Override
public void stepInto() throws DebugException {
}
项目:pandionj    文件:ArrayPrimitiveModel.java   
public ArrayPrimitiveModel(IJavaArray array, RuntimeModel runtime, IReferenceModel sourceReference) throws DebugException {
    super(array, runtime);
}
项目:gemoc-studio-modeldebugging    文件:DSLDebugTargetAdapterTests.java   
/**
 * Test {@link DSLDebugTargetAdapter#handleEvent(org.eclipse.gemoc.dsl.debug.ide.event.IDSLDebugEvent)}.
 * 
 * @throws DebugException
 *             if fail
 */
@Test
public void handleEventStepIntoResumingReply() throws DebugException {
    DebugTarget eDebugTarget = DebugPackage.eINSTANCE.getDebugFactory().createDebugTarget();
    eDebugTarget.setName("Debug target");
    final TestEventProcessor testEventProcessor = new TestEventProcessor();
    final DSLEclipseDebugIntegration integration = new DSLEclipseDebugIntegration("id", null,
            eDebugTarget, new ModelUpdater(), testEventProcessor);
    final DSLDebugTargetAdapter debugTarget = integration.getDebugTarget();
    TestDebugEventSetListener listener = new TestDebugEventSetListener();

    createThreads(eDebugTarget);
    debugTarget.getThreads(); // force adapter creation to avoid create event

    eDebugTarget.getThreads().get(suspendedThreadIndex).getTopStackFrame()
            .setCanStepIntoCurrentInstruction(true);
    DebugPlugin.getDefault().addDebugEventListener(listener);
    try {
        debugTarget.handleEvent(new StepIntoResumingReply(eDebugTarget.getThreads().get(
                suspendedThreadIndex).getName()));
        listener.waitForEvent();
    } finally {
        DebugPlugin.getDefault().removeDebugEventListener(listener);
    }

    assertEquals(2, listener.getEventsList().size());
    DebugEvent[] events = listener.getEventsList().get(0);
    assertEquals(1, events.length);
    DebugEvent event = events[0];
    assertTrue(event.getSource() == integration.getThread(eDebugTarget.getThreads().get(
            suspendedThreadIndex)));
    assertEquals(DebugEvent.RESUME, event.getKind());
    assertEquals(DebugEvent.STEP_INTO, event.getDetail());

    events = listener.getEventsList().get(1);
    assertEquals(1, events.length);
    event = events[0];
    assertTrue(event.getSource() == debugTarget);
    assertEquals(DebugEvent.CHANGE, event.getKind());
    assertEquals(DebugEvent.STATE, event.getDetail());
}
项目:pandionj    文件:StaticRefsContainer.java   
public IVariableModel<?> get(StackFrameModel frame, String varName) throws DebugException {
    String id = frame.getStackFrame().getDeclaringTypeName() + "." + varName;
    return map.get(id);
}
项目:dsp4e    文件:DSPValue.java   
@Override
public boolean hasVariables() throws DebugException {
    return variablesReference != null && variablesReference > 0;
}
项目:pandionj    文件:VariableModel.java   
public VariableModel(IJavaVariable variable, boolean isInstance, boolean isVisible, StackFrameModel stackFrame) throws DebugException {
    this(variable, isInstance, isVisible, stackFrame.getRuntime());
    this.stackFrame = stackFrame;   
}
项目:dsp4e    文件:DSPValue.java   
@Override
public boolean isAllocated() throws DebugException {
    // TODO
    return true;
}