use of org.eclipse.jdt.debug.core.IJavaBreakpoint in project tdi-studio-se by Talend.
the class JavaProcessor method updateGraphicalNodeBreaking.
/**
* yzhang Comment method "updateGraphicalNodeBreaking".
*
* @param breakpoint
*/
private void updateGraphicalNodeBreaking(IJavaBreakpoint breakpoint, boolean removed) {
try {
Integer breakLineNumber = (Integer) breakpoint.getMarker().getAttribute(IMarker.LINE_NUMBER);
if (breakLineNumber == null || breakLineNumber == -1) {
return;
}
IFile codeFile = this.getCodeProject().getFile(this.getSrcCodePath());
if (!codeFile.exists()) {
JDIDebugModel.removeJavaBreakpointListener(this);
return;
}
LineNumberReader lineReader = new LineNumberReader(new InputStreamReader(codeFile.getContents()));
String content = null;
while (lineReader.getLineNumber() < breakLineNumber - 3) {
content = lineReader.readLine();
if (content == null) {
return;
}
}
//$NON-NLS-1$
int startIndex = content.indexOf("[") + 1;
//$NON-NLS-1$
int endIndex = content.indexOf(" main ] start");
if (startIndex != -1 && endIndex != -1) {
String nodeUniqueName = content.substring(startIndex, endIndex);
List<? extends INode> breakpointNodes = CorePlugin.getContext().getBreakpointNodes(process);
List<? extends INode> graphicalNodes = process.getGraphicalNodes();
if (graphicalNodes == null) {
return;
}
for (INode node : graphicalNodes) {
if (node.getUniqueName().equals(nodeUniqueName) && removed && breakpointNodes.contains(node)) {
CorePlugin.getContext().removeBreakpoint(process, node);
if (node instanceof Node) {
final INode currentNode = node;
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
((Node) currentNode).removeStatus(Process.BREAKPOINT_STATUS);
}
});
}
} else if (node.getUniqueName().equals(nodeUniqueName) && !removed && !breakpointNodes.contains(node)) {
CorePlugin.getContext().addBreakpoint(process, node);
if (node instanceof Node) {
final INode currentNode = node;
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
((Node) currentNode).addStatus(Process.BREAKPOINT_STATUS);
}
});
}
}
}
}
} catch (CoreException e) {
RuntimeExceptionHandler.process(e);
} catch (IOException e) {
RuntimeExceptionHandler.process(e);
}
}
Aggregations