removed redundant extension point
authorliana.bakradze <liana.bakradze@jetbrains.com>
Wed, 19 Aug 2015 08:00:39 +0000 (11:00 +0300)
committerliana.bakradze <liana.bakradze@jetbrains.com>
Wed, 19 Aug 2015 08:00:39 +0000 (11:00 +0300)
python/edu/src/META-INF/PyCharmEduPlugin.xml
python/edu/src/com/jetbrains/python/edu/debugger/PyEduDebugTransformer.java [deleted file]
python/edu/src/com/jetbrains/python/edu/debugger/PyEduStackFrame.java
python/src/META-INF/python-core.xml
python/src/com/jetbrains/python/debugger/PyDebugValueTransformer.java [deleted file]
python/src/com/jetbrains/python/debugger/PyStackFrame.java

index 743e43a7d7790d9bda8f4a850eb83b5c40eb5614..a1724898ccfdcaff4e4ca087367dbe817f11cdcc 100644 (file)
       <consoleInputFilterProvider implementation="com.jetbrains.python.edu.debugger.PyEduConsoleInputFilterProvider"/>
   </extensions>
 
-  <extensions defaultExtensionNs="Pythonid">
-    <debugValueTransformer implementation="com.jetbrains.python.edu.debugger.PyEduDebugTransformer"/>
-  </extensions>
-
   <actions>
     <group overrides="true" class="com.intellij.openapi.actionSystem.EmptyActionGroup" id="ToolsMenu"/>
 
diff --git a/python/edu/src/com/jetbrains/python/edu/debugger/PyEduDebugTransformer.java b/python/edu/src/com/jetbrains/python/edu/debugger/PyEduDebugTransformer.java
deleted file mode 100644 (file)
index a4ce044..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.jetbrains.python.edu.debugger;
-
-import com.intellij.util.containers.hash.HashMap;
-import com.intellij.xdebugger.frame.XValue;
-import com.intellij.xdebugger.frame.XValueChildrenList;
-import com.jetbrains.python.debugger.PyDebugValueTransformer;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Map;
-
-public class PyEduDebugTransformer implements PyDebugValueTransformer {
-  @Override
-  public XValueChildrenList getTransformedChildren(@NotNull XValueChildrenList children) {
-    XValueChildrenList list = new XValueChildrenList();
-    Map<String, XValue> magicValues = new HashMap<String, XValue>();
-    for (int i = 0; i < children.size(); i++) {
-      String name = children.getName(i);
-      XValue value = children.getValue(i);
-      if (name.startsWith("__") && name.endsWith("__")) {
-        magicValues.put(name, value);
-      }
-      else {
-        list.add(name, value);
-      }
-    }
-    if (!magicValues.isEmpty()) {
-      list.add(new PyEduMagicDebugValue("magic variables", magicValues));
-    }
-    return list;
-  }
-}
index be496d1a31fb0eccd70df818897422213535415c..f88c23e7dc7ea4079eb8b2888ae920db16c9ead1 100644 (file)
@@ -5,15 +5,23 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.ui.ColoredTextContainer;
 import com.intellij.ui.SimpleTextAttributes;
+import com.intellij.util.containers.hash.HashMap;
 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.jetbrains.python.debugger.PyFrameAccessor;
 import com.jetbrains.python.debugger.PyStackFrame;
 import com.jetbrains.python.debugger.PyStackFrameInfo;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Map;
 
 public class PyEduStackFrame extends PyStackFrame {
   public static final String MODULE = "<module>";
   public static final String GLOBAL_FRAME = "Globals";
+  public static final String DOUBLE_UNDERSCORE = "__";
   private final PyStackFrameInfo myFrameInfo;
   private final XSourcePosition myPosition;
 
@@ -48,4 +56,29 @@ public class PyEduStackFrame extends PyStackFrame {
         .append(MODULE.equals(frameName) ? GLOBAL_FRAME : frameName, regularAttributes);
     }
   }
+
+  @Override
+  protected void addChildren(@NotNull final XCompositeNode node,
+                             @Nullable final XValueChildrenList children) {
+    Map<String, XValue> specialValues = new HashMap<String, XValue>();
+    XValueChildrenList newChildren = new XValueChildrenList();
+    if (children == null) {
+      node.addChildren(XValueChildrenList.EMPTY, true);
+      return;
+    }
+    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);
+      }
+      else {
+        newChildren.add(name, value);
+      }
+    }
+    if (!specialValues.isEmpty()) {
+      newChildren.add(new PyEduMagicDebugValue("special variables", specialValues));
+    }
+    node.addChildren(newChildren, true);
+  }
 }
index abd422fe5b3a37ebef4d7d95eb613773c8f0438d..476948f3a9bc75bb85a2c5bcf1c6ce0587b2b046 100644 (file)
     <extensionPoint qualifiedName="Pythonid.breakpointHandler" interface="com.jetbrains.python.debugger.PyBreakpointHandlerFactory"/>
     <extensionPoint qualifiedName="Pythonid.consoleOptionsProvider" interface="com.jetbrains.python.console.PyConsoleOptionsProvider"/>
     <extensionPoint qualifiedName="Pythonid.pyRootTypeProvider" interface="com.jetbrains.python.module.PyRootTypeProvider"/>
-    <extensionPoint qualifiedName="Pythonid.debugValueTransformer" interface="com.jetbrains.python.debugger.PyDebugValueTransformer"/>
   </extensionPoints>
 
   <extensions defaultExtensionNs="Pythonid">
diff --git a/python/src/com/jetbrains/python/debugger/PyDebugValueTransformer.java b/python/src/com/jetbrains/python/debugger/PyDebugValueTransformer.java
deleted file mode 100644 (file)
index 3b697d5..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2000-2015 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.jetbrains.python.debugger;
-
-import com.intellij.openapi.extensions.ExtensionPointName;
-import com.intellij.xdebugger.frame.XValueChildrenList;
-import org.jetbrains.annotations.NotNull;
-
-public interface PyDebugValueTransformer {
-  ExtensionPointName<PyDebugValueTransformer> EP_NAME = ExtensionPointName.create("Pythonid.debugValueTransformer");
-
-  /**
-   * This method is used in python debugger to modify content and presentation of stack frame nodes
-   * @param children
-   * @return modified children list
-   */
-  XValueChildrenList getTransformedChildren(@NotNull final XValueChildrenList children);
-}
index 80cce5540e6ffe9be6814d8ac454f34721b003d9..4ada2e7fc112d487204bd7c14da4711f288e311d 100644 (file)
@@ -19,7 +19,6 @@ import com.intellij.icons.AllIcons;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.roots.ProjectRootManager;
@@ -32,6 +31,7 @@ import com.intellij.xdebugger.frame.XCompositeNode;
 import com.intellij.xdebugger.frame.XStackFrame;
 import com.intellij.xdebugger.frame.XValueChildrenList;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 
 public class PyStackFrame extends XStackFrame {
@@ -115,14 +115,7 @@ public class PyStackFrame extends XStackFrame {
         try {
           XValueChildrenList values = myDebugProcess.loadFrame();
           if (!node.isObsolete()) {
-            if (values == null) {
-              node.addChildren(XValueChildrenList.EMPTY, true);
-              return;
-            }
-            for (PyDebugValueTransformer transformer : Extensions.getExtensions(PyDebugValueTransformer.EP_NAME)) {
-              values = transformer.getTransformedChildren(values);
-            }
-            node.addChildren(values, true);
+            addChildren(node, values);
           }
         }
         catch (PyDebuggerException e) {
@@ -135,6 +128,10 @@ public class PyStackFrame extends XStackFrame {
     });
   }
 
+  protected void addChildren(@NotNull final XCompositeNode node, @Nullable final XValueChildrenList children) {
+    node.addChildren(children != null ? children : XValueChildrenList.EMPTY, true);
+  }
+
   public String getThreadId() {
     return myFrameInfo.getThreadId();
   }