Search in sources :

Example 1 with BreakpointContext

use of org.intellij.plugins.xsltDebugger.BreakpointContext in project intellij-community by JetBrains.

the class XsltDebuggerEditorsProvider method createDocument.

@NotNull
@Override
public Document createDocument(@NotNull Project project, @NotNull String text, @Nullable XSourcePosition sourcePosition, @NotNull EvaluationMode mode) {
    final PsiFile psiFile = PsiFileFactory.getInstance(project).createFileFromText("XPathExpr." + myFileType.getDefaultExtension(), myFileType, text, LocalTimeCounter.currentTime(), true);
    if (sourcePosition instanceof XsltSourcePosition && ((XsltSourcePosition) sourcePosition).getLocation() instanceof Debugger.StyleFrame) {
        final Debugger.Locatable location = ((XsltSourcePosition) sourcePosition).getLocation();
        final EvalContextProvider context = new EvalContextProvider(((Debugger.StyleFrame) location).getVariables());
        context.attachTo(psiFile);
    } else {
        final PsiElement contextElement = XsltBreakpointHandler.findContextElement(project, sourcePosition);
        if (contextElement != null) {
            final BreakpointContext context = new BreakpointContext(contextElement);
            context.attachTo(psiFile);
        }
    }
    final Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
    assert document != null;
    return document;
}
Also used : Debugger(org.intellij.plugins.xsltDebugger.rt.engine.Debugger) BreakpointContext(org.intellij.plugins.xsltDebugger.BreakpointContext) PsiFile(com.intellij.psi.PsiFile) Document(com.intellij.openapi.editor.Document) PsiElement(com.intellij.psi.PsiElement) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Document (com.intellij.openapi.editor.Document)1 PsiElement (com.intellij.psi.PsiElement)1 PsiFile (com.intellij.psi.PsiFile)1 BreakpointContext (org.intellij.plugins.xsltDebugger.BreakpointContext)1 Debugger (org.intellij.plugins.xsltDebugger.rt.engine.Debugger)1 NotNull (org.jetbrains.annotations.NotNull)1