[jbosstools-commits] JBoss Tools SVN: r35731 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Oct 17 11:49:49 EDT 2011


Author: adietish
Date: 2011-10-17 11:49:49 -0400 (Mon, 17 Oct 2011)
New Revision: 35731

Modified:
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
Log:
[JBIDE-9793] added "cloning from" label that shows git repo url

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java	2011-10-17 15:24:58 UTC (rev 35730)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java	2011-10-17 15:49:49 UTC (rev 35731)
@@ -17,10 +17,9 @@
 
 import org.eclipse.core.databinding.DataBindingContext;
 import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
 import org.eclipse.core.databinding.observable.value.IObservableValue;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.databinding.swt.WidgetProperties;
 import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.layout.GridLayoutFactory;
@@ -104,10 +103,24 @@
 				.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cloneGroup);
 		GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(4).applyTo(cloneGroup);
 
+		Label gitUriLabel = new Label(cloneGroup, SWT.NONE);
+		gitUriLabel.setText("Cloning From");
+		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(gitUriLabel);
+
+		Text gitUriValueText = new Text(cloneGroup, SWT.BORDER);
+		gitUriValueText.setEditable(false);
+//		gitUriValueText.setBackground(cloneGroup.getBackground());
+		GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(gitUriValueText);
+		dbc.bindValue(
+				WidgetProperties.text(SWT.Modify).observe(gitUriValueText)
+				, BeanProperties.value(AdapterWizardPageModel.PROPERTY_GIT_URI).observe(model)
+				, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)
+				, null);
+		
 		Label repoPathLabel = new Label(cloneGroup, SWT.NONE);
 		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(repoPathLabel);
-		repoPathLabel.setText("Location");
-
+		repoPathLabel.setText("Destination");
+		
 		Button defaultRepoPathButton = new Button(cloneGroup, SWT.CHECK);
 		defaultRepoPathButton.setText("default");
 		GridDataFactory.fillDefaults()
@@ -166,8 +179,7 @@
 
 		Link sshPrefsLink = new Link(cloneGroup, SWT.NONE);
 		sshPrefsLink
-				.setText("Please make sure that the private part of the key pair, "
-						+ "you used to create your domain,\nis listed in the <a>SSH2 Preferences</a>");
+				.setText("Make sure your SSH key used with the domain is listed in <a>SSH2 Preferences</a>");
 		GridDataFactory.fillDefaults()
 				.span(4, 1).align(SWT.FILL, SWT.CENTER).indent(0, 10).applyTo(sshPrefsLink);
 		sshPrefsLink.addSelectionListener(onSshPrefs());
@@ -342,11 +354,12 @@
 	}
 
 	protected void onPageActivated(DataBindingContext dbc) {
-		/*
-		 * this needs to be initialized at page visibility since the default
-		 * repository path default
-		 */
 		model.resetRepositoryPath();
+		try {
+			model.updateGitUri();
+		} catch (OpenshiftException e) {
+			OpenshiftUIActivator.log(OpenshiftUIActivator.createErrorStatus(e.getMessage(), e));
+		}
 
 		serverTypeToCreate = getServerTypeToCreate();
 		model.getParentModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
@@ -363,8 +376,7 @@
 			modeLabel.setText("Mode: Source");
 			model.getParentModel().setProperty(AdapterWizardPageModel.MODE, AdapterWizardPageModel.MODE_SOURCE);
 		} catch (OpenshiftException ose) {
-			OpenshiftUIActivator.getDefault().getLog()
-					.log(new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, ose.getMessage(), ose));
+			OpenshiftUIActivator.log(OpenshiftUIActivator.createErrorStatus(ose.getMessage(), ose));
 		}
 	}
 

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java	2011-10-17 15:24:58 UTC (rev 35730)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java	2011-10-17 15:49:49 UTC (rev 35731)
@@ -13,6 +13,8 @@
 import org.eclipse.egit.ui.Activator;
 import org.eclipse.egit.ui.UIPreferences;
 import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
 
 /**
  * @author André Dietisheim
@@ -22,6 +24,7 @@
 
 	private static final String REMOTE_NAME_DEFAULT = "origin";
 
+	public static final String PROPERTY_GIT_URI = "gitUri";
 	public static final String PROPERTY_REPO_PATH = "repositoryPath";
 	public static final String PROPERTY_REMOTE_NAME = "remoteName";
 
@@ -33,12 +36,28 @@
 	public static final String SERVER_TYPE = "serverType";
 
 	private ImportProjectWizardModel wizardModel;
+	private String gitUri;
 
 	public AdapterWizardPageModel(ImportProjectWizardModel wizardModel) {
 		this.wizardModel = wizardModel;
 		setRemoteName(REMOTE_NAME_DEFAULT);
 	}
 
+	public void updateGitUri() throws OpenshiftException {
+		IApplication application = wizardModel.getApplication();
+		if (application != null) {
+			setGitUri(application.getGitUri());
+		}
+	}
+
+	public void setGitUri(String gitUri) {
+		firePropertyChange(PROPERTY_GIT_URI, this.gitUri, this.gitUri = gitUri);
+	}
+
+	public String getGitUri() {
+		return this.gitUri;
+	}
+
 	public String getRepositoryPath() {
 		return wizardModel.getRepositoryPath();
 	}
@@ -58,9 +77,7 @@
 	}
 
 	private String getEGitDefaultRepositoryPath() {
-		String destinationDir =
-				Activator.getDefault().getPreferenceStore().getString(UIPreferences.DEFAULT_REPO_DIR);
-		return destinationDir;
+		return Activator.getDefault().getPreferenceStore().getString(UIPreferences.DEFAULT_REPO_DIR);
 	}
 
 	public String getRemoteName() {



More information about the jbosstools-commits mailing list