From fcdf5b928b90196f8ef91df2b33f68ba0758eca4 Mon Sep 17 00:00:00 2001 From: "Liana.Bakradze" Date: Fri, 25 Nov 2016 18:23:07 +0300 Subject: [PATCH] remove special and builtins groups from edu debugger (moved to PyCharm) --- .../python/edu/debugger/PyEduStackFrame.java | 66 ------------------- 1 file changed, 66 deletions(-) diff --git a/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduStackFrame.java b/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduStackFrame.java index 1d15dc812e82..46cc881b9fab 100644 --- a/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduStackFrame.java +++ b/python/educational-python/src/com/jetbrains/python/edu/debugger/PyEduStackFrame.java @@ -5,28 +5,16 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.ColoredTextContainer; import com.intellij.ui.SimpleTextAttributes; import com.intellij.xdebugger.XSourcePosition; -import com.intellij.xdebugger.frame.XCompositeNode; -import com.intellij.xdebugger.frame.XValue; -import com.intellij.xdebugger.frame.XValueChildrenList; -import com.intellij.xdebugger.frame.XValueGroup; import com.jetbrains.python.debugger.PyFrameAccessor; import com.jetbrains.python.debugger.PyStackFrame; import com.jetbrains.python.debugger.PyStackFrameInfo; import icons.PythonEducationalIcons; -import icons.PythonIcons; import icons.PythonPsiApiIcons; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import java.util.HashMap; -import java.util.Map; public class PyEduStackFrame extends PyStackFrame { public static final String MODULE = ""; public static final String GLOBAL_FRAME = "Globals"; - public static final String DOUBLE_UNDERSCORE = "__"; - public static final String BUILTINS_VALUE_NAME = "__builtins__"; private final PyStackFrameInfo myFrameInfo; private final XSourcePosition myPosition; @@ -57,58 +45,4 @@ public class PyEduStackFrame extends PyStackFrame { component.append(frameName, SimpleTextAttributes.REGULAR_ATTRIBUTES); } } - - @Override - protected void addChildren(@NotNull final XCompositeNode node, - @Nullable final XValueChildrenList children) { - if (children == null) { - node.addChildren(XValueChildrenList.EMPTY, true); - return; - } - final Map specialValues = new HashMap<>(); - XValueChildrenList filteredChildren = new XValueChildrenList(); - for (int i = 0; i < children.size(); i++) { - String name = children.getName(i); - XValue value = children.getValue(i); - if (name.startsWith(DOUBLE_UNDERSCORE) && name.endsWith(DOUBLE_UNDERSCORE)) { - specialValues.put(name, value); - continue; - } - filteredChildren.add(name, value); - } - node.addChildren(filteredChildren, specialValues.isEmpty()); - if (specialValues.isEmpty()) { - return; - } - addSpecialVars(node, specialValues); - } - - private static void addSpecialVars(@NotNull XCompositeNode node, Map specialValues) { - XValue builtins = specialValues.get(BUILTINS_VALUE_NAME); - if (builtins != null) { - specialValues.remove(BUILTINS_VALUE_NAME); - node.addChildren(XValueChildrenList.singleton("Builtins", builtins), false); - } - node.addChildren(XValueChildrenList.bottomGroup(createSpecialVarsGroup(specialValues)), true); - } - - @NotNull - private static XValueGroup createSpecialVarsGroup(final Map specialValues) { - return new XValueGroup("Special Variables") { - @Nullable - @Override - public Icon getIcon() { - return PythonIcons.Python.Debug.SpecialVar; - } - - @Override - public void computeChildren(@NotNull XCompositeNode node) { - XValueChildrenList list = new XValueChildrenList(); - for (Map.Entry entry : specialValues.entrySet()) { - list.add(entry.getKey(), entry.getValue()); - } - node.addChildren(list, true); - } - }; - } }