[jbosstools-commits] JBoss Tools SVN: r35617 - 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
Thu Oct 13 08:01:08 EDT 2011


Author: adietish
Date: 2011-10-13 08:01:07 -0400 (Thu, 13 Oct 2011)
New Revision: 35617

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
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java
Log:
[JBIDE-9793] implementing default clone destination

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-13 11:49:49 UTC (rev 35616)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java	2011-10-13 12:01:07 UTC (rev 35617)
@@ -20,6 +20,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.databinding.observable.value.IValueChangeListener;
+import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
 import org.eclipse.core.databinding.validation.IValidator;
 import org.eclipse.core.databinding.validation.ValidationStatus;
 import org.eclipse.core.runtime.CoreException;
@@ -106,13 +109,13 @@
 		GridDataFactory.fillDefaults()
 				.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(projectGroup);
 		GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(3).applyTo(projectGroup);
-
+		
 		Button defaultRepoPathButton = new Button(projectGroup, SWT.CHECK);
 		defaultRepoPathButton.setText("Use default destination");
 		GridDataFactory.fillDefaults()
 				.span(3, 1).align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(defaultRepoPathButton);
 		defaultRepoPathButton.addSelectionListener(onDefaultRepoPath());
-
+		
 		Label repoPathLabel = new Label(projectGroup, SWT.NONE);
 		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(repoPathLabel);
 		repoPathLabel.setText("Repository Destination");
@@ -121,12 +124,25 @@
 				.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(repoPathText);
 		DataBindingUtils.bindMandatoryTextField(
 				repoPathText, "Repository path", AdapterWizardPageModel.PROPERTY_REPO_PATH, model, dbc);
+		IObservableValue selectionObservable = WidgetProperties.selection().observe(defaultRepoPathButton);
+		selectionObservable.addValueChangeListener(new IValueChangeListener() {
+			
+			@Override
+			public void handleValueChange(ValueChangeEvent event) {
+				System.err.println("selected!! = " + event.diff.getNewValue());
+			}
+		});
+		dbc.bindValue(
+				selectionObservable 
+				, WidgetProperties.enabled().observe(repoPathText)
+				, null
+				, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
 		Button browseRepoPathButton = new Button(projectGroup, SWT.PUSH);
 		browseRepoPathButton.setText("Browse");
 		GridDataFactory.fillDefaults()
 				.align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseRepoPathButton);
 		browseRepoPathButton.addSelectionListener(onRepoPath());
-
+		
 		Label branchLabel = new Label(projectGroup, SWT.NONE);
 		branchLabel.setText("Branch to clone");
 		GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(branchLabel);

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-13 11:49:49 UTC (rev 35616)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java	2011-10-13 12:01:07 UTC (rev 35617)
@@ -10,6 +10,8 @@
  ******************************************************************************/
 package org.jboss.tools.openshift.express.internal.ui.wizard;
 
+import java.io.File;
+
 import org.eclipse.egit.ui.Activator;
 import org.eclipse.egit.ui.UIPreferences;
 import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
@@ -40,15 +42,19 @@
 	}
 
 	public String getRepositoryPath() {
-		return wizardModel.getCloneDirectory();
+		return wizardModel.getRepositoryPath();
 	}
 
 	public void setRepositoryPath(String repositoryPath) {
-		wizardModel.setCloneDirectory(repositoryPath);
+		firePropertyChange(PROPERTY_REPO_PATH
+				, wizardModel.getRepositoryPath()
+				, wizardModel.setRepositoryPath(repositoryPath));
 	}
 
 	public void resetRepositoryPath() {
-		setRepositoryPath(getEGitDefaultRepositoryPath() + wizardModel.getApplication().getName());
+		setRepositoryPath(getEGitDefaultRepositoryPath()
+				+ File.separatorChar
+				+ wizardModel.getApplication().getName());
 	}
 
 	public String getEGitDefaultRepositoryPath() {
@@ -62,14 +68,16 @@
 	}
 
 	public void setRemoteName(String remoteName) {
-		wizardModel.setRemoteName(remoteName);
+		firePropertyChange(PROPERTY_REMOTE_NAME
+				, wizardModel.getRemoteName()
+				, wizardModel.setRemoteName(remoteName));
 	}
 
 	public void resetRemoteName() {
 		setRemoteName(REMOTE_NAME_DEFAULT);
 	}
 
-	// TODO should this stay? 
+	// TODO should this stay?
 	public ImportProjectWizardModel getParentModel() {
 		return wizardModel;
 	}

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java	2011-10-13 11:49:49 UTC (rev 35616)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java	2011-10-13 12:01:07 UTC (rev 35617)
@@ -53,10 +53,10 @@
 
 	private HashMap<String, Object> dataModel = new HashMap<String, Object>();
 
-	protected static final String USER = "user";
-	protected static final String APPLICATION = "application";
-	protected static final String REMOTE_NAME = "remoteName";
-	protected static final String CLONE_DIR = "cloneDir";
+	public static final String USER = "user";
+	public static final String APPLICATION = "application";
+	public static final String REMOTE_NAME = "remoteName";
+	public static final String REPOSITORY_PATH = "repositoryPath";
 
 	public void setProperty(String key, Object value) {
 		Object oldVal = dataModel.get(key);
@@ -84,20 +84,22 @@
 		setProperty(APPLICATION, application);
 	}
 
-	public void setRemoteName(String remoteName) {
+	public String setRemoteName(String remoteName) {
 		setProperty(REMOTE_NAME, remoteName);
+		return remoteName;
 	}
 
 	public String getRemoteName() {
 		return (String) getProperty(REMOTE_NAME);
 	}
 
-	public void setCloneDirectory(String cloneDir) {
-		setProperty(CLONE_DIR, cloneDir);
+	public String setRepositoryPath(String repositoryPath) {
+		setProperty(REPOSITORY_PATH, repositoryPath);
+		return repositoryPath;
 	}
 
-	public String getCloneDirectory() {
-		return (String) getProperty(CLONE_DIR);
+	public String getRepositoryPath() {
+		return (String) getProperty(REPOSITORY_PATH);
 	}
 
 	public void importProject(final File projectFolder, IProgressMonitor monitor) throws OpenshiftException,
@@ -146,7 +148,7 @@
 			InvocationTargetException,
 			InterruptedException {
 		IApplication application = getApplication();
-		File destination = new File(getCloneDirectory(), application.getName());
+		File destination = new File(getRepositoryPath(), application.getName());
 		cloneRepository(application.getGitUri(), destination, monitor);
 		return destination;
 	}



More information about the jbosstools-commits mailing list