当前位置: 首页>>代码示例>>Java>>正文


Java DebugException类代码示例

本文整理汇总了Java中org.eclipse.debug.core.DebugException的典型用法代码示例。如果您正苦于以下问题:Java DebugException类的具体用法?Java DebugException怎么用?Java DebugException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DebugException类属于org.eclipse.debug.core包,在下文中一共展示了DebugException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: terminate

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:23,代码来源:DSLDebugTargetAdapterTests.java

示例2: resume

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:22,代码来源:DSLDebugTargetAdapterTests.java

示例3: valueSpecialChars

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
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;
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:22,代码来源:StackFrameModel.java

示例4: setTerminated

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
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));
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:17,代码来源:RuntimeModel.java

示例5: valueToString

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
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);
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:22,代码来源:StackFrameModel.java

示例6: getVariables

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
/**
 * {@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()]);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:22,代码来源:DSLStackFrameAdapter.java

示例7: getValueString

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
/**
 * {@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();
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:21,代码来源:DSLArrayValue.java

示例8: getArray

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
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;
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:17,代码来源:ObjectModel.java

示例9: toString

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
@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;
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:23,代码来源:ArrayModel.java

示例10: traverseSiblings

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
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);
			}
		}
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:20,代码来源:ObjectModel.java

示例11: calcString

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
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();
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:30,代码来源:StackFrameModel.java

示例12: getTopStackFrame

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
@Override
public IStackFrame getTopStackFrame() throws DebugException {
	if (frames == null) {
		calculateFrames();
	}
	return frames.get(0);
}
 
开发者ID:tracymiranda,项目名称:dsp4e,代码行数:8,代码来源:DSPThread.java

示例13: getMatrixDimension

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
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);
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:13,代码来源:ArrayModel.java

示例14: handleEventSpawnRunningThreadReply

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:39,代码来源:DSLDebugTargetAdapterTests.java

示例15: handleEventResumingReply

import org.eclipse.debug.core.DebugException; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:45,代码来源:DSLDebugTargetAdapterTests.java


注:本文中的org.eclipse.debug.core.DebugException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。