Move AndroidUtil.isAndroidVM into DebuggerUtils
authorVitaliy.Bibaev <vitaliy.bibaev@jetbrains.com>
Mon, 19 Feb 2018 13:37:51 +0000 (16:37 +0300)
committerVitaliy.Bibaev <vitaliy.bibaev@jetbrains.com>
Mon, 19 Feb 2018 13:59:31 +0000 (16:59 +0300)
java/debugger/impl/src/com/intellij/debugger/memory/ui/ClassesFilteredView.java
java/debugger/impl/src/com/intellij/debugger/memory/ui/InstancesWindow.java
java/debugger/impl/src/com/intellij/debugger/memory/utils/AndroidUtil.java
java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java

index 35b8212f5782bb9ed12d6f077a74b7891a17a5dc..9d891f6cd060125947789b0d2b5ff3a7dcc08ab1 100644 (file)
@@ -461,7 +461,7 @@ public class ClassesFilteredView extends BorderLayoutPanel implements Disposable
     }
 
     private Map<ReferenceType, Long> getInstancesCounts(@NotNull List<ReferenceType> classes, @NotNull VirtualMachine vm) {
-      final int batchSize = AndroidUtil.isAndroidVM(vm)
+      final int batchSize = DebuggerUtils.isAndroidVM(vm)
                             ? AndroidUtil.ANDROID_COUNT_BY_CLASSES_BATCH_SIZE
                             : DEFAULT_BATCH_SIZE;
 
index 4130600dce9a51b3e55f847b44d3ee503c0d5393..69478482f8b400dbfc3e988c0592b249410007b2 100644 (file)
@@ -17,6 +17,7 @@ package com.intellij.debugger.memory.ui;
 
 import com.intellij.debugger.DebuggerManager;
 import com.intellij.debugger.engine.DebugProcessImpl;
+import com.intellij.debugger.engine.DebuggerUtils;
 import com.intellij.debugger.engine.JavaValue;
 import com.intellij.debugger.engine.SuspendContextImpl;
 import com.intellij.debugger.engine.evaluation.EvaluationContext;
@@ -260,7 +261,7 @@ public class InstancesWindow extends DialogWrapper {
 
         @Override
         public void threadAction(@NotNull SuspendContextImpl suspendContext) {
-          myIsAndroidVM = AndroidUtil.isAndroidVM(myDebugProcess.getVirtualMachineProxy().getVirtualMachine());
+          myIsAndroidVM = DebuggerUtils.isAndroidVM(myDebugProcess.getVirtualMachineProxy().getVirtualMachine());
           final int limit = myIsAndroidVM
                             ? AndroidUtil.ANDROID_INSTANCES_LIMIT
                             : DEFAULT_INSTANCES_LIMIT;
index 4b22c6f9df6c68d04802520c27cefcf8b18b2729..2dd1b84f18eeb1f0657f3dc1db1498af51b1ba7c 100644 (file)
  */
 package com.intellij.debugger.memory.utils;
 
-import com.sun.jdi.VirtualMachine;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Locale;
-
 public class AndroidUtil {
   public static final int ANDROID_COUNT_BY_CLASSES_BATCH_SIZE = 500;
   public static final int ANDROID_INSTANCES_LIMIT = 30000;
-
-  public static boolean isAndroidVM(@NotNull VirtualMachine vm) {
-    return vm.name().toLowerCase(Locale.ENGLISH).contains("dalvik");
-  }
 }
index 678396198278740152593443507407f611d59a4b..6e6c3ae6546c973e50824a1f0733c953b1152cbe 100644 (file)
@@ -566,4 +566,8 @@ public abstract class DebuggerUtils {
     return Arrays.stream(JavaDebugAware.EP_NAME.getExtensions())
       .anyMatch(provider -> breakpointAware ? provider.isBreakpointAware(file) : provider.isActionAware(file));
   }
+
+  public static boolean isAndroidVM(@NotNull VirtualMachine virtualMachine) {
+    return StringUtil.containsIgnoreCase(virtualMachine.name(), "dalvik");
+  }
 }