Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2019-10-30 18:58:15 -0400
committerThomas Wolf2019-11-16 06:48:19 -0500
commit68b419516456615c04722e167fcede4adc1bf5d0 (patch)
tree9942a7d4af0556f28525258788b1b77de1d63dee
parentc288b8b9792b1bdf78e230f9dae392c8b68dc006 (diff)
downloadegit-68b419516456615c04722e167fcede4adc1bf5d0.tar.gz
egit-68b419516456615c04722e167fcede4adc1bf5d0.tar.xz
egit-68b419516456615c04722e167fcede4adc1bf5d0.zip
[repo groups] "Don't show again" for deletion confirmation
Introduce a preference for showing this confirmation dialog (by default true). Add a checkbox to the dialog to toggle the setting. Add an item on the "Confirmations & Warnings" preference page to set and re-set the setting. Show the dialog only if the setting is true, and there are any repositories in the to-be-deleted repository groups. Change-Id: Ia4b292af2fd84844a3f4c64f7a3d97db9c72e6ff Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java3
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/DialogsPreferencePage.java6
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/DeleteRepositoryGroupCommand.java28
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/DeleteRepositoryGroupConfirmDialog.java20
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties2
7 files changed, 61 insertions, 8 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java
index fa891ffb9..c8c132a2d 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java
@@ -6,7 +6,7 @@
* Copyright (C) 2013, Robin Stocker <robin@nibor.org>
* Copyright (C) 2015, Jan-Ove Weichel <ovi.weichel@gmail.com>
* Copyright (C) 2015, SAP SE (Christian Georgi <christian.georgi@sap.com>)
- * Copyright (C) 2016, Thomas Wolf <thomas.wolf@paranor.ch>
+ * Copyright (C) 2016, 2019 Thomas Wolf <thomas.wolf@paranor.ch>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -121,6 +121,7 @@ public class PluginPreferenceInitializer extends AbstractPreferenceInitializer {
store.setDefault(UIPreferences.SHOW_HOME_DIR_WARNING, true);
store.setDefault(UIPreferences.LFS_AUTO_CONFIGURATION, false);
store.setDefault(UIPreferences.SHOW_DETACHED_HEAD_WARNING, true);
+ store.setDefault(UIPreferences.SHOW_DELETE_REPO_GROUP_WARNING, true);
store.setDefault(UIPreferences.SHOW_CHECKOUT_CONFIRMATION, true);
store.setDefault(UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING,
true);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java
index ebf186c11..891787848 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java
@@ -8,7 +8,7 @@
* Copyright (C) 2014, Marc Khouzam <marc.khouzam@ericsson.com>
* Copyright (C) 2015, Jan-Ove Weichel <ovi.weichel@gmail.com>
* Copyright (C) 2015, SAP SE (Christian Georgi <christian.georgi@sap.com>)
- * Copyright (C) 2016, Thomas Wolf <thomas.wolf@paranor.ch>
+ * Copyright (C) 2016, 2019 Thomas Wolf <thomas.wolf@paranor.ch>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -203,6 +203,8 @@ public class UIPreferences {
/** */
public static final String SHOW_DETACHED_HEAD_WARNING = "show_detached_head_warning"; //$NON-NLS-1$
/** */
+ public static final String SHOW_DELETE_REPO_GROUP_WARNING = "show_delete_repo_group_warning"; //$NON-NLS-1$
+ /** */
public static final String SHOW_CHECKOUT_CONFIRMATION = "show_checkout_confirmation"; //$NON-NLS-1$
/** */
public static final String SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING = "show_running_launch_on_checkout_warning"; //$NON-NLS-1$
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
index d14ec4abe..4143c09a8 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
@@ -3841,6 +3841,9 @@ public class UIText extends NLS {
public static String RepositoriesView_RepoGroup_Remove_Title;
/** */
+ public static String RepositoriesView_RepoGroup_DeleteDontShowAgain;
+
+ /** */
public static String RepositoriesView_RepoGroup_Delete_Title;
/** */
@@ -3910,6 +3913,9 @@ public class UIText extends NLS {
public static String DialogsPreferencePage_HideConfirmationGroupHeader;
/** */
+ public static String DialogsPreferencePage_ShowDeleteRepoGroup;
+
+ /** */
public static String DialogsPreferencePage_ShowInfoGroupHeader;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/DialogsPreferencePage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/DialogsPreferencePage.java
index 2194dcb74..8148a76cc 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/DialogsPreferencePage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/DialogsPreferencePage.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* Copyright (C) 2011, Mathias Kinzler <mathias.kinzler@sap.com>
* Copyright (C) 2012, Matthias Sohn <matthias.sohn@sap.com>
- * Copyright (C) 2017, Thomas Wolf <thomas.wolf@paranor.ch>
+ * Copyright (C) 2017, 2019 Thomas Wolf <thomas.wolf@paranor.ch>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -72,6 +72,10 @@ public class DialogsPreferencePage extends FieldEditorPreferencePage implements
UIPreferences.SHOW_DETACHED_HEAD_WARNING,
UIText.DialogsPreferencePage_DetachedHeadCombo, confirmDialogsGroup));
addField(new BooleanFieldEditor(
+ UIPreferences.SHOW_DELETE_REPO_GROUP_WARNING,
+ UIText.DialogsPreferencePage_ShowDeleteRepoGroup,
+ confirmDialogsGroup));
+ addField(new BooleanFieldEditor(
UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING,
UIText.DialogsPreferencePage_RunningLaunchOnCheckout,
confirmDialogsGroup));
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/DeleteRepositoryGroupCommand.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/DeleteRepositoryGroupCommand.java
index 182c97871..f35543f9e 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/DeleteRepositoryGroupCommand.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/DeleteRepositoryGroupCommand.java
@@ -15,14 +15,17 @@ import java.util.List;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.egit.ui.Activator;
+import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.internal.groups.RepositoryGroup;
import org.eclipse.egit.ui.internal.groups.RepositoryGroups;
import org.eclipse.egit.ui.internal.repository.tree.RepositoryGroupNode;
import org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.window.Window;
/**
- * Deletes a repository group, the repositories themselves are not affeced
+ * Deletes a repository group, the repositories themselves are not affected.
*/
public class DeleteRepositoryGroupCommand
extends RepositoriesViewCommandHandler<RepositoryTreeNode> {
@@ -32,17 +35,32 @@ public class DeleteRepositoryGroupCommand
List<RepositoryGroup> groupsToDelete = new ArrayList<>();
List<RepositoryGroupNode> groupsNodes = new ArrayList<>();
List<RepositoryTreeNode> elements = getSelectedNodes();
+ int numberOfRepos = 0;
for (Object element : elements) {
if (element instanceof RepositoryGroupNode) {
RepositoryGroupNode groupNode = (RepositoryGroupNode) element;
groupsNodes.add(groupNode);
- groupsToDelete.add(groupNode.getObject());
+ RepositoryGroup group = groupNode.getObject();
+ groupsToDelete.add(group);
+ numberOfRepos += group.getRepositoryDirectories().size();
}
}
if (!groupsToDelete.isEmpty()) {
- DeleteRepositoryGroupConfirmDialog confirmDelete = new DeleteRepositoryGroupConfirmDialog(
- getShell(event), groupsNodes);
- if (confirmDelete.open() == Window.OK) {
+ IPreferenceStore store = Activator.getDefault()
+ .getPreferenceStore();
+
+ boolean delete = true;
+ if (numberOfRepos > 0 && store
+ .getBoolean(UIPreferences.SHOW_DELETE_REPO_GROUP_WARNING)) {
+ DeleteRepositoryGroupConfirmDialog confirmDelete = new DeleteRepositoryGroupConfirmDialog(
+ getShell(event), groupsNodes);
+ delete = confirmDelete.open() == Window.OK;
+ if (!confirmDelete.showAgain()) {
+ store.setValue(UIPreferences.SHOW_DELETE_REPO_GROUP_WARNING,
+ false);
+ }
+ }
+ if (delete) {
RepositoryGroups.getInstance().delete(groupsToDelete);
getView(event).refresh();
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/DeleteRepositoryGroupConfirmDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/DeleteRepositoryGroupConfirmDialog.java
index 71f325d85..ae9d7a2b8 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/DeleteRepositoryGroupConfirmDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/DeleteRepositoryGroupConfirmDialog.java
@@ -29,6 +29,7 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
@@ -40,6 +41,10 @@ public class DeleteRepositoryGroupConfirmDialog extends TitleAreaDialog {
private List<RepositoryGroupNode> groupsToDelete;
+ private boolean shouldShowAgain;
+
+ private Button dontShowAgain;
+
/**
* @param parentShell
* @param groupsToDelete
@@ -76,12 +81,27 @@ public class DeleteRepositoryGroupConfirmDialog extends TitleAreaDialog {
groupsViewer.setContentProvider(
new DeleteRepositoryGroupTreeContentProvider());
groupsViewer.setInput(groupsToDelete);
+ dontShowAgain = new Button(main, SWT.CHECK);
+ dontShowAgain.setText(UIText.RepositoriesView_RepoGroup_DeleteDontShowAgain);
setTitle(UIText.RepositoriesView_RepoGroup_Delete_Title);
setMessage(UIText.RepositoriesView_RepoGroup_Delete_Confirm);
return main;
}
@Override
+ protected void okPressed() {
+ shouldShowAgain = !dontShowAgain.getSelection();
+ super.okPressed();
+ }
+
+ /**
+ * @return whether to show this dialog again in the future
+ */
+ public boolean showAgain() {
+ return shouldShowAgain;
+ }
+
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID,
UIText.DeleteRepositoryConfirmDialog_DeleteRepositoryConfirmButton,
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
index beded8819..00fa735d2 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
@@ -1356,6 +1356,7 @@ RepositoriesView_RepoGroup_Create_MenuItemLabel=Create Repository Group...
RepositoriesView_RepoGroup_Create_Title=Create Repository Group
RepositoriesView_RepoGroup_Assign=Move to ''{0}''
RepositoriesView_RepoGroup_Remove_Title=Remove from Repository Group
+RepositoriesView_RepoGroup_DeleteDontShowAgain=Don't show this dialog again
RepositoriesView_RepoGroup_Delete_Title=Delete Repository Groups
RepositoriesView_RepoGroup_Delete_Confirm=Confirm the deletion of repository groups. Repositories will not be removed or deleted.\nThey will not belong to any group afterwards.
RepositoriesView_RepoGroup_Rename_Title=Rename Repository Group
@@ -1380,6 +1381,7 @@ RepositoryGroups_SavePreferencesError=Error saving repository group state
DialogsPreferencePage_autoConfigureLfs=Automatically configure LFS without confirmation
DialogsPreferencePage_DetachedHeadCombo=D&etached HEAD and checkout of remote-tracking branch
DialogsPreferencePage_HideConfirmationGroupHeader=Show confirmation dialogs
+DialogsPreferencePage_ShowDeleteRepoGroup=Deletion of non-empty repository groups in the repositories view
DialogsPreferencePage_ShowInfoGroupHeader=Show result dialogs after git remote operations
DialogsPreferencePage_ShowFetchInfoDialog=&Fetch Result Dialog
DialogsPreferencePage_ShowPushInfoDialog=&Push Result Dialog

Back to the top