aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Scholz2011-03-18 13:23:35 (EDT)
committerSascha Scholz2011-03-18 13:23:35 (EDT)
commita3d255e0c9f027d39ffdbafe218b169cad7d17a1 (patch)
tree1ac3c1f263f1d743a0176928332ffcd226462eeb
parent26272c3e0e3508775ba813c54d8135a626cfffa3 (diff)
downloadegit-a3d255e0c9f027d39ffdbafe218b169cad7d17a1.zip
egit-a3d255e0c9f027d39ffdbafe218b169cad7d17a1.tar.gz
egit-a3d255e0c9f027d39ffdbafe218b169cad7d17a1.tar.bz2
Allow ref name prepopulation in gerrit fetch wizardrefs/changes/81/2781/1
Mylyn Reviews Gerrit connector plans to use this functionality to allow fetching changes from the task editor. Change-Id: Ida2465e16bc92b8620f7d76b8428d68e30227ddb
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java15
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangeWizard.java13
2 files changed, 26 insertions, 2 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java
index 6a50dde..13a7027 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangePage.java
@@ -96,12 +96,16 @@ public class FetchGerritChangePage extends WizardPage {
private Text branchText;
+ private String refName;
+
/**
* @param repository
+ * @param refName initial value for the ref field
*/
- public FetchGerritChangePage(Repository repository) {
+ public FetchGerritChangePage(Repository repository, String refName) {
super(FetchGerritChangePage.class.getName());
this.repository = repository;
+ this.refName = refName;
setTitle(NLS
.bind(UIText.FetchGerritChangePage_PageTitle,
Activator.getDefault().getRepositoryUtil()
@@ -148,6 +152,8 @@ public class FetchGerritChangePage extends WizardPage {
});
branchTextlabel = new Label(checkoutGroup, SWT.NONE);
+ GridDataFactory.defaultsFor(branchTextlabel).exclude(false)
+ .applyTo(branchTextlabel);
branchTextlabel.setText(UIText.FetchGerritChangePage_BranchNameText);
branchText = new Text(checkoutGroup, SWT.SINGLE | SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(branchText);
@@ -243,6 +249,13 @@ public class FetchGerritChangePage extends WizardPage {
setControl(main);
}
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if (visible && refName != null)
+ refText.setText(refName);
+ }
+
private void checkPage() {
boolean createBranchSelected = createBranch.getSelection();
branchText.setEnabled(createBranchSelected);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangeWizard.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangeWizard.java
index c70b85f..b59133e 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangeWizard.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/fetch/FetchGerritChangeWizard.java
@@ -22,6 +22,8 @@ public class FetchGerritChangeWizard extends Wizard {
FetchGerritChangePage page;
+ private String refName;
+
/**
* @param repository
* the repository
@@ -33,9 +35,18 @@ public class FetchGerritChangeWizard extends Wizard {
setWindowTitle(UIText.FetchGerritChangeWizard_WizardTitle);
}
+ /**
+ * @param repository
+ * @param refName initial value for the ref field
+ */
+ public FetchGerritChangeWizard(Repository repository, String refName) {
+ this(repository);
+ this.refName = refName;
+ }
+
@Override
public void addPages() {
- page = new FetchGerritChangePage(repository);
+ page = new FetchGerritChangePage(repository, refName);
addPage(page);
}