mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use MigLayout instead of UI Designer, update MigLayout to 5.0.0
This commit is contained in:
Generated
+4
-2
@@ -1,11 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="miglayout-swing">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/miglayout-swing.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/miglayout-swing-5.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/miglayout-core-5.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/miglayout-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/miglayout-core-5.0-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/miglayout-swing-5.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
@@ -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"),
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
}
|
||||
+3
-6
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -50,5 +50,6 @@
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="Slf4j" level="project" />
|
||||
<orderEntry type="module" module-name="configuration-store-impl" />
|
||||
<orderEntry type="library" name="miglayout-swing" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.settingsRepository.IcsConfigurableForm">
|
||||
<grid id="27dc6" binding="rootPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="623" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="b2b46" binding="readOnlySourcesPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<clientProperties>
|
||||
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithoutIndent"/>
|
||||
</clientProperties>
|
||||
<border type="etched" title="Read-only Sources"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<component id="7e36f" class="javax.swing.JCheckBox" binding="autoSyncCheckBox">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Auto Sync"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f2b09" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="3" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<componentStyle value="SMALL"/>
|
||||
<fontColor value="BRIGHTER"/>
|
||||
<text value="Use VCS -> Sync Settings to sync when you want"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="e4449" binding="repositoryListEditor" custom-create="true" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
-39
@@ -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();
|
||||
}
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.settingsRepository.RepositoryListEditorForm">
|
||||
<grid id="27dc6" binding="component" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="bd9ae" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Repository:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="16b46" class="com.intellij.openapi.ui.ComboBox" binding="repositoryList" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="58a6" class="javax.swing.JButton" binding="deleteButton">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="1" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Delete"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
-34
@@ -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() {
|
||||
}
|
||||
}
|
||||
@@ -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<IcsConfigurableUi, IcsSettings>("ics", icsMessage("ics.settings"), "reference.settings.ics") {
|
||||
override fun getSettings() = icsManager.settings
|
||||
@@ -27,16 +31,8 @@ internal class IcsConfigurable : ConfigurableBase<IcsConfigurableUi, IcsSettings
|
||||
}
|
||||
|
||||
internal class IcsConfigurableUi : ConfigurableUi<IcsSettings>, 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<IcsSettings>, 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))
|
||||
}
|
||||
}
|
||||
@@ -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<IcsSettings> {
|
||||
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<IcsSettings> {
|
||||
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<IcsSettings> {
|
||||
editor.reset(list)
|
||||
editor.model.selectedItem = upstream
|
||||
|
||||
editorForm.deleteButton.isEnabled = editor.model.selectedItem != null
|
||||
deleteButton.isEnabled = editor.model.selectedItem != null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user