added missing file
authorliana.bakradze <liana.bakradze@jetbrains.com>
Fri, 14 Aug 2015 17:00:44 +0000 (20:00 +0300)
committerliana.bakradze <liana.bakradze@jetbrains.com>
Fri, 14 Aug 2015 17:00:44 +0000 (20:00 +0300)
python/edu/src/com/jetbrains/python/edu/debugger/PyEduConsoleInputFilterProvider.java [new file with mode: 0644]

diff --git a/python/edu/src/com/jetbrains/python/edu/debugger/PyEduConsoleInputFilterProvider.java b/python/edu/src/com/jetbrains/python/edu/debugger/PyEduConsoleInputFilterProvider.java
new file mode 100644 (file)
index 0000000..0f74c02
--- /dev/null
@@ -0,0 +1,32 @@
+package com.jetbrains.python.edu.debugger;
+
+import com.intellij.execution.filters.ConsoleInputFilterProvider;
+import com.intellij.execution.filters.InputFilter;
+import com.intellij.execution.ui.ConsoleViewContentType;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Pair;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+
+public class PyEduConsoleInputFilterProvider implements ConsoleInputFilterProvider {
+  @NotNull
+  @Override
+  public InputFilter[] getDefaultFilters(@NotNull Project project) {
+    return new InputFilter[]{new InputFilter() {
+      @Nullable
+      @Override
+      public List<Pair<String, ConsoleViewContentType>> applyFilter(String text, ConsoleViewContentType outputType) {
+        if (outputType.equals(ConsoleViewContentType.SYSTEM_OUTPUT) && !text.contains("exit code")) {
+          return Collections.emptyList();
+        }
+        if (text.startsWith("pydev debugger")) {
+          return Collections.emptyList();
+        }
+        return Collections.singletonList(Pair.create(text, outputType));
+      }
+    }};
+  }
+}