disable language switcher together with the expression editor
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Thu, 11 Feb 2016 15:42:40 +0000 (18:42 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Thu, 11 Feb 2016 15:43:07 +0000 (18:43 +0300)
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java
platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java

index 7ebd4066a39bc44837e2d111201879f95bbc4a54..c79eaa2525772d69ada3d6c740be2f4932777657 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2015 JetBrains s.r.o.
+ * Copyright 2000-2016 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.
@@ -82,16 +82,19 @@ public abstract class XDebuggerEditorBase {
     new ClickListener() {
       @Override
       public boolean onClick(@NotNull MouseEvent e, int clickCount) {
-        ListPopup oldPopup = SoftReference.dereference(myPopup);
-        if (oldPopup != null && !oldPopup.isDisposed()) {
-          oldPopup.cancel();
-          myPopup = null;
+        if (myChooseFactory.isEnabled()) {
+          ListPopup oldPopup = SoftReference.dereference(myPopup);
+          if (oldPopup != null && !oldPopup.isDisposed()) {
+            oldPopup.cancel();
+            myPopup = null;
+            return true;
+          }
+          ListPopup popup = createLanguagePopup();
+          popup.showUnderneathOf(myChooseFactory);
+          myPopup = new WeakReference<ListPopup>(popup);
           return true;
         }
-        ListPopup popup = createLanguagePopup();
-        popup.showUnderneathOf(myChooseFactory);
-        myPopup = new WeakReference<ListPopup>(popup);
-        return true;
+        return false;
       }
     }.installOn(myChooseFactory);
   }
index 3d418d2fcdcd2c8c2c110148f198c946c9297ffc..3d394a79d34af002fe8cc8fabd159289ea106578 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2015 JetBrains s.r.o.
+ * Copyright 2000-2016 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.
@@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.ComboBox;
 import com.intellij.ui.EditorComboBoxEditor;
 import com.intellij.ui.EditorComboBoxRenderer;
+import com.intellij.util.ui.UIUtil;
 import com.intellij.xdebugger.XExpression;
 import com.intellij.xdebugger.XSourcePosition;
 import com.intellij.xdebugger.evaluation.EvaluationMode;
@@ -33,7 +34,6 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
-import javax.swing.plaf.basic.ComboPopup;
 import java.awt.*;
 
 /**
@@ -80,7 +80,7 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase {
   public void setEnabled(boolean enable) {
     if (enable == myComboBox.isEnabled()) return;
 
-    myComboBox.setEnabled(enable);
+    UIUtil.setEnabled(myComponent, enable, true);
     //myComboBox.setEditable(enable);
 
     if (enable) {