summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDariusz Luksza2010-08-16 19:32:09 (EDT)
committer Matthias Sohn2010-08-17 07:41:45 (EDT)
commitad9304982526131ba7664a75dc581360248000a4 (patch)
tree0500aaacbe106b9967aef061576d020cffd7c205
parent3f3af98563c6c9dadd80741a655635ecd24b5eec (diff)
downloadegit-ad9304982526131ba7664a75dc581360248000a4.zip
egit-ad9304982526131ba7664a75dc581360248000a4.tar.gz
egit-ad9304982526131ba7664a75dc581360248000a4.tar.bz2
Set default values in sync dialogrefs/changes/21/1321/2
Preset default values in SelectSynchronizeResourceDialog to: * source: local .git/HEAD * destination: origin/master Bug: 322851 Change-Id: I1ab00c8f6b091538119013da35dee78e14ceeef9 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/internal/synchronize/RemoteSelectionCombo.java23
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/SelectSynchronizeResourceDialog.java6
2 files changed, 29 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/RemoteSelectionCombo.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/RemoteSelectionCombo.java
index ad3f7e1..b36e1ab 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/RemoteSelectionCombo.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/RemoteSelectionCombo.java
@@ -70,6 +70,29 @@ class RemoteSelectionCombo extends Composite {
refSelectedIndex).getValue();
}
+ public void setDefautlValue(String remote, String ref) {
+ int i = 0;
+ for (; i < syncRepos.size(); i++)
+ if (syncRepos.get(i).getName().equals(remote))
+ break;
+
+ if (i == syncRepos.size())
+ return; // repository name not found
+
+ remotesCombo.select(i);
+ fillRefsCombo();
+
+ List<SyncRefEntity> refList = syncRepos.get(i).getRefList();
+ i = 0;
+ for (; i < refList.size(); i++)
+ if (refList.get(i).getDescription().equals(ref))
+ break;
+
+ if (i == syncRepos.size())
+ return; // ref name not found
+ refsCombo.select(i);
+ }
+
private void fillRefsCombo() {
int selected = remotesCombo.getSelectionIndex();
if (selected < 0) {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/SelectSynchronizeResourceDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/SelectSynchronizeResourceDialog.java
index e55a271..34b0128 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/SelectSynchronizeResourceDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/SelectSynchronizeResourceDialog.java
@@ -8,6 +8,10 @@
*******************************************************************************/
package org.eclipse.egit.ui.internal.synchronize;
+import static org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME;
+import static org.eclipse.jgit.lib.Constants.HEAD;
+import static org.eclipse.jgit.lib.Constants.MASTER;
+
import java.io.File;
import java.util.List;
@@ -106,6 +110,7 @@ public class SelectSynchronizeResourceDialog extends TitleAreaDialog {
.setText(UIText.SelectSynchronizeResourceDialog_srcRef);
srcRefCombo = new RemoteSelectionCombo(composite, syncRepos);
+ srcRefCombo.setDefautlValue(UIText.SynchronizeWithAction_localRepoName, HEAD);
srcRefCombo.setLayoutData(data);
srcRefCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true,
false).create());
@@ -118,6 +123,7 @@ public class SelectSynchronizeResourceDialog extends TitleAreaDialog {
.setText(UIText.SelectSynchronizeResourceDialog_dstRef);
dstRefCombo = new RemoteSelectionCombo(composite, syncRepos);
+ dstRefCombo.setDefautlValue(DEFAULT_REMOTE_NAME, MASTER);
dstRefCombo.setLayoutData(data);
dstRefCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true,
false).create());