IDEA-78660: XSLT debug: Breakpoints dialog: there are two XSLT Breakpoints tabs

This commit is contained in:
Sascha Weinreuter
2011-12-21 15:02:34 +01:00
parent 03d9326f90
commit 284e3f13c1
4 changed files with 31 additions and 36 deletions
@@ -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);
}
@@ -20,8 +20,7 @@
</change-notes>
<extensions defaultExtensionNs="com.intellij">
<xdebugger.breakpointType implementation="org.intellij.plugins.xsltDebugger.XsltBreakpointType$V1"/>
<xdebugger.breakpointType implementation="org.intellij.plugins.xsltDebugger.XsltBreakpointType$V2"/>
<xdebugger.breakpointType implementation="org.intellij.plugins.xsltDebugger.XsltBreakpointType"/>
<programRunner implementation="org.intellij.plugins.xsltDebugger.XsltDebuggerRunner"/>
</extensions>
@@ -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<XBreakpointProperties> {
public class XsltBreakpointType extends XLineBreakpointType<XBreakpointProperties> {
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<XBreakpoint
if (fileType != StdFileTypes.XML || !XsltSupport.isXsltFile(psiFile)) {
return false;
}
return getLanguageLevel() == XsltSupport.getXsltLanguageLevel(psiFile);
return true;
}
protected abstract XsltChecker.LanguageLevel getLanguageLevel();
@Override
public XDebuggerEditorsProvider getEditorsProvider() {
return myMyEditorsProvider;
public XDebuggerEditorsProvider getEditorsProvider(@NotNull XLineBreakpoint<XBreakpointProperties> 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<XBreakpoint
public XBreakpointProperties createBreakpointProperties(@NotNull VirtualFile file, int line) {
return null;
}
public static final class V1 extends XsltBreakpointType {
public V1() {
super("xslt");
}
@Override
protected XsltChecker.LanguageLevel getLanguageLevel() {
return XsltChecker.LanguageLevel.V1;
}
}
public static final class V2 extends XsltBreakpointType {
public V2() {
super("xslt2");
}
@Override
protected XsltChecker.LanguageLevel getLanguageLevel() {
return XsltChecker.LanguageLevel.V2;
}
}
}
@@ -37,8 +37,7 @@ public class XsltDebugProcess extends XDebugProcess implements Disposable {
private BreakpointManager myBreakpointManager = new BreakpointManagerImpl();
private final XBreakpointHandler<?>[] myXBreakpointHandlers = new XBreakpointHandler<?>[]{
new XsltBreakpointHandler(this, XsltBreakpointType.V1.class),
new XsltBreakpointHandler(this, XsltBreakpointType.V2.class)
new XsltBreakpointHandler(this, XsltBreakpointType.class),
};
private XsltDebuggerSession myDebuggerSession;