diff --git a/.idea/libraries/miglayout_swing.xml b/.idea/libraries/miglayout_swing.xml
index 03394158a644..9f4cc9e88800 100644
--- a/.idea/libraries/miglayout_swing.xml
+++ b/.idea/libraries/miglayout_swing.xml
@@ -1,11 +1,13 @@
-
+
+
-
+
+
\ No newline at end of file
diff --git a/build/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy b/build/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy
index c00643ffdf82..21b756d66e1d 100644
--- a/build/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy
+++ b/build/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy
@@ -242,7 +242,7 @@ class CommunityLibraryLicenses {
licenseUrl: "https://github.com/willemv/mercurial_prompthooks/blob/master/LICENSE.txt"),
libraryLicense(name: "Microba", libraryName: "microba", version: "0.4.2", license: "BSD", url: "http://microba.sourceforge.net/",
licenseUrl: "http://microba.sourceforge.net/license.txt"),
- libraryLicense(name: "MigLayout", libraryName: "miglayout-swing", version: "3.7.1", license: "BSD", url: "http://www.miglayout.com/",
+ libraryLicense(name: "MigLayout", libraryName: "miglayout", version: "5.0.0", license: "BSD", url: "http://www.miglayout.com/",
licenseUrl: "http://www.miglayout.com/mavensite/license.html"),
libraryLicense(name: "minlog", libraryName: "minlog-1.2.jar", version: "1.2", license: "BSD",
url: "https://github.com/EsotericSoftware/minlog", licenseUrl: "http://opensource.org/licenses/BSD-3-Clause"),
diff --git a/lib/miglayout-core-5.0.jar b/lib/miglayout-core-5.0.jar
new file mode 100644
index 000000000000..1211b7016818
Binary files /dev/null and b/lib/miglayout-core-5.0.jar differ
diff --git a/lib/miglayout-swing-5.0.jar b/lib/miglayout-swing-5.0.jar
new file mode 100644
index 000000000000..6a4df9687c87
Binary files /dev/null and b/lib/miglayout-swing-5.0.jar differ
diff --git a/lib/miglayout-swing.jar b/lib/miglayout-swing.jar
deleted file mode 100644
index 81b75f3e6bd3..000000000000
Binary files a/lib/miglayout-swing.jar and /dev/null differ
diff --git a/lib/required_for_dist.txt b/lib/required_for_dist.txt
index 38121eceab12..dc9fca43a0a1 100644
--- a/lib/required_for_dist.txt
+++ b/lib/required_for_dist.txt
@@ -47,7 +47,8 @@ log4j.jar
markdownj-core-0.4.2-SNAPSHOT.jar
markdown4j-2.2.jar
microba.jar
-miglayout-swing.jar
+miglayout-core-5.0.jar
+miglayout-swing-5.0.jar
nanoxml-2.2.3.jar
nekohtml-1.9.14.jar
netty-all-4.1.1.Final.jar
diff --git a/lib/src/miglayout-core-5.0-sources.jar b/lib/src/miglayout-core-5.0-sources.jar
new file mode 100644
index 000000000000..004faae6f54e
Binary files /dev/null and b/lib/src/miglayout-core-5.0-sources.jar differ
diff --git a/lib/src/miglayout-sources.jar b/lib/src/miglayout-sources.jar
deleted file mode 100644
index 328016e31f74..000000000000
Binary files a/lib/src/miglayout-sources.jar and /dev/null differ
diff --git a/lib/src/miglayout-swing-5.0-sources.jar b/lib/src/miglayout-swing-5.0-sources.jar
new file mode 100644
index 000000000000..9804a9b63bcb
Binary files /dev/null and b/lib/src/miglayout-swing-5.0-sources.jar differ
diff --git a/platform/platform-impl/src/com/intellij/ui/migLayout.kt b/platform/platform-impl/src/com/intellij/ui/migLayout.kt
new file mode 100644
index 000000000000..d26c327d1567
--- /dev/null
+++ b/platform/platform-impl/src/com/intellij/ui/migLayout.kt
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.migLayout
+
+import com.intellij.ui.IdeBorderFactory
+import com.intellij.ui.components.JBLabel
+import com.intellij.util.ui.UIUtil
+import net.miginfocom.layout.CC
+import net.miginfocom.layout.ConstraintParser
+import net.miginfocom.layout.LC
+import net.miginfocom.swing.MigLayout
+import java.awt.BorderLayout
+import java.awt.Component
+import javax.swing.JLabel
+import javax.swing.JPanel
+
+val DEFAULT_PANEL_LC = c()
+
+fun panel(layoutConstraints: LC? = DEFAULT_PANEL_LC) = JPanel(MigLayout(layoutConstraints))
+
+inline fun panel(layoutConstraints: LC? = DEFAULT_PANEL_LC, init: JPanel.() -> Unit): JPanel {
+ val panel = panel(layoutConstraints)
+ panel.init()
+ return panel
+}
+
+fun titledPanel(title: String): JPanel {
+ val panel = JPanel(BorderLayout())
+ val border = IdeBorderFactory.createTitledBorder(title, false)
+ panel.border = border
+ border.acceptMinimumSize(panel)
+ return panel
+}
+
+fun JPanel.titledPanel(title: String, wrappedComponent: Component, constrains: CC? = null) {
+ val panel = titledPanel(title)
+ panel.add(wrappedComponent)
+ add(panel, constrains)
+}
+
+fun JPanel.label(text: String, constrains: CC? = null, componentStyle: UIUtil.ComponentStyle? = null, fontColor: UIUtil.FontColor? = null) {
+ val label = if (componentStyle == null && fontColor == null) {
+ JLabel(text)
+ }
+ else {
+ JBLabel(text, componentStyle ?: UIUtil.ComponentStyle.REGULAR, fontColor ?: UIUtil.FontColor.NORMAL)
+ }
+
+ add(label, constrains)
+}
+
+fun JPanel.hint(text: String, constrains: CC = CC()) {
+ if (constrains.horizontal.gapBefore == null) {
+ // default gap 10 * indent 3
+ constrains.gapLeft("30")
+ }
+ label(text, constrains, componentStyle = UIUtil.ComponentStyle.SMALL, fontColor = UIUtil.FontColor.BRIGHTER)
+}
+
+// default values differs to MigLayout - IntelliJ Platform defaults are used
+// see com.intellij.uiDesigner.core.AbstractLayout.DEFAULT_HGAP and DEFAULT_VGAP (multiplied by 2 to achieve the same look (it seems in terms of MigLayout gap is both left and right space))
+fun c(insets: String? = "0", gap: String? = "20 5", fill: Boolean = false, noGrid: Boolean = false, flowY: Boolean = false): LC {
+ // no setter for gap, so, create string to parse
+ val lc = if (gap == null) LC() else ConstraintParser.parseLayoutConstraint("gap ${gap}")
+ insets?.let {
+ lc.insets(it)
+ }
+ if (fill) {
+ lc.fill()
+ }
+ if (noGrid) {
+ lc.noGrid()
+ }
+ if (flowY) {
+ lc.flowY()
+ }
+ return lc
+}
+
+@Suppress("unused")
+// add receiver to reduce completion scope
+fun JPanel.c(grow: Boolean = false, push: Boolean = false): CC {
+ val cc = CC()
+ if (grow) {
+ cc.grow()
+ }
+ if (push) {
+ cc.push()
+ }
+ return cc
+}
\ No newline at end of file
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java
index e10088deab18..4dfc1a3a5920 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/settings/DataViewsConfigurableUi.java
@@ -15,10 +15,9 @@
*/
package com.intellij.xdebugger.impl.settings;
+import com.intellij.migLayout.MigLayoutKt;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtilRt;
-import com.intellij.ui.IdeBorderFactory;
-import com.intellij.ui.border.IdeaTitledBorder;
import com.intellij.ui.components.JBLabel;
import com.intellij.util.ui.UIUtil;
import com.intellij.xdebugger.XDebuggerBundle;
@@ -34,6 +33,7 @@ public class DataViewsConfigurableUi {
private JFormattedTextField valueTooltipDelayTextField;
private JPanel panel;
private JCheckBox sortAlphabeticallyCheckBox;
+ @SuppressWarnings("unused")
private JPanel myEditorSettingsPanel;
private JCheckBox myShowValuesInlineCheckBox;
private JCheckBox myShowValueTooltipCheckBox;
@@ -84,9 +84,6 @@ public class DataViewsConfigurableUi {
}
private void createUIComponents() {
- myEditorSettingsPanel = new JPanel();
- IdeaTitledBorder titledBorder = IdeBorderFactory.createTitledBorder("Editor", false);
- myEditorSettingsPanel.setBorder(titledBorder);
- titledBorder.acceptMinimumSize(myEditorSettingsPanel);
+ myEditorSettingsPanel = MigLayoutKt.titledPanel("Editor");
}
}
\ No newline at end of file
diff --git a/plugins/settings-repository/settings-repository.iml b/plugins/settings-repository/settings-repository.iml
index 057c02111866..c1199e3bb452 100644
--- a/plugins/settings-repository/settings-repository.iml
+++ b/plugins/settings-repository/settings-repository.iml
@@ -50,5 +50,6 @@
+
\ No newline at end of file
diff --git a/plugins/settings-repository/src/org/jetbrains/settingsRepository/IcsConfigurableForm.form b/plugins/settings-repository/src/org/jetbrains/settingsRepository/IcsConfigurableForm.form
deleted file mode 100644
index a7d7ad7f516d..000000000000
--- a/plugins/settings-repository/src/org/jetbrains/settingsRepository/IcsConfigurableForm.form
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
diff --git a/plugins/settings-repository/src/org/jetbrains/settingsRepository/IcsConfigurableForm.java b/plugins/settings-repository/src/org/jetbrains/settingsRepository/IcsConfigurableForm.java
deleted file mode 100644
index 072e4447fe5a..000000000000
--- a/plugins/settings-repository/src/org/jetbrains/settingsRepository/IcsConfigurableForm.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.settingsRepository;
-
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-
-public class IcsConfigurableForm {
- private final IcsConfigurableUi ui;
-
- JPanel readOnlySourcesPanel;
- JPanel rootPanel;
- JCheckBox autoSyncCheckBox;
-
- @SuppressWarnings("unused")
- private JPanel repositoryListEditor;
-
- public IcsConfigurableForm(@NotNull IcsConfigurableUi ui) {
- this.ui = ui;
- }
-
- private void createUIComponents() {
- repositoryListEditor = (JPanel)ui.getRepositoryListEditor().getComponent();
- }
-}
\ No newline at end of file
diff --git a/plugins/settings-repository/src/org/jetbrains/settingsRepository/RepositoryListEditorForm.form b/plugins/settings-repository/src/org/jetbrains/settingsRepository/RepositoryListEditorForm.form
deleted file mode 100644
index 67e1bd34ecce..000000000000
--- a/plugins/settings-repository/src/org/jetbrains/settingsRepository/RepositoryListEditorForm.form
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
diff --git a/plugins/settings-repository/src/org/jetbrains/settingsRepository/RepositoryListEditorForm.java b/plugins/settings-repository/src/org/jetbrains/settingsRepository/RepositoryListEditorForm.java
deleted file mode 100644
index aa46127b085d..000000000000
--- a/plugins/settings-repository/src/org/jetbrains/settingsRepository/RepositoryListEditorForm.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jetbrains.settingsRepository;
-
-import com.intellij.openapi.ui.ComboBox;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-
-class RepositoryListEditorForm {
- ComboBox repositoryList;
- JButton deleteButton;
- JPanel component;
-
- public RepositoryListEditorForm(@NotNull ComboBox repositoryList) {
- this.repositoryList = repositoryList;
- }
-
- private void createUIComponents() {
- }
-}
diff --git a/plugins/settings-repository/src/settings/IcsConfigurable.kt b/plugins/settings-repository/src/settings/IcsConfigurable.kt
index 0b8838a7998f..a0a29d908664 100644
--- a/plugins/settings-repository/src/settings/IcsConfigurable.kt
+++ b/plugins/settings-repository/src/settings/IcsConfigurable.kt
@@ -15,10 +15,14 @@
*/
package org.jetbrains.settingsRepository
+import com.intellij.migLayout.c
+import com.intellij.migLayout.hint
+import com.intellij.migLayout.panel
+import com.intellij.migLayout.titledPanel
import com.intellij.openapi.Disposable
import com.intellij.openapi.options.ConfigurableBase
import com.intellij.openapi.options.ConfigurableUi
-import java.awt.BorderLayout
+import javax.swing.JCheckBox
internal class IcsConfigurable : ConfigurableBase("ics", icsMessage("ics.settings"), "reference.settings.ics") {
override fun getSettings() = icsManager.settings
@@ -27,16 +31,8 @@ internal class IcsConfigurable : ConfigurableBase, Disposable {
- val repositoryListEditor = createRepositoryListEditor()
- private val readOnlyEditor = createReadOnlySourcesEditor()
-
- private val editors = listOf(repositoryListEditor, readOnlyEditor)
-
- private val panel = IcsConfigurableForm(this)
-
- init {
- panel.readOnlySourcesPanel.add(readOnlyEditor.component, BorderLayout.CENTER)
- }
+ private val editors = listOf(createRepositoryListEditor(), createReadOnlySourcesEditor())
+ private val autoSync = JCheckBox("Auto Sync")
override fun dispose() {
icsManager.autoSyncManager.enabled = true
@@ -46,20 +42,25 @@ internal class IcsConfigurableUi : ConfigurableUi, Disposable {
// do not set in constructor to avoid
icsManager.autoSyncManager.enabled = false
- panel.autoSyncCheckBox.isSelected = settings.autoSync
+ autoSync.isSelected = settings.autoSync
editors.forEach { it.reset(settings) }
}
- override fun isModified(settings: IcsSettings) = panel.autoSyncCheckBox.isSelected != settings.autoSync || editors.any { it.isModified(settings) }
+ override fun isModified(settings: IcsSettings) = autoSync.isSelected != settings.autoSync || editors.any { it.isModified(settings) }
override fun apply(settings: IcsSettings) {
- settings.autoSync = panel.autoSyncCheckBox.isSelected
+ settings.autoSync = autoSync.isSelected
editors.forEach { it.apply(settings) }
saveSettings(settings, icsManager.settingsFile)
}
- override fun getComponent() = panel.rootPanel!!
+ override fun getComponent() = panel(c(noGrid = true, flowY = true)) {
+ add(editors.get(0).component)
+ add(autoSync)
+ hint("Use VCS -> Sync Settings to sync when you want")
+ titledPanel("Read-only Sources", editors.get(1).component, c(grow = true, push = true))
+ }
}
\ No newline at end of file
diff --git a/plugins/settings-repository/src/settings/repositoryListEditor.kt b/plugins/settings-repository/src/settings/repositoryListEditor.kt
index de96ef2cd2e3..4afbe76516fe 100644
--- a/plugins/settings-repository/src/settings/repositoryListEditor.kt
+++ b/plugins/settings-repository/src/settings/repositoryListEditor.kt
@@ -19,6 +19,8 @@ import com.intellij.configurationStore.ComponentStoreImpl
import com.intellij.configurationStore.SchemeManagerFactoryBase
import com.intellij.configurationStore.StateStorageManagerImpl
import com.intellij.configurationStore.reloadAppStore
+import com.intellij.migLayout.label
+import com.intellij.migLayout.panel
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.stateStore
import com.intellij.openapi.options.ConfigurableUi
@@ -27,6 +29,7 @@ import com.intellij.openapi.progress.runModalTask
import com.intellij.util.ui.ComboBoxModelEditor
import com.intellij.util.ui.ListItemEditor
import java.util.*
+import javax.swing.JButton
internal class RepositoryItem(var url: String? = null) {
override fun toString() = url ?: ""
@@ -39,19 +42,22 @@ internal fun createRepositoryListEditor(): ConfigurableUi {
override fun clone(item: RepositoryItem, forInPlaceEditing: Boolean) = RepositoryItem(item.url)
})
- val editorForm = RepositoryListEditorForm(editor.comboBox)
-
- editorForm.deleteButton.addActionListener {
+ val deleteButton = JButton("Delete")
+ deleteButton.addActionListener {
editor.model.selected?.let {
editor.model.remove(it)
- editorForm.deleteButton.isEnabled = editor.model.selected != null
+ deleteButton.isEnabled = editor.model.selected != null
}
}
return object: ConfigurableUi {
override fun isModified(settings: IcsSettings) = editor.isModified
- override fun getComponent() = editorForm.component
+ override fun getComponent() = panel {
+ label("Repository:")
+ add(editor.comboBox)
+ add(deleteButton)
+ }
override fun apply(settings: IcsSettings) {
val newList = editor.apply()
@@ -71,7 +77,7 @@ internal fun createRepositoryListEditor(): ConfigurableUi {
editor.reset(list)
editor.model.selectedItem = upstream
- editorForm.deleteButton.isEnabled = editor.model.selectedItem != null
+ deleteButton.isEnabled = editor.model.selectedItem != null
}
}
}