mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEABKL-4550 diff: show whitespace-only changes in gutter
* enabled Smart mode by-default * allow to change mode from settings
This commit is contained in:
+10
-2
@@ -355,7 +355,7 @@
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="7f3f5" layout-manager="GridLayoutManager" row-count="5" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="7f3f5" layout-manager="GridLayoutManager" row-count="6" 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>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@@ -417,7 +417,7 @@
|
||||
</component>
|
||||
<vspacer id="612dd">
|
||||
<constraints>
|
||||
<grid row="4" 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>
|
||||
</vspacer>
|
||||
<component id="d83cc" class="com.intellij.ui.components.JBLabel" binding="myStripTrailingSpacesExplanationLabel">
|
||||
@@ -428,6 +428,14 @@
|
||||
<text value="explanation"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="95944" class="javax.swing.JCheckBox" binding="myShowWhitespacesModificationsInLSTGutterCheckBox">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Highlight lines with whitespace-only modifications in gutter"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="7bb4" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
|
||||
+20
-2
@@ -44,6 +44,8 @@ import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.VcsApplicationSettings;
|
||||
import com.intellij.openapi.vcs.impl.LineStatusTrackerManager;
|
||||
import com.intellij.ui.ListCellRendererWrapper;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
@@ -101,8 +103,9 @@ public class EditorOptionsPanel {
|
||||
private JTextField myQuickDocDelayTextField;
|
||||
private JComboBox myRichCopyColorSchemeComboBox;
|
||||
private JCheckBox myShowInlineDialogForCheckBox;
|
||||
private JBLabel myStripTrailingSpacesExplanationLabel;
|
||||
private JCheckBox myCbEnableRichCopyByDefault;
|
||||
private JBLabel myStripTrailingSpacesExplanationLabel;
|
||||
private JCheckBox myCbEnableRichCopyByDefault;
|
||||
private JCheckBox myShowWhitespacesModificationsInLSTGutterCheckBox;
|
||||
|
||||
private static final String ACTIVE_COLOR_SCHEME = ApplicationBundle.message("combobox.richcopy.color.scheme.active");
|
||||
|
||||
@@ -160,6 +163,7 @@ public class EditorOptionsPanel {
|
||||
EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
|
||||
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
|
||||
UISettings uiSettings = UISettings.getInstance();
|
||||
VcsApplicationSettings vcsSettings = VcsApplicationSettings.getInstance();
|
||||
|
||||
// Display
|
||||
|
||||
@@ -227,6 +231,8 @@ public class EditorOptionsPanel {
|
||||
myShowNotificationAfterReformatCodeCheckBox.setSelected(editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION);
|
||||
myShowNotificationAfterOptimizeImportsCheckBox.setSelected(editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_OPTIMIZE_IMPORTS_ACTION);
|
||||
|
||||
myShowWhitespacesModificationsInLSTGutterCheckBox.setSelected(vcsSettings.SHOW_WHITESPACES_IN_LST);
|
||||
|
||||
myErrorHighlightingPanel.reset();
|
||||
|
||||
RichCopySettings settings = RichCopySettings.getInstance();
|
||||
@@ -265,6 +271,7 @@ public class EditorOptionsPanel {
|
||||
EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
|
||||
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
|
||||
UISettings uiSettings=UISettings.getInstance();
|
||||
VcsApplicationSettings vcsSettings = VcsApplicationSettings.getInstance();
|
||||
|
||||
// Display
|
||||
|
||||
@@ -342,6 +349,14 @@ public class EditorOptionsPanel {
|
||||
editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION = myShowNotificationAfterReformatCodeCheckBox.isSelected();
|
||||
editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_OPTIMIZE_IMPORTS_ACTION = myShowNotificationAfterOptimizeImportsCheckBox.isSelected();
|
||||
|
||||
if (vcsSettings.SHOW_WHITESPACES_IN_LST != myShowWhitespacesModificationsInLSTGutterCheckBox.isSelected()) {
|
||||
vcsSettings.SHOW_WHITESPACES_IN_LST = myShowWhitespacesModificationsInLSTGutterCheckBox.isSelected();
|
||||
Project[] projects = ProjectManager.getInstance().getOpenProjects();
|
||||
for (Project project : projects) {
|
||||
LineStatusTrackerManager.getInstance(project).updateSettings();
|
||||
}
|
||||
}
|
||||
|
||||
reinitAllEditors();
|
||||
|
||||
String temp=myRecentFilesLimitField.getText();
|
||||
@@ -432,6 +447,7 @@ public class EditorOptionsPanel {
|
||||
EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
|
||||
CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
|
||||
UISettings uiSettings=UISettings.getInstance();
|
||||
VcsApplicationSettings vcsSettings = VcsApplicationSettings.getInstance();
|
||||
|
||||
// Display
|
||||
boolean isModified = isModified(myCbSmoothScrolling, editorSettings.isSmoothScrolling());
|
||||
@@ -485,6 +501,8 @@ public class EditorOptionsPanel {
|
||||
isModified |= isModified(myShowNotificationAfterReformatCodeCheckBox, editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION);
|
||||
isModified |= isModified(myShowNotificationAfterOptimizeImportsCheckBox, editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_OPTIMIZE_IMPORTS_ACTION);
|
||||
|
||||
isModified |= isModified(myShowWhitespacesModificationsInLSTGutterCheckBox, vcsSettings.SHOW_WHITESPACES_IN_LST);
|
||||
|
||||
isModified |= myErrorHighlightingPanel.isModified();
|
||||
|
||||
RichCopySettings settings = RichCopySettings.getInstance();
|
||||
|
||||
@@ -363,7 +363,6 @@ testng_sm_runner=false
|
||||
show.flex.debug.design.view=false
|
||||
|
||||
diff.patience.alg=false
|
||||
diff.status.tracker.smart=false
|
||||
diff.status.tracker.skip.spaces=true
|
||||
diff.verify.iterable=false
|
||||
diff.unimportant.line.char.count=3
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||
)
|
||||
public class VcsApplicationSettings implements PersistentStateComponent<VcsApplicationSettings> {
|
||||
public String PATCH_STORAGE_LOCATION = null;
|
||||
public boolean SHOW_WHITESPACES_IN_LST = false;
|
||||
|
||||
public static VcsApplicationSettings getInstance() {
|
||||
return ServiceManager.getService(VcsApplicationSettings.class);
|
||||
|
||||
@@ -80,14 +80,15 @@ public class LineStatusTracker {
|
||||
private boolean myAnathemaThrown;
|
||||
private boolean myReleased;
|
||||
|
||||
@NotNull private Mode myMode = Registry.is("diff.status.tracker.smart") ? Mode.SMART : Mode.DEFAULT;
|
||||
@NotNull private Mode myMode;
|
||||
|
||||
@NotNull private List<Range> myRanges;
|
||||
|
||||
private LineStatusTracker(@NotNull final Document document,
|
||||
@NotNull final Document vcsDocument,
|
||||
@NotNull final Project project,
|
||||
@NotNull final VirtualFile virtualFile) {
|
||||
@NotNull final VirtualFile virtualFile,
|
||||
@NotNull final Mode mode) {
|
||||
myDocument = document;
|
||||
myVcsDocument = vcsDocument;
|
||||
myProject = project;
|
||||
@@ -97,6 +98,8 @@ public class LineStatusTracker {
|
||||
myFileEditorManager = FileEditorManager.getInstance(myProject);
|
||||
myVcsDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject);
|
||||
|
||||
myMode = mode;
|
||||
|
||||
myRanges = new ArrayList<Range>();
|
||||
}
|
||||
|
||||
@@ -173,6 +176,7 @@ public class LineStatusTracker {
|
||||
|
||||
public void setMode(@NotNull Mode mode) {
|
||||
synchronized (myLock) {
|
||||
if (myMode == mode) return;
|
||||
myMode = mode;
|
||||
reinstallRanges();
|
||||
}
|
||||
@@ -916,10 +920,11 @@ public class LineStatusTracker {
|
||||
}
|
||||
}
|
||||
|
||||
public static LineStatusTracker createOn(@NotNull VirtualFile virtualFile, @NotNull final Document doc, final Project project) {
|
||||
public static LineStatusTracker createOn(@NotNull VirtualFile virtualFile, @NotNull final Document doc, final Project project,
|
||||
@NotNull Mode mode) {
|
||||
final Document document = new DocumentImpl("", true);
|
||||
document.putUserData(UndoConstants.DONT_RECORD_UNDO, Boolean.TRUE);
|
||||
return new LineStatusTracker(doc, document, project, virtualFile);
|
||||
return new LineStatusTracker(doc, document, project, virtualFile, mode);
|
||||
}
|
||||
|
||||
public static class RevisionPack {
|
||||
|
||||
@@ -208,6 +208,15 @@ public class LineStatusTrackerManager implements ProjectComponent, LineStatusTra
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSettings() {
|
||||
synchronized (myLock) {
|
||||
LineStatusTracker.Mode mode = getMode();
|
||||
for (LineStatusTracker tracker : myLineStatusTrackers.values()) {
|
||||
tracker.setMode(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void resetTracker(@NotNull final VirtualFile virtualFile) {
|
||||
resetTracker(virtualFile, false);
|
||||
}
|
||||
@@ -300,13 +309,18 @@ public class LineStatusTrackerManager implements ProjectComponent, LineStatusTra
|
||||
if (myLineStatusTrackers.containsKey(document)) return;
|
||||
assert !myPartner.containsKey(document);
|
||||
|
||||
final LineStatusTracker tracker = LineStatusTracker.createOn(virtualFile, document, myProject);
|
||||
final LineStatusTracker tracker = LineStatusTracker.createOn(virtualFile, document, myProject, getMode());
|
||||
myLineStatusTrackers.put(document, tracker);
|
||||
|
||||
startAlarm(document, virtualFile);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static LineStatusTracker.Mode getMode() {
|
||||
return VcsApplicationSettings.getInstance().SHOW_WHITESPACES_IN_LST ? LineStatusTracker.Mode.SMART : LineStatusTracker.Mode.DEFAULT;
|
||||
}
|
||||
|
||||
private void startAlarm(@NotNull final Document document, @NotNull final VirtualFile virtualFile) {
|
||||
synchronized (myLock) {
|
||||
myPartner.add(document, new BaseRevisionLoader(document, virtualFile));
|
||||
|
||||
@@ -23,6 +23,8 @@ public interface LineStatusTrackerManagerI {
|
||||
@Nullable
|
||||
LineStatusTracker getLineStatusTracker(Document document);
|
||||
|
||||
void updateSettings();
|
||||
|
||||
class Dummy implements LineStatusTrackerManagerI {
|
||||
private final static Dummy ourInstance = new Dummy();
|
||||
|
||||
@@ -34,5 +36,9 @@ public interface LineStatusTrackerManagerI {
|
||||
public LineStatusTracker getLineStatusTracker(final Document document) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSettings() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user