vcs: remove "enable changelist conflict tracking" checkbox

This commit is contained in:
Aleksey Pivovarov
2018-04-26 20:03:28 +03:00
parent b55ae2057a
commit 5ed8cf9265
5 changed files with 75 additions and 106 deletions
@@ -20,14 +20,14 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeList; import com.intellij.openapi.vcs.changes.ChangeList;
import com.intellij.openapi.vcs.changes.ChangeListManagerImpl; import com.intellij.openapi.vcs.changes.ChangeListManagerImpl;
import com.intellij.openapi.vfs.WritingAccessProvider;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.WritingAccessProvider;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet;
/** /**
* @author Dmitry Avdeev * @author Dmitry Avdeev
@@ -46,7 +46,7 @@ public class ChangelistConflictAccessProvider extends WritingAccessProvider {
@Override @Override
public Collection<VirtualFile> requestWriting(VirtualFile... files) { public Collection<VirtualFile> requestWriting(VirtualFile... files) {
ChangelistConflictTracker.Options options = myManager.getConflictTracker().getOptions(); ChangelistConflictTracker.Options options = myManager.getConflictTracker().getOptions();
if (!options.TRACKING_ENABLED || !options.SHOW_DIALOG) { if (!options.SHOW_DIALOG) {
return Collections.emptyList(); return Collections.emptyList();
} }
ArrayList<VirtualFile> denied = new ArrayList<>(); ArrayList<VirtualFile> denied = new ArrayList<>();
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.openapi.vcs.changes.conflicts.ChangelistConflictConfigurable"> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.openapi.vcs.changes.conflicts.ChangelistConflictConfigurable">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints> <constraints>
<xy x="20" y="20" width="854" height="412"/> <xy x="20" y="20" width="854" height="412"/>
@@ -8,90 +8,9 @@
<properties/> <properties/>
<border type="none"/> <border type="none"/>
<children> <children>
<component id="4d345" class="javax.swing.JCheckBox" binding="myEnableConflictTrackingCheckBox">
<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="Enable changelist conflict tracking"/>
</properties>
</component>
<grid id="31c09" binding="myOptionsPanel" 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>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="2" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="6646a" class="javax.swing.JCheckBox" binding="myShowDialogCheckBox">
<constraints>
<grid row="0" 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="Show conflict resolving &amp;dialog "/>
</properties>
</component>
<component id="644ea" class="javax.swing.JCheckBox" binding="myHighlightConflictsCheckBox">
<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="&amp;Highlight files with conflicts"/>
</properties>
</component>
<component id="6b1a6" class="javax.swing.JCheckBox" binding="myHighlightNonActiveCheckBox">
<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 value="Highlight files from &amp;non-active changelists"/>
</properties>
</component>
<grid id="722" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="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="none" title="Files with ignored conflicts"/>
<children>
<scrollpane id="66692" class="com.intellij.ui.components.JBScrollPane">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="5cdb5" class="com.intellij.ui.components.JBList" binding="myIgnoredFiles">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
<component id="9276f" class="javax.swing.JButton" binding="myClearButton" default-binding="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Clear"/>
</properties>
</component>
<hspacer id="61e54">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</children>
</grid>
<vspacer id="523f5"> <vspacer id="523f5">
<constraints> <constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> <grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</vspacer> </vspacer>
<component id="10c41" class="javax.swing.JCheckBox" binding="myEnablePartialChangelists"> <component id="10c41" class="javax.swing.JCheckBox" binding="myEnablePartialChangelists">
@@ -102,6 +21,69 @@
<text resource-bundle="messages/VcsBundle" key="settings.partial.changelists.enable.checkbox"/> <text resource-bundle="messages/VcsBundle" key="settings.partial.changelists.enable.checkbox"/>
</properties> </properties>
</component> </component>
<component id="6646a" class="javax.swing.JCheckBox" binding="myShowDialogCheckBox">
<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="Show conflict resolving &amp;dialog "/>
</properties>
</component>
<component id="644ea" class="javax.swing.JCheckBox" binding="myHighlightConflictsCheckBox">
<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 value="&amp;Highlight files with conflicts"/>
</properties>
</component>
<component id="6b1a6" class="javax.swing.JCheckBox" binding="myHighlightNonActiveCheckBox">
<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 value="Highlight files from &amp;non-active changelists"/>
</properties>
</component>
<grid id="722" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="4" 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="none" title="Files with ignored conflicts"/>
<children>
<scrollpane id="66692" class="com.intellij.ui.components.JBScrollPane">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="5cdb5" class="com.intellij.ui.components.JBList" binding="myIgnoredFiles">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
<component id="9276f" class="javax.swing.JButton" binding="myClearButton" default-binding="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Clear"/>
</properties>
</component>
<hspacer id="61e54">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</children> </children>
</grid> </grid>
</form> </form>
@@ -28,7 +28,6 @@ import com.intellij.openapi.vcs.changes.ChangeListManagerImpl;
import com.intellij.openapi.vcs.impl.LineStatusTrackerSettingListener; import com.intellij.openapi.vcs.impl.LineStatusTrackerSettingListener;
import com.intellij.ui.components.JBList; import com.intellij.ui.components.JBList;
import com.intellij.util.ArrayUtil; import com.intellij.util.ArrayUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -43,10 +42,6 @@ import java.util.Collection;
public class ChangelistConflictConfigurable extends BindableConfigurable implements SearchableConfigurable, Configurable.NoScroll { public class ChangelistConflictConfigurable extends BindableConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private JPanel myPanel; private JPanel myPanel;
private JPanel myOptionsPanel;
@BindControl("TRACKING_ENABLED")
private JCheckBox myEnableConflictTrackingCheckBox;
@BindControl("SHOW_DIALOG") @BindControl("SHOW_DIALOG")
private JCheckBox myShowDialogCheckBox; private JCheckBox myShowDialogCheckBox;
@@ -69,11 +64,6 @@ public class ChangelistConflictConfigurable extends BindableConfigurable impleme
super(new ControlBinder(manager.getConflictTracker().getOptions())); super(new ControlBinder(manager.getConflictTracker().getOptions()));
myVcsApplicationSettings = VcsApplicationSettings.getInstance(); myVcsApplicationSettings = VcsApplicationSettings.getInstance();
myEnableConflictTrackingCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
UIUtil.setEnabled(myOptionsPanel, myEnableConflictTrackingCheckBox.isSelected(), true);
}
});
myConflictTracker = manager.getConflictTracker(); myConflictTracker = manager.getConflictTracker();
myClearButton.addActionListener(new ActionListener() { myClearButton.addActionListener(new ActionListener() {
@@ -100,7 +90,6 @@ public class ChangelistConflictConfigurable extends BindableConfigurable impleme
Collection<String> conflicts = myConflictTracker.getIgnoredConflicts(); Collection<String> conflicts = myConflictTracker.getIgnoredConflicts();
myIgnoredFiles.setListData(ArrayUtil.toStringArray(conflicts)); myIgnoredFiles.setListData(ArrayUtil.toStringArray(conflicts));
myClearButton.setEnabled(!conflicts.isEmpty()); myClearButton.setEnabled(!conflicts.isEmpty());
UIUtil.setEnabled(myOptionsPanel, myEnableConflictTrackingCheckBox.isSelected(), true);
} }
@Override @Override
@@ -51,11 +51,7 @@ public class ChangelistConflictFileStatusProvider implements FileStatusProvider
@Nullable @Nullable
public FileStatus getFileStatus(@NotNull VirtualFile virtualFile) { public FileStatus getFileStatus(@NotNull VirtualFile virtualFile) {
ChangelistConflictTracker.Options options = myConflictTracker.getOptions(); ChangelistConflictTracker.Options options = myConflictTracker.getOptions();
if (!options.TRACKING_ENABLED) { if (options.HIGHLIGHT_CONFLICTS && myConflictTracker.hasConflict(virtualFile)) {
return null;
}
boolean conflict = myConflictTracker.hasConflict(virtualFile);
if (conflict && options.HIGHLIGHT_CONFLICTS) {
return CHANGELIST_CONFLICT; return CHANGELIST_CONFLICT;
} }
else if (options.HIGHLIGHT_NON_ACTIVE_CHANGELIST) { else if (options.HIGHLIGHT_NON_ACTIVE_CHANGELIST) {
@@ -95,7 +95,7 @@ public class ChangelistConflictTracker {
myDocumentListener = new DocumentListener() { myDocumentListener = new DocumentListener() {
@Override @Override
public void documentChanged(DocumentEvent e) { public void documentChanged(DocumentEvent e) {
if (!myOptions.TRACKING_ENABLED) { if (!myOptions.isTrackingEnabled()) {
return; return;
} }
Document document = e.getDocument(); Document document = e.getDocument();
@@ -277,7 +277,7 @@ public class ChangelistConflictTracker {
} }
public boolean hasConflict(@NotNull VirtualFile file) { public boolean hasConflict(@NotNull VirtualFile file) {
if (!myOptions.TRACKING_ENABLED) { if (!myOptions.isTrackingEnabled()) {
return false; return false;
} }
String path = file.getPath(); String path = file.getPath();
@@ -320,11 +320,13 @@ public class ChangelistConflictTracker {
} }
public static class Options { public static class Options {
public boolean TRACKING_ENABLED = true;
public boolean SHOW_DIALOG = false; public boolean SHOW_DIALOG = false;
public boolean HIGHLIGHT_CONFLICTS = true; public boolean HIGHLIGHT_CONFLICTS = true;
public boolean HIGHLIGHT_NON_ACTIVE_CHANGELIST = false; public boolean HIGHLIGHT_NON_ACTIVE_CHANGELIST = false;
public ChangelistConflictResolution LAST_RESOLUTION = ChangelistConflictResolution.IGNORE; public ChangelistConflictResolution LAST_RESOLUTION = ChangelistConflictResolution.IGNORE;
}
public boolean isTrackingEnabled() {
return SHOW_DIALOG || HIGHLIGHT_CONFLICTS;
}
}
} }