use of org.netbeans.spi.debugger.jpda.EditorContext.Operation in project enclojure by EricThorsen.
the class CljSourcePath method annotateOperations.
private static List annotateOperations(JPDADebugger debugger, String url, Operation currentOperation, List lastOperations, int locLineNumber) {
List annotations = null;
if (currentOperation != null) {
annotations = new ArrayList();
annotations.add(createAnnotation(debugger, url, currentOperation, EditorContext.CURRENT_LINE_ANNOTATION_TYPE, true));
int lineNumber;
if (currentOperation.getMethodName() != null) {
lineNumber = currentOperation.getMethodStartPosition().getLine();
} else {
lineNumber = currentOperation.getStartPosition().getLine();
}
annotations.add(EditorContextBridge.getContext().annotate(url, lineNumber, EditorContext.CURRENT_EXPRESSION_CURRENT_LINE_ANNOTATION_TYPE, debugger));
}
boolean isNewLineExp = false;
if (lastOperations != null && lastOperations.size() > 0) {
if (annotations == null) {
annotations = new ArrayList();
}
isNewLineExp = currentOperation == null;
for (int i = 0; i < lastOperations.size(); i++) {
Operation lastOperation = (Operation) lastOperations.get(i);
if (currentOperation == lastOperation && i == lastOperations.size() - 1) {
annotations.add(createAnnotation(debugger, url, lastOperation, EditorContext.CURRENT_OUT_OPERATION_ANNOTATION_TYPE, false));
int lineNumber = lastOperation.getEndPosition().getLine();
annotations.add(EditorContextBridge.getContext().annotate(url, lineNumber, EditorContext.CURRENT_EXPRESSION_CURRENT_LINE_ANNOTATION_TYPE, debugger));
isNewLineExp = false;
} else {
annotations.add(createAnnotation(debugger, url, lastOperation, EditorContext.CURRENT_LAST_OPERATION_ANNOTATION_TYPE, true));
}
}
}
if (isNewLineExp) {
annotations.add(EditorContextBridge.getContext().annotate(url, locLineNumber, EditorContext.CURRENT_LINE_ANNOTATION_TYPE, debugger));
}
if (annotations != null) {
return annotations;
} else {
return Collections.EMPTY_LIST;
}
}
use of org.netbeans.spi.debugger.jpda.EditorContext.Operation in project enclojure by EricThorsen.
the class CljSourcePath method annotate.
public Object annotate(CallStackFrame csf, String stratumn) {
int lineNumber = csf.getLineNumber(stratumn);
if (lineNumber < 1) {
return null;
}
Operation operation = csf.getCurrentOperation(stratumn);
try {
if (operation != null) {
int startOffset;
int endOffset;
if (operation.getMethodName() != null) {
startOffset = operation.getMethodStartPosition().getOffset();
endOffset = operation.getMethodEndPosition().getOffset();
} else {
startOffset = operation.getStartPosition().getOffset();
endOffset = operation.getEndPosition().getOffset();
}
return EditorContextBridge.getContext().annotate(getURL(convertSlash(csf.getSourcePath(stratumn)), true), startOffset, endOffset, EditorContext.CALL_STACK_FRAME_ANNOTATION_TYPE, debugger);
} else {
return EditorContextBridge.getContext().annotate(getURL(convertSlash(csf.getSourcePath(stratumn)), true), lineNumber, EditorContext.CALL_STACK_FRAME_ANNOTATION_TYPE, debugger);
}
} catch (AbsentInformationException e) {
return EditorContextBridge.getContext().annotate(getURL(convertClassNameToRelativePath(csf.getClassName()), true), lineNumber, EditorContext.CALL_STACK_FRAME_ANNOTATION_TYPE, debugger);
}
}
use of org.netbeans.spi.debugger.jpda.EditorContext.Operation in project enclojure by EricThorsen.
the class CljSourcePath method annotate.
public Object annotate(JPDAThread t, String stratumn) {
int lineNumber = t.getLineNumber(stratumn);
if (lineNumber < 1) {
return null;
//AST ast = t.getAST(stratumn);
}
Operation operation = t.getCurrentOperation();
String url;
try {
url = getURL(convertSlash(t.getSourcePath(stratumn)), true);
} catch (AbsentInformationException e) {
url = getURL(convertClassNameToRelativePath(t.getClassName()), true);
}
List operationsAnn = annotateOperations(debugger, url, operation, t.getLastOperations(), lineNumber);
if (operation == null) {
if (operationsAnn.size() == 0) {
return EditorContextBridge.getContext().annotate(url, lineNumber, EditorContext.CURRENT_LINE_ANNOTATION_TYPE, debugger);
} else {
/*
operationsAnn.add(EditorContextBridge.annotate (
url,
lineNumber,
EditorContext.CURRENT_LINE_ANNOTATION_TYPE,
debugger
));
*/
}
}
return operationsAnn;
}
Aggregations