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


Java IThread类代码示例

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


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

示例1: getThreads

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
/**
 * Test {@link DSLDebugTargetAdapter#getThreads()}.
 * 
 * @throws DebugException
 *             if fail
 */
@Test
public void getThreads() 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();

	createThreads(eDebugTarget);

	final IThread[] threads = debugTarget.getThreads();

	assertEquals(0, testEventProcessor.getEvents().size());
	assertEquals(8, threads.length);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:23,代码来源:DSLDebugTargetAdapterTests.java

示例2: displayVariable

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
/**
 * Render a selected variable.
 * 
 * @param selection
 *            the selection object
 * @param element
 *            the variable element
 * @throws DebugException
 */
private void displayVariable(IStructuredSelection selection, IDebugElement element) throws DebugException {
    IValue value = ((IVariable) element).getValue();

    if (value instanceof IJavaPrimitiveValue) {
        setBrowserTextToPrimitive((IJavaPrimitiveValue) value);
    } else {
        TreePath firstElementTreePath = ((TreeSelection) selection).getPaths()[0];
        String watchExpression = generateWatchExpression(firstElementTreePath);
        String messageExpression = generateMessageExpression(watchExpression);

        // Iterate all threads and run our rendering
        // expression in them in the hopes that we can find
        // the relevant selection in only one thread
        // FIXME find a better way to derive the correct thread!
        IWatchExpressionDelegate delegate = DebugPlugin.getDefault().getExpressionManager()
                .newWatchExpressionDelegate(element.getModelIdentifier());
        for (IThread thread : element.getDebugTarget().getThreads()) {
            delegate.evaluateExpression(messageExpression, thread, this);
        }
    }
}
 
开发者ID:danielrozenberg,项目名称:vebugger,代码行数:31,代码来源:VisualDetailPane.java

示例3: getThreads

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
@Override
public IThread[] getThreads() throws DebugException {
    if (debugger == null) {
        return null;
    }

    if (threads == null) {
        ThreadListCommand cmd = new ThreadListCommand(this);
        this.postCommand(cmd);
        try {
            cmd.waitUntilDone(1000);
            threads = cmd.getThreads();
        } catch (InterruptedException e) {
            threads = new PyThread[0];
        }
    }
    return threads;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:19,代码来源:AbstractDebugTarget.java

示例4: waitForSuspendedThread

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
/**
 * Waits until some thread is suspended.
 */
protected IThread waitForSuspendedThread(final PyDebugTarget target) throws Throwable {
    final IThread[] ret = new IThread[1];

    waitForCondition(new ICallback() {

        @Override
        public Object call(Object args) throws Exception {
            IThread[] threads = target.getThreads();
            for (IThread thread : threads) {
                if (thread.isSuspended()) {
                    ret[0] = thread;
                    return true;
                }
            }
            return false;
        }
    }, "waitForSuspendedThread");

    return ret[0];
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:24,代码来源:DebuggerTestUtils.java

示例5: getStackFrame

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
/**
 * Returns the current stack frame context, or <code>null</code> if none.
 * 
 * @return the current stack frame context, or <code>null</code> if none
 */
public static IJavaStackFrame getStackFrame() {
    IAdaptable adaptable = DebugUITools.getDebugContext();
    if (adaptable != null) {
    	Object x = adaptable.getAdapter(IJavaStackFrame.class);
    	if (x != null)
    		return (IJavaStackFrame)x;
    }
    try {
		for (ILaunch launch: DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
			for (IThread thread: launch.getDebugTarget().getThreads()) {
				IStackFrame[] frames = thread.getStackFrames();
				if (frames.length > 0)
					return (IJavaStackFrame)frames[0];
			}
		}
    } catch (DebugException e) {
    	throw new RuntimeException(e);
    }
	return null;
}
 
开发者ID:jgalenson,项目名称:codehint,代码行数:26,代码来源:EclipseUtils.java

示例6: initSupportedTypes

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
/**
 * Initializes {@link DSLEclipseDebugIntegration#SUPPORTED_TYPES}.
 * 
 * @return the {@link Set} of
 *         {@link org.eclipse.emf.common.notify.AdapterFactory#isFactoryForType(Object) supported
 *         types}.
 */
private static Set<Object> initSupportedTypes() {
final Set<Object> res = new HashSet<Object>();

res.add(IThread.class);
res.add(IDebugTarget.class);
res.add(IStackFrame.class);
res.add(IVariable.class);
res.add(IBreakpoint.class);

return res;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:19,代码来源:DSLEclipseDebugIntegration.java

示例7: getThread

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
/**
 * Gets an {@link IThread} form a {@link Thread}.
 * 
 * @param thread
 *            the {@link Thread}
 * @return the {@link IThread}
 */
public DSLThreadAdapter getThread(Thread thread) {
synchronized(thread) {
	final DSLThreadAdapter res = (DSLThreadAdapter)adapt(thread, IThread.class);
	if (res == null) {
	throw new IllegalStateException("can't addapt Thread to IThread.");
	}
	return res;
}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:17,代码来源:DSLEclipseDebugIntegration.java

示例8: getThreads

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IDebugTarget#getThreads()
 */
public IThread[] getThreads() throws DebugException {
	final List<IThread> res = new ArrayList<IThread>();

	for (Thread thread : getHost().getThreads()) {
		res.add(factory.getThread(thread));
	}

	return res.toArray(new IThread[res.size()]);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:15,代码来源:DSLDebugTargetAdapter.java

示例9: stepInto

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
static void stepInto(ExecutionEvent event) {
	if(launch != null) {
		try {
			for(IThread t : launch.getDebugTarget().getThreads())
				if(t.canStepInto())
					t.stepInto();
		} catch (DebugException e) {
			e.printStackTrace();
		}
	}
	//		showView(event);
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:13,代码来源:Activator.java

示例10: stepOver

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

示例11: stepReturn

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

示例12: handleDebugEvents

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
public void handleDebugEvents(DebugEvent[] events) {
	if (events != null) {
		int size = events.length;
		for (int i = 0; i < size; i++) {

			if (events[i].getKind() == DebugEvent.TERMINATE) {

				Object source = events[i].getSource();

				// THe event source should be a thread as remote debugging
				// does not launch a separate local process
				// However, multiple threads may be associated with the
				// debug target, so to check if an app
				// is disconnected from the debugger, additional termination
				// checks need to be performed on the debug target
				// itself
				if (source instanceof IThread) {
					IDebugTarget debugTarget = ((IThread) source).getDebugTarget();

					// Be sure to only handle events from the debugger
					// source that generated the termination event. Do not
					// handle
					// any other application that is currently connected to
					// the debugger.
					if (eventSource.equals(debugTarget) && debugTarget.isDisconnected()) {

						DebugPlugin.getDefault().removeDebugEventListener(this);
						ApplicationDebugLauncher.terminateLaunch(launchId);
						return;
					}
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:cft,代码行数:36,代码来源:ConnectToDebuggerListener.java

示例13: handleDebugEvents

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
public void handleDebugEvents(DebugEvent[] events) {
	if (events != null) {
		int size = events.length;
		for (int i = 0; i < size; i++) {

			if (events[i].getKind() == DebugEvent.TERMINATE) {

				Object source = events[i].getSource();

				// THe event source should be a thread as remote debugging
				// does not launch a separate local process
				// However, multiple threads may be associated with the
				// debug target, so to check if an app
				// is disconnected from the debugger, additional termination
				// checks need to be performed on the debug target
				// itself
				if (source instanceof IThread) {
					IDebugTarget debugTarget = ((IThread) source).getDebugTarget();

					// Be sure to only handle events from the debugger
					// source that generated the termination event. Do not
					// handle
					// any other application that is currently connected to
					// the debugger.
					if (eventSource.equals(debugTarget) && debugTarget.isDisconnected()) {

						DebugPlugin.getDefault().removeDebugEventListener(this);
						DebugOperations.terminateLaunch(launchId);
						return;
					}
				}
			}
		}
	}
}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:36,代码来源:ConnectToDebuggerListener.java

示例14: fireEventForThread

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
private void fireEventForThread(int kind, int detail) {
  try {
    IThread[] threads = debugTargetState.getThreads();
    if (threads.length > 0) {
      DebugTargetImpl.fireDebugEvent(new DebugEvent(threads[0], kind, detail));
    }
  } catch (DebugException e) {
    // Actually, this is not thrown in our getThreads()
    return;
  }
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:12,代码来源:ConnectedTargetData.java

示例15: createRequests

import org.eclipse.debug.core.model.IThread; //导入依赖的package包/类
protected void createRequests()
{
  for (final IThread thread : this.getThreads())
  {
    if (thread instanceof JiveThread)
    {
      ((JiveThread) thread).createRequests();
    }
  }
  eventHandlerFactory.createRequests();
}
 
开发者ID:UBPL,项目名称:jive,代码行数:12,代码来源:JiveDebugTarget.java


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