JBoss Tools SVN: r35622 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-13 11:11:03 -0400 (Thu, 13 Oct 2011)
New Revision: 35622
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
Log:
[JBIDE-9793] implemented default clone destination, default remote name
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 14:51:37 UTC (rev 35621)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-13 15:11:03 UTC (rev 35622)
@@ -17,6 +17,9 @@
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.UpdateValueStrategy;
+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.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -111,12 +114,18 @@
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(defaultRepoPathButton);
defaultRepoPathButton.addSelectionListener(onDefaultRepoPath());
+ IObservableValue defaultRepoButtonSelection = WidgetProperties.selection().observe(defaultRepoPathButton);
Text repoPathText = new Text(projectGroup, SWT.BORDER);
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(repoPathText);
DataBindingUtils.bindMandatoryTextField(
repoPathText, "Location", AdapterWizardPageModel.PROPERTY_REPO_PATH, model, dbc);
+ dbc.bindValue(
+ defaultRepoButtonSelection
+ , WidgetProperties.enabled().observe(repoPathText)
+ , new UpdateValueStrategy().setConverter(new InvertingBooleanConverter())
+ , new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
Button browseRepoPathButton = new Button(projectGroup, SWT.PUSH);
browseRepoPathButton.setText("Browse");
@@ -124,17 +133,12 @@
.align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseRepoPathButton);
browseRepoPathButton.addSelectionListener(onRepoPath());
dbc.bindValue(
- WidgetProperties.selection().observe(defaultRepoPathButton)
+ defaultRepoButtonSelection
, WidgetProperties.enabled().observe(browseRepoPathButton)
, new UpdateValueStrategy().setConverter(new InvertingBooleanConverter())
, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
- dbc.bindValue(
- WidgetProperties.selection().observe(defaultRepoPathButton)
- , WidgetProperties.enabled().observe(repoPathText)
- , new UpdateValueStrategy().setConverter(new InvertingBooleanConverter())
- , new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
- defaultRepoPathButton.setSelection(true);
+ defaultRepoButtonSelection.setValue(true);
Label remoteNameLabel = new Label(projectGroup, SWT.NONE);
remoteNameLabel.setText("Remote name");
@@ -153,12 +157,13 @@
DataBindingUtils.bindMandatoryTextField(
remoteNameText, "Remote name", AdapterWizardPageModel.PROPERTY_REMOTE_NAME, model, dbc);
+ IObservableValue defaultRemoteNameSelection = WidgetProperties.selection().observe(defaultRemoteNameButton);
dbc.bindValue(
- WidgetProperties.selection().observe(defaultRemoteNameButton)
+ defaultRemoteNameSelection
, WidgetProperties.enabled().observe(remoteNameText)
, new UpdateValueStrategy().setConverter(new InvertingBooleanConverter())
, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
- defaultRemoteNameButton.setSelection(true);
+ defaultRemoteNameSelection.setValue(true);
return projectGroup;
}
14 years, 6 months
JBoss Tools SVN: r35621 - in trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui: part and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-10-13 10:51:37 -0400 (Thu, 13 Oct 2011)
New Revision: 35621
Modified:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/action/StartDelegate.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/action/StopDelegate.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java
Log:
JBIDE-9866: Closing and Reopening the Forge Console View Results in Errors When Starting the Forge Runtime
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/action/StartDelegate.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/action/StartDelegate.java 2011-10-13 13:32:15 UTC (rev 35620)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/action/StartDelegate.java 2011-10-13 14:51:37 UTC (rev 35621)
@@ -8,9 +8,13 @@
public class StartDelegate implements IViewActionDelegate {
+ private IViewPart part = null;
+
@Override
public void run(IAction action) {
- ForgeView.INSTANCE.startForge();
+ if (part != null && part instanceof ForgeView) {
+ ((ForgeView)part).startForge();
+ }
}
@Override
@@ -21,8 +25,7 @@
@Override
public void init(IViewPart view) {
- // TODO Auto-generated method stub
-
+ part = view;
}
}
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/action/StopDelegate.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/action/StopDelegate.java 2011-10-13 13:32:15 UTC (rev 35620)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/action/StopDelegate.java 2011-10-13 14:51:37 UTC (rev 35621)
@@ -8,9 +8,13 @@
public class StopDelegate implements IViewActionDelegate {
+ private IViewPart part = null;
+
@Override
public void run(IAction action) {
- ForgeView.INSTANCE.stopForge();
+ if (part != null && part instanceof ForgeView) {
+ ((ForgeView)part).stopForge();
+ }
}
@Override
@@ -21,8 +25,7 @@
@Override
public void init(IViewPart view) {
- // TODO Auto-generated method stub
-
+ part = view;
}
}
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java 2011-10-13 13:32:15 UTC (rev 35620)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java 2011-10-13 14:51:37 UTC (rev 35621)
@@ -28,8 +28,6 @@
private static final String NOT_RUNNING_MESSAGE = "Forge is not running.";
private static final String STARTING_MESSAGE = "Please wait while Forge is starting";
- public static ForgeView INSTANCE;
-
private class ForgePage extends Page {
private ForgeTextViewer viewer;
@@ -65,12 +63,12 @@
private ForgeRuntime runtime;
- public ForgeView() {
- if (INSTANCE == null) {
- INSTANCE = this;
- }
- }
-
+// public ForgeView() {
+// if (INSTANCE == null) {
+// INSTANCE = this;
+// }
+// }
+//
@Override
public void createPartControl(Composite parent) {
pageBook = new PageBook(parent, SWT.NONE);
@@ -130,7 +128,7 @@
private void handleStateNotRunning() {
if (runtime != null) {
- runtime.removePropertyChangeListener(INSTANCE);
+ runtime.removePropertyChangeListener(this);
runtime = null;
}
getDisplay().asyncExec(new Runnable() {
@@ -172,9 +170,8 @@
}
public void dispose() {
- if (runtime != null) {
- runtime.stop(null);
- runtime = null;
+ if (runtime != null && ForgeRuntime.STATE_RUNNING.equals(runtime.getState())) {
+ stopForge();
}
super.dispose();
}
@@ -182,7 +179,7 @@
public void startForge() {
if (runtime != null) return;
runtime = ForgeRuntimesPreferences.INSTANCE.getDefault();
- runtime.addPropertyChangeListener(INSTANCE);
+ runtime.addPropertyChangeListener(this);
Job job = new Job("Starting Forge") {
@Override
protected IStatus run(IProgressMonitor monitor) {
@@ -221,6 +218,7 @@
if (runtime == null) return;
final IProgressMonitor progressMonitor = getViewSite().getActionBars().getStatusLineManager().getProgressMonitor();
runtime.stop(progressMonitor);
+ runtime = null;
}
private Display getDisplay() {
14 years, 6 months
JBoss Tools SVN: r35620 - trunk/forge/plugins/org.jboss.tools.forge.runtime.ext.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-10-13 09:32:15 -0400 (Thu, 13 Oct 2011)
New Revision: 35620
Modified:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/.classpath
Log:
correct buildpath glitch
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/.classpath
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/.classpath 2011-10-13 13:30:39 UTC (rev 35619)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/.classpath 2011-10-13 13:32:15 UTC (rev 35620)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry exported="true" kind="lib" path="bin/"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
14 years, 6 months
JBoss Tools SVN: r35619 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-13 09:30:39 -0400 (Thu, 13 Oct 2011)
New Revision: 35619
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
Log:
[JBIDE-9793] implementing default clone destination, default remote name
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 13:28:00 UTC (rev 35618)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-13 13:30:39 UTC (rev 35619)
@@ -123,6 +123,11 @@
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseRepoPathButton);
browseRepoPathButton.addSelectionListener(onRepoPath());
+ dbc.bindValue(
+ WidgetProperties.selection().observe(defaultRepoPathButton)
+ , WidgetProperties.enabled().observe(browseRepoPathButton)
+ , new UpdateValueStrategy().setConverter(new InvertingBooleanConverter())
+ , new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
dbc.bindValue(
WidgetProperties.selection().observe(defaultRepoPathButton)
14 years, 6 months
JBoss Tools SVN: r35618 - in trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-13 09:28:00 -0400 (Thu, 13 Oct 2011)
New Revision: 35618
Added:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java
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, default remote name
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java 2011-10-13 13:28:00 UTC (rev 35618)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.common;
+
+/**
+ * @author André Dietisheim
+ */
+public class StringUtils {
+
+ public static String null2emptyString(String value) {
+ if (value != null) {
+ return value;
+ }
+ return "";
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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 12:01:07 UTC (rev 35617)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-13 13:28:00 UTC (rev 35618)
@@ -14,21 +14,12 @@
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;
-import java.util.regex.Pattern;
-import org.eclipse.core.databinding.Binding;
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;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
@@ -63,6 +54,7 @@
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.ui.UIUtil;
import org.jboss.tools.common.ui.databinding.DataBindingUtils;
+import org.jboss.tools.common.ui.databinding.InvertingBooleanConverter;
import org.jboss.tools.openshift.express.client.ICartridge;
import org.jboss.tools.openshift.express.client.OpenshiftException;
import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
@@ -105,64 +97,64 @@
private Group createProjectGroup(Composite parent, DataBindingContext dbc) {
Group projectGroup = new Group(parent, SWT.BORDER);
- projectGroup.setText("Project setup");
+ projectGroup.setText("Git clone");
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);
-
+ GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(4).applyTo(projectGroup);
+
+ Label repoPathLabel = new Label(projectGroup, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(repoPathLabel);
+ repoPathLabel.setText("Location");
+
Button defaultRepoPathButton = new Button(projectGroup, SWT.CHECK);
- defaultRepoPathButton.setText("Use default destination");
+ defaultRepoPathButton.setText("default");
GridDataFactory.fillDefaults()
- .span(3, 1).align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(defaultRepoPathButton);
+ .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");
+
Text repoPathText = new Text(projectGroup, SWT.BORDER);
GridDataFactory.fillDefaults()
.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));
+ repoPathText, "Location", AdapterWizardPageModel.PROPERTY_REPO_PATH, model, dbc);
+
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);
- Text branchText = new Text(projectGroup, SWT.BORDER);
+
+ dbc.bindValue(
+ WidgetProperties.selection().observe(defaultRepoPathButton)
+ , WidgetProperties.enabled().observe(repoPathText)
+ , new UpdateValueStrategy().setConverter(new InvertingBooleanConverter())
+ , new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
+ defaultRepoPathButton.setSelection(true);
+
+ Label remoteNameLabel = new Label(projectGroup, SWT.NONE);
+ remoteNameLabel.setText("Remote name");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteNameLabel);
+
+ Button defaultRemoteNameButton = new Button(projectGroup, SWT.CHECK);
+ defaultRemoteNameButton.setText("default");
GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false)
- .applyTo(branchText);
- Binding branchNameBinding = dbc.bindValue(
- WidgetProperties.text(SWT.Modify).observe(branchText)
- , BeanProperties.value(AdapterWizardPageModel.PROPERTY_REMOTE_NAME).observe(model)
- , new UpdateValueStrategy().setAfterGetValidator(new BranchNameValidator())
- , null);
- ControlDecorationSupport.create(branchNameBinding, SWT.TOP | SWT.LEFT);
+ .align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(defaultRemoteNameButton);
+ defaultRemoteNameButton.addSelectionListener(onDefaultRemoteName());
- Button defaultBranchnameButton = new Button(projectGroup, SWT.PUSH);
- defaultBranchnameButton.setText("Default");
+ Text remoteNameText = new Text(projectGroup, SWT.BORDER);
GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(defaultBranchnameButton);
- defaultBranchnameButton.addSelectionListener(onBranchnameDefault());
+ .span(2, 1).align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false)
+ .applyTo(remoteNameText);
+ DataBindingUtils.bindMandatoryTextField(
+ remoteNameText, "Remote name", AdapterWizardPageModel.PROPERTY_REMOTE_NAME, model, dbc);
+ dbc.bindValue(
+ WidgetProperties.selection().observe(defaultRemoteNameButton)
+ , WidgetProperties.enabled().observe(remoteNameText)
+ , new UpdateValueStrategy().setConverter(new InvertingBooleanConverter())
+ , new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
+ defaultRemoteNameButton.setSelection(true);
+
return projectGroup;
}
@@ -182,6 +174,7 @@
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
+ dialog.setMessage("Choose the location to store your repository clone to...");
String repositoryPath = dialog.open();
if (repositoryPath != null) {
model.setRepositoryPath(repositoryPath);
@@ -190,7 +183,7 @@
};
}
- private SelectionListener onBranchnameDefault() {
+ private SelectionListener onDefaultRemoteName() {
return new SelectionAdapter() {
@Override
@@ -259,15 +252,16 @@
addRuntimeLink.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
IRuntimeType type = getValidRuntimeType();
- if( type != null )
+ if (type != null)
showRuntimeWizard(type);
}
});
-
+
serverAdapterCheckbox.setLayoutData(UIUtil.createFormData2(0, 5, null, 0, 0, 5, null, 0));
runtimeLabel.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, 0, 5, null, 0));
addRuntimeLink.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, null, 0, 100, -5));
- suitableRuntimes.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, runtimeLabel, 5, addRuntimeLink, -5));
+ suitableRuntimes.setLayoutData(UIUtil.createFormData2(serverAdapterCheckbox, 5, null, 0, runtimeLabel, 5,
+ addRuntimeLink, -5));
domainLabel.setLayoutData(UIUtil.createFormData2(suitableRuntimes, 5, null, 0, 0, 5, 100, 0));
// appLabel.setLayoutData(UIUtil.createFormData2(domainLabel, 5, null,
// 0, 0, 5, 100, 0));
@@ -287,7 +281,7 @@
}
private IRuntimeType getValidRuntimeType() {
- String cartridgeName = model.getParentModel().getApplication().getCartridge().getName();
+ String cartridgeName = model.getParentModel().getApplicationCartridgeName();
if (ICartridge.JBOSSAS_7.getName().equals(cartridgeName)) {
return ServerCore.findRuntimeType(IJBossToolingConstants.AS_70);
}
@@ -295,7 +289,7 @@
}
private IServerType getServerTypeToCreate() {
- String cartridgeName = model.getParentModel().getApplication().getCartridge().getName();
+ String cartridgeName = model.getParentModel().getApplicationCartridgeName();
if (ICartridge.JBOSSAS_7.getName().equals(cartridgeName)) {
return ServerCore.findServerType(IJBossToolingConstants.SERVER_AS_70);
}
@@ -321,6 +315,12 @@
}
protected void onPageActivated(DataBindingContext dbc) {
+ /*
+ * this needs to be initialized at page visibility since the default
+ * repository path default
+ */
+ model.resetRepositoryPath();
+
serverTypeToCreate = getServerTypeToCreate();
model.getParentModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
refreshValidRuntimes();
@@ -343,7 +343,7 @@
protected void refreshValidRuntimes() {
IRuntimeType type = getValidRuntimeType();
- if( type != null ) {
+ if (type != null) {
IRuntime[] runtimes = getRuntimesOfType(type.getId());
fillRuntimeCombo(suitableRuntimes, runtimes);
} else {
@@ -386,35 +386,13 @@
return returnValue;
}
- private static class BranchNameValidator implements IValidator {
-
- private static final Pattern BRANCH_PATTERN = Pattern.compile(".+\\/.+");
-
- @Override
- public IStatus validate(Object value) {
- if (value == null
- || ((String) value).length() == 0) {
- return ValidationStatus.error("you have to provide a branch to clone");
- }
-
- if (!isValidBranch((String) value)) {
- return ValidationStatus.error("you have to provide a valid branch name (ex. origin/master)");
- }
- return ValidationStatus.ok();
- }
-
- private boolean isValidBranch(String branchname) {
- return BRANCH_PATTERN.matcher(branchname).matches();
- }
- }
-
@Override
public void propertyChange(PropertyChangeEvent evt) {
- if( ImportProjectWizardModel.APPLICATION.equals(evt.getPropertyName())) {
+ if (ImportProjectWizardModel.APPLICATION.equals(evt.getPropertyName())) {
handleApplicationChanged();
}
}
-
+
private void handleApplicationChanged() {
// we need to enable or disable all the server widgets depending on
// if we can make a server out of this
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 12:01:07 UTC (rev 35617)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-10-13 13:28:00 UTC (rev 35618)
@@ -15,6 +15,7 @@
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.internal.ui.common.StringUtils;
/**
* @author André Dietisheim
@@ -52,9 +53,13 @@
}
public void resetRepositoryPath() {
- setRepositoryPath(getEGitDefaultRepositoryPath()
+ setRepositoryPath(getDefaultRepositoryPath());
+ }
+
+ private String getDefaultRepositoryPath() {
+ return getEGitDefaultRepositoryPath()
+ File.separatorChar
- + wizardModel.getApplication().getName());
+ + StringUtils.null2emptyString(wizardModel.getApplicationName());
}
public String getEGitDefaultRepositoryPath() {
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 12:01:07 UTC (rev 35617)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java 2011-10-13 13:28:00 UTC (rev 35618)
@@ -37,6 +37,7 @@
import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.express.client.IApplication;
+import org.jboss.tools.openshift.express.client.ICartridge;
import org.jboss.tools.openshift.express.client.IUser;
import org.jboss.tools.openshift.express.client.OpenshiftException;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
@@ -80,6 +81,33 @@
return (IApplication) getProperty(APPLICATION);
}
+ public String getApplicationName() {
+ String applicationName = null;
+ IApplication application = getApplication();
+ if (application != null) {
+ applicationName = application.getName();
+ }
+ return applicationName;
+ }
+
+ public ICartridge getApplicationCartridge() {
+ ICartridge cartridge = null;
+ IApplication application = getApplication();
+ if (application != null) {
+ cartridge = application.getCartridge();
+ }
+ return cartridge;
+ }
+
+ public String getApplicationCartridgeName() {
+ String cartridgeName = null;
+ ICartridge cartridge = getApplicationCartridge();
+ if (cartridge != null) {
+ cartridgeName = cartridge.getName();
+ }
+ return cartridgeName;
+ }
+
public void setApplication(IApplication application) {
setProperty(APPLICATION, application);
}
14 years, 6 months
JBoss Tools SVN: r35617 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
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;
}
14 years, 6 months
JBoss Tools SVN: r35616 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-10-13 07:49:49 -0400 (Thu, 13 Oct 2011)
New Revision: 35616
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/ImportProjectWizardModel.java
Log:
JBIDE-9793 - NPE when using php cartridge + improving UI in that case.
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:29:34 UTC (rev 35615)
+++ 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)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
@@ -62,7 +64,7 @@
import org.jboss.tools.openshift.express.client.OpenshiftException;
import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
-public class AdapterWizardPage extends AbstractOpenshiftWizardPage implements IWizardPage {
+public class AdapterWizardPage extends AbstractOpenshiftWizardPage implements IWizardPage, PropertyChangeListener {
private AdapterWizardPageModel model;
private Combo suitableRuntimes;
@@ -72,7 +74,7 @@
private Label modeLabel;
private Link addRuntimeLink;
private Label runtimeLabel;
-
+ private Button serverAdapterCheckbox;
public AdapterWizardPage(ImportProjectWizard wizard, ImportProjectWizardModel model) {
super(
@@ -82,6 +84,7 @@
"Server Adapter",
wizard);
this.model = new AdapterWizardPageModel(model);
+ model.addPropertyChangeListener(this);
}
@Override
@@ -204,7 +207,7 @@
private void fillServerAdapterGroup(Group serverAdapterGroup) {
Composite c = new Composite(serverAdapterGroup, SWT.NONE);
c.setLayout(new FormLayout());
- Button serverAdapterCheckbox = new Button(c, SWT.CHECK);
+ serverAdapterCheckbox = new Button(c, SWT.CHECK);
serverAdapterCheckbox.setText("Create a JBoss server adapter");
final Button serverAdapterCheckbox2 = serverAdapterCheckbox;
serverAdapterCheckbox.addSelectionListener(new SelectionListener() {
@@ -218,7 +221,7 @@
}
});
- runtimeLabel = new Label(c, SWT.BORDER);
+ runtimeLabel = new Label(c, SWT.NONE);
runtimeLabel.setText("Local Runtime: ");
suitableRuntimes = new Combo(c, SWT.READ_ONLY);
@@ -327,6 +330,8 @@
if( type != null ) {
IRuntime[] runtimes = getRuntimesOfType(type.getId());
fillRuntimeCombo(suitableRuntimes, runtimes);
+ } else {
+ suitableRuntimes.setItems(new String[0]);
}
}
@@ -387,4 +392,24 @@
}
}
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if( ImportProjectWizardModel.APPLICATION.equals(evt.getPropertyName())) {
+ handleApplicationChanged();
+ }
+ }
+
+ private void handleApplicationChanged() {
+ // we need to enable or disable all the server widgets depending on
+ // if we can make a server out of this
+ serverTypeToCreate = getServerTypeToCreate();
+ boolean canCreateServer = serverTypeToCreate != null;
+ serverAdapterCheckbox.setEnabled(canCreateServer);
+ serverAdapterCheckbox.setSelection(canCreateServer);
+ enableServerWidgets(canCreateServer);
+ refreshValidRuntimes();
+ model.getParentModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
+ model.getParentModel().setProperty(AdapterWizardPageModel.CREATE_SERVER, canCreateServer);
+ }
+
}
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:29:34 UTC (rev 35615)
+++ 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)
@@ -53,10 +53,10 @@
private HashMap<String, Object> dataModel = new HashMap<String, Object>();
- private static final String USER = "user";
- private static final String APPLICATION = "application";
- private static final String REMOTE_NAME = "remoteName";
- private static final String CLONE_DIR = "cloneDir";
+ 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 void setProperty(String key, Object value) {
Object oldVal = dataModel.get(key);
14 years, 6 months
JBoss Tools SVN: r35615 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-10-13 07:29:34 -0400 (Thu, 13 Oct 2011)
New Revision: 35615
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
Log:
JBIDE-9793 - ensuring events are fired at correct time
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:27:32 UTC (rev 35614)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-10-13 11:29:34 UTC (rev 35615)
@@ -32,18 +32,15 @@
public static final String RUNTIME_DELEGATE = "runtimeDelegate";
public static final String SERVER_TYPE = "serverType";
- private String repositoryPath;
- private String remoteName;
-
private ImportProjectWizardModel wizardModel;
public AdapterWizardPageModel(ImportProjectWizardModel wizardModel) {
this.wizardModel = wizardModel;
- this.remoteName = REMOTE_NAME_DEFAULT;
+ setRemoteName(REMOTE_NAME_DEFAULT);
}
public String getRepositoryPath() {
- return repositoryPath;
+ return wizardModel.getCloneDirectory();
}
public void setRepositoryPath(String repositoryPath) {
@@ -61,7 +58,7 @@
}
public String getRemoteName() {
- return remoteName;
+ return wizardModel.getRemoteName();
}
public void setRemoteName(String remoteName) {
14 years, 6 months
JBoss Tools SVN: r35614 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-10-13 07:27:32 -0400 (Thu, 13 Oct 2011)
New Revision: 35614
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/ImportProjectWizardModel.java
Log:
JBIDE-9793 - ensuring events are fired at correct time
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:12:52 UTC (rev 35613)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-10-13 11:27:32 UTC (rev 35614)
@@ -47,7 +47,6 @@
}
public void setRepositoryPath(String repositoryPath) {
- firePropertyChange(PROPERTY_REPO_PATH, this.repositoryPath, this.repositoryPath = repositoryPath);
wizardModel.setCloneDirectory(repositoryPath);
}
@@ -66,7 +65,6 @@
}
public void setRemoteName(String remoteName) {
- firePropertyChange(PROPERTY_REMOTE_NAME, this.remoteName, this.remoteName = remoteName);
wizardModel.setRemoteName(remoteName);
}
@@ -74,8 +72,7 @@
setRemoteName(REMOTE_NAME_DEFAULT);
}
- // TODO is this the best way? Or should we expose ONLY getters to the parent
- // model?
+ // 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:12:52 UTC (rev 35613)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java 2011-10-13 11:27:32 UTC (rev 35614)
@@ -59,7 +59,9 @@
private static final String CLONE_DIR = "cloneDir";
public void setProperty(String key, Object value) {
+ Object oldVal = dataModel.get(key);
dataModel.put(key, value);
+ firePropertyChange(key, oldVal, value);
}
public Object getProperty(String key) {
@@ -67,37 +69,37 @@
}
public void setUser(IUser user) {
- dataModel.put(USER, user);
+ setProperty(USER, user);
}
public IUser getUser() {
- return (IUser) dataModel.get(USER);
+ return (IUser)getProperty(USER);
}
public IApplication getApplication() {
- return (IApplication) dataModel.get(APPLICATION);
+ return (IApplication) getProperty(APPLICATION);
}
+ public void setApplication(IApplication application) {
+ setProperty(APPLICATION, application);
+ }
+
public void setRemoteName(String remoteName) {
- dataModel.put(REMOTE_NAME, remoteName);
+ setProperty(REMOTE_NAME, remoteName);
}
public String getRemoteName() {
- return (String) dataModel.get(REMOTE_NAME);
+ return (String) getProperty(REMOTE_NAME);
}
public void setCloneDirectory(String cloneDir) {
- dataModel.put(CLONE_DIR, cloneDir);
+ setProperty(CLONE_DIR, cloneDir);
}
public String getCloneDirectory() {
- return (String) dataModel.get(CLONE_DIR);
+ return (String) getProperty(CLONE_DIR);
}
- public void setApplication(IApplication application) {
- dataModel.put(APPLICATION, application);
- }
-
public void importProject(final File projectFolder, IProgressMonitor monitor) throws OpenshiftException,
CoreException,
InterruptedException {
14 years, 6 months
JBoss Tools SVN: r35613 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-13 07:12:52 -0400 (Thu, 13 Oct 2011)
New Revision: 35613
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] added default repo destination (checkbox and model code)
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:05:30 UTC (rev 35612)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-13 11:12:52 UTC (rev 35613)
@@ -95,7 +95,6 @@
Group serverAdapterGroup = createAdapterGroup(parent);
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(serverAdapterGroup);
-
}
private Group createProjectGroup(Composite parent, DataBindingContext dbc) {
@@ -105,19 +104,25 @@
.align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(projectGroup);
GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(3).applyTo(projectGroup);
- Label cloneDirLabel = new Label(projectGroup, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(cloneDirLabel);
- cloneDirLabel.setText("Repository Destination");
- Text cloneDirText = new Text(projectGroup, SWT.BORDER);
+ Button defaultRepoPathButton = new Button(projectGroup, SWT.CHECK);
+ defaultRepoPathButton.setText("Use default destination");
GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cloneDirText);
+ .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");
+ Text repoPathText = new Text(projectGroup, SWT.BORDER);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(repoPathText);
DataBindingUtils.bindMandatoryTextField(
- cloneDirText, "Repository Destination", AdapterWizardPageModel.PROPERTY_CLONEDIR, model, dbc);
- Button browseDestinationButton = new Button(projectGroup, SWT.PUSH);
- browseDestinationButton.setText("Browse");
+ repoPathText, "Repository path", AdapterWizardPageModel.PROPERTY_REPO_PATH, model, dbc);
+ Button browseRepoPathButton = new Button(projectGroup, SWT.PUSH);
+ browseRepoPathButton.setText("Browse");
GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseDestinationButton);
- browseDestinationButton.addSelectionListener(onBrowseDestination());
+ .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");
@@ -128,11 +133,11 @@
.applyTo(branchText);
Binding branchNameBinding = dbc.bindValue(
WidgetProperties.text(SWT.Modify).observe(branchText)
- , BeanProperties.value(AdapterWizardPageModel.PROPERTY_BRANCHNAME).observe(model)
+ , BeanProperties.value(AdapterWizardPageModel.PROPERTY_REMOTE_NAME).observe(model)
, new UpdateValueStrategy().setAfterGetValidator(new BranchNameValidator())
, null);
ControlDecorationSupport.create(branchNameBinding, SWT.TOP | SWT.LEFT);
-
+
Button defaultBranchnameButton = new Button(projectGroup, SWT.PUSH);
defaultBranchnameButton.setText("Default");
GridDataFactory.fillDefaults()
@@ -142,15 +147,25 @@
return projectGroup;
}
- private SelectionListener onBrowseDestination() {
+ private SelectionListener onDefaultRepoPath() {
return new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
+ model.resetRepositoryPath();
+ }
+ };
+ }
+
+ private SelectionListener onRepoPath() {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
- String cloneDir = dialog.open();
- if (cloneDir != null) {
- model.setCloneDirectory(cloneDir);
+ String repositoryPath = dialog.open();
+ if (repositoryPath != null) {
+ model.setRepositoryPath(repositoryPath);
}
}
};
@@ -161,7 +176,7 @@
@Override
public void widgetSelected(SelectionEvent e) {
- model.resetBranchname();
+ model.resetRemoteName();
}
};
}
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:05:30 UTC (rev 35612)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-10-13 11:12:52 UTC (rev 35613)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
+import org.eclipse.egit.ui.Activator;
+import org.eclipse.egit.ui.UIPreferences;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
/**
@@ -18,11 +20,11 @@
*/
public class AdapterWizardPageModel extends ObservableUIPojo {
- private static final String BRANCHNAME_DEFAULT = "origin/master";
+ private static final String REMOTE_NAME_DEFAULT = "origin";
- public static final String PROPERTY_CLONEDIR = "cloneDirectory";
- public static final String PROPERTY_BRANCHNAME = "branchname";
-
+ public static final String PROPERTY_REPO_PATH = "repositoryPath";
+ public static final String PROPERTY_REMOTE_NAME = "remoteName";
+
public static final String CREATE_SERVER = "createServer";
public static final String MODE = "serverMode";
public static final String MODE_SOURCE = "serverModeSource";
@@ -30,39 +32,50 @@
public static final String RUNTIME_DELEGATE = "runtimeDelegate";
public static final String SERVER_TYPE = "serverType";
- private String cloneDir;
- private String branchname;
-
+ private String repositoryPath;
+ private String remoteName;
+
private ImportProjectWizardModel wizardModel;
public AdapterWizardPageModel(ImportProjectWizardModel wizardModel) {
this.wizardModel = wizardModel;
- this.branchname = BRANCHNAME_DEFAULT;
+ this.remoteName = REMOTE_NAME_DEFAULT;
}
-
- public String getCloneDirectory() {
- return cloneDir;
+
+ public String getRepositoryPath() {
+ return repositoryPath;
}
- public void setCloneDirectory(String cloneDir) {
- firePropertyChange(PROPERTY_CLONEDIR, this.cloneDir, this.cloneDir = cloneDir);
- wizardModel.setCloneDirectory(cloneDir);
+ public void setRepositoryPath(String repositoryPath) {
+ firePropertyChange(PROPERTY_REPO_PATH, this.repositoryPath, this.repositoryPath = repositoryPath);
+ wizardModel.setCloneDirectory(repositoryPath);
}
- public String getBranchname() {
- return branchname;
+ public void resetRepositoryPath() {
+ setRepositoryPath(getEGitDefaultRepositoryPath() + wizardModel.getApplication().getName());
}
- public void setBranchname(String branchname) {
- firePropertyChange(PROPERTY_BRANCHNAME, this.branchname, this.branchname = branchname);
- wizardModel.setBranchname(branchname);
+ public String getEGitDefaultRepositoryPath() {
+ String destinationDir =
+ Activator.getDefault().getPreferenceStore().getString(UIPreferences.DEFAULT_REPO_DIR);
+ return destinationDir;
}
- public void resetBranchname() {
- setBranchname(BRANCHNAME_DEFAULT);
+ public String getRemoteName() {
+ return remoteName;
}
- // TODO is this the best way? Or should we expose ONLY getters to the parent model?
+ public void setRemoteName(String remoteName) {
+ firePropertyChange(PROPERTY_REMOTE_NAME, this.remoteName, this.remoteName = remoteName);
+ wizardModel.setRemoteName(remoteName);
+ }
+
+ public void resetRemoteName() {
+ setRemoteName(REMOTE_NAME_DEFAULT);
+ }
+
+ // TODO is this the best way? Or should we expose ONLY getters to the parent
+ // model?
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:05:30 UTC (rev 35612)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportProjectWizardModel.java 2011-10-13 11:12:52 UTC (rev 35613)
@@ -55,7 +55,7 @@
private static final String USER = "user";
private static final String APPLICATION = "application";
- private static final String BRANCHNAME = "branchname";
+ private static final String REMOTE_NAME = "remoteName";
private static final String CLONE_DIR = "cloneDir";
public void setProperty(String key, Object value) {
@@ -78,12 +78,12 @@
return (IApplication) dataModel.get(APPLICATION);
}
- public void setBranchname(String branchname) {
- dataModel.put(BRANCHNAME, branchname);
+ public void setRemoteName(String remoteName) {
+ dataModel.put(REMOTE_NAME, remoteName);
}
- public String getBranchname() {
- return (String) dataModel.get(BRANCHNAME);
+ public String getRemoteName() {
+ return (String) dataModel.get(REMOTE_NAME);
}
public void setCloneDirectory(String cloneDir) {
@@ -158,11 +158,10 @@
}
ensureEgitUIIsStarted();
URIish gitUri = new URIish(uri);
- RepositoryUtil repositoryUtil = Activator.getDefault().getRepositoryUtil();
-
CloneOperation cloneOperation =
- new CloneOperation(gitUri, true, null, destination, Constants.HEAD, "origin", CLONE_TIMEOUT);
+ new CloneOperation(gitUri, true, null, destination, Constants.HEAD, getRemoteName(), CLONE_TIMEOUT);
cloneOperation.run(monitor);
+ RepositoryUtil repositoryUtil = Activator.getDefault().getRepositoryUtil();
repositoryUtil.addConfiguredRepository(new File(destination, Constants.DOT_GIT));
}
14 years, 6 months