mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-207306 Fix UI in Subversion settings
- Presentation GitOrigin-RevId: 2ce6d88944efb2b788cc7d405ac2d05f6903293a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
63abd60ba4
commit
1e19c4e5d6
@@ -142,7 +142,7 @@
|
||||
areChildrenValidMappings="true"/>
|
||||
<projectConfigurable id="vcs.Subversion" key="configurable.name.svn.general" instance="org.jetbrains.idea.svn.SvnConfigurable$General"
|
||||
parentId="project.propVCSSupport.Mappings" groupWeight="-500">
|
||||
<configurable id="vcs.Subversion.Presentation" instance="org.jetbrains.idea.svn.SvnConfigurable$Presentation"
|
||||
<configurable id="vcs.Subversion.Presentation" instance="org.jetbrains.idea.svn.PresentationSvnConfigurable"
|
||||
bundle="messages.SvnBundle" key="configurable.name.svn.presentation"/>
|
||||
<configurable id="vcs.Subversion.Network" instance="org.jetbrains.idea.svn.NetworkSvnConfigurable"
|
||||
bundle="messages.SvnBundle" key="configurable.name.svn.network"/>
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.idea.svn.PresentationSettingsPanel">
|
||||
<grid id="718dd" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="5" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="0" y="0" width="542" height="137"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="41718" class="javax.swing.JCheckBox" binding="myCheckNestedInQuickMerge">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/SvnBundle" key="settings.check.mergeinfo"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="7b7ed">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="2" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<vspacer id="a25f1">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="a1351" class="javax.swing.JCheckBox" binding="myMaximumNumberOfRevisionsCheckBox" default-binding="true">
|
||||
<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 resource-bundle="messages/SvnBundle" key="settings.maximum.revisions.number"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="44294">
|
||||
<constraints>
|
||||
<grid row="1" column="2" row-span="1" col-span="2" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="aa58e" class="javax.swing.JSpinner" binding="myNumRevsInAnnotations" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="70" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="cd5ae" class="javax.swing.JCheckBox" binding="myShowMergeSourceInAnnotate" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="2" 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 resource-bundle="messages/SvnBundle" key="annotation.show.merge.sources.default.text"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f2afc" class="javax.swing.JCheckBox" binding="myIgnoreWhitespaceDifferenciesInCheckBox" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="3" 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 resource-bundle="messages/SvnBundle" key="svn.option.ignore.whitespace.in.annotate"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -1,96 +0,0 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.svn;
|
||||
|
||||
import com.intellij.openapi.options.ConfigurableUi;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class PresentationSettingsPanel implements ConfigurableUi<SvnConfiguration> {
|
||||
|
||||
private final @NotNull Project myProject;
|
||||
|
||||
private JPanel myMainPanel;
|
||||
|
||||
private JCheckBox myCheckNestedInQuickMerge;
|
||||
private JCheckBox myIgnoreWhitespaceDifferenciesInCheckBox;
|
||||
private JCheckBox myShowMergeSourceInAnnotate;
|
||||
|
||||
private JCheckBox myMaximumNumberOfRevisionsCheckBox;
|
||||
private JSpinner myNumRevsInAnnotations;
|
||||
|
||||
public PresentationSettingsPanel(@NotNull Project project) {
|
||||
myProject = project;
|
||||
|
||||
myMaximumNumberOfRevisionsCheckBox
|
||||
.addActionListener(e -> myNumRevsInAnnotations.setEnabled(myMaximumNumberOfRevisionsCheckBox.isSelected()));
|
||||
myNumRevsInAnnotations.setEnabled(myMaximumNumberOfRevisionsCheckBox.isSelected());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull JComponent getComponent() {
|
||||
return myMainPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(@NotNull SvnConfiguration configuration) {
|
||||
myCheckNestedInQuickMerge.setSelected(configuration.isCheckNestedForQuickMerge());
|
||||
myIgnoreWhitespaceDifferenciesInCheckBox.setSelected(configuration.isIgnoreSpacesInAnnotate());
|
||||
myShowMergeSourceInAnnotate.setSelected(configuration.isShowMergeSourcesInAnnotate());
|
||||
final int annotateRevisions = configuration.getMaxAnnotateRevisions();
|
||||
if (annotateRevisions == -1) {
|
||||
myMaximumNumberOfRevisionsCheckBox.setSelected(false);
|
||||
myNumRevsInAnnotations.setValue(SvnConfiguration.ourMaxAnnotateRevisionsDefault);
|
||||
}
|
||||
else {
|
||||
myMaximumNumberOfRevisionsCheckBox.setSelected(true);
|
||||
myNumRevsInAnnotations.setValue(annotateRevisions);
|
||||
}
|
||||
myNumRevsInAnnotations.setEnabled(myMaximumNumberOfRevisionsCheckBox.isSelected());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified(@NotNull SvnConfiguration configuration) {
|
||||
if (configuration.isCheckNestedForQuickMerge() != myCheckNestedInQuickMerge.isSelected()) {
|
||||
return true;
|
||||
}
|
||||
if (configuration.isIgnoreSpacesInAnnotate() != myIgnoreWhitespaceDifferenciesInCheckBox.isSelected()) {
|
||||
return true;
|
||||
}
|
||||
if (configuration.isShowMergeSourcesInAnnotate() != myShowMergeSourceInAnnotate.isSelected()) {
|
||||
return true;
|
||||
}
|
||||
final int annotateRevisions = configuration.getMaxAnnotateRevisions();
|
||||
final boolean useMaxInAnnot = annotateRevisions != -1;
|
||||
if (useMaxInAnnot != myMaximumNumberOfRevisionsCheckBox.isSelected()) {
|
||||
return true;
|
||||
}
|
||||
if (myMaximumNumberOfRevisionsCheckBox.isSelected()) {
|
||||
if (annotateRevisions != ((SpinnerNumberModel)myNumRevsInAnnotations.getModel()).getNumber().intValue()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(@NotNull SvnConfiguration configuration) {
|
||||
configuration.setCheckNestedForQuickMerge(myCheckNestedInQuickMerge.isSelected());
|
||||
configuration.setIgnoreSpacesInAnnotate(myIgnoreWhitespaceDifferenciesInCheckBox.isSelected());
|
||||
configuration.setShowMergeSourcesInAnnotate(myShowMergeSourceInAnnotate.isSelected());
|
||||
if (!myMaximumNumberOfRevisionsCheckBox.isSelected()) {
|
||||
configuration.setMaxAnnotateRevisions(-1);
|
||||
}
|
||||
else {
|
||||
configuration.setMaxAnnotateRevisions(((SpinnerNumberModel)myNumRevsInAnnotations.getModel()).getNumber().intValue());
|
||||
}
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
final SvnConfiguration configuration = SvnConfiguration.getInstance(myProject);
|
||||
int value = configuration.getMaxAnnotateRevisions();
|
||||
value = (value == -1) ? SvnConfiguration.ourMaxAnnotateRevisionsDefault : value;
|
||||
myNumRevsInAnnotations = new JSpinner(new SpinnerNumberModel(value, 10, 100000, 100));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.svn
|
||||
|
||||
import com.intellij.openapi.options.BoundSearchableConfigurable
|
||||
import com.intellij.openapi.options.Configurable.NoScroll
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.DialogPanel
|
||||
import com.intellij.ui.JBIntSpinner
|
||||
import com.intellij.ui.components.JBCheckBox
|
||||
import com.intellij.ui.dsl.builder.RightGap
|
||||
import com.intellij.ui.dsl.builder.bindSelected
|
||||
import com.intellij.ui.dsl.builder.panel
|
||||
import com.intellij.ui.layout.selected
|
||||
|
||||
internal class PresentationSvnConfigurable(private val project: Project) : BoundSearchableConfigurable(
|
||||
SvnBundle.message("configurable.name.svn.presentation"),
|
||||
SvnConfigurable.HELP_ID + ".Presentation",
|
||||
SvnConfigurable.ID + ".Presentation"
|
||||
), NoScroll {
|
||||
|
||||
private lateinit var chMaxRevisions: JBCheckBox
|
||||
private lateinit var spMaxRevisions: JBIntSpinner
|
||||
|
||||
override fun createPanel(): DialogPanel {
|
||||
val settings = SvnConfiguration.getInstance(project)
|
||||
|
||||
return panel {
|
||||
row {
|
||||
checkBox(SvnBundle.message("settings.check.mergeinfo"))
|
||||
.bindSelected(settings::isCheckNestedForQuickMerge, settings::setCheckNestedForQuickMerge)
|
||||
}
|
||||
row {
|
||||
chMaxRevisions = checkBox(SvnBundle.message("settings.maximum.revisions.number"))
|
||||
.gap(RightGap.SMALL)
|
||||
.component
|
||||
spMaxRevisions = spinner(10..100000, 100)
|
||||
.enabledIf(chMaxRevisions.selected)
|
||||
.onReset {
|
||||
chMaxRevisions.isSelected = settings.maxAnnotateRevisions != -1
|
||||
spMaxRevisions.value = if (chMaxRevisions.isSelected) settings.maxAnnotateRevisions else SvnConfiguration.ourMaxAnnotateRevisionsDefault
|
||||
}.onApply {
|
||||
settings.maxAnnotateRevisions = getCurrentMaxAnnotateRevisions()
|
||||
}.onIsModified {
|
||||
getCurrentMaxAnnotateRevisions() != settings.maxAnnotateRevisions
|
||||
}
|
||||
.component
|
||||
}
|
||||
row {
|
||||
checkBox(SvnBundle.message("annotation.show.merge.sources.default.text"))
|
||||
.bindSelected(settings::isShowMergeSourcesInAnnotate, settings::setShowMergeSourcesInAnnotate)
|
||||
}
|
||||
row {
|
||||
checkBox(SvnBundle.message("svn.option.ignore.whitespace.in.annotate"))
|
||||
.bindSelected(settings::isIgnoreSpacesInAnnotate, settings::setIgnoreSpacesInAnnotate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCurrentMaxAnnotateRevisions(): Int {
|
||||
return if (chMaxRevisions.isSelected) spMaxRevisions.number else -1
|
||||
}
|
||||
}
|
||||
@@ -68,12 +68,6 @@ public abstract class SvnConfigurable extends ConfigurableBase<ConfigurableUi<Sv
|
||||
}
|
||||
}
|
||||
|
||||
public static class Presentation extends SvnConfigurable {
|
||||
public Presentation(@NotNull Project project) {
|
||||
super(project, "Presentation", message("configurable.name.svn.presentation"), () -> new PresentationSettingsPanel(project));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Ssh extends SvnConfigurable {
|
||||
public Ssh(@NotNull Project project) {
|
||||
super(project, "SSH", message("configurable.name.svn.ssh"), () -> new SshSettingsPanel(project));
|
||||
|
||||
Reference in New Issue
Block a user