Set minimal width for TextFieldWithHistory

This commit is contained in:
Aleksey Kladov
2017-02-17 13:17:26 +01:00
committed by Vladimir Krivosheev
parent fe4f113ae4
commit 8a6de5742b
@@ -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.
@@ -24,6 +24,8 @@ import com.intellij.openapi.project.DumbAware
import com.intellij.openapi.ui.ComponentWithBrowseButton
import com.intellij.openapi.ui.OnePixelDivider
import com.intellij.ui.SeparatorComponent
import com.intellij.ui.TextFieldWithHistory
import com.intellij.ui.TextFieldWithHistoryWithBrowseButton
import com.intellij.ui.components.Label
import com.intellij.ui.components.noteComponent
import com.intellij.util.SmartList
@@ -173,11 +175,15 @@ internal class MigLayoutBuilder : LayoutBuilderImpl {
}
private fun addGrowIfNeed(cc: CC, component: Component) {
if (component is JTextComponent || component is SeparatorComponent || component is ComponentWithBrowseButton<*>) {
if (component is TextFieldWithHistory || component is TextFieldWithHistoryWithBrowseButton) {
cc.minWidth("350")
cc.growX()
}
else if (component is JTextComponent || component is SeparatorComponent || component is ComponentWithBrowseButton<*>) {
cc.growX()
}
else if (component is JPanel && component.componentCount == 1 &&
(component.getComponent(0) as? JComponent)?.getClientProperty(ActionToolbar.ACTION_TOOLBAR_PROPERTY_KEY) != null) {
(component.getComponent(0) as? JComponent)?.getClientProperty(ActionToolbar.ACTION_TOOLBAR_PROPERTY_KEY) != null) {
cc.grow().push()
}
}