Java 类org.eclipse.debug.core.model.DebugElement 实例源码
项目:brainfuck
文件:BfProcess.java
@Override
public void interpreterSuspended(InterpreterState state, List<EventReason> eventReasons) {
this.suspendedState = state;
this.isSuspended = true;
synchronized (this.debugElements) {
for (DebugElement element : this.debugElements) {
if (eventReasons.contains(EventReason.BreakPoint) || eventReasons.contains(EventReason.WatchPoint)) {
element.fireSuspendEvent(DebugEvent.BREAKPOINT);
}
if (eventReasons.contains(EventReason.ClientRequest)) {
element.fireSuspendEvent(DebugEvent.CLIENT_REQUEST);
}
if (eventReasons.contains(EventReason.StepEnd)) {
element.fireSuspendEvent(DebugEvent.STEP_END);
}
}
}
}
项目: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();
}
}
}
项目:statecharts
文件:SCTSourceDisplay.java
public void displaySource(Object element, IWorkbenchPage page, boolean forceSourceLookup) {
debugElement = (DebugElement) element;
IEditorPart editor = openEditor(debugElement, page);
displaySource(editor);
}
项目:statecharts
文件:SCTSourceDisplay.java
public IEditorPart openEditor(DebugElement debugElement, IWorkbenchPage page) {
EObject semanticObject = (EObject) debugElement.getAdapter(EObject.class);
IFile file = (IFile) debugElement.getAdapter(IFile.class);
if (file == null)
file = WorkspaceSynchronizer.getFile(semanticObject.eResource());
// check if an editor for the resource is already open, the return the
// opened editor.
// This is important for simulating subdiagrams
IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActiveEditor();
if (activeEditor != null) {
IEditorInput editorInput = activeEditor.getEditorInput();
if (editorInput instanceof IFileEditorInput) {
if (((IFileEditorInput) editorInput).getFile().equals(file))
return activeEditor;
}
}
// check if a Diagram is available and open the editor for the
// corresponding diagram
Diagram diagram = DiagramPartitioningUtil.getDiagramContaining(semanticObject);
if (diagram != null) {
if (URIConverter.INSTANCE.exists(semanticObject.eResource().getURI(), null)) {
Resource sharedDomainResource = DiagramPartitioningUtil.getSharedDomain().getResourceSet()
.getResource(semanticObject.eResource().getURI(), true);
Collection<Diagram> contents = EcoreUtil.getObjectsByType(sharedDomainResource.getContents(),
NotationPackage.Literals.DIAGRAM);
for (Diagram diag : contents) {
if (EcoreUtil.getURI(diag.getElement()).equals(EcoreUtil.getURI(diagram.getElement()))) {
return DiagramPartitioningUtil.openEditor((Diagram) diag);
}
}
}
// No diagram for the semantic element -> open the default editor
// for the file
} else {
IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
try {
return page.openEditor(new FileEditorInput(file), desc.getId());
} catch (PartInitException e) {
e.printStackTrace();
}
}
// No editor found
throw new RuntimeException("No editor found for semantic element " + semanticObject);
}
项目:brainfuck
文件:BfProcess.java
void addEventSourceElement(DebugElement element) {
if (!this.debugElements.contains(element)) {
this.debugElements.add(element);
}
}
项目:brainfuck
文件:BfProcess.java
void removeEventSourceElement(DebugElement element) {
this.debugElements.remove(element);
}