Java 类org.eclipse.debug.core.model.IDebugTarget 实例源码
项目:statecharts
文件:HotModelReplacementListener.java
public void hotCodeReplaceFailed(final List<IDebugTarget> targets) {
final Display display = Display.getDefault();
try {
final String title = "Model changed during simulation";
display.asyncExec(new Runnable() {
public void run() {
if (display.isDisposed()) {
return;
}
SimulationLaunchErrorDialog dialog = new SimulationLaunchErrorDialog(
DebugUIPlugin.getShell(), title, MESSAGE, status,
targets);
dialog.setBlockOnOpen(false);
dialog.open();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
项目:statecharts
文件:SCTHotModelReplacementManager.java
private void handleCloseEvent(IResourceChangeEvent event) {
if (event.getResource() instanceof IProject) {
IProject project = ((IProject) event.getResource());
for (IDebugTarget target : activeTargets) {
EObject object = (EObject) target.getAdapter(EObject.class);
IFile file = WorkspaceSynchronizer.getFile(object.eResource());
if (project.equals(file.getProject())) {
try {
target.terminate();
} catch (DebugException e) {
e.printStackTrace();
}
}
}
}
}
项目:statecharts
文件:SCTHotModelReplacementManager.java
private void handleHotModelReplacement() {
// first implementation: If the underlying model does not change
// semantically, no notification is required...
List<IDebugTarget> targets = getAffectedTargets();
List<IDebugTarget> modelReplacementFailedTargets = new ArrayList<IDebugTarget>();
for (IDebugTarget sctDebugTarget : targets) {
// Reload the Statechart form the changes resource
Statechart newStatechart = ResourceUtil.loadStatechart(((SCTDebugElement) sctDebugTarget)
.getResourceString());
if (!EcoreUtil.equals(newStatechart, (EObject) sctDebugTarget.getAdapter(EObject.class))) {
// The model semantically changed, we have to create a
// notificiation for that....
modelReplacementFailedTargets.add(sctDebugTarget);
}
}
if (modelReplacementFailedTargets.size() > 0) {
notifyHotModelReplacementFailed(targets);
}
}
项目:statecharts
文件:SCTHotModelReplacementManager.java
private List<IDebugTarget> getAffectedTargets() {
List<IDebugTarget> targets = new ArrayList<IDebugTarget>();
synchronized (activeTargets) {
for (IDebugTarget debugTarget : activeTargets) {
if (debugTarget instanceof SCTDebugTarget) {
String resourceString = ((SCTDebugElement) debugTarget).getResourceString();
IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(resourceString);
if (changedFiles.contains(resource)) {
targets.add(debugTarget);
}
}
}
}
return targets;
}
项目:brainfuck
文件:BfProcess.java
@Override
public void interpreterFinished(InterpreterState state, List<EventReason> reasons) {
this.isStopped = true;
this.isSuspended = false;
IDebugTarget target = null;
if (DebugPlugin.getDefault() != null) {
synchronized (this.debugElements) {
for (DebugElement element : this.debugElements) {
element.fireTerminateEvent();
target = element.getDebugTarget();
}
}
DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[]{new DebugEvent(BfProcess.this, DebugEvent.TERMINATE)});
if (target != null && target instanceof BfDebugTarget) {
((BfDebugTarget) target).fireTerminateEvent();
}
}
}
项目:chromedevtools
文件:DebugTargetImpl.java
public static List<ConnectedTargetData> getAllConnectedTargetDatas() {
IDebugTarget[] array = DebugPlugin.getDefault().getLaunchManager().getDebugTargets();
List<ConnectedTargetData> result = new ArrayList<ConnectedTargetData>(array.length);
for (IDebugTarget target : array) {
if (target instanceof DebugTargetImpl == false) {
continue;
}
if (target.getLaunch().isTerminated()) {
continue;
}
DebugTargetImpl debugTargetImpl = (DebugTargetImpl) target;
ConnectedTargetData connectedData = debugTargetImpl.getConnectedDataOrNull();
if (connectedData == null) {
continue;
}
result.add(connectedData);
}
return result;
}
项目:chromedevtools
文件:SynchronizeBreakpoints.java
public static ConnectedTargetData getConnectionTargetData(Object element) {
IDebugTarget debugTarget;
if (element instanceof ILaunch) {
ILaunch launch = (ILaunch) element;
debugTarget = launch.getDebugTarget();
} else if (element instanceof IDebugElement) {
IDebugElement debugElement = (IDebugElement) element;
debugTarget = debugElement.getDebugTarget();
} else {
return null;
}
if (debugTarget instanceof DebugTargetImpl == false) {
return null;
}
DebugTargetImpl debugTargetImpl = (DebugTargetImpl) debugTarget;
return debugTargetImpl.getConnectedOrNull();
}
项目:watchdog
文件:DebuggerListener.java
@Override
public void handleDebugEvents(DebugEvent[] events) {
for (DebugEvent event : events) {
switch (event.getKind()) {
case DebugEvent.CREATE:
if (event.getSource() instanceof IDebugTarget) {
WatchDogEventType.START_DEBUG.process(this);
}
break;
case DebugEvent.TERMINATE:
if (event.getSource() instanceof IDebugTarget) {
WatchDogEventType.END_DEBUG.process(this);
}
break;
default:
break;
}
}
}
项目:Pydev
文件:PyDebugTargetServer.java
public PyDebugTargetServer(ILaunch launch, IPath[] file, RemoteDebuggerServer debugger) {
this.file = file;
this.debugger = debugger;
this.threads = new PyThread[0];
this.launch = launch;
if (launch != null) {
for (IDebugTarget target : launch.getDebugTargets()) {
if (target instanceof PyDebugTargetServer && target.isTerminated()) {
launch.removeDebugTarget(target);
}
}
launch.addDebugTarget(this);
}
debugger.addTarget(this);
PyExceptionBreakPointManager.getInstance().addListener(this);
PyPropertyTraceManager.getInstance().addListener(this);
IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
breakpointManager.addBreakpointListener(this);
// we have to know when we get removed, so that we can shut off the debugger
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
}
项目:Pydev
文件:ProcessServerOutputStream.java
/**
* Checks if the last thing entered was a new line, and if it was, notifies clients about it.
*/
private void checkFinishedLine() {
String s = this.toString();
this.reset();
char c;
if (s.length() > 0 && ((c = s.charAt(s.length() - 1)) == '\n' || c == '\r')) {
IAdaptable context = DebugUITools.getDebugContext();
if (context != null) {
s = StringUtils.rightTrim(s);
Object adapter = context.getAdapter(IDebugTarget.class);
if (adapter instanceof AbstractDebugTarget) {
AbstractDebugTarget target = (AbstractDebugTarget) adapter;
for (IConsoleInputListener listener : participants) {
listener.newLineReceived(s, target);
}
}
}
}
}
项目:Pydev
文件:PydevIProcessFactory.java
public static String getEncodingFromFrame(PyStackFrame selectedFrame) {
try {
IDebugTarget adapter = (IDebugTarget) selectedFrame.getAdapter(IDebugTarget.class);
if (adapter == null) {
return "UTF-8";
}
IProcess process = adapter.getProcess();
if (process == null) {
return "UTF-8";
}
ILaunch launch = process.getLaunch();
if (launch == null) {
Log.log("Unable to get launch for: " + process);
return "UTF-8";
}
return getEncodingFromLaunch(launch);
} catch (Exception e) {
Log.log(e);
return "UTF-8";
}
}
项目:Pydev
文件:PydevConsoleInterpreter.java
public void setLaunchAndRelatedInfo(ILaunch launch) {
this.setLaunch(launch);
if (launch != null) {
IDebugTarget debugTarget = launch.getDebugTarget();
IInterpreterInfo projectInterpreter = null;
if (debugTarget instanceof PyDebugTarget) {
PyDebugTarget pyDebugTarget = (PyDebugTarget) debugTarget;
PythonNature nature = PythonNature.getPythonNature(pyDebugTarget.project);
if (nature != null) {
ArrayList<IPythonNature> natures = new ArrayList<>(1);
natures.add(nature);
this.setNaturesUsed(natures);
try {
projectInterpreter = nature.getProjectInterpreter();
this.setInterpreterInfo(projectInterpreter);
} catch (Throwable e1) {
Log.log(e1);
}
}
}
}
}
项目:Pydev
文件:CurrentExceptionView.java
@Override
protected void onSetTreeInput() {
IDebugTarget[] debugTargets = DebugPlugin.getDefault().getLaunchManager().getDebugTargets();
List<AbstractDebugTarget> targets = new ArrayList<AbstractDebugTarget>();
if (debugTargets.length > 0) {
for (IDebugTarget iDebugTarget : debugTargets) {
if (iDebugTarget instanceof AbstractDebugTarget) {
AbstractDebugTarget debugTarget = (AbstractDebugTarget) iDebugTarget;
if (!debugTarget.isTerminated() && !debugTarget.isDisconnected()) {
if (debugTarget.hasCurrExceptions()) {
targets.add(debugTarget);
}
}
}
}
}
viewer.setInput(targets);
}
项目:Pydev
文件:PySourceLocator.java
@Override
public IEditorInput getEditorInput(Object element) {
IEditorInput edInput = null;
if (element instanceof PyStackFrame) {
PyStackFrame pyStackFrame = (PyStackFrame) element;
IPath path = pyStackFrame.getPath();
// get the project of the file that is being debugged
Object target = pyStackFrame.getAdapter(IDebugTarget.class);
if (target instanceof PyDebugTarget) {
lastProject = ((PyDebugTarget) target).project;
}
if (path != null && !path.toString().startsWith("<")) {
edInput = locatorBase.createEditorInput(path, true, pyStackFrame, lastProject);
}
}
return edInput;
}
项目:Pydev
文件:ConsoleCompletionsPageParticipant.java
/**
* Gets the completions at the passed offset.
*/
@Override
public ICompletionProposal[] getCompletions(String text, String actTok, int offset,
boolean showForTabCompletion)
throws Exception {
this.text = text;
this.actTok = actTok;
this.offset = offset;
PyStackFrame stackFrame = currentPyStackFrameForConsole.getLastSelectedFrame();
if (stackFrame != null) {
AbstractDebugTarget target = (AbstractDebugTarget) stackFrame.getAdapter(IDebugTarget.class);
if (target != null) {
GetCompletionsCommand cmd = new GetCompletionsCommand(target, actTok, stackFrame.getLocalsLocator()
.getPyDBLocation());
cmd.setCompletionListener(this);
target.postCommand(cmd);
}
return waitForCommand();
}
return EMPTY_COMPLETION_PROPOSALS;
}
项目:gemoc-studio-modeldebugging
文件:DSLDebugTargetAdapterTests.java
/**
* Test {@link DSLDebugTargetAdapter#isAdapterForType(Object)}.
*/
@Test
public void isAdapterForType() {
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();
assertTrue(debugTarget.isAdapterForType(IDebugTarget.class));
}
项目:gemoc-studio-modeldebugging
文件:DSLEclipseDebugIntegration.java
/**
* 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;
}
项目:gemoc-studio-modeldebugging
文件:DSLEclipseDebugIntegration.java
/**
* Gets an {@link IDebugTarget} form a {@link DebugTarget}.
*
* @param target
* the {@link DebugTarget}
* @return the {@link IDebugTarget}
*/
public DSLDebugTargetAdapter getDebugTarget(DebugTarget target) {
synchronized(target) {
final DSLDebugTargetAdapter res = (DSLDebugTargetAdapter)adapt(target, IDebugTarget.class);
if (res == null) {
throw new IllegalStateException("can't addapt DebugTarget to IDebugTarget.");
}
return res;
}
}
项目:gemoc-studio-modeldebugging
文件:DSLDebugModelPresentation.java
/**
* Changes the current {@link IStackFrame}.
*
* @param frame
* the selected {@link IStackFrame}
*/
protected void changeCurrentStackFrame(IStackFrame frame) {
final IDebugTarget debugTarget = frame.getDebugTarget();
for (IDSLCurrentInstructionListener listener : ((DSLDebugTargetAdapter)debugTarget)
.getCurrentInstructionListeners()) {
listener.setCurrentFrame(frame.getModelIdentifier(), ((DSLStackFrameAdapter)frame).getHost());
}
}
项目: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
文件: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);
}
项目:google-cloud-eclipse
文件:CloudSdkDebugTargetPresentation.java
@Override
public String getText(Object element) {
if (element instanceof IDebugTarget) {
try {
IDebugTarget target = (IDebugTarget) element;
String text = target.getName();
return target.isTerminated() ? Messages.getString("target.terminated", text) : text;
} catch (DebugException ex) {
logger.log(Level.FINE, "Unexpected execption", ex);
/* FALLTHROUGH */
}
}
return super.getText(element);
}
项目:google-cloud-eclipse
文件:CloudSdkDebugTargetPresentation.java
@Override
public Image getImage(Object element) {
if (element instanceof IDebugTarget) {
if (image == null) {
image = SharedImages.CLOUDSDK_IMAGE_DESCRIPTOR.createImage();
}
return image;
}
return super.getImage(element);
}
项目:google-cloud-eclipse
文件:MockLaunch.java
@Override
public boolean canTerminate() {
for (IProcess p : processes) {
if (p.canTerminate()) {
return true;
}
}
for (IDebugTarget t : targets) {
if (t.canTerminate()) {
return true;
}
}
return false;
}
项目:google-cloud-eclipse
文件:MockLaunch.java
@Override
public boolean isTerminated() {
for (IProcess p : processes) {
if (!p.isTerminated()) {
return false;
}
}
for (IDebugTarget t : targets) {
if (!t.isTerminated()) {
return false;
}
}
return true;
}
项目:google-cloud-eclipse
文件:MockLaunch.java
@Override
public void terminate() throws DebugException {
for (Iterator<IProcess> iter = processes.iterator(); iter.hasNext(); iter.remove()) {
IProcess p = iter.next();
if (p.canTerminate()) {
p.terminate();
}
}
for (Iterator<IDebugTarget> iter = targets.iterator(); iter.hasNext(); iter.remove()) {
IDebugTarget t = iter.next();
if (t.canTerminate()) {
t.terminate();
}
}
}
项目:cft
文件:ConnectToDebuggerListener.java
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;
}
}
}
}
}
}
项目:statecharts
文件:AbstractSimulationEngine.java
protected Object getDebugTarget() {
IDebugTarget[] debugTargets = DebugPlugin.getDefault().getLaunchManager().getDebugTargets();
for (IDebugTarget iDebugTarget : debugTargets) {
if (iDebugTarget.isTerminated())
continue;
if (iDebugTarget.getAdapter(ISimulationEngine.class) == this)
return iDebugTarget;
}
return null;
}
项目:statecharts
文件:SCTPerspectiveManager.java
protected boolean allTargetsTerminated() {
ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
for (ILaunch launch : launches) {
for (IDebugTarget target : launch.getDebugTargets()) {
if (!target.isTerminated())
return false;
}
}
return true;
}
项目:statecharts
文件:AbstractDebugTargetView.java
protected void setActiveSession() {
// if a simulation session is running, we should initialize with its
// content
IAdaptable debugContext = DebugUITools.getDebugContext();
if (debugContext != null) {
IDebugTarget debugTarget = (IDebugTarget) debugContext.getAdapter(IDebugTarget.class);
if (debugTarget != null) {
if (!debugTarget.isTerminated()) {
this.debugTarget = (IDebugTarget) debugTarget;
activeTargetChanged(this.debugTarget);
}
}
}
}
项目:statecharts
文件:AbstractDebugTargetView.java
protected void changeTarget(IDebugTarget newTarget) {
if (newTarget == debugTarget) {
return;
}
if (newTarget != debugTarget && newTarget != null && !newTarget.isTerminated()) {
debugTarget = newTarget;
activeTargetChanged(newTarget);
} else {
setActiveSession();
}
}
项目:statecharts
文件:SimulationView.java
protected void activeTargetChanged(final IDebugTarget debugTarget) {
openEditorForTarget(debugTarget);
updateTypeSystem(debugTarget);
ISimulationEngine engine = (ISimulationEngine) debugTarget.getAdapter(ISimulationEngine.class);
timeScheduler = (DefaultTimeTaskScheduler) engine.getTimeTaskScheduler();
setViewerInput(engine.getExecutionContext());
updateActions();
updateSessionDropdownInput(debugTarget);
}
项目:statecharts
文件:SimulationView.java
protected void openEditorForTarget(final IDebugTarget debugTarget) {
if (this.debugTarget != null) {
EObject adapter = debugTarget.getAdapter(EObject.class);
if (adapter instanceof Statechart) {
Statechart statechart = (Statechart) adapter;
Diagram diagram = DiagramPartitioningUtil.getDiagramContaining(statechart);
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
DiagramPartitioningUtil.openEditor(diagram);
}
});
}
}
}
项目:statecharts
文件:SimulationView.java
protected void updateSessionDropdownInput(final IDebugTarget debugTarget) {
Display.getDefault().asyncExec(() -> {
if (debugTarget != null) {
if (!targets.contains(debugTarget)) {
targets.add(debugTarget);
sessionDropdown.setInput(targets);
sessionDropdown.setSelection(new StructuredSelection(debugTarget), true);
changeTarget(debugTarget);
}
sessionDropdown.refresh();
}
});
}
项目:statecharts
文件:SimulationView.java
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
IDebugTarget debugTarget = (IDebugTarget) selection.getFirstElement();
if (debugTarget != null) {
changeTarget(debugTarget);
sctSourceDisplayDispatcher.displaySource(debugTarget, SimulationView.this.getSite().getPage(), true);
}
}
项目:statecharts
文件:HighlightingSubmachineDecorationProvider.java
public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
PlatformObject object = (PlatformObject) ((IStructuredSelection) event.getContext()).getFirstElement();
if (object == null)
return;
IDebugTarget newTarget = (IDebugTarget) object.getAdapter(IDebugTarget.class);
if (newTarget != debugTarget && newTarget != null && !newTarget.isTerminated()) {
debugTarget = newTarget;
}
}
}
项目:statecharts
文件:SCTSourceDisplayDispatcher.java
protected SCTDebugTarget unwrapTarget(Object element) {
if (element instanceof Launch) {
IDebugTarget debugTarget = ((Launch) element).getDebugTarget();
if (debugTarget instanceof SCTDebugTarget)
return (SCTDebugTarget) debugTarget;
} else if (element instanceof SCTDebugElement) {
return (SCTDebugTarget) ((SCTDebugElement) element).getDebugTarget();
}
return null;
}
项目:statecharts
文件:SCTSourceDisplayDispatcher.java
protected void handleDebugTargetTerminated(DebugEvent debugEvent) {
Object source = debugEvent.getSource();
if (source instanceof IDebugTarget) {
IDebugTarget target = (IDebugTarget) source;
if (target == activeDebugTarget) {
activeSourceDisplay.terminate(true);
activeSourceDisplay = null;
}
}
}
项目:statecharts
文件:TerminateLaunchStatusHandler.java
public Object handleStatus(final IStatus status, final Object source) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
Shell shell = DebugUIPlugin.getShell();
SimulationLaunchErrorDialog dialog = new SimulationLaunchErrorDialog(shell,
"Exception occured during simulation", ERROR_MSG, status, Collections
.singletonList((IDebugTarget) source));
dialog.setBlockOnOpen(false);
dialog.open();
}
});
return null;
}
项目:statecharts
文件:SCTHotModelReplacementManager.java
public void handleDebugEvents(DebugEvent[] events) {
for (DebugEvent debugEvent : events) {
if (debugEvent.getKind() == DebugEvent.TERMINATE) {
Object source = debugEvent.getSource();
if (source instanceof IAdaptable) {
Object adapter = ((IAdaptable) source).getAdapter(IDebugTarget.class);
if (adapter instanceof SCTDebugTarget) {
unregisterSCTTarget((SCTDebugTarget) adapter);
}
}
}
}
}