Community
Participate
Working Groups
Try to insert the "systrace" template in a conditional breakpoint expression. It will just yield this, instead of properly filling in the context variables: System.out.println("enclosing_type.enclosing_method()"); Expected for a breakpoint in p.q.MyType#foo(): System.out.println("MyType.foo()"); The problem is that org.eclipse.jdt.internal.corext.template.java.CompilationUnitContextType.EnclosingJavaElement#resolve(TemplateContext) is called with a JavaContext whose fCompilationUnit is null, so the context is lost. org.eclipse.jdt.internal.debug.ui.contentassist.JavaDebugContentAssistProcessor#computeCompletionProposals(ITextViewer, int) probably needs to pass a non-null CU when calling TemplateEngine#complete(ITextViewer, int, ICompilationUnit). The hard part is that this probably cannot be the actual ICompilationUnit, because that - would allow template variables like the ImportsResolver to modify a CU that should not be modified, and - would not work for breakpoints in class files with attached source JavaDebugContentAssistProcessor#computeCompletionProposals(..) already knows the enclosing "IType type". This could be a starting point for passing on the required context, and TemplateContext#fReadOnly could help avoiding unwanted non-local edits. Another solution could be to actually create a new working copy and then disregard non-local changes.
(In reply to Markus Keller from comment #0) I tried passing the Compilation Unit for the document( forgetting about having working copy and throwing the changes) for once, but still I did get the resolved type and method. org.eclipse.jdt.internal.corext.template.java.CompilationUnitContextType.EnclosingJavaElement.resolve(TemplateContext) does not get the element. Where as While working on Tracepoint creation Bug 71020, when passing the Compilation unit and just applying the context to resolve the template, it gets resolved.
Moving out.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
Still valid. If someone wants to work on this?
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.