From 5ed8cf9265e96f1cb4fb24669926005aa21c223d Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Thu, 1 Mar 2018 18:22:15 +0300 Subject: [PATCH] vcs: remove "enable changelist conflict tracking" checkbox --- .../ChangelistConflictAccessProvider.java | 6 +- .../ChangelistConflictConfigurable.form | 148 ++++++++---------- .../ChangelistConflictConfigurable.java | 11 -- .../ChangelistConflictFileStatusProvider.java | 6 +- .../conflicts/ChangelistConflictTracker.java | 10 +- 5 files changed, 75 insertions(+), 106 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictAccessProvider.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictAccessProvider.java index ba1c99815c52..892de1e9dea0 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictAccessProvider.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictAccessProvider.java @@ -20,14 +20,14 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ChangeList; import com.intellij.openapi.vcs.changes.ChangeListManagerImpl; -import com.intellij.openapi.vfs.WritingAccessProvider; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.WritingAccessProvider; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collection; -import java.util.HashSet; import java.util.Collections; +import java.util.HashSet; /** * @author Dmitry Avdeev @@ -46,7 +46,7 @@ public class ChangelistConflictAccessProvider extends WritingAccessProvider { @Override public Collection requestWriting(VirtualFile... files) { ChangelistConflictTracker.Options options = myManager.getConflictTracker().getOptions(); - if (!options.TRACKING_ENABLED || !options.SHOW_DIALOG) { + if (!options.SHOW_DIALOG) { return Collections.emptyList(); } ArrayList denied = new ArrayList<>(); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictConfigurable.form b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictConfigurable.form index ea1a5c03f81c..c5ebb36a40ec 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictConfigurable.form +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictConfigurable.form @@ -1,6 +1,6 @@
- + @@ -8,90 +8,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -102,6 +21,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictConfigurable.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictConfigurable.java index 23914ab1999c..bcff37e71e3f 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictConfigurable.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictConfigurable.java @@ -28,7 +28,6 @@ import com.intellij.openapi.vcs.changes.ChangeListManagerImpl; import com.intellij.openapi.vcs.impl.LineStatusTrackerSettingListener; import com.intellij.ui.components.JBList; import com.intellij.util.ArrayUtil; -import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; @@ -43,10 +42,6 @@ import java.util.Collection; public class ChangelistConflictConfigurable extends BindableConfigurable implements SearchableConfigurable, Configurable.NoScroll { private JPanel myPanel; - private JPanel myOptionsPanel; - - @BindControl("TRACKING_ENABLED") - private JCheckBox myEnableConflictTrackingCheckBox; @BindControl("SHOW_DIALOG") private JCheckBox myShowDialogCheckBox; @@ -69,11 +64,6 @@ public class ChangelistConflictConfigurable extends BindableConfigurable impleme super(new ControlBinder(manager.getConflictTracker().getOptions())); myVcsApplicationSettings = VcsApplicationSettings.getInstance(); - myEnableConflictTrackingCheckBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - UIUtil.setEnabled(myOptionsPanel, myEnableConflictTrackingCheckBox.isSelected(), true); - } - }); myConflictTracker = manager.getConflictTracker(); myClearButton.addActionListener(new ActionListener() { @@ -100,7 +90,6 @@ public class ChangelistConflictConfigurable extends BindableConfigurable impleme Collection conflicts = myConflictTracker.getIgnoredConflicts(); myIgnoredFiles.setListData(ArrayUtil.toStringArray(conflicts)); myClearButton.setEnabled(!conflicts.isEmpty()); - UIUtil.setEnabled(myOptionsPanel, myEnableConflictTrackingCheckBox.isSelected(), true); } @Override diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictFileStatusProvider.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictFileStatusProvider.java index bbc6a80a8210..914573590abb 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictFileStatusProvider.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictFileStatusProvider.java @@ -51,11 +51,7 @@ public class ChangelistConflictFileStatusProvider implements FileStatusProvider @Nullable public FileStatus getFileStatus(@NotNull VirtualFile virtualFile) { ChangelistConflictTracker.Options options = myConflictTracker.getOptions(); - if (!options.TRACKING_ENABLED) { - return null; - } - boolean conflict = myConflictTracker.hasConflict(virtualFile); - if (conflict && options.HIGHLIGHT_CONFLICTS) { + if (options.HIGHLIGHT_CONFLICTS && myConflictTracker.hasConflict(virtualFile)) { return CHANGELIST_CONFLICT; } else if (options.HIGHLIGHT_NON_ACTIVE_CHANGELIST) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictTracker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictTracker.java index d61f64360fdf..4accae2678ea 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictTracker.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictTracker.java @@ -95,7 +95,7 @@ public class ChangelistConflictTracker { myDocumentListener = new DocumentListener() { @Override public void documentChanged(DocumentEvent e) { - if (!myOptions.TRACKING_ENABLED) { + if (!myOptions.isTrackingEnabled()) { return; } Document document = e.getDocument(); @@ -277,7 +277,7 @@ public class ChangelistConflictTracker { } public boolean hasConflict(@NotNull VirtualFile file) { - if (!myOptions.TRACKING_ENABLED) { + if (!myOptions.isTrackingEnabled()) { return false; } String path = file.getPath(); @@ -320,11 +320,13 @@ public class ChangelistConflictTracker { } public static class Options { - public boolean TRACKING_ENABLED = true; public boolean SHOW_DIALOG = false; public boolean HIGHLIGHT_CONFLICTS = true; public boolean HIGHLIGHT_NON_ACTIVE_CHANGELIST = false; public ChangelistConflictResolution LAST_RESOLUTION = ChangelistConflictResolution.IGNORE; - } + public boolean isTrackingEnabled() { + return SHOW_DIALOG || HIGHLIGHT_CONFLICTS; + } + } }