From 9b20786f23b122f0ff7f9996176a1f0690bbae24 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 1 Sep 2017 12:16:46 +0300 Subject: [PATCH] IDEA-155080 - only text in language chooser --- .../impl/ui/XDebuggerEditorBase.java | 22 ++++++++++++++----- .../impl/ui/XDebuggerExpressionComboBox.java | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java index 91924b10badf..6a6bdec553e4 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. + * Copyright 2000-2017 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. @@ -36,7 +36,9 @@ import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.psi.PsiElement; import com.intellij.reference.SoftReference; import com.intellij.ui.ClickListener; +import com.intellij.ui.JBColor; import com.intellij.ui.LayeredIcon; +import com.intellij.util.IconUtil; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.components.BorderLayoutPanel; import com.intellij.xdebugger.XDebuggerBundle; @@ -86,6 +88,8 @@ public abstract class XDebuggerEditorBase { myHistoryId = historyId; mySourcePosition = sourcePosition; + myChooseFactory.setHorizontalTextPosition(SwingConstants.LEFT); + myChooseFactory.setIconTextGap(0); myChooseFactory.setToolTipText(XDebuggerBundle.message("xdebugger.evaluate.language.hint")); myChooseFactory.setBorder(JBUI.Borders.empty(0, 3, 0, 3)); new ClickListener() { @@ -228,16 +232,24 @@ public abstract class XDebuggerEditorBase { //myChooseFactory.setEnabled(many && languages.contains(language)); if (language != null && language.getAssociatedFileType() != null) { - LayeredIcon icon = JBUI.scale(new LayeredIcon(2)); - icon.setIcon(language.getAssociatedFileType().getIcon(), 0); - icon.setIcon(AllIcons.General.Dropdown, 1, 3, 0); - myChooseFactory.setIcon(icon); + Icon dropdownIcon = AllIcons.General.Dropdown; + int width = dropdownIcon.getIconWidth(); + dropdownIcon = IconUtil.cropIcon(dropdownIcon, new Rectangle(width / 2, 0, width - width / 2, dropdownIcon.getIconHeight())); + LayeredIcon icon = JBUI.scale(new LayeredIcon(1)); + icon.setIcon(dropdownIcon, 0, 0, -5); + myChooseFactory.setIcon(IconUtil.desaturate(icon)); + myChooseFactory.setText(language.getDisplayName()); + myChooseFactory.setForeground(JBColor.darkGray); myChooseFactory.setDisabledIcon(IconLoader.getDisabledIcon(icon)); } doSetText(text); } + public void setEnabled(boolean enable) { + myChooseFactory.setEnabled(enable); + } + public abstract XExpression getExpression(); @Nullable diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java index 2e66ef823ebc..0d2748300a1c 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java @@ -24,7 +24,6 @@ import com.intellij.openapi.ui.ComboBox; import com.intellij.ui.EditorComboBoxEditor; import com.intellij.ui.EditorComboBoxRenderer; import com.intellij.ui.EditorTextField; -import com.intellij.util.ui.UIUtil; import com.intellij.xdebugger.XExpression; import com.intellij.xdebugger.XSourcePosition; import com.intellij.xdebugger.evaluation.EvaluationMode; @@ -113,7 +112,7 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase { public void setEnabled(boolean enable) { if (enable == myComboBox.isEnabled()) return; - UIUtil.setEnabled(myComponent, enable, true); + myComboBox.setEnabled(enable); //myComboBox.setEditable(enable); if (enable) { @@ -122,6 +121,7 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase { else { myExpression = getExpression(); } + super.setEnabled(enable); } private void initEditor() {