mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs-ignore: add checkbox to control external files addition
* restore setting (checkbox) losted in 0301b114eb2d950079743d2bb9995154b3304d17 * use VcsConfiguration settings to control external files addition instead of generic property. GitOrigin-RevId: 9a23130f2adf62153061aa29c5f5aa0c127bc662
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a0d95b0db2
commit
0082b48cc2
+15
-10
@@ -7,6 +7,9 @@ import com.intellij.openapi.application.runReadAction
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.openapi.vcs.VcsConfiguration.StandardConfirmation.ADD
|
||||
import com.intellij.openapi.vcs.VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY
|
||||
import com.intellij.openapi.vcs.VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY
|
||||
import com.intellij.openapi.vcs.changes.ChangeListListener
|
||||
import com.intellij.openapi.vcs.changes.ChangeListManagerImpl
|
||||
import com.intellij.openapi.vcs.changes.VcsIgnoreManager
|
||||
@@ -21,7 +24,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock
|
||||
import kotlin.concurrent.read
|
||||
import kotlin.concurrent.write
|
||||
|
||||
private const val ADD_EXTERNAL_FILES_PROPERTY = "ADD_EXTERNAL_FILES"
|
||||
private const val ASKED_ADD_EXTERNAL_FILES_PROPERTY = "ASKED_ADD_EXTERNAL_FILES"
|
||||
|
||||
private val LOG = logger<ExternallyAddedFilesProcessorImpl>()
|
||||
@@ -59,7 +61,7 @@ class ExternallyAddedFilesProcessorImpl(project: Project,
|
||||
val files = UNPROCESSED_FILES_LOCK.read { unprocessedFiles.toList() }
|
||||
if (files.isEmpty()) return
|
||||
|
||||
if (needAddSilently()) {
|
||||
if (needDoForCurrentProject()) {
|
||||
LOG.debug("Add external files to ${vcs.displayName} silently ", files)
|
||||
addChosenFiles(doFilterFiles(files))
|
||||
}
|
||||
@@ -91,13 +93,7 @@ class ExternallyAddedFilesProcessorImpl(project: Project,
|
||||
}
|
||||
}
|
||||
|
||||
private fun needAddSilently() =
|
||||
vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD,
|
||||
vcs).value == VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY
|
||||
&& VcsConfiguration.getInstance(project).ADD_EXTERNAL_FILES_SILENTLY
|
||||
|
||||
private fun doNothingSilently() = vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD,
|
||||
vcs).value == VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY
|
||||
private fun doNothingSilently() = vcsManager.getStandardConfirmation(ADD, vcs).value == DO_NOTHING_SILENTLY
|
||||
|
||||
private fun needProcessExternalFiles(): Boolean {
|
||||
if (doNothingSilently()) return false
|
||||
@@ -113,7 +109,7 @@ class ExternallyAddedFilesProcessorImpl(project: Project,
|
||||
}
|
||||
|
||||
override val askedBeforeProperty = ASKED_ADD_EXTERNAL_FILES_PROPERTY
|
||||
override val doForCurrentProjectProperty = ADD_EXTERNAL_FILES_PROPERTY
|
||||
override val doForCurrentProjectProperty: String? = null
|
||||
|
||||
override val showActionText: String = VcsBundle.message("external.files.add.notification.action.view")
|
||||
override val forCurrentProjectActionText: String = VcsBundle.message("external.files.add.notification.action.add")
|
||||
@@ -130,6 +126,15 @@ class ExternallyAddedFilesProcessorImpl(project: Project,
|
||||
addChosenFiles(files)
|
||||
}
|
||||
|
||||
override fun rememberForCurrentProject() {
|
||||
vcsManager.getStandardConfirmation(ADD, vcs).value = DO_ACTION_SILENTLY
|
||||
VcsConfiguration.getInstance(project).ADD_EXTERNAL_FILES_SILENTLY = true
|
||||
}
|
||||
|
||||
override fun needDoForCurrentProject() =
|
||||
vcsManager.getStandardConfirmation(ADD, vcs).value == DO_ACTION_SILENTLY
|
||||
&& VcsConfiguration.getInstance(project).ADD_EXTERNAL_FILES_SILENTLY
|
||||
|
||||
override fun doFilterFiles(files: Collection<VirtualFile>): Collection<VirtualFile> =
|
||||
changeListManager.unversionedFiles
|
||||
.asSequence()
|
||||
|
||||
+11
-3
@@ -13,7 +13,7 @@
|
||||
<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"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<grid id="4ec1c" binding="myAddConfirmationPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="4ec1c" binding="myAddConfirmationPanel" layout-manager="GridLayoutManager" row-count="3" 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="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@@ -26,7 +26,7 @@
|
||||
<children>
|
||||
<component id="61373" class="javax.swing.JRadioButton" binding="myShowDialogOnAddingFile">
|
||||
<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"/>
|
||||
<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>
|
||||
<margin top="2" left="2" bottom="2" right="2"/>
|
||||
@@ -43,12 +43,20 @@
|
||||
</component>
|
||||
<component id="7fc5c" class="javax.swing.JRadioButton" binding="myDoNothingOnAddingFile">
|
||||
<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"/>
|
||||
<grid row="2" 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/VcsBundle" key="radio.after.creation.do.not.add"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="aab0" class="javax.swing.JCheckBox" binding="myAddExternalFiles">
|
||||
<constraints>
|
||||
<grid row="1" column="1" 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="Including &external files"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="19911" binding="myEmptyChangeListPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
|
||||
+14
@@ -17,6 +17,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.Border;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
@@ -48,6 +50,7 @@ public class VcsGeneralConfigurationPanel {
|
||||
private JCheckBox myReloadContext;
|
||||
private JLabel myOnPatchCreationLabel;
|
||||
private JPanel myEmptyChangeListPanel;
|
||||
private JCheckBox myAddExternalFiles;
|
||||
private ButtonGroup myEmptyChangelistRemovingGroup;
|
||||
|
||||
public VcsGeneralConfigurationPanel(final Project project) {
|
||||
@@ -62,6 +65,13 @@ public class VcsGeneralConfigurationPanel {
|
||||
myDoNothingOnAddingFile
|
||||
};
|
||||
|
||||
myPerformActionOnAddingFile.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
myAddExternalFiles.setEnabled(myPerformActionOnAddingFile.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
myOnFileRemovingGroup = new JRadioButton[]{
|
||||
myShowDialogOnRemovingFile,
|
||||
myPerformActionOnRemovingFile,
|
||||
@@ -91,6 +101,7 @@ public class VcsGeneralConfigurationPanel {
|
||||
|
||||
settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS = getSelected(myEmptyChangelistRemovingGroup);
|
||||
settings.RELOAD_CONTEXT = myReloadContext.isSelected();
|
||||
settings.ADD_EXTERNAL_FILES_SILENTLY = myAddExternalFiles.isSelected();
|
||||
|
||||
for (VcsShowOptionsSettingImpl setting : myPromptOptions.keySet()) {
|
||||
setting.setValue(myPromptOptions.get(setting).isSelected());
|
||||
@@ -176,6 +187,7 @@ public class VcsGeneralConfigurationPanel {
|
||||
return true;
|
||||
}
|
||||
if (settings.RELOAD_CONTEXT != myReloadContext.isSelected()) return true;
|
||||
if (settings.ADD_EXTERNAL_FILES_SILENTLY != myAddExternalFiles.isSelected()) return true;
|
||||
|
||||
if (getReadOnlyStatusHandler().getState().SHOW_DIALOG != myShowReadOnlyStatusDialog.isSelected()) {
|
||||
return true;
|
||||
@@ -195,6 +207,8 @@ public class VcsGeneralConfigurationPanel {
|
||||
public void reset() {
|
||||
VcsConfiguration settings = VcsConfiguration.getInstance(myProject);
|
||||
myReloadContext.setSelected(settings.RELOAD_CONTEXT);
|
||||
myAddExternalFiles.setSelected(settings.ADD_EXTERNAL_FILES_SILENTLY);
|
||||
myAddExternalFiles.setEnabled(myPerformActionOnAddingFile.isSelected());
|
||||
VcsShowConfirmationOption.Value value = settings.REMOVE_EMPTY_INACTIVE_CHANGELISTS;
|
||||
UIUtil.setSelectedButton(myEmptyChangelistRemovingGroup, value == VcsShowConfirmationOption.Value.SHOW_CONFIRMATION
|
||||
? 0
|
||||
|
||||
Reference in New Issue
Block a user