Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2011-03-30 13:31:46 +0000
committerCode Review2011-03-30 13:31:46 +0000
commitbc429b816589c950d4dcb9829b3d5d6f7ac7eeaf (patch)
tree26f6c5eb2494780abedbdabcbf83c94e73d43c77
parentceba597d5e71b3969340b8063b9bc3606c99ca7a (diff)
parent21981f6a510043fa26f138ab52f98caa9b65e771 (diff)
downloadegit-bc429b816589c950d4dcb9829b3d5d6f7ac7eeaf.tar.gz
egit-bc429b816589c950d4dcb9829b3d5d6f7ac7eeaf.tar.xz
egit-bc429b816589c950d4dcb9829b3d5d6f7ac7eeaf.zip
Merge "Push/Fetch configuration: show branch information only where needed"
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/SimpleConfigureFetchDialog.java46
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/SimpleConfigurePushDialog.java52
2 files changed, 66 insertions, 32 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/SimpleConfigureFetchDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/SimpleConfigureFetchDialog.java
index 49df9338e1..bf1e3d2aa0 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/SimpleConfigureFetchDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/SimpleConfigureFetchDialog.java
@@ -89,6 +89,8 @@ public class SimpleConfigureFetchDialog extends TitleAreaDialog {
private RemoteConfig config;
+ private final boolean showBranchInfo;
+
private Text commonUriText;
private TableViewer specViewer;
@@ -108,7 +110,8 @@ public class SimpleConfigureFetchDialog extends TitleAreaDialog {
*/
public static Dialog getDialog(Shell shell, Repository repository) {
RemoteConfig configToUse = getConfiguredRemote(repository);
- return new SimpleConfigureFetchDialog(shell, repository, configToUse);
+ return new SimpleConfigureFetchDialog(shell, repository, configToUse,
+ true);
}
/**
@@ -127,7 +130,8 @@ public class SimpleConfigureFetchDialog extends TitleAreaDialog {
Activator.handleError(e.getMessage(), e, true);
return null;
}
- return new SimpleConfigureFetchDialog(shell, repository, configToUse);
+ return new SimpleConfigureFetchDialog(shell, repository, configToUse,
+ false);
}
/**
@@ -181,14 +185,18 @@ public class SimpleConfigureFetchDialog extends TitleAreaDialog {
* @param shell
* @param repository
* @param config
+ * @param showBranchInfo
+ * should be true if this is used for upstream configuration; if
+ * false, branch information will be hidden in the dialog
*/
private SimpleConfigureFetchDialog(Shell shell, Repository repository,
- RemoteConfig config) {
+ RemoteConfig config, boolean showBranchInfo) {
super(shell);
setHelpAvailable(false);
setShellStyle(getShellStyle() | SWT.SHELL_TRIM);
this.repository = repository;
this.config = config;
+ this.showBranchInfo = showBranchInfo;
}
@Override
@@ -213,20 +221,24 @@ public class SimpleConfigureFetchDialog extends TitleAreaDialog {
repositoryText.setText(Activator.getDefault().getRepositoryUtil()
.getRepositoryName(repository));
- Label branchLabel = new Label(repositoryGroup, SWT.NONE);
- branchLabel.setText(UIText.SimpleConfigureFetchDialog_BranchLabel);
- String branch;
- try {
- branch = repository.getBranch();
- } catch (IOException e2) {
- branch = null;
- }
- if (branch == null || ObjectId.isId(branch)) {
- branch = UIText.SimpleConfigureFetchDialog_DetachedHeadMessage;
+ if (showBranchInfo) {
+ Label branchLabel = new Label(repositoryGroup, SWT.NONE);
+ branchLabel.setText(UIText.SimpleConfigureFetchDialog_BranchLabel);
+ String branch;
+ try {
+ branch = repository.getBranch();
+ } catch (IOException e2) {
+ branch = null;
+ }
+ if (branch == null || ObjectId.isId(branch)) {
+ branch = UIText.SimpleConfigureFetchDialog_DetachedHeadMessage;
+ }
+ Text branchText = new Text(repositoryGroup, SWT.BORDER
+ | SWT.READ_ONLY);
+ GridDataFactory.fillDefaults().grab(true, false)
+ .applyTo(branchText);
+ branchText.setText(branch);
}
- Text branchText = new Text(repositoryGroup, SWT.BORDER | SWT.READ_ONLY);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(branchText);
- branchText.setText(branch);
Group remoteGroup = new Group(main, SWT.SHADOW_ETCHED_IN);
remoteGroup.setLayout(new GridLayout(1, false));
@@ -636,6 +648,8 @@ public class SimpleConfigureFetchDialog extends TitleAreaDialog {
* @param parent
*/
private void addDefaultOriginWarningIfNeeded(Composite parent) {
+ if (!showBranchInfo)
+ return;
List<String> otherBranches = new ArrayList<String>();
String currentBranch;
try {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/SimpleConfigurePushDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/SimpleConfigurePushDialog.java
index 3f61860ca4..2af53e2156 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/SimpleConfigurePushDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/SimpleConfigurePushDialog.java
@@ -88,6 +88,8 @@ public class SimpleConfigurePushDialog extends TitleAreaDialog {
private RemoteConfig config;
+ private final boolean showBranchInfo;
+
private Text commonUriText;
private TableViewer uriViewer;
@@ -111,7 +113,8 @@ public class SimpleConfigurePushDialog extends TitleAreaDialog {
*/
public static Dialog getDialog(Shell shell, Repository repository) {
RemoteConfig configToUse = getConfiguredRemote(repository);
- return new SimpleConfigurePushDialog(shell, repository, configToUse);
+ return new SimpleConfigurePushDialog(shell, repository, configToUse,
+ true);
}
/**
@@ -130,7 +133,8 @@ public class SimpleConfigurePushDialog extends TitleAreaDialog {
Activator.handleError(e.getMessage(), e, true);
return null;
}
- return new SimpleConfigurePushDialog(shell, repository, configToUse);
+ return new SimpleConfigurePushDialog(shell, repository, configToUse,
+ false);
}
/**
@@ -178,13 +182,23 @@ public class SimpleConfigurePushDialog extends TitleAreaDialog {
return configToUse;
}
+ /**
+ *
+ * @param shell
+ * @param repository
+ * @param config
+ * @param showBranchInfo
+ * should be true if this is used for upstream configuration; if
+ * false, branch information will be hidden in the dialog
+ */
private SimpleConfigurePushDialog(Shell shell, Repository repository,
- RemoteConfig config) {
+ RemoteConfig config, boolean showBranchInfo) {
super(shell);
setHelpAvailable(false);
setShellStyle(getShellStyle() | SWT.SHELL_TRIM);
this.repository = repository;
this.config = config;
+ this.showBranchInfo = showBranchInfo;
}
@Override
@@ -209,20 +223,24 @@ public class SimpleConfigurePushDialog extends TitleAreaDialog {
repositoryText.setText(Activator.getDefault().getRepositoryUtil()
.getRepositoryName(repository));
- Label branchLabel = new Label(repositoryGroup, SWT.NONE);
- branchLabel.setText(UIText.SimpleConfigurePushDialog_BranchLabel);
- String branch;
- try {
- branch = repository.getBranch();
- } catch (IOException e2) {
- branch = null;
- }
- if (branch == null || ObjectId.isId(branch)) {
- branch = UIText.SimpleConfigurePushDialog_DetachedHeadMessage;
+ if (showBranchInfo) {
+ Label branchLabel = new Label(repositoryGroup, SWT.NONE);
+ branchLabel.setText(UIText.SimpleConfigurePushDialog_BranchLabel);
+ String branch;
+ try {
+ branch = repository.getBranch();
+ } catch (IOException e2) {
+ branch = null;
+ }
+ if (branch == null || ObjectId.isId(branch)) {
+ branch = UIText.SimpleConfigurePushDialog_DetachedHeadMessage;
+ }
+ Text branchText = new Text(repositoryGroup, SWT.BORDER
+ | SWT.READ_ONLY);
+ GridDataFactory.fillDefaults().grab(true, false)
+ .applyTo(branchText);
+ branchText.setText(branch);
}
- Text branchText = new Text(repositoryGroup, SWT.BORDER | SWT.READ_ONLY);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(branchText);
- branchText.setText(branch);
Group remoteGroup = new Group(main, SWT.SHADOW_ETCHED_IN);
remoteGroup.setLayout(new GridLayout());
@@ -711,6 +729,8 @@ public class SimpleConfigurePushDialog extends TitleAreaDialog {
* @param parent
*/
private void addDefaultOriginWarningIfNeeded(Composite parent) {
+ if (!showBranchInfo)
+ return;
List<String> otherBranches = new ArrayList<String>();
String currentBranch;
try {

Back to the top