Author: adietish
Date: 2011-10-10 03:33:12 -0400 (Mon, 10 Oct 2011)
New Revision: 35506
Added:
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/DomainWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/DomainWizardPageModel.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java
Removed:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractSkippingWizard.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ISkipableWizardPage.java
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.tools.openshift.express.ui/build.properties
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ParametrizableWizardPageSupport.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/Status2BooleanConverter.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties
Log:
[JBIDE-9793] cloning openshift repo
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2011-10-10
00:41:51 UTC (rev 35505)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2011-10-10
07:33:12 UTC (rev 35506)
@@ -5,6 +5,8 @@
Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator
Require-Bundle:
org.jboss.tools.openshift.express.client;bundle-version="2.3.0",
+ org.eclipse.egit.core;bundle-version="1.2.0",
+ org.eclipse.jgit;bundle-version="1.2.0",
org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.databinding;bundle-version="1.4.0",
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/build.properties
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/build.properties 2011-10-10
00:41:51 UTC (rev 35505)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/build.properties 2011-10-10
07:33:12 UTC (rev 35506)
@@ -1,11 +1,8 @@
source.. = src/
output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml
-src.includes = .classpath,\
- .project,\
+bin.includes = .,\
+ icons/,\
+ pom.xml,\
META-INF/,\
- build.properties,\
- plugin.xml,\
- pom.xml
+ bin/,\
+ plugin.xml
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenshiftWizardPage.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -64,6 +64,8 @@
public void pageChanged(PageChangedEvent event) {
if (event.getSelectedPage() == AbstractOpenshiftWizardPage.this) {
onPageActivated(dbc);
+ } else {
+ onPageDeactivated(dbc);
}
}
});
@@ -76,6 +78,10 @@
protected void onPageActivated(DataBindingContext dbc) {
}
+
+ protected void onPageDeactivated(DataBindingContext dbc) {
+ }
+
protected abstract void doCreateControls(Composite parent, DataBindingContext dbc);
}
Deleted:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractSkippingWizard.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractSkippingWizard.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractSkippingWizard.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.wizard;
-
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-
-/**
- * @author André Dietisheim
- */
-public abstract class AbstractSkippingWizard extends Wizard implements INewWizard {
-
- @Override
- public IWizardPage getNextPage(IWizardPage page) {
- IWizardPage nextPage = null;
- while ((nextPage = super.getNextPage(page)) != null) {
- if (ISkipableWizardPage.class.isAssignableFrom(nextPage.getClass())
- && ((ISkipableWizardPage) nextPage).isSkip()) {
- page = nextPage;
- continue;
- } else {
- break;
- }
- }
- return nextPage;
- }
-
- @Override
- public IWizardPage getPreviousPage(IWizardPage page) {
- IWizardPage previousPage = null;
- while ((previousPage = super.getPreviousPage(page)) != null) {
- if (ISkipableWizardPage.class.isAssignableFrom(previousPage.getClass())
- && ((ISkipableWizardPage) previousPage).isSkip()) {
- page = previousPage;
- continue;
- } else {
- break;
- }
- }
- return previousPage;
- }
-}
Added:
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
(rev 0)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.wizard;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.widgets.Composite;
+
+public class AdapterWizardPage extends AbstractOpenshiftWizardPage implements IWizardPage
{
+
+ private AdapterWizardPageModel model;
+
+ public AdapterWizardPage(ServerAdapterWizard wizard, ServerAdapterWizardModel model) {
+ super("Server Adapter", "...", "Server Adapter",
wizard);
+ this.model = new AdapterWizardPageModel(model);
+ }
+
+ @Override
+ protected void doCreateControls(Composite parent, DataBindingContext dbc) {
+ // TODO Auto-generated method stub
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
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
(rev 0)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wizard;
+
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+
+/**
+ * @author André Dietisheim
+ */
+public class AdapterWizardPageModel extends ObservableUIPojo {
+
+ private ServerAdapterWizardModel wizardModel;
+
+ public AdapterWizardPageModel(ServerAdapterWizardModel wizardModel) {
+ this.wizardModel = wizardModel;
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.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/ApplicationWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -109,13 +109,13 @@
Button deleteButton = new Button(container, SWT.PUSH);
deleteButton.setText("&Delete");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(80,
30).applyTo(deleteButton);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(80,
SWT.DEFAULT).applyTo(deleteButton);
DataBindingUtils.bindEnablementToValidationStatus(deleteButton, IStatus.INFO, dbc,
selectedApplicationBinding);
deleteButton.addSelectionListener(onDelete(dbc));
Button detailsButton = new Button(container, SWT.PUSH);
detailsButton.setText("De&tails");
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).hint(80,
30).applyTo(detailsButton);
+ GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).hint(80,
SWT.DEFAULT).applyTo(detailsButton);
DataBindingUtils.bindEnablementToValidationStatus(detailsButton, IStatus.INFO, dbc ,
selectedApplicationBinding);
detailsButton.addSelectionListener(onDetails(dbc));
}
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -46,6 +46,7 @@
}
public void setSelectedApplication(IApplication application) {
+ wizardModel.setApplication(application);
firePropertyChange(PROPERTY_SELECTED_APPLICATION, this.selectedApplication,
this.selectedApplication = application);
}
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
-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;
@@ -58,7 +57,7 @@
GridLayoutFactory.fillDefaults().numColumns(3).margins(10, 10).applyTo(container);
Link signupLink = new Link(container, SWT.WRAP);
- signupLink.setText("If you have no user account on Openshit Express yet, please
sign up <a>here</a>.");
+ signupLink.setText("If you have no user account on OpenShit Express yet, please
sign up <a>here</a>.");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(3, 1).hint(SWT.DEFAULT,
30).applyTo(signupLink);
signupLink.addSelectionListener(onSignupLinkClicked());
@@ -86,7 +85,7 @@
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(rhLoginLabel);
Text rhLoginText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2,
1).applyTo(rhLoginText);
- Binding rhLoginBining = DataBindingUtils.bindMandatoryTextField(
+ DataBindingUtils.bindMandatoryTextField(
rhLoginText, "Username", CredentialsWizardPageModel.PROPERTY_RHLOGIN,
model, dbc);
Label passwordLabel = new Label(container, SWT.NONE);
@@ -94,7 +93,7 @@
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(passwordLabel);
Text passwordText = new Text(container, SWT.BORDER | SWT.PASSWORD);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2,
1).applyTo(passwordText);
- Binding passwordBinding = DataBindingUtils.bindMandatoryTextField(
+ DataBindingUtils.bindMandatoryTextField(
passwordText, "Password", CredentialsWizardPageModel.PROPERTY_PASSWORD,
model, dbc);
// Label credentialsValidatyLabel = new Label(container, SWT.None);
@@ -106,11 +105,11 @@
this.validateButton = new Button(container, SWT.NONE);
validateButton.setText("&Validate");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1).indent(0,
10).hint(100, 30).applyTo(validateButton);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1).indent(0,
10).hint(100, SWT.DEFAULT).applyTo(validateButton);
DataBindingUtils.bindEnablementToValidationStatus(
- validateButton,
- dbc,
- rhLoginBining, passwordBinding);
+ validateButton
+ , IStatus.INFO
+ , dbc);
validateButton.addSelectionListener(onValidate(dbc));
dbc.bindValue(
new WritableValue(null, IStatus.class),
@@ -118,6 +117,8 @@
new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
new UpdateValueStrategy().setAfterGetValidator(
new CredentialsStatusValidator()));
+
+ setErrorMessage(null);
}
protected SelectionAdapter onValidate(final DataBindingContext dbc) {
Copied:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/DomainWizardPage.java
(from rev 35415,
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java)
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/DomainWizardPage.java
(rev 0)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/DomainWizardPage.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * 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.wizard;
+
+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.WritableValue;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.common.ui.databinding.DataBindingUtils;
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+
+/**
+ * @author André Dietisheim
+ */
+public class DomainWizardPage extends AbstractOpenshiftWizardPage {
+
+ private DomainWizardPageModel model;
+ private ServerAdapterWizardModel wizardModel;
+
+ public DomainWizardPage(IWizard wizard, ServerAdapterWizardModel wizardModel) {
+ super("Domain", "Create a new domain (if you have none yet), use your
existing domain or rename it...",
+ "new Domain", wizard);
+ this.wizardModel = wizardModel;
+ this.model = new DomainWizardPageModel(wizardModel);
+ }
+
+ protected void doCreateControls(Composite container, DataBindingContext dbc) {
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(container);
+
+ Label namespaceLabel = new Label(container, SWT.NONE);
+ namespaceLabel.setText("&Domain name");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(namespaceLabel);
+ Text namespaceText = new Text(container, SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2,
1).applyTo(namespaceText);
+ DataBindingUtils.bindMandatoryTextField(
+ namespaceText, "Domain name", DomainWizardPageModel.PROPERTY_NAMESPACE,
model, dbc);
+
+ // bind the existence of a domain to the page validity
+ dbc.bindValue(
+ new WritableValue(null, IDomain.class)
+ , BeanProperties.value(DomainWizardPageModel.PROPERTY_DOMAIN).observe(model)
+ , new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)
+ , new UpdateValueStrategy().setAfterGetValidator(new IValidator() {
+
+ @Override
+ public IStatus validate(Object value) {
+ if (!(value instanceof IDomain)) {
+ System.err.println("domain validator: domain is NOT
present!!!!!!!!!!!!!");
+ return ValidationStatus.info("You have no domain yet, you need to create
one.");
+ }
+ System.err.println("domain validator: domain is present");
+ return ValidationStatus.ok();
+ }
+ }));
+
+ Label spacerLabel = new Label(container, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(80,
30).applyTo(spacerLabel);
+
+ Button createButton = new Button(container, SWT.PUSH);
+ createButton.setText("&Create");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(80,
SWT.DEFAULT).applyTo(createButton);
+ DataBindingUtils.bindEnablementToValidationStatus(createButton, IStatus.ERROR |
IStatus.WARNING | IStatus.INFO , dbc);
+ createButton.addSelectionListener(onCreate(dbc));
+
+ Button renameButton = new Button(container, SWT.PUSH);
+ renameButton.setText("&Rename");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(80,
SWT.DEFAULT).applyTo(renameButton);
+ DataBindingUtils.bindEnablementToValidationStatus(renameButton, IStatus.OK, dbc);
+ renameButton.addSelectionListener(onRename(dbc));
+ }
+
+ private SelectionListener onCreate(DataBindingContext dbc) {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Shell shell = getContainer().getShell();
+ if (WizardUtils.openWizardDialog(new NewDomainDialog(model.getNamespace(),
wizardModel), shell)
+ == Dialog.OK) {
+ }
+ }
+ };
+ }
+
+ private SelectionListener onRename(DataBindingContext dbc) {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ WizardUtils.runInWizard(new Job("Renaming domain...") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ System.err.println("running job " + this);
+ try {
+ model.renameDomain();
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
+ "Could not get domain", e);
+ }
+ }
+ }, getWizard().getContainer(), getDatabindingContext());
+ } catch (Exception ex) {
+ // ignore
+ }
+ }
+ };
+ }
+
+ @Override
+ protected void onPageActivated(DataBindingContext dbc) {
+ try {
+ WizardUtils.runInWizard(new Job("Checking presence of domain...") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ System.err.println("running job " + this);
+ try {
+ model.updateDomain();
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
+ "Could not get domain", e);
+ }
+ }
+ }, getWizard().getContainer(), getDatabindingContext());
+ } catch (Exception ex) {
+ // ignore
+ }
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/DomainWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/DomainWizardPageModel.java
(from rev 35415,
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java)
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/DomainWizardPageModel.java
(rev 0)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/DomainWizardPageModel.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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.wizard;
+
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+
+/**
+ * @author André Dietisheim
+ */
+public class DomainWizardPageModel extends ObservableUIPojo {
+
+ public static final String PROPERTY_NAMESPACE = "namespace";
+ public static final String PROPERTY_DOMAIN = "domain";
+
+ private String namespace;
+ private IDomain domain;
+ private ServerAdapterWizardModel wizardModel;
+
+ public DomainWizardPageModel(ServerAdapterWizardModel wizardModel) {
+ this.wizardModel = wizardModel;
+ }
+
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ firePropertyChange(PROPERTY_NAMESPACE, this.namespace, this.namespace = namespace);
+ }
+
+ public boolean hasDomain() {
+ return domain != null;
+ }
+
+ public IDomain getDomain() {
+ return domain;
+ }
+
+ public void setDomain(IDomain domain) {
+ firePropertyChange(PROPERTY_DOMAIN, this.domain, this.domain = domain);
+ setNamespace(domain);
+ }
+
+ private void setNamespace(IDomain domain) {
+ if (domain != null) {
+ setNamespace(domain.getNamespace());
+ } else {
+ setNamespace((String) null);
+ }
+ }
+
+ public void renameDomain() throws OpenshiftException {
+ getDomain().setNamespace(namespace);
+ }
+
+ public void updateDomain() throws OpenshiftException {
+ setDomain(getUser().getDomain());
+ }
+
+ public IUser getUser() {
+ return wizardModel.getUser();
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/DomainWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ISkipableWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ISkipableWizardPage.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ISkipableWizardPage.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * 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.wizard;
-
-/**
- * @author André Dietisheim
- */
-public interface ISkipableWizardPage {
-
- public boolean isSkip();
-
-}
Added:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java
(rev 0)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.wizard;
+
+import java.util.concurrent.ArrayBlockingQueue;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+
+/**
+ * @author André Dietisheim
+ */
+public class NewDomainDialog extends Wizard {
+
+ private NewDomainWizardPageModel newDomainWizardModel;
+ private ServerAdapterWizardModel wizardModel;
+ private String namespace;
+
+ public NewDomainDialog(String namespace, ServerAdapterWizardModel wizardModel) {
+ this.namespace = namespace;
+ this.wizardModel = wizardModel;
+ setNeedsProgressMonitor(true);
+ }
+
+ @Override
+ public boolean performFinish() {
+ final ArrayBlockingQueue<Boolean> queue = new
ArrayBlockingQueue<Boolean>(1);
+ try {
+ WizardUtils.runInWizard(new Job("Creating application...") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ newDomainWizardModel.createDomain();
+ queue.offer(true);
+ } catch (Exception e) {
+ queue.offer(false);
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
+ NLS.bind("Could not create domain \"{0}\"",
newDomainWizardModel.getNamespace()), e);
+ }
+ return Status.OK_STATUS;
+ }
+ }, getContainer());
+ } catch (Exception e) {
+ // ignore
+ }
+ return queue.poll();
+ }
+
+ @Override
+ public void addPages() {
+ addPage(new NewDomainWizardPage(namespace, wizardModel, this));
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.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/NewDomainWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -11,26 +11,16 @@
package org.jboss.tools.openshift.express.internal.ui.wizard;
import java.io.File;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.TimeUnit;
+import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.UpdateValueStrategy;
-import org.eclipse.core.databinding.ValidationStatusProvider;
import org.eclipse.core.databinding.beans.BeanProperties;
-import org.eclipse.core.databinding.observable.IObservableCollection;
-import org.eclipse.core.databinding.observable.list.WritableList;
-import org.eclipse.core.databinding.observable.value.WritableValue;
-import org.eclipse.core.databinding.validation.IValidator;
-import org.eclipse.core.databinding.validation.ValidationStatus;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
+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;
import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -42,29 +32,22 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.common.ui.BrowserUtil;
-import org.jboss.tools.common.ui.WizardUtils;
import org.jboss.tools.common.ui.databinding.DataBindingUtils;
-import org.jboss.tools.openshift.express.client.IDomain;
-import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
/**
* @author André Dietisheim
*/
-public class NewDomainWizardPage extends AbstractOpenshiftWizardPage implements
ISkipableWizardPage {
+public class NewDomainWizardPage extends AbstractOpenshiftWizardPage {
- private static final String OPENSHIFT_EXPRESS_SIGNUP_URL =
"https://openshift.redhat.com/app/user/new/express"; //$NON-NLS-1$
-
private static final String DIRECTORY_SSH_KEYS = ".ssh";
private static final String FILTEREXPRESSION_PUBLIC_SSH_KEY = "*.pub";
private static final String FILTERNAME_PUBLIC_SSH_KEY = "Public ssh key file
(*.pub)";
private NewDomainWizardPageModel model;
- public NewDomainWizardPage(IWizard wizard, ServerAdapterWizardModel wizardModel) {
- super("New Domain", "Please create a new domain",
- "new Domain", wizard);
- this.model = new NewDomainWizardPageModel(wizardModel);
+ public NewDomainWizardPage(String namespace, ServerAdapterWizardModel wizardModel,
IWizard wizard) {
+ super("Domain", "Create a new domain", "New Domain",
wizard);
+ this.model = new NewDomainWizardPageModel(namespace, wizardModel);
}
protected void doCreateControls(Composite container, DataBindingContext dbc) {
@@ -75,36 +58,27 @@
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(namespaceLabel);
Text namespaceText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2,
1).applyTo(namespaceText);
- DataBindingUtils.bindMandatoryTextField(namespaceText, "Domain name",
- NewDomainWizardPageModel.PROPERTY_NAMESPACE, model, dbc);
+ DataBindingUtils.bindMandatoryTextField(
+ namespaceText, "Domain name", NewDomainWizardPageModel.PROPERTY_NAMESPACE,
model, dbc);
Label sshKeyLabel = new Label(container, SWT.NONE);
sshKeyLabel.setText("SSH Key");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(sshKeyLabel);
Text sshKeyText = new Text(container, SWT.READ_ONLY | SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(sshKeyText);
- DataBindingUtils.bindMandatoryTextField(sshKeyText, "SSH Key",
NewDomainWizardPageModel.PROPERTY_SSHKEY, model,
- dbc);
+
+ Binding sshKeyBinding = dbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observe(sshKeyText)
+ , BeanProperties.value(NewDomainWizardPageModel.PROPERTY_SSHKEY).observe(model)
+ , new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)
+ , null
+ );
+ ControlDecorationSupport.create(sshKeyBinding, SWT.TOP | SWT.LEFT);
+
Button browseSShKeyButton = new Button(container, SWT.PUSH);
browseSShKeyButton.setText("Browse");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(100,
SWT.DEFAULT).applyTo(browseSShKeyButton);
browseSShKeyButton.addSelectionListener(onBrowseSshKey());
-
- Label spacerLabel = new Label(container, SWT.None);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(spacerLabel);
-
- Button createButton = new Button(container, SWT.NONE);
- createButton.setText("&Create New Domain");
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).span(2, 1).indent(0,
10).hint(160, 34)
- .applyTo(createButton);
- createButton.addSelectionListener(onCreate(dbc));
- DataBindingUtils.bindEnablementToValidationStatus(createButton, dbc);
-
- dbc.bindValue(
- new WritableValue(null, IDomain.class)
- , BeanProperties.value(NewDomainWizardPageModel.PROPERTY_DOMAIN).observe(model)
- , new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)
- , new UpdateValueStrategy().setAfterGetValidator(new DomainCreatedValidator()));
}
private SelectionListener onBrowseSshKey() {
@@ -130,98 +104,4 @@
File sshKeysDirectory = new File(userHome, DIRECTORY_SSH_KEYS);
return sshKeysDirectory.getAbsolutePath();
}
-
- protected SelectionAdapter onCreate(final DataBindingContext dbc) {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- WizardUtils.runInWizard(
- new Job("Creating new domain") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- model.createDomain();
- } catch (Exception e) {
- return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, NLS.bind(
- "Could not create a new domain with the name \"{0}\"",
- model.getNamespace()), e);
- }
- return Status.OK_STATUS;
- }
- }, getWizard().getContainer(), dbc);
- } catch (Exception ex) {
- // ignore
- }
- };
- };
- }
-
- protected SelectionAdapter onSignupLinkClicked() {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- BrowserUtil.checkedCreateInternalBrowser(OPENSHIFT_EXPRESS_SIGNUP_URL,
OPENSHIFT_EXPRESS_SIGNUP_URL,
- OpenshiftUIActivator.PLUGIN_ID, OpenshiftUIActivator.getDefault().getLog());
- getWizard().getContainer().getShell().close();
- }
- };
- }
-
- protected IObservableCollection toObservableCollection(ValidationStatusProvider...
validationStatusProviders) {
- WritableList validationProviders = new WritableList();
- for (ValidationStatusProvider provider : validationStatusProviders) {
- validationProviders.add(provider);
- }
- return validationProviders;
- }
-
- @Override
- public boolean isSkip() {
- if (!model.hasUser()) {
- return false;
- }
-
- final ArrayBlockingQueue<Boolean> queue = new
ArrayBlockingQueue<Boolean>(1);
- try {
- WizardUtils.runInWizard(
- new Job("Checking presence of domain") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- queue.offer(model.hasDomain());
- } catch (Exception e) {
- queue.offer(false);
- return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
- "Could not get domain", e);
- }
- return Status.OK_STATUS;
- }
- }, getWizard().getContainer(), getDatabindingContext());
- } catch (Exception ex) {
- // ignore
- }
-
- try {
- return queue.poll(6, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- return false;
- }
- }
-
- private static class DomainCreatedValidator implements IValidator {
- @Override
- public IStatus validate(Object value) {
- if (value != null) {
- return ValidationStatus.ok();
- } else {
- return ValidationStatus.info("You have to create a domain...");
- }
- }
- };
-
}
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -16,7 +16,6 @@
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.express.client.IDomain;
import org.jboss.tools.openshift.express.client.ISSHPublicKey;
-import org.jboss.tools.openshift.express.client.IUser;
import org.jboss.tools.openshift.express.client.OpenshiftException;
import org.jboss.tools.openshift.express.client.SSHPublicKey;
@@ -34,7 +33,8 @@
private String sshKey;
private ServerAdapterWizardModel wizardModel;
- public NewDomainWizardPageModel(ServerAdapterWizardModel wizardModel) {
+ public NewDomainWizardPageModel(String namespace, ServerAdapterWizardModel wizardModel)
{
+ setNamespace(namespace);
this.wizardModel = wizardModel;
}
@@ -43,8 +43,7 @@
}
public void createDomain() throws OpenshiftException, IOException {
- IUser user = getUser();
- IDomain domain = user.createDomain(namespace, loadSshKey());
+ IDomain domain = wizardModel.getUser().createDomain(namespace, loadSshKey());
setDomain(domain);
}
@@ -60,15 +59,12 @@
return new SSHPublicKey(new File(sshKey));
}
- public void setNamespace(String namespace) throws OpenshiftException {
+ public void setNamespace(String namespace) {
firePropertyChange(PROPERTY_NAMESPACE, this.namespace, this.namespace = namespace);
}
- public boolean hasDomain() throws OpenshiftException {
- if (!hasUser()) {
- return false;
- }
- return getUser().hasDomain();
+ public boolean hasDomain() {
+ return domain != null;
}
public IDomain getDomain() {
@@ -77,13 +73,12 @@
public void setDomain(IDomain domain) {
firePropertyChange(PROPERTY_DOMAIN, this.domain, this.domain = domain);
+ if (domain != null) {
+ setNamespace(domain.getNamespace());
+ }
}
- public boolean hasUser() {
- return wizardModel.getUser() != null;
+ public void updateDomain() throws OpenshiftException {
+ setDomain(wizardModel.getUser().getDomain());
}
-
- public IUser getUser() {
- return wizardModel.getUser();
- }
}
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizard.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -10,33 +10,77 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
/**
* @author André Dietisheim
*/
-public class ServerAdapterWizard extends AbstractSkippingWizard {
+public class ServerAdapterWizard extends Wizard implements INewWizard {
+ private ServerAdapterWizardModel model;
+
public ServerAdapterWizard() {
}
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
- setWindowTitle("Create new Openshift Express Server Adapter");
+ setWindowTitle("OpenShift application wizard");
setNeedsProgressMonitor(true);
}
@Override
public boolean performFinish() {
- return true;
+ try {
+ WizardUtils.runInWizard(
+ new Job("Creating local git repo...") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ model.createGitClone();
+ return Status.OK_STATUS;
+ } catch (OpenshiftException e) {
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
+ "An exception occurred while creating local git repository.", e);
+ } catch (URISyntaxException e) {
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
+ "The url of the remote git repository is not valid", e);
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
+ "An exception occurred while creating local git repository.", e);
+ }
+ }
+ }, getContainer());
+ return true;
+ } catch (Exception e) {
+ ErrorDialog.openError(getShell(), "Error", "Could not create local git
repository.",
+ new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
+ "An exception occurred while creating local git repository.", e));
+ return false;
+ }
}
@Override
public void addPages() {
- ServerAdapterWizardModel model = new ServerAdapterWizardModel();
+ this.model = new ServerAdapterWizardModel();
addPage(new CredentialsWizardPage(this, model));
- addPage(new NewDomainWizardPage(this, model));
+ addPage(new DomainWizardPage(this, model));
addPage(new ApplicationWizardPage(this, model));
+ addPage(new AdapterWizardPage(this, model));
}
}
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java
===================================================================
---
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ServerAdapterWizardModel.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -10,8 +10,19 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.egit.core.op.CloneOperation;
+import org.eclipse.jgit.transport.URIish;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.openshift.express.client.IApplication;
import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
/**
* @author André Dietisheim
@@ -19,7 +30,8 @@
public class ServerAdapterWizardModel extends ObservableUIPojo {
private IUser user;
-
+ private IApplication application;
+
public void setUser(IUser user) {
this.user = user;
}
@@ -27,4 +39,21 @@
public IUser getUser() {
return user;
}
+
+ public IApplication getApplication() {
+ return application;
+ }
+
+ public void setApplication(IApplication application) {
+ this.application = application;
+ }
+
+ public void createGitClone() throws OpenshiftException, URISyntaxException,
InvocationTargetException, InterruptedException {
+ String applicationWorkingdir = "openshift-" + application.getName();
+ File workspace = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile();
+ File workDir = new File(workspace, applicationWorkingdir);
+ URIish gitUri = new URIish(application.getGitUri());
+ new CloneOperation(gitUri, true, null, workDir, "refs/heads/*",
"master", 10 * 1024).run(null);
+ }
+
}
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ParametrizableWizardPageSupport.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ParametrizableWizardPageSupport.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/ParametrizableWizardPageSupport.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -63,8 +63,10 @@
if (currentStatusStale) {
pageComplete = false;
} else if (currentStatus != null) {
- pageComplete = !currentStatus.matches(nonValidatingSeverity);
+// pageComplete = !currentStatus.matches(nonValidatingSeverity);
+ pageComplete = !((nonValidatingSeverity | currentStatus.getSeverity()) ==
nonValidatingSeverity);
}
+ System.err.println("pageComplete == " + pageComplete);
((WizardPage) getDialogPage()).setPageComplete(pageComplete);
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/Status2BooleanConverter.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/Status2BooleanConverter.java 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/Status2BooleanConverter.java 2011-10-10
07:33:12 UTC (rev 35506)
@@ -46,16 +46,22 @@
}
int current = ((IStatus) fromObject).getSeverity();
- switch (severity) {
- default:
- case IStatus.ERROR:
- return current != IStatus.ERROR;
- case IStatus.WARNING:
- return current != IStatus.WARNING;
- case IStatus.INFO:
- return current != IStatus.INFO;
- case IStatus.OK:
- return current != IStatus.OK;
+// switch (severity) {
+// default:
+// case IStatus.ERROR:
+// return current != IStatus.ERROR;
+// case IStatus.WARNING:
+// return current != IStatus.WARNING;
+// case IStatus.INFO:
+// return current != IStatus.INFO;
+// case IStatus.OK:
+// return current != IStatus.OK;
+// }
+ if (current == IStatus.OK) {
+ System.err.println("converter result = " + (severity == IStatus.OK) +
"<- current = " + current + " configured = " + severity);
+ return severity == IStatus.OK;
}
+ System.err.println("converter result = " + ((severity | current) ==
severity));
+ return (severity | current) == severity;
}
}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties 2011-10-10
00:41:51 UTC (rev 35505)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties 2011-10-10
07:33:12 UTC (rev 35506)
@@ -31,4 +31,4 @@
BROWSER_COULD_NOT_DISPLAY_MALFORMED_URL=Could not display malformed url
\"{0}\".
URLSTRINGVALIDATOR_NOT_A_VALID_URL=\"{0}\" is not a valid url.
-MANDATORYSTRING_VALIDATOR_MUST_PROVIDE_VALUE=You have to provide a value for the {0}.
\ No newline at end of file
+MANDATORYSTRING_VALIDATOR_MUST_PROVIDE_VALUE=You have to provide a {0}.
\ No newline at end of file