Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDariusz Luksza2012-05-18 09:30:30 +0000
committerMatthias Sohn2012-05-18 09:30:30 +0000
commitf8982e557ce997c0c12846ef12ff360d53cd5b5f (patch)
tree9ba9274e5a9623f18300455a18cf425c4cdedb1b
parent5c5d942d83fb0a9ea2f5582ed60d6b47f3724cc7 (diff)
downloadegit-f8982e557ce997c0c12846ef12ff360d53cd5b5f.tar.gz
egit-f8982e557ce997c0c12846ef12ff360d53cd5b5f.tar.xz
egit-f8982e557ce997c0c12846ef12ff360d53cd5b5f.zip
Improve clone operation failure dialog
Improves dialog showed when ls-remotes command failed by adding additional information about failure cause and suggestions what could solve this issue. Bug: 336795 Change-Id: I1f6bdfd7355941a9a732be7d55d44fc76c618cb8 Signed-off-by: Dariusz Luksza <dariusz@luksza.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/PluginPreferenceInitializer.java1
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIPreferences.java2
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java15
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/SourceBranchPage.java20
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SourceBranchFailureDialog.java107
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/DialogsPreferencePage.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties8
7 files changed, 144 insertions, 13 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 14896fe1e8..7e50cb3ccb 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
@@ -99,6 +99,7 @@ public class PluginPreferenceInitializer extends AbstractPreferenceInitializer {
store.setDefault(UIPreferences.CHECKOUT_PROJECT_RESTORE, true);
store.setDefault(UIPreferences.HISTORY_MAX_TAG_LENGTH, 15);
store.setDefault(UIPreferences.HISTORY_MAX_BRANCH_LENGTH, 15);
+ store.setDefault(UIPreferences.CLONE_WIZARD_SHOW_DETAILED_FAILURE_DIALOG, 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 7cdb850f02..68c1d9a450 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
@@ -174,6 +174,8 @@ public class UIPreferences {
public static final String CLONE_WIZARD_STORE_SECURESTORE = "CloneWizard_StoreInSecureStore"; //$NON-NLS-1$
/** */
public static final String CLONE_WIZARD_IMPORT_PROJECTS = "CloneWizard_ImportProjects"; //$NON-NLS-1$
+ /** */
+ public static final String CLONE_WIZARD_SHOW_DETAILED_FAILURE_DIALOG = "CloneWizard_ShowDetailedFailureDialog"; //$NON-NLS-1$
/**
* Converts a persisted String separated with commas to an integer array
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
index 80b372e1e6..ba6bd73ec6 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
@@ -1174,9 +1174,6 @@ public class UIText extends NLS {
public static String SourceBranchPage_errorBranchRequired;
/** */
- public static String SourceBranchPage_transportError;
-
- /** */
public static String SourceBranchPage_cannotListBranches;
/** */
@@ -2998,6 +2995,9 @@ public class UIText extends NLS {
public static String DialogsPreferencePage_ShowInitialConfigCheckbox;
/** */
+ public static String DialogsPreferencePage_ShowCloneFailedDialog;
+
+ /** */
public static String DiffEditorPage_TaskGeneratingDiff;
/** */
@@ -4498,6 +4498,15 @@ public class UIText extends NLS {
/** */
public static String EclipseSshSessionFactory_noIdentities;
+ /** */
+ public static String CloneFailureDialog_tile;
+
+ /** */
+ public static String CloneFailureDialog_dontShowAgain;
+
+ /** */
+ public static String CloneFailureDialog_checkList;
+
static {
initializeMessages(BUNDLE_NAME, UIText.class);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/SourceBranchPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/SourceBranchPage.java
index 0e0785d7aa..80e45916d2 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/SourceBranchPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/clone/SourceBranchPage.java
@@ -23,8 +23,6 @@ import java.util.Comparator;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.egit.core.op.ListRemoteOperation;
@@ -36,9 +34,9 @@ import org.eclipse.egit.ui.internal.CachedCheckboxTreeViewer;
import org.eclipse.egit.ui.internal.FilteredCheckboxTree;
import org.eclipse.egit.ui.internal.components.RepositorySelection;
import org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider;
+import org.eclipse.egit.ui.internal.dialogs.SourceBranchFailureDialog;
import org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNodeType;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
@@ -328,11 +326,8 @@ class SourceBranchPage extends WizardPage {
} catch (InvocationTargetException e) {
Throwable why = e.getCause();
transportError(why);
- ErrorDialog.openError(getShell(),
- UIText.SourceBranchPage_transportError,
- UIText.SourceBranchPage_cannotListBranches, new Status(
- IStatus.ERROR, Activator.getPluginId(), 0, why
- .getMessage(), why));
+ if (showDetailedFailureDialog())
+ SourceBranchFailureDialog.show(getShell(), transportError);
return;
} catch (IOException e) {
transportError(UIText.SourceBranchPage_cannotCreateTemp);
@@ -390,4 +385,13 @@ class SourceBranchPage extends WizardPage {
transportError = msg;
checkPage();
}
+
+ private boolean showDetailedFailureDialog() {
+ return Activator
+ .getDefault()
+ .getPreferenceStore()
+ .getBoolean(
+ UIPreferences.CLONE_WIZARD_SHOW_DETAILED_FAILURE_DIALOG);
+ }
+
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SourceBranchFailureDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SourceBranchFailureDialog.java
new file mode 100644
index 0000000000..13c6fb125d
--- /dev/null
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SourceBranchFailureDialog.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (C) 2012, Dariusz Luksza <dariusz@luksza.org>
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.egit.ui.internal.dialogs;
+
+import org.eclipse.egit.ui.Activator;
+import org.eclipse.egit.ui.UIPreferences;
+import org.eclipse.egit.ui.UIText;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.Bullet;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.GlyphMetrics;
+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;
+
+/**
+ * Creates and shows custom error dialog for failed ls-remotes operation
+ */
+public class SourceBranchFailureDialog extends MessageDialog {
+
+ /**
+ * Creates and shows custom error dialog for failed ls-remotes operation
+ *
+ * @param parentShell
+ * @param cause full failure cause message
+ */
+ public static void show(Shell parentShell, String cause) {
+ SourceBranchFailureDialog dialog = new SourceBranchFailureDialog(parentShell, cause);
+ dialog.setShellStyle(dialog.getShellStyle() | SWT.SHEET | SWT.RESIZE);
+ dialog.open();
+ }
+
+ private Button toggleButton;
+
+ private final String cause;
+
+ private SourceBranchFailureDialog(Shell parentShell, String cause) {
+ super(parentShell, UIText.CloneFailureDialog_tile, null, null,
+ MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0);
+ this.cause = cause;
+ }
+
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (toggleButton != null)
+ Activator
+ .getDefault()
+ .getPreferenceStore()
+ .setValue(UIPreferences.CLONE_WIZARD_SHOW_DETAILED_FAILURE_DIALOG,
+ !toggleButton.getSelection());
+
+ super.buttonPressed(buttonId);
+ }
+
+ @Override
+ protected Control createMessageArea(Composite composite) {
+ Composite main = new Composite(composite, SWT.NONE);
+ main.setLayout(new GridLayout(2, false));
+ GridDataFactory.fillDefaults().indent(0, 0).grab(true, true).applyTo(
+ main);
+ // add error image
+ super.createMessageArea(main);
+
+ StyledText text = new StyledText(main, SWT.FULL_SELECTION | SWT.WRAP);
+ text.setEnabled(false);
+ text.setBackground(main.getBackground());
+
+ String messageText = NLS.bind(UIText.CloneFailureDialog_checkList, cause);
+ int newLinesCount = messageText.split("\n").length; //$NON-NLS-1$
+ Bullet bullet = createBullet(main);
+
+ text.setText(messageText);
+ text.setLineBullet(newLinesCount - 4, 2, bullet);
+
+ return main;
+ }
+
+ private Bullet createBullet(Composite main) {
+ StyleRange style = new StyleRange();
+ style.metrics = new GlyphMetrics(0, 0, 40);
+ style.foreground = main.getDisplay().getSystemColor(SWT.COLOR_BLACK);
+ Bullet bullet = new Bullet(style);
+ return bullet;
+ }
+
+ @Override
+ protected Control createCustomArea(Composite parent) {
+ toggleButton = new Button(parent, SWT.CHECK | SWT.LEFT);
+ toggleButton.setText(UIText.CloneFailureDialog_dontShowAgain);
+
+ return null;
+ }
+
+}
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 a9d658cd68..88d222141c 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
@@ -66,6 +66,10 @@ public class DialogsPreferencePage extends FieldEditorPreferencePage implements
UIText.DialogsPreferencePage_DetachedHeadCombo, confirmGroup));
addField(new BooleanFieldEditor(UIPreferences.SHOW_HOME_DIR_WARNING,
UIText.DialogsPreferencePage_HomeDirWarning, confirmGroup));
+ addField(new BooleanFieldEditor(
+ UIPreferences.CLONE_WIZARD_SHOW_DETAILED_FAILURE_DIALOG,
+ UIText.DialogsPreferencePage_ShowCloneFailedDialog,
+ confirmGroup));
updateMargins(confirmGroup);
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
index c53b285312..36147c5d96 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
@@ -406,7 +406,6 @@ SourceBranchPage_branchList=Branches &of {0}:
SourceBranchPage_selectAll=&Select All
SourceBranchPage_selectNone=&Deselect All
SourceBranchPage_errorBranchRequired=At least one branch must be selected.
-SourceBranchPage_transportError=Transport Error
SourceBranchPage_cannotListBranches=Cannot list the available branches.
SourceBranchPage_remoteListingCancelled=Operation canceled
SourceBranchPage_cannotCreateTemp=Couldn't create temporary repository.
@@ -1037,6 +1036,7 @@ DialogsPreferencePage_HomeDirWarning=&Home directory warning (Windows only)
DialogsPreferencePage_RebaseCheckbox=&Rebase confirmation
DialogsPreferencePage_ShowDialog=Prompt
DialogsPreferencePage_ShowInitialConfigCheckbox=&Initial configuration
+DialogsPreferencePage_ShowCloneFailedDialog=Clone failed error
DiffEditorPage_TaskGeneratingDiff=Generating diff
DiffEditorPage_TaskUpdatingViewer=Updating diff viewer
DiffEditorPage_Title=Diff
@@ -1566,4 +1566,8 @@ RebasePulldownAction_Abort=&Abort
SynchronizeCommand_jobName=Synchronizing {0} ...
GitOpenInCompareAction_cannotRetrieveCommitWithId=Cannot retrieve commit with id {0} from repository {1}
-EclipseSshSessionFactory_noIdentities=Cannot find SSH keys. \ No newline at end of file
+EclipseSshSessionFactory_noIdentities=Cannot find SSH keys.
+
+CloneFailureDialog_tile=Transport Error
+CloneFailureDialog_dontShowAgain=Don't show this dialog again
+CloneFailureDialog_checkList={0}\n\nPlease check:\nNetwork Connection settings\nNetwork Connection -> SSH2 Eclipse preferences\n\nYou may also need to restart Eclipse after making changes in preferences. \ No newline at end of file

Back to the top