diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/XsltSupport.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/XsltSupport.java index 0b16c272cc4b..76887f89f3eb 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/XsltSupport.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/XsltSupport.java @@ -231,7 +231,7 @@ public class XsltSupport { return level != XsltChecker.LanguageLevel.NONE; } - public static XsltChecker.LanguageLevel getXsltLanguageLevel(PsiFile psiFile) { + public static XsltChecker.LanguageLevel getXsltLanguageLevel(@NotNull PsiFile psiFile) { final CachedValuesManager mgr = CachedValuesManager.getManager(psiFile.getProject()); return mgr.getParameterizedCachedValue(psiFile, FORCE_XSLT_KEY, XsltSupportProvider.INSTANCE, false, psiFile); } diff --git a/plugins/xslt-debugger/src/META-INF/plugin.xml b/plugins/xslt-debugger/src/META-INF/plugin.xml index c02c972de3da..2670f2b5e4bf 100644 --- a/plugins/xslt-debugger/src/META-INF/plugin.xml +++ b/plugins/xslt-debugger/src/META-INF/plugin.xml @@ -20,8 +20,7 @@ - - + diff --git a/plugins/xslt-debugger/src/org/intellij/plugins/xsltDebugger/XsltBreakpointType.java b/plugins/xslt-debugger/src/org/intellij/plugins/xsltDebugger/XsltBreakpointType.java index 65fa36c0ee2b..6b3205e94a1f 100644 --- a/plugins/xslt-debugger/src/org/intellij/plugins/xsltDebugger/XsltBreakpointType.java +++ b/plugins/xslt-debugger/src/org/intellij/plugins/xsltDebugger/XsltBreakpointType.java @@ -8,7 +8,10 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiManager; +import com.intellij.xdebugger.XSourcePosition; import com.intellij.xdebugger.breakpoints.XBreakpointProperties; +import com.intellij.xdebugger.breakpoints.XLineBreakpoint; import com.intellij.xdebugger.breakpoints.XLineBreakpointType; import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider; import com.intellij.xdebugger.ui.DebuggerIcons; @@ -24,12 +27,13 @@ import javax.swing.*; * User: sweinreuter * Date: 03.03.11 */ -public abstract class XsltBreakpointType extends XLineBreakpointType { +public class XsltBreakpointType extends XLineBreakpointType { - private final XsltDebuggerEditorsProvider myMyEditorsProvider = new XsltDebuggerEditorsProvider(getLanguageLevel()); + private final XsltDebuggerEditorsProvider myMyEditorsProvider1 = new XsltDebuggerEditorsProvider(XsltChecker.LanguageLevel.V1); + private final XsltDebuggerEditorsProvider myMyEditorsProvider2 = new XsltDebuggerEditorsProvider(XsltChecker.LanguageLevel.V2); - protected XsltBreakpointType(final String id) { - super(id, "XSLT Breakpoints"); + public XsltBreakpointType() { + super("xslt", "XSLT Breakpoints"); } @Override @@ -45,14 +49,29 @@ public abstract class XsltBreakpointType extends XLineBreakpointType breakpoint, @NotNull Project project) { + final XSourcePosition position = breakpoint.getSourcePosition(); + if (position == null) { + return null; + } + + final PsiFile file = PsiManager.getInstance(project).findFile(position.getFile()); + if (file == null) { + return null; + } + + final XsltChecker.LanguageLevel level = XsltSupport.getXsltLanguageLevel(file); + if (level == XsltChecker.LanguageLevel.V1) { + return myMyEditorsProvider1; + } else if (level == XsltChecker.LanguageLevel.V2) { + return myMyEditorsProvider2; + } + + return null; } @NotNull @@ -71,26 +90,4 @@ public abstract class XsltBreakpointType extends XLineBreakpointType[] myXBreakpointHandlers = new XBreakpointHandler[]{ - new XsltBreakpointHandler(this, XsltBreakpointType.V1.class), - new XsltBreakpointHandler(this, XsltBreakpointType.V2.class) + new XsltBreakpointHandler(this, XsltBreakpointType.class), }; private XsltDebuggerSession myDebuggerSession;