JBoss Tools SVN: r35321 - trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-04 08:21:36 -0400 (Tue, 04 Oct 2011)
New Revision: 35321
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPageModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPageModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPageModel.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java
Log:
[JBIDE-9793] now skipping domain page if domain is already present
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java 2011-10-04 11:47:23 UTC (rev 35320)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java 2011-10-04 12:21:36 UTC (rev 35321)
@@ -28,13 +28,10 @@
*/
public abstract class AbstractOpenshiftWizardPage extends WizardPage {
- protected ServerAdapterWizardModel model;
private DataBindingContext dbc;
- protected AbstractOpenshiftWizardPage(String title, String description, String pageName, IWizard wizard,
- ServerAdapterWizardModel model) {
+ protected AbstractOpenshiftWizardPage(String title, String description, String pageName, IWizard wizard) {
super(pageName);
- this.model = model;
setWizard(wizard);
setTitle(title);
setDescription(description);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java 2011-10-04 11:47:23 UTC (rev 35320)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java 2011-10-04 12:21:36 UTC (rev 35321)
@@ -31,7 +31,6 @@
break;
}
}
-
return nextPage;
}
@@ -47,7 +46,6 @@
break;
}
}
-
return previousPage;
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java 2011-10-04 11:47:23 UTC (rev 35320)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java 2011-10-04 12:21:36 UTC (rev 35321)
@@ -33,7 +33,6 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.PlatformUI;
import org.jboss.ide.eclipse.as.openshift.core.IApplication;
-import org.jboss.ide.eclipse.as.openshift.core.IUser;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
import org.jboss.tools.common.ui.WizardUtils;
@@ -44,10 +43,12 @@
public class ApplicationWizardPage extends AbstractOpenshiftWizardPage {
private TableViewer viewer;
+ private ApplicationWizardPageModel model;
- protected ApplicationWizardPage(IWizard wizard, ServerAdapterWizardModel model) {
+ protected ApplicationWizardPage(IWizard wizard, ServerAdapterWizardModel wizardModel) {
super("Application selection", "Please select an Openshift Express application to use",
- "Application selection", wizard, model);
+ "Application selection", wizard);
+ this.model = new ApplicationWizardPageModel(wizardModel);
}
@Override
@@ -97,11 +98,7 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- IUser user = model.getUser();
- if (user == null) {
- return Status.OK_STATUS;
- }
- bindApplications(user.getApplications(), viewer);
+ bindApplications(model.getApplications(), viewer);
return Status.OK_STATUS;
} catch (OpenshiftException e) {
return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPageModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPageModel.java 2011-10-04 12:21:36 UTC (rev 35321)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.ide.eclipse.as.openshift.ui.internal.wizard;
+
+import java.util.Collection;
+
+import org.jboss.ide.eclipse.as.openshift.core.IApplication;
+import org.jboss.ide.eclipse.as.openshift.core.IUser;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+
+/**
+ * @author André Dietisheim
+ *
+ */
+public class ApplicationWizardPageModel {
+
+ private ServerAdapterWizardModel wizardModel;
+
+ public ApplicationWizardPageModel(ServerAdapterWizardModel wizardModel) {
+ this.wizardModel = wizardModel;
+ }
+
+ public Collection<IApplication> getApplications() throws OpenshiftException {
+ IUser user = wizardModel.getUser();
+ return user.getApplications();
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPage.java (from rev 35313, trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPage.java 2011-10-04 12:21:36 UTC (rev 35321)
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * 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.ide.eclipse.as.openshift.ui.internal.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;
+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.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.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
+import org.jboss.tools.common.ui.BrowserUtil;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.common.ui.databinding.DataBindingUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class CredentialsWizardPage extends AbstractOpenshiftWizardPage {
+
+ protected static final String OPENSHIFT_EXPRESS_SIGNUP_URL = "https://openshift.redhat.com/app/user/new/express"; //$NON-NLS-1$
+
+ private Button validateButton;
+
+ private CredentialsWizardPageModel model;
+
+ public CredentialsWizardPage(IWizard wizard, ServerAdapterWizardModel wizardModel) {
+ super("Server connetion", "Please provide the credentails of your user account on Openshift Express",
+ "Server Connection", wizard);
+ this.model = new CredentialsWizardPageModel(wizardModel);
+ }
+
+ protected void doCreateControls(Composite container, DataBindingContext dbc) {
+ 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>.");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(3, 1).hint(SWT.DEFAULT, 30).applyTo(signupLink);
+ signupLink.addSelectionListener(onSignupLinkClicked());
+
+ // Label serverUrlLabel = new Label(container, SWT.NONE);
+ // serverUrlLabel.setText("Server URL");
+ // GridDataFactory.fillDefaults().align(SWT.LEFT,
+ // SWT.CENTER).applyTo(serverUrlLabel);
+ // Text serverUrlText = new Text(container, SWT.BORDER);
+ // GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
+ // false).span(2, 1).applyTo(serverUrlText);
+ // dbc.bindValue(
+ // WidgetProperties.text(SWT.Modify).observe(serverUrlText),
+ // BeanProperties.value(
+ // ServerAdapterWizardModel.class,
+ // ServerAdapterWizardModel.PROPERTY_SERVER_URL).observe(model),
+ // new UpdateValueStrategy()
+ // .setAfterGetValidator(new
+ // MandatoryStringValidator("You have to provide a value for the server url."))
+ // .setBeforeSetValidator(new SimpleUrlStringValidator())
+ // .setConverter(new TrimTrailingSlashConverter()),
+ // null);
+
+ Label rhLoginLabel = new Label(container, SWT.NONE);
+ rhLoginLabel.setText("&Username");
+ 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(
+ rhLoginText, "Username", CredentialsWizardPageModel.PROPERTY_RHLOGIN, model, dbc);
+
+ Label passwordLabel = new Label(container, SWT.NONE);
+ passwordLabel.setText("&Password");
+ 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(
+ passwordText, "Password", CredentialsWizardPageModel.PROPERTY_PASSWORD, model, dbc);
+
+ Label spacerLabel = new Label(container, SWT.None);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1).applyTo(spacerLabel);
+
+ // Label credentialsValidatyLabel = new Label(container, SWT.None);
+ // GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).hint(64,
+ // 64).applyTo(credentialsValidatyLabel);
+
+ this.validateButton = new Button(container, SWT.NONE);
+ validateButton.setText("&Validate");
+ GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).indent(0, 10).hint(100, 34).applyTo(validateButton);
+ DataBindingUtils.bindButtonEnablementToValidationStatus(
+ validateButton,
+ dbc,
+ rhLoginBining, passwordBinding);
+ validateButton.addSelectionListener(onValidate(dbc));
+ dbc.bindValue(
+ new WritableValue(null, IStatus.class),
+ BeanProperties.value(CredentialsWizardPageModel.PROPERTY_CREDENTIALS_VALIDITY).observe(model),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy().setAfterGetValidator(
+ new CredentialsStatusValidator()));
+ }
+
+ protected SelectionAdapter onValidate(final DataBindingContext dbc) {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ WizardUtils.runInWizard(
+ new Job("Testing user credentials") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ model.validateCredentials();
+ 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();
+ }
+ };
+ }
+
+ private static class CredentialsStatusValidator implements IValidator {
+ public IStatus validate(Object value) {
+ if (value instanceof IStatus) {
+ int currentSeverity = ((IStatus) value).getSeverity();
+ if (currentSeverity < IStatus.ERROR) {
+ return ValidationStatus.ok();
+ }
+ } else if (value == null) {
+ return ValidationStatus.info("You have to validate your credentials");
+ }
+ return ValidationStatus.error("The given credentials are not valid");
+ }
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPageModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPageModel.java 2011-10-04 12:21:36 UTC (rev 35321)
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * 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.ide.eclipse.as.openshift.ui.internal.wizard;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.IUser;
+import org.jboss.ide.eclipse.as.openshift.core.NotFoundOpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.User;
+import org.jboss.ide.eclipse.as.openshift.core.UserConfiguration;
+import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.common.ui.preferencevalue.StringPreferenceValue;
+
+/**
+ * @author André Dietisheim
+ */
+public class CredentialsWizardPageModel extends ObservableUIPojo {
+
+ private static final String RHLOGIN_PREFS_KEY = "org.jboss.ide.eclipse.as.openshift.ui.internal.wizard.CredentialsWizardModel_RHLOGIN";
+
+ public static final String PROPERTY_SERVER_URL = "serverUrl";
+ public static final String PROPERTY_RHLOGIN = "rhLogin";
+ public static final String PROPERTY_PASSWORD = "password";
+ public static final String PROPERTY_CREDENTIALS_VALIDITY = "credentialsValidity";
+
+ private String serverUrl;
+ private String rhLogin;
+ private String password;
+ private IStatus credentialsValidity;
+ private IUser user;
+ private StringPreferenceValue rhLoginPreferenceValue;
+
+ private ServerAdapterWizardModel wizardModel;
+
+ public CredentialsWizardPageModel(ServerAdapterWizardModel model) {
+ this.wizardModel = model;
+ this.serverUrl = IOpenshiftService.BASE_URL;
+ this.rhLoginPreferenceValue = new StringPreferenceValue(RHLOGIN_PREFS_KEY, OpenshiftUIActivator.PLUGIN_ID);
+ this.rhLogin = initRhLogin();
+ resetCredentialsStatus();
+ }
+
+ protected String initRhLogin() {
+ String rhLogin = null;
+ rhLogin = rhLoginPreferenceValue.get();
+ if (rhLogin == null) {
+ rhLogin = getUserConfiguration();
+ }
+ return rhLogin;
+ }
+
+ protected String getUserConfiguration() {
+ String configuredUsername = null;
+ try {
+ configuredUsername = new UserConfiguration().getRhlogin();
+ } catch (Exception e) {
+ // do nothing
+ }
+ return configuredUsername;
+ }
+
+ public String getServerUrl() {
+ return serverUrl;
+ }
+
+ public void setServerUrl(String serverUrl) {
+ firePropertyChange(PROPERTY_SERVER_URL, this.serverUrl, this.serverUrl = serverUrl);
+ }
+
+ public String getRhLogin() {
+ return rhLogin;
+ }
+
+ public void setRhLogin(String rhLogin) {
+ if (rhLogin != null
+ && !rhLogin.equals(this.rhLogin)) {
+ rhLoginPreferenceValue.store(rhLogin);
+ firePropertyChange(PROPERTY_RHLOGIN, this.rhLogin, this.rhLogin = rhLogin);
+ resetCredentialsStatus();
+ }
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ if (password != null
+ && !password.equals(this.password)) {
+ firePropertyChange(PROPERTY_PASSWORD, this.password, this.password = password);
+ resetCredentialsStatus();
+ }
+ }
+
+ private void resetCredentialsStatus() {
+ setCredentialsStatus(null);
+ }
+
+ private void setCredentialsStatus(IStatus status) {
+ firePropertyChange(PROPERTY_CREDENTIALS_VALIDITY, this.credentialsValidity,
+ this.credentialsValidity = status);
+ }
+
+ public IStatus getCredentialsValidity() {
+ return credentialsValidity;
+ }
+
+ public void validateCredentials() {
+ IStatus status = new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, "Your credentails are not valid.");
+ try {
+ this.user = new User(getRhLogin(), getPassword());
+ if (user.isValid()) {
+ status = Status.OK_STATUS;
+ }
+ } catch (NotFoundOpenshiftException e) {
+ // valid user without domain
+ status = Status.OK_STATUS;
+ } catch (OpenshiftException e) {
+ this.user = null;
+ }
+ wizardModel.setUser(user);
+ setCredentialsStatus(status);
+ }
+
+ public IUser getUser() {
+ return user;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java 2011-10-04 11:47:23 UTC (rev 35320)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java 2011-10-04 12:21:36 UTC (rev 35321)
@@ -11,6 +11,8 @@
package org.jboss.ide.eclipse.as.openshift.ui.internal.wizard;
import java.io.File;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.ValidationStatusProvider;
@@ -52,10 +54,12 @@
private static final String FILTEREXPRESSION_PUBLIC_SSH_KEY = "*.pub";
private static final String FILTERNAME_PUBLIC_SSH_KEY = "Public ssh key file (*.pub)";
- public NewDomainWizardPage(IWizard wizard, ServerAdapterWizardModel model) {
+ private NewDomainWizardPageModel model;
+
+ public NewDomainWizardPage(IWizard wizard, ServerAdapterWizardModel wizardModel) {
super("New Domain", "Please create a new domain",
- "new Domain", wizard, model);
- this.model = model;
+ "new Domain", wizard);
+ this.model = new NewDomainWizardPageModel(wizardModel);
}
protected void doCreateControls(Composite container, DataBindingContext dbc) {
@@ -67,14 +71,14 @@
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",
- ServerAdapterWizardModel.PROPERTY_NAMESPACE, model, dbc);
+ 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", ServerAdapterWizardModel.PROPERTY_SSHKEY, model,
+ DataBindingUtils.bindMandatoryTextField(sshKeyText, "SSH Key", NewDomainWizardPageModel.PROPERTY_SSHKEY, model,
dbc);
Button browseSShKeyButton = new Button(container, SWT.PUSH);
browseSShKeyButton.setText("Browse");
@@ -167,7 +171,11 @@
@Override
public boolean isSkip() {
- final boolean[] isSkip = new boolean[] { false };
+ if (!model.hasUser()) {
+ return false;
+ }
+
+ final BlockingQueue<Boolean> queue = new ArrayBlockingQueue<Boolean>(1);
try {
WizardUtils.runInWizard(
new Job("Checking presence of domain") {
@@ -175,17 +183,18 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- isSkip[0] = model.hasDomain();
- } catch (OpenshiftException e) {
+ 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
}
- return isSkip[0];
+ return queue.poll();
}
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPageModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPageModel.java 2011-10-04 12:21:36 UTC (rev 35321)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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.ide.eclipse.as.openshift.ui.internal.wizard;
+
+import org.jboss.ide.eclipse.as.openshift.core.IDomain;
+import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
+import org.jboss.ide.eclipse.as.openshift.core.IUser;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+
+/**
+ * @author André Dietisheim
+ */
+public class NewDomainWizardPageModel extends ObservableUIPojo {
+
+ public static final String PROPERTY_NAMESPACE = "namespace";
+ public static final String PROPERTY_SSHKEY = "sshKey";
+
+ private String namespace;
+ private IDomain domain;
+ private String sshKey;
+ private ServerAdapterWizardModel wizardModel;
+
+ public NewDomainWizardPageModel(ServerAdapterWizardModel wizardModel) {
+ this.wizardModel = wizardModel;
+ }
+
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ public void createDomain() throws OpenshiftException {
+ IUser user = wizardModel.getUser();
+ this.domain = user.createDomain(namespace, loadSshKey());
+ }
+
+ public String getSshKey() {
+ return sshKey;
+ }
+
+ public void setSshKey(String sshKey) {
+ firePropertyChange(PROPERTY_SSHKEY, this.sshKey, this.sshKey = sshKey);
+ }
+
+ private ISSHPublicKey loadSshKey() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setNamespace(String namespace) throws OpenshiftException {
+ firePropertyChange(PROPERTY_NAMESPACE, this.namespace, this.namespace = namespace);
+ }
+
+ public boolean hasDomain() throws OpenshiftException {
+ if (!hasUser()) {
+ return false;
+ }
+ return getUser().hasDomain();
+ }
+
+ public void loadDomain() throws OpenshiftException {
+ if (!hasUser()) {
+ return;
+ }
+ IDomain domain = getUser().getDomain();
+ if (domain != null) {
+ this.domain = domain;
+ setNamespace(domain.getNamespace());
+ }
+ }
+
+ public boolean hasUser() {
+ return wizardModel.getUser() != null;
+ }
+
+ public IUser getUser() {
+ return wizardModel.getUser();
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java 2011-10-04 11:47:23 UTC (rev 35320)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java 2011-10-04 12:21:36 UTC (rev 35321)
@@ -35,7 +35,7 @@
@Override
public void addPages() {
ServerAdapterWizardModel model = new ServerAdapterWizardModel();
- addPage(new ServerWizardPage(this, model));
+ addPage(new CredentialsWizardPage(this, model));
addPage(new NewDomainWizardPage(this, model));
addPage(new ApplicationWizardPage(this, model));
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java 2011-10-04 11:47:23 UTC (rev 35320)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java 2011-10-04 12:21:36 UTC (rev 35321)
@@ -10,170 +10,21 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.ui.internal.wizard;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.jboss.ide.eclipse.as.openshift.core.IDomain;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
-import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
import org.jboss.ide.eclipse.as.openshift.core.IUser;
-import org.jboss.ide.eclipse.as.openshift.core.NotFoundOpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.core.UserConfiguration;
-import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.common.ui.preferencevalue.StringPreferenceValue;
/**
* @author André Dietisheim
*/
public class ServerAdapterWizardModel extends ObservableUIPojo {
- private static final String RHLOGIN_PREFS_KEY = "org.jboss.ide.eclipse.as.openshift.ui.internal.wizard.ServerAdapterWizardModel_RHLOGIN";
-
- public static final String PROPERTY_SERVER_URL = "serverUrl";
- public static final String PROPERTY_RHLOGIN = "rhLogin";
- public static final String PROPERTY_PASSWORD = "password";
- public static final String PROPERTY_CREDENTIALS_VALIDITY = "credentialsValidity";
- public static final String PROPERTY_NAMESPACE = "namespace";
- public static final String PROPERTY_SSHKEY = "sshKey";
-
- private String serverUrl;
- private String rhLogin;
- private String password;
- private IStatus credentialsValidity;
private IUser user;
- private String namespace;
- private StringPreferenceValue rhLoginPreferenceValue;
- private IDomain domain;
- private String sshKey;
- public ServerAdapterWizardModel() {
- this.serverUrl = IOpenshiftService.BASE_URL;
- this.rhLoginPreferenceValue = new StringPreferenceValue(RHLOGIN_PREFS_KEY, OpenshiftUIActivator.PLUGIN_ID);
- this.rhLogin = initRhLogin();
- resetCredentialsStatus();
+ public void setUser(IUser user) {
+ this.user = user;
}
-
- protected String initRhLogin() {
- String rhLogin = null;
- rhLogin = rhLoginPreferenceValue.get();
- if (rhLogin == null) {
- rhLogin = getUserConfiguration();
- }
- return rhLogin;
- }
-
- protected String getUserConfiguration() {
- String configuredUsername = null;
- try {
- configuredUsername = new UserConfiguration().getRhlogin();
- } catch (Exception e) {
- // do nothing
- }
- return configuredUsername;
- }
-
- public String getServerUrl() {
- return serverUrl;
- }
-
- public void setServerUrl(String serverUrl) {
- firePropertyChange(PROPERTY_SERVER_URL, this.serverUrl, this.serverUrl = serverUrl);
- }
-
- public String getRhLogin() {
- return rhLogin;
- }
-
- public void setRhLogin(String rhLogin) {
- if (rhLogin != null
- && !rhLogin.equals(this.rhLogin)) {
- rhLoginPreferenceValue.store(rhLogin);
- firePropertyChange(PROPERTY_RHLOGIN, this.rhLogin, this.rhLogin = rhLogin);
- resetCredentialsStatus();
- }
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- if (password != null
- && !password.equals(this.password)) {
- firePropertyChange(PROPERTY_PASSWORD, this.password, this.password = password);
- resetCredentialsStatus();
- }
- }
-
- private void resetCredentialsStatus() {
- setCredentialsStatus(null);
- }
-
- private void setCredentialsStatus(IStatus status) {
- firePropertyChange(PROPERTY_CREDENTIALS_VALIDITY, this.credentialsValidity,
- this.credentialsValidity = status);
- }
-
- public IStatus getCredentialsValidity() {
- return credentialsValidity;
- }
-
- public void validateCredentials() {
- IStatus status = new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, "Your credentails are not valid.");
- try {
- this.user = new User(getRhLogin(), getPassword());
- if (user.isValid()) {
- status = Status.OK_STATUS;
- }
- } catch (NotFoundOpenshiftException e) {
- // valid user without domain
- status = Status.OK_STATUS;
- } catch (OpenshiftException e) {
- this.user = null;
- }
- setCredentialsStatus(status);
- }
-
+
public IUser getUser() {
return user;
}
-
- public String getNamespace() {
- return this.namespace;
- }
-
- public void createDomain() throws OpenshiftException {
- this.domain = getUser().createDomain(namespace, loadSshKey());
- }
-
- public String getSshKey() {
- return sshKey;
- }
-
- public void setSshKey(String sshKey) {
- firePropertyChange(PROPERTY_SSHKEY, this.sshKey, this.sshKey = sshKey);
- }
-
- private ISSHPublicKey loadSshKey() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setNamespace(String namespace) throws OpenshiftException {
- firePropertyChange(PROPERTY_NAMESPACE, this.namespace, this.namespace = namespace);
- }
-
- public boolean hasDomain() throws OpenshiftException {
- return getUser().hasDomain();
- }
-
- public void loadDomain() throws OpenshiftException {
- IDomain domain = getUser().getDomain();
- if (domain != null) {
- this.domain = domain;
- setNamespace(domain.getNamespace());
- }
- }
}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java 2011-10-04 11:47:23 UTC (rev 35320)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java 2011-10-04 12:21:36 UTC (rev 35321)
@@ -1,168 +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.ide.eclipse.as.openshift.ui.internal.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;
-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.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.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
-import org.jboss.tools.common.ui.BrowserUtil;
-import org.jboss.tools.common.ui.WizardUtils;
-import org.jboss.tools.common.ui.databinding.DataBindingUtils;
-
-/**
- * @author André Dietisheim
- */
-public class ServerWizardPage extends AbstractOpenshiftWizardPage {
-
- protected static final String OPENSHIFT_EXPRESS_SIGNUP_URL = "https://openshift.redhat.com/app/user/new/express"; //$NON-NLS-1$
-
- private Button validateButton;
-
- public ServerWizardPage(IWizard wizard, ServerAdapterWizardModel model) {
- super("Server connetion", "Please provide the credentails of your user account on Openshift Express",
- "Server Connection", wizard, model);
- this.model = model;
- }
-
- protected void doCreateControls(Composite container, DataBindingContext dbc) {
- 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>.");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(3, 1).hint(SWT.DEFAULT, 30).applyTo(signupLink);
- signupLink.addSelectionListener(onSignupLinkClicked());
-
- // Label serverUrlLabel = new Label(container, SWT.NONE);
- // serverUrlLabel.setText("Server URL");
- // GridDataFactory.fillDefaults().align(SWT.LEFT,
- // SWT.CENTER).applyTo(serverUrlLabel);
- // Text serverUrlText = new Text(container, SWT.BORDER);
- // GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
- // false).span(2, 1).applyTo(serverUrlText);
- // dbc.bindValue(
- // WidgetProperties.text(SWT.Modify).observe(serverUrlText),
- // BeanProperties.value(
- // ServerAdapterWizardModel.class,
- // ServerAdapterWizardModel.PROPERTY_SERVER_URL).observe(model),
- // new UpdateValueStrategy()
- // .setAfterGetValidator(new
- // MandatoryStringValidator("You have to provide a value for the server url."))
- // .setBeforeSetValidator(new SimpleUrlStringValidator())
- // .setConverter(new TrimTrailingSlashConverter()),
- // null);
-
- Label rhLoginLabel = new Label(container, SWT.NONE);
- rhLoginLabel.setText("&Username");
- 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(
- rhLoginText, "Username", ServerAdapterWizardModel.PROPERTY_RHLOGIN, model, dbc);
-
- Label passwordLabel = new Label(container, SWT.NONE);
- passwordLabel.setText("&Password");
- 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(
- passwordText, "Password", ServerAdapterWizardModel.PROPERTY_PASSWORD, model, dbc);
-
- Label spacerLabel = new Label(container, SWT.None);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1).applyTo(spacerLabel);
-
- // Label credentialsValidatyLabel = new Label(container, SWT.None);
- // GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).hint(64,
- // 64).applyTo(credentialsValidatyLabel);
-
- this.validateButton = new Button(container, SWT.NONE);
- validateButton.setText("&Validate");
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).indent(0, 10).hint(100, 34).applyTo(validateButton);
- DataBindingUtils.bindButtonEnablementToValidationStatus(
- validateButton,
- dbc,
- rhLoginBining, passwordBinding);
- validateButton.addSelectionListener(onValidate(dbc));
- dbc.bindValue(
- new WritableValue(null, IStatus.class),
- BeanProperties.value(ServerAdapterWizardModel.PROPERTY_CREDENTIALS_VALIDITY).observe(model),
- new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
- new UpdateValueStrategy().setAfterGetValidator(
- new CredentialsStatusValidator()));
- }
-
- protected SelectionAdapter onValidate(final DataBindingContext dbc) {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- WizardUtils.runInWizard(
- new Job("Testing user credentials") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- model.validateCredentials();
- 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();
- }
- };
- }
-
- private static class CredentialsStatusValidator implements IValidator {
- public IStatus validate(Object value) {
- if (value instanceof IStatus) {
- int currentSeverity = ((IStatus) value).getSeverity();
- if (currentSeverity < IStatus.ERROR) {
- return ValidationStatus.ok();
- }
- } else if (value == null) {
- return ValidationStatus.info("You have to validate your credentials");
- }
- return ValidationStatus.error("The given credentials are not valid");
- }
- }
-}
13 years, 3 months
JBoss Tools SVN: r35320 - in trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples: preferences and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-10-04 07:47:23 -0400 (Tue, 04 Oct 2011)
New Revision: 35320
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/IProjectExampleSite.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleSite.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectModelElement.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/SiteCategory.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/SiteDialog.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/Sites.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
Log:
JBIDE-9708 project examples should resolve its path relative to the location of the projectexample.xml file by default
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java 2011-10-04 10:53:42 UTC (rev 35319)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Category.java 2011-10-04 11:47:23 UTC (rev 35320)
@@ -14,7 +14,6 @@
import java.util.List;
import org.jboss.tools.project.examples.Messages;
-import org.jboss.tools.project.examples.ProjectExamplesActivator;
/**
* @author snjeza
@@ -24,6 +23,7 @@
private String name;
private List<Project> projects = new ArrayList<Project>();
+ private IProjectExampleSite site;
public static Category OTHER = new Category(Messages.Category_Other);
public Category(String name) {
@@ -80,8 +80,13 @@
return getName();
}
- public String getSite() {
- return ProjectExamplesActivator.ALL_SITES;
+ public IProjectExampleSite getSite() {
+ return site;
}
+ @Override
+ public void setSite(IProjectExampleSite site) {
+ this.site = site;
+ }
+
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/IProjectExampleSite.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/IProjectExampleSite.java 2011-10-04 10:53:42 UTC (rev 35319)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/IProjectExampleSite.java 2011-10-04 11:47:23 UTC (rev 35320)
@@ -1,5 +1,21 @@
package org.jboss.tools.project.examples.model;
+import java.net.URL;
+
public interface IProjectExampleSite {
public String getName();
+
+ public void setEditable(boolean editable);
+
+ public boolean isEditable();
+
+ public void setExperimental(boolean experimental);
+
+ public boolean isExperimental();
+
+ public void setName(String name);
+
+ public void setUrl(URL url);
+
+ public URL getUrl();
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2011-10-04 10:53:42 UTC (rev 35319)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2011-10-04 11:47:23 UTC (rev 35320)
@@ -12,9 +12,12 @@
import java.io.File;
import java.math.BigDecimal;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
/**
@@ -23,6 +26,8 @@
*/
public class Project implements ProjectModelElement {
+ private static final String SEP = "/"; //$NON-NLS-1$
+ private static String[] PREFIXES = { "file:" , "http:", "https:" , "ftp:" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
private String name;
private String shortDescription;
private String description;
@@ -33,7 +38,6 @@
private boolean welcome;
private String type;
private String welcomeURL;
- private String site;
private List<ProjectFix> fixes = new ArrayList<ProjectFix>();
private List<ProjectFix> unsatisfiedFixes;
private String perspectiveId;
@@ -41,6 +45,7 @@
private String importTypeDescription;
private ArchetypeModel archetypeModel = new ArchetypeModel();
private File file;
+ private IProjectExampleSite site;
public Project() {
name=""; //$NON-NLS-1$
@@ -78,7 +83,35 @@
}
public String getUrl() {
- return url;
+ if (url == null) {
+ return url;
+ }
+ url = url.trim();
+ for (String prefix:PREFIXES) {
+ if (url.startsWith(prefix)) {
+ return url;
+ }
+ }
+ if (site == null) {
+ return url;
+ }
+ URL siteURL = site.getUrl();
+ if (siteURL == null) {
+ return url;
+ }
+ String urlString = siteURL.toString();
+ if (urlString.endsWith(SEP)) {
+ urlString = urlString.substring(0, urlString.length() - 1);
+ } else {
+ int index = urlString.lastIndexOf(SEP);
+ if (index > 0) {
+ urlString = urlString.substring(0, index);
+ }
+ }
+ if (url.startsWith(SEP)) {
+ return urlString + url;
+ }
+ return urlString + SEP + url;
}
public void setUrl(String url) {
@@ -148,7 +181,7 @@
this.welcomeURL = welcomeURL;
}
- public String getSite() {
+ public IProjectExampleSite getSite() {
/*if (site == null) {
if (getUrl().startsWith("http://anonsvn.jboss.org")) { //$NON-NLS-1$
site = Messages.Project_JBoss_Tools_Team_from_jboss_org;
@@ -161,7 +194,7 @@
return site;
}
- public void setSite(String site) {
+ public void setSite(IProjectExampleSite site) {
this.site = site;
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleSite.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleSite.java 2011-10-04 10:53:42 UTC (rev 35319)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleSite.java 2011-10-04 11:47:23 UTC (rev 35320)
@@ -11,34 +11,42 @@
public ProjectExampleSite() {
}
+ @Override
public URL getUrl() {
return url;
}
+ @Override
public void setUrl(URL url) {
this.url = url;
}
+ @Override
public String getName() {
return name;
}
+ @Override
public void setName(String name) {
this.name = name;
}
+ @Override
public boolean isExperimental() {
return experimental;
}
+ @Override
public void setExperimental(boolean experimental) {
this.experimental = experimental;
}
+ @Override
public boolean isEditable() {
return editable;
}
+ @Override
public void setEditable(boolean editable) {
this.editable = editable;
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectModelElement.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectModelElement.java 2011-10-04 10:53:42 UTC (rev 35319)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectModelElement.java 2011-10-04 11:47:23 UTC (rev 35320)
@@ -19,5 +19,6 @@
public String getName();
public String getDescription();
public String getShortDescription();
- public String getSite();
+ public IProjectExampleSite getSite();
+ public void setSite(IProjectExampleSite site);
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2011-10-04 10:53:42 UTC (rev 35319)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2011-10-04 11:47:23 UTC (rev 35320)
@@ -245,6 +245,7 @@
for (int i = 0; i < len; i++) {
Node node = projects.item(i);
Project project = new Project();
+ project.setSite(site);
Category category = other;
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) node;
@@ -271,6 +272,7 @@
}
if (!found) {
category = new Category(value);
+ category.setSite(site);
list.add(category);
}
project.setCategory(category);
@@ -278,9 +280,6 @@
if (nodeName.equals(NAME)) {
project.setName(getContent(child));
}
- if (nodeName.equals("site")) { //$NON-NLS-1$
- project.setSite(getContent(child));
- }
if (nodeName.equals("shortDescription")) { //$NON-NLS-1$
project
.setShortDescription(getContent(child));
@@ -344,13 +343,6 @@
}
}
}
- if (project.getSite() == null) {
- String siteName = site.getName();
- if (siteName == null) {
- siteName = Messages.Project_Unknown;
- }
- project.setSite(siteName);
- }
category.getProjects().add(project);
}
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/SiteCategory.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/SiteCategory.java 2011-10-04 10:53:42 UTC (rev 35319)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/SiteCategory.java 2011-10-04 11:47:23 UTC (rev 35320)
@@ -10,6 +10,7 @@
************************************************************************************/
package org.jboss.tools.project.examples.model;
+import java.net.URL;
import java.util.Set;
/**
@@ -37,4 +38,28 @@
public void setSites(Set<ProjectExampleSite> sites) {
this.sites = sites;
}
+
+ public void setEditable(boolean editable) {
+ }
+
+ public boolean isEditable() {
+ return false;
+ }
+
+ public void setExperimental(boolean experimental) {
+ }
+
+ public boolean isExperimental() {
+ return false;
+ }
+
+ public void setName(String name) {
+ }
+
+ public void setUrl(URL url) {
+ }
+
+ public URL getUrl() {
+ return null;
+ }
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java 2011-10-04 10:53:42 UTC (rev 35319)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java 2011-10-04 11:47:23 UTC (rev 35320)
@@ -179,7 +179,7 @@
Object object = treeSelection.getFirstElement();
if (object instanceof ProjectExampleSite) {
selectedSite = (ProjectExampleSite) object;
- boolean editable = ((ProjectExampleSite) object).isEditable();
+ boolean editable = ((IProjectExampleSite) object).isEditable();
editButton.setEnabled(editable);
removeButton.setEnabled(editable);
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/SiteDialog.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/SiteDialog.java 2011-10-04 10:53:42 UTC (rev 35319)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/SiteDialog.java 2011-10-04 11:47:23 UTC (rev 35320)
@@ -35,6 +35,7 @@
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.project.examples.Messages;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
+import org.jboss.tools.project.examples.model.IProjectExampleSite;
import org.jboss.tools.project.examples.model.ProjectExampleSite;
/**
@@ -175,7 +176,7 @@
return updateButton(false);
}
Set<ProjectExampleSite> siteList = sites.getSites();
- for(ProjectExampleSite site:siteList) {
+ for(IProjectExampleSite site:siteList) {
if (site != selectedSite && nameText.getText().equals(site.getName())) {
setErrorMessage(Messages.SiteDialog_The_site_already_exists);
return updateButton(false);
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/Sites.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/Sites.java 2011-10-04 10:53:42 UTC (rev 35319)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/Sites.java 2011-10-04 11:47:23 UTC (rev 35320)
@@ -14,6 +14,7 @@
import java.util.Set;
import org.jboss.tools.project.examples.Messages;
+import org.jboss.tools.project.examples.model.IProjectExampleSite;
import org.jboss.tools.project.examples.model.ProjectExampleSite;
import org.jboss.tools.project.examples.model.ProjectUtil;
import org.jboss.tools.project.examples.model.SiteCategory;
@@ -46,7 +47,7 @@
return siteCategories;
}
- public void remove(ProjectExampleSite site) {
+ public void remove(IProjectExampleSite site) {
userSite.getSites().remove(site);
sites.remove(site);
}
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2011-10-04 10:53:42 UTC (rev 35319)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2011-10-04 11:47:23 UTC (rev 35320)
@@ -441,7 +441,8 @@
for (Category category:categories) {
List<Project> projects = category.getProjects();
for (Project project:projects) {
- sites.add(project.getSite());
+ String name = project.getSite() == null ? ProjectExamplesActivator.ALL_SITES : project.getSite().getName();
+ sites.add(name);
}
}
String[] items = sites.toArray(new String[0]);
13 years, 3 months
JBoss Tools SVN: r35319 - in trunk/forge/plugins/org.jboss.tools.forge.runtime: bin and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-10-04 06:53:42 -0400 (Tue, 04 Oct 2011)
New Revision: 35319
Added:
trunk/forge/plugins/org.jboss.tools.forge.runtime/bin/
trunk/forge/plugins/org.jboss.tools.forge.runtime/bin/forge
trunk/forge/plugins/org.jboss.tools.forge.runtime/bin/forge.bat
Log:
add the forge startup scripts to svn
Added: trunk/forge/plugins/org.jboss.tools.forge.runtime/bin/forge
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime/bin/forge (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime/bin/forge 2011-10-04 10:53:42 UTC (rev 35319)
@@ -0,0 +1,163 @@
+#!/bin/sh
+
+# ----------------------------------------------------------------------------
+# Licensed under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+
+# ----------------------------------------------------------------------
+# Forge Startup script
+#
+# Required Environment vars:
+# ------------------
+# JAVA_HOME - location of a JRE home directory
+#
+# Optional Environment Variables
+# ------------------
+# FORGE_HOME - location of Forge's installed home dir
+# FORGE_OPTS - parameters passed to the Java VM when running Forge
+# -----------------------------------------------------------------------
+
+QUOTED_ARGS=""
+while [ "$1" != "" ] ; do
+
+ QUOTED_ARGS="$QUOTED_ARGS \"$1\""
+ shift
+
+done
+
+if [ -f /etc/forgerc ] ; then
+ . /etc/forgerc
+fi
+
+if [ -f "$HOME/.forgerc" ] ; then
+ . "$HOME/.forgerc"
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ if [ -z "$JAVA_VERSION" ] ; then
+ JAVA_VERSION="CurrentJDK"
+ fi
+ if [ -z "$JAVA_HOME" ] ; then
+ JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$FORGE_HOME" ] ; then
+ ## resolve links - $0 may be a link to Forge's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ FORGE_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ FORGE_HOME=`cd "$FORGE_HOME" && pwd`
+
+ cd "$saveddir"
+ echo Using Forge at $FORGE_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$FORGE_HOME" ] &&
+ FORGE_HOME=`cygpath --unix "$FORGE_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Migwn, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$FORGE_HOME" ] &&
+ FORGE_HOME="`(cd "$FORGE_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+ # TODO classpath?
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`which java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly."
+ echo " We cannot execute $JAVACMD"
+ exit 1
+fi
+
+JAVAVER=`$JAVACMD -version 2>&1`
+case $JAVAVER in
+*1.[6-9]*) ;;
+*1.[1-5]*)
+ echo " Error: a Java 1.6 or higher JRE is required to run Forge; found [$JAVACMD -version == $JAVAVER]."
+ exit 1
+ ;;
+esac
+
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+FORGE_MAIN_CLASS=org.jboss.forge.shell.Bootstrap
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$FORGE_HOME" ] &&
+ FORGE_HOME=`cygpath --path --windows "$FORGE_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$HOME" ] &&
+ HOME=`cygpath --path --windows "$HOME"`
+fi
+
+forge_exec_cmd="\"$JAVACMD\" $FORGE_OPTS \"-Dforge.home=${FORGE_HOME}\" \"-Dforge.shell.colorEnabled=true\" -jar \"${FORGE_HOME}/jboss-modules.jar\" -modulepath \"${FORGE_HOME}/modules:${HOME}/.forge/plugins\" org.jboss.forge"
+
+eval $forge_exec_cmd "$QUOTED_ARGS"
Property changes on: trunk/forge/plugins/org.jboss.tools.forge.runtime/bin/forge
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/forge/plugins/org.jboss.tools.forge.runtime/bin/forge.bat
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime/bin/forge.bat (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime/bin/forge.bat 2011-10-04 10:53:42 UTC (rev 35319)
@@ -0,0 +1,173 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Forge Startup script
+@REM
+@REM Required Environment vars:
+@REM ------------------
+@REM JAVA_HOME - location of a JRE home dir
+@REM
+@REM Optional Environment vars
+@REM ------------------
+@REM FORGE_HOME - location of Forge's installed home dir
+@REM FORGE_OPTS - parameters passed to the Java VM when running Forge
+@REM ----------------------------------------------------------------------------
+
+@echo off
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if exist "%HOME%\forgerc_pre.bat" call "%HOME%\forgerc_pre.bat"
+
+set ERROR_CODE=0
+
+@REM set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" @setlocal
+if "%OS%"=="WINNT" @setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo ERROR: JAVA_HOME not found in your environment.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto chkFHome
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory.
+echo JAVA_HOME = "%JAVA_HOME%"
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation
+echo.
+goto error
+
+:chkFHome
+if not "%FORGE_HOME%"=="" goto valFHome
+
+if "%OS%"=="Windows_NT" SET "FORGE_HOME=%~dp0.."
+if "%OS%"=="WINNT" SET "FORGE_HOME=%~dp0.."
+if not "%FORGE_HOME%"=="" goto valFHome
+
+echo.
+echo ERROR: FORGE_HOME not found in your environment.
+echo Please set the FORGE_HOME variable in your environment to match the
+echo location of the Forge installation
+echo.
+goto error
+
+:valFHome
+
+:stripFHome
+if not "_%FORGE_HOME:~-1%"=="_\" goto checkFBat
+set "FORGE_HOME=%FORGE_HOME:~0,-1%"
+goto stripFHome
+
+:checkFBat
+if exist "%FORGE_HOME%\bin\forge.bat" goto init
+
+echo.
+echo ERROR: FORGE_HOME is set to an invalid directory.
+echo FORGE_HOME = "%FORGE_HOME%"
+echo Please set the FORGE_HOME variable in your environment to match the
+echo location of the Forge installation
+echo.
+goto error
+@REM ==== END VALIDATION ====
+
+:init
+@REM Decide how to startup depending on the version of windows
+
+@REM -- Windows NT with Novell Login
+if "%OS%"=="WINNT" goto WinNTNovell
+
+@REM -- Win98ME
+if NOT "%OS%"=="Windows_NT" goto Win9xArg
+
+:WinNTNovell
+
+@REM -- 4NT shell
+if "%@eval[2+2]" == "4" goto 4NTArgs
+
+@REM -- Regular WinNT shell
+set FORGE_CMD_LINE_ARGS=%*
+goto endInit
+
+@REM The 4NT Shell from jp software
+:4NTArgs
+set FORGE_CMD_LINE_ARGS=%$
+goto endInit
+
+:Win9xArg
+@REM Slurp the command line arguments. This loop allows for an unlimited number
+@REM of agruments (up to the command line limit, anyway).
+set FORGE_CMD_LINE_ARGS=
+:Win9xApp
+if %1a==a goto endInit
+set FORGE_CMD_LINE_ARGS=%FORGE_CMD_LINE_ARGS% %1
+shift
+goto Win9xApp
+
+@REM Reaching here means variables are defined and arguments have been captured
+:endInit
+SET FORGE_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+
+@REM -- 4NT shell
+if "%@eval[2+2]" == "4" goto 4NTCWJars
+
+set JBOSS_MODULES="%FORGE_HOME%\jboss-modules.jar"
+goto runForge
+
+@REM Start Forge
+:runForge
+set FORGE_MAIN_CLASS=org.jboss.forge.shell.Bootstrap
+%FORGE_JAVA_EXE% %FORGE_OPTS% "-Dforge.home=%FORGE_HOME%" -Dforge.shell.colorEnabled=true -jar %JBOSS_MODULES% -modulepath "%FORGE_HOME%\modules;%HOME%\.forge\plugins" org.jboss.forge %FORGE_CMD_LINE_ARGS%
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+if "%OS%"=="Windows_NT" @endlocal
+if "%OS%"=="WINNT" @endlocal
+set ERROR_CODE=1
+
+:end
+@REM set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" goto endNT
+if "%OS%"=="WINNT" goto endNT
+
+@REM For old DOS remove the set variables from ENV - we assume they were not set
+@REM before we started - at least we don't leave any baggage around
+set FORGE_JAVA_EXE=
+set FORGE_CMD_LINE_ARGS=
+goto postExec
+
+:endNT
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+:postExec
+if exist "%HOME%\forgerc_post.bat" call "%HOME%\forgerc_post.bat"
+
+if "%FORGE_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%
+
+
13 years, 3 months
JBoss Tools SVN: r35318 - in branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console: ext and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-10-04 06:05:08 -0400 (Tue, 04 Oct 2011)
New Revision: 35318
Removed:
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeDelegatingDriver.java
Modified:
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtensionDefinition.java
Log:
Move FakeDelegatingDriver to the plugins with Libraries. This make it loaded by correct plugin and DriverManager is happy
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2011-10-04 10:05:01 UTC (rev 35317)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2011-10-04 10:05:08 UTC (rev 35318)
@@ -53,6 +53,7 @@
import org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.resolver.DialectFactory;
+import org.hibernate.eclipse.libs.FakeDelegatingDriver;
import org.hibernate.util.ConfigHelper;
import org.hibernate.util.ReflectHelper;
import org.hibernate.util.StringHelper;
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2011-10-04 10:05:01 UTC (rev 35317)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2011-10-04 10:05:08 UTC (rev 35318)
@@ -49,6 +49,7 @@
import org.hibernate.console.ext.HibernateExtensionDefinition;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.console.preferences.PreferencesClassPathUtils;
+import org.hibernate.eclipse.libs.FakeDelegatingDriver;
import org.hibernate.tool.hbm2x.StringUtils;
public class ConsoleConfiguration implements ExecutionContextHolder {
Deleted: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeDelegatingDriver.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeDelegatingDriver.java 2011-10-04 10:05:01 UTC (rev 35317)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/FakeDelegatingDriver.java 2011-10-04 10:05:08 UTC (rev 35318)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.hibernate.console;
-
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.DriverPropertyInfo;
-import java.sql.SQLException;
-import java.util.Properties;
-
-public class FakeDelegatingDriver implements Driver {
- private Driver driver;
-
- public FakeDelegatingDriver(Driver d) {
- this.driver = d;
- }
- public boolean acceptsURL(String u) throws SQLException {
- return this.driver.acceptsURL(u);
- }
- public Connection connect(String u, Properties p) throws SQLException {
- return this.driver.connect(u, p);
- }
- public int getMajorVersion() {
- return this.driver.getMajorVersion();
- }
- public int getMinorVersion() {
- return this.driver.getMinorVersion();
- }
- public DriverPropertyInfo[] getPropertyInfo(String u, Properties p)
- throws SQLException {
- return this.driver.getPropertyInfo(u, p);
- }
- public boolean jdbcCompliant() {
- return this.driver.jdbcCompliant();
- }
-}
\ No newline at end of file
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtensionDefinition.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtensionDefinition.java 2011-10-04 10:05:01 UTC (rev 35317)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/ext/HibernateExtensionDefinition.java 2011-10-04 10:05:08 UTC (rev 35318)
@@ -12,9 +12,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.osgi.util.NLS;
-import org.hibernate.console.HibernateConsoleRuntimeException;
-import org.hibernate.util.ReflectHelper;
/**
* @author Dmitry Geraskov
13 years, 3 months
JBoss Tools SVN: r35317 - in branches/dead/hibernatetools-multiversion2/plugins: org.hibernate.eclipse.libs/src/org/hibernate/console and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-10-04 06:05:01 -0400 (Tue, 04 Oct 2011)
New Revision: 35317
Added:
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.libs/src/org/hibernate/console/
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.libs/src/org/hibernate/console/libs/
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.libs/src/org/hibernate/eclipse/libs/FakeDelegatingDriver.java
Modified:
branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java
Log:
Move FakeDelegatingDriver to the plugins with Libraries. This make it loaded by correct plugin and DriverManager is happy
Added: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.libs/src/org/hibernate/eclipse/libs/FakeDelegatingDriver.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.libs/src/org/hibernate/eclipse/libs/FakeDelegatingDriver.java (rev 0)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.libs/src/org/hibernate/eclipse/libs/FakeDelegatingDriver.java 2011-10-04 10:05:01 UTC (rev 35317)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.hibernate.eclipse.libs;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.util.Properties;
+
+public class FakeDelegatingDriver implements Driver {
+ private Driver driver;
+
+ public FakeDelegatingDriver(Driver d) {
+ this.driver = d;
+ }
+ public boolean acceptsURL(String u) throws SQLException {
+ return this.driver.acceptsURL(u);
+ }
+ public Connection connect(String u, Properties p) throws SQLException {
+ return this.driver.connect(u, p);
+ }
+ public int getMajorVersion() {
+ return this.driver.getMajorVersion();
+ }
+ public int getMinorVersion() {
+ return this.driver.getMinorVersion();
+ }
+ public DriverPropertyInfo[] getPropertyInfo(String u, Properties p)
+ throws SQLException {
+ return this.driver.getPropertyInfo(u, p);
+ }
+ public boolean jdbcCompliant() {
+ return this.driver.jdbcCompliant();
+ }
+}
\ No newline at end of file
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java 2011-10-04 09:34:36 UTC (rev 35316)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HibernateExtension3_5.java 2011-10-04 10:05:01 UTC (rev 35317)
@@ -19,7 +19,6 @@
import org.hibernate.console.ConsoleConfigClassLoader;
import org.hibernate.console.ConsoleMessages;
import org.hibernate.console.ConsoleQueryParameter;
-import org.hibernate.console.FakeDelegatingDriver;
import org.hibernate.console.QueryInputModel;
import org.hibernate.console.execution.DefaultExecutionContext;
import org.hibernate.console.execution.ExecutionContext;
@@ -30,6 +29,7 @@
import org.hibernate.console.ext.QueryResultImpl;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.console.preferences.PreferencesClassPathUtils;
+import org.hibernate.eclipse.libs.FakeDelegatingDriver;
import org.hibernate.type.Type;
public class HibernateExtension3_5 implements HibernateExtension {
13 years, 3 months
JBoss Tools SVN: r35316 - in trunk/as/features: org.jboss.ide.eclipse.as.jmx.integration.feature and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-10-04 05:34:36 -0400 (Tue, 04 Oct 2011)
New Revision: 35316
Modified:
trunk/as/features/org.jboss.ide.eclipse.as.archives.integration.feature/feature.xml
trunk/as/features/org.jboss.ide.eclipse.as.jmx.integration.feature/feature.xml
trunk/as/features/org.jboss.ide.eclipse.as.server.rse.integration.feature/feature.xml
Log:
JBIDE-8460 - branding shown in screenshot has been fixed
Modified: trunk/as/features/org.jboss.ide.eclipse.as.archives.integration.feature/feature.xml
===================================================================
--- trunk/as/features/org.jboss.ide.eclipse.as.archives.integration.feature/feature.xml 2011-10-04 09:05:29 UTC (rev 35315)
+++ trunk/as/features/org.jboss.ide.eclipse.as.archives.integration.feature/feature.xml 2011-10-04 09:34:36 UTC (rev 35316)
@@ -2,7 +2,9 @@
<feature
id="org.jboss.ide.eclipse.as.archives.integration.feature"
label="%featureName"
- version="2.3.0.qualifier">
+ version="2.3.0.qualifier"
+ provider-name="%providerName"
+ plugin="org.jboss.ide.eclipse.as.ui">
<description url="http://www.jboss.org/tools">
%description
Modified: trunk/as/features/org.jboss.ide.eclipse.as.jmx.integration.feature/feature.xml
===================================================================
--- trunk/as/features/org.jboss.ide.eclipse.as.jmx.integration.feature/feature.xml 2011-10-04 09:05:29 UTC (rev 35315)
+++ trunk/as/features/org.jboss.ide.eclipse.as.jmx.integration.feature/feature.xml 2011-10-04 09:34:36 UTC (rev 35316)
@@ -2,7 +2,9 @@
<feature
id="org.jboss.ide.eclipse.as.jmx.integration.feature"
label="%featureName"
- version="2.3.0.qualifier">
+ version="2.3.0.qualifier"
+ provider-name="%providerName"
+ plugin="org.jboss.ide.eclipse.as.ui">
<description url="http://www.jboss.org/tools">
%description
Modified: trunk/as/features/org.jboss.ide.eclipse.as.server.rse.integration.feature/feature.xml
===================================================================
--- trunk/as/features/org.jboss.ide.eclipse.as.server.rse.integration.feature/feature.xml 2011-10-04 09:05:29 UTC (rev 35315)
+++ trunk/as/features/org.jboss.ide.eclipse.as.server.rse.integration.feature/feature.xml 2011-10-04 09:34:36 UTC (rev 35316)
@@ -2,7 +2,9 @@
<feature
id="org.jboss.ide.eclipse.as.server.rse.integration.feature"
label="%featureName"
- version="2.3.0.qualifier">
+ version="2.3.0.qualifier"
+ provider-name="%providerName"
+ plugin="org.jboss.ide.eclipse.as.ui">
<description url="http://www.jboss.org/tools">
%description
13 years, 3 months
JBoss Tools SVN: r35315 - trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-04 05:05:29 -0400 (Tue, 04 Oct 2011)
New Revision: 35315
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ISkipableWizardPage.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java
Log:
[JBIDE-9793] now skipping domain page if domain is already present
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java 2011-10-04 08:56:48 UTC (rev 35314)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java 2011-10-04 09:05:29 UTC (rev 35315)
@@ -12,12 +12,14 @@
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.IPageChangedListener;
+import org.eclipse.jface.dialogs.PageChangedEvent;
import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftImages;
import org.jboss.tools.common.ui.databinding.ParametrizableWizardPageSupport;
@@ -27,8 +29,10 @@
public abstract class AbstractOpenshiftWizardPage extends WizardPage {
protected ServerAdapterWizardModel model;
+ private DataBindingContext dbc;
- protected AbstractOpenshiftWizardPage(String title, String description, String pageName, IWizard wizard, ServerAdapterWizardModel model) {
+ protected AbstractOpenshiftWizardPage(String title, String description, String pageName, IWizard wizard,
+ ServerAdapterWizardModel model) {
super(pageName);
this.model = model;
setWizard(wizard);
@@ -39,23 +43,44 @@
@Override
public void createControl(Composite parent) {
- final DataBindingContext dbc = new DataBindingContext();
+ this.dbc = new DataBindingContext();
ParametrizableWizardPageSupport.create(
IStatus.ERROR | IStatus.INFO | IStatus.WARNING | IStatus.CANCEL, this,
dbc);
Composite container = new Composite(parent, SWT.NONE);
setControl(container);
- container.addListener(SWT.Show, new Listener() {
- @Override
- public void handleEvent(Event event) {
- onPageVisible(dbc);
- }
- });
+ initPageChangedListener();
+
+ // container.addListener(SWT.Show, new Listener() {
+ // @Override
+ // public void handleEvent(Event event) {
+ // onPageVisible(dbc);
+ // }
+ // });
doCreateControls(container, dbc);
}
-
- protected void onPageVisible(DataBindingContext dbc) {
+
+ protected void initPageChangedListener() {
+ IWizardContainer wizardContainer = getContainer();
+ if (wizardContainer instanceof WizardDialog) {
+ ((WizardDialog) getContainer()).addPageChangedListener(new IPageChangedListener() {
+
+ @Override
+ public void pageChanged(PageChangedEvent event) {
+ if (event.getSelectedPage() == AbstractOpenshiftWizardPage.this) {
+ onPageActivated(dbc);
+ }
+ }
+ });
+ }
}
+ protected DataBindingContext getDatabindingContext() {
+ return dbc;
+ }
+
+ protected void onPageActivated(DataBindingContext dbc) {
+ }
+
protected abstract void doCreateControls(Composite parent, DataBindingContext dbc);
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java 2011-10-04 09:05:29 UTC (rev 35315)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.ide.eclipse.as.openshift.ui.internal.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;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java 2011-10-04 08:56:48 UTC (rev 35314)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java 2011-10-04 09:05:29 UTC (rev 35315)
@@ -69,7 +69,7 @@
}
@Override
- protected void onPageVisible(DataBindingContext dbc) {
+ protected void onPageActivated(DataBindingContext dbc) {
try {
WizardUtils.runInWizard(new LoadApplicationsJob(), getWizard().getContainer(), dbc);
} catch (Exception ex) {
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ISkipableWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ISkipableWizardPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ISkipableWizardPage.java 2011-10-04 09:05:29 UTC (rev 35315)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * 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.ide.eclipse.as.openshift.ui.internal.wizard;
+
+/**
+ * @author André Dietisheim
+ */
+public interface ISkipableWizardPage {
+
+ public boolean isSkip();
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ISkipableWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java 2011-10-04 08:56:48 UTC (rev 35314)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java 2011-10-04 09:05:29 UTC (rev 35315)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.ui.internal.wizard;
-
import java.io.File;
import org.eclipse.core.databinding.DataBindingContext;
@@ -24,8 +23,6 @@
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -38,7 +35,6 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
-import org.jboss.ide.eclipse.as.openshift.core.NotFoundOpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
import org.jboss.tools.common.ui.BrowserUtil;
@@ -48,7 +44,7 @@
/**
* @author André Dietisheim
*/
-public class NewDomainWizardPage extends AbstractOpenshiftWizardPage {
+public class NewDomainWizardPage extends AbstractOpenshiftWizardPage implements ISkipableWizardPage {
private static final String OPENSHIFT_EXPRESS_SIGNUP_URL = "https://openshift.redhat.com/app/user/new/express"; //$NON-NLS-1$
@@ -70,14 +66,16 @@
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", ServerAdapterWizardModel.PROPERTY_NAMESPACE, model, dbc);
+ DataBindingUtils.bindMandatoryTextField(namespaceText, "Domain name",
+ ServerAdapterWizardModel.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", ServerAdapterWizardModel.PROPERTY_SSHKEY, model, dbc);
+ DataBindingUtils.bindMandatoryTextField(sshKeyText, "SSH Key", ServerAdapterWizardModel.PROPERTY_SSHKEY, model,
+ dbc);
Button browseSShKeyButton = new Button(container, SWT.PUSH);
browseSShKeyButton.setText("Browse");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseSShKeyButton);
@@ -88,7 +86,8 @@
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);
+ GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).span(2, 1).indent(0, 10).hint(160, 34)
+ .applyTo(createButton);
createButton.addSelectionListener(onCreate(dbc));
DataBindingUtils.bindButtonEnablementToValidationStatus(createButton, dbc);
}
@@ -101,16 +100,17 @@
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
FileDialog dialog = new FileDialog(shell);
dialog.setFilterPath(getSshKeysDirectory());
- dialog.setFilterNames(new String[]{FILTERNAME_PUBLIC_SSH_KEY});
- dialog.setFilterExtensions(new String[]{FILTEREXPRESSION_PUBLIC_SSH_KEY});
+ dialog.setFilterNames(new String[] { FILTERNAME_PUBLIC_SSH_KEY });
+ dialog.setFilterExtensions(new String[] { FILTEREXPRESSION_PUBLIC_SSH_KEY });
String sshKeyPath = dialog.open();
- if (sshKeyPath != null){
+ if (sshKeyPath != null) {
model.setSshKey(sshKeyPath);
- };
+ }
+ ;
}
};
}
-
+
private String getSshKeysDirectory() {
String userHome = System.getProperty("user.home");
File sshKeysDirectory = new File(userHome, DIRECTORY_SSH_KEYS);
@@ -132,7 +132,8 @@
model.createDomain();
} catch (OpenshiftException e) {
return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, NLS.bind(
- "Could not create a new domain with the name \"{0}\"", model.getNamespace()), e);
+ "Could not create a new domain with the name \"{0}\"",
+ model.getNamespace()), e);
}
return Status.OK_STATUS;
}
@@ -165,28 +166,26 @@
}
@Override
- protected void onPageVisible(DataBindingContext dbc) {
+ public boolean isSkip() {
+ final boolean[] isSkip = new boolean[] { false };
try {
WizardUtils.runInWizard(
- new Job("Loading domain name") {
+ new Job("Checking presence of domain") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- model.loadDomain();
- IWizardPage page = getNextPage();
- ((WizardDialog) getWizard().getContainer()).showPage(page);
- } catch(NotFoundOpenshiftException e) {
- // valid user without domain
+ isSkip[0] = model.hasDomain();
} catch (OpenshiftException e) {
return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
- "Could not get domain name", e);
+ "Could not get domain", e);
}
return Status.OK_STATUS;
}
- }, getWizard().getContainer(), dbc);
+ }, getWizard().getContainer(), getDatabindingContext());
} catch (Exception ex) {
// ignore
}
+ return isSkip[0];
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java 2011-10-04 08:56:48 UTC (rev 35314)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java 2011-10-04 09:05:29 UTC (rev 35315)
@@ -11,14 +11,12 @@
package org.jboss.ide.eclipse.as.openshift.ui.internal.wizard;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
/**
* @author André Dietisheim
*/
-public class ServerAdapterWizard extends Wizard implements INewWizard {
+public class ServerAdapterWizard extends AbstractSkippingWizard {
public ServerAdapterWizard() {
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java 2011-10-04 08:56:48 UTC (rev 35314)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java 2011-10-04 09:05:29 UTC (rev 35315)
@@ -161,17 +161,19 @@
return null;
}
- public void renameDomain() throws OpenshiftException {
- IDomain domain = getUser().getDomain();
- domain.setNamespace(namespace);
- }
-
public void setNamespace(String namespace) throws OpenshiftException {
firePropertyChange(PROPERTY_NAMESPACE, this.namespace, this.namespace = namespace);
}
+ public boolean hasDomain() throws OpenshiftException {
+ return getUser().hasDomain();
+ }
+
public void loadDomain() throws OpenshiftException {
- this.domain = getUser().getDomain();
- setNamespace(domain.getNamespace());
+ IDomain domain = getUser().getDomain();
+ if (domain != null) {
+ this.domain = domain;
+ setNamespace(domain.getNamespace());
+ }
}
}
13 years, 3 months
JBoss Tools SVN: r35314 - in trunk/deltacloud/tests/org.jboss.tools.deltacloud.test: META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-04 04:56:48 -0400 (Tue, 04 Oct 2011)
New Revision: 35314
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/plugin.properties
Removed:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/ui/preferences/
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/META-INF/MANIFEST.MF
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudTestSuite.java
Log:
[JBIDE-9805] corrected errors in org.jboss.tools.deltacloud.test
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/META-INF/MANIFEST.MF 2011-10-04 07:25:11 UTC (rev 35313)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/META-INF/MANIFEST.MF 2011-10-04 08:56:48 UTC (rev 35314)
@@ -12,3 +12,4 @@
org.junit;bundle-version="[4.8.0,5.0.0)",
org.junit.source;bundle-version="4.8.2"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.jboss.tools.common.ui.preferencevalue
Added: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/plugin.properties
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/plugin.properties (rev 0)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/plugin.properties 2011-10-04 08:56:48 UTC (rev 35314)
@@ -0,0 +1,3 @@
+#Properties file for org.jboss.tools.common.model.ui.test
+Bundle-Vendor.0=JBoss by Red Hat
+Bundle-Name.0=Deltacloud Test Plug-in
\ No newline at end of file
Property changes on: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/plugin.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudTestSuite.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudTestSuite.java 2011-10-04 07:25:11 UTC (rev 35313)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudTestSuite.java 2011-10-04 08:56:48 UTC (rev 35314)
@@ -11,6 +11,7 @@
package org.jboss.tools.internal.deltacloud.test;
import org.jboss.tools.internal.deltacloud.test.core.job.CloudSchedulingRulesTest;
+import org.jboss.tools.internal.deltacloud.test.ui.utils.URIUtilsTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -19,6 +20,7 @@
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
- CloudSchedulingRulesTest.class})
+ CloudSchedulingRulesTest.class,
+ URIUtilsTest.class})
public class DeltaCloudTestSuite {
}
13 years, 3 months
JBoss Tools SVN: r35313 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-10-04 03:25:11 -0400 (Tue, 04 Oct 2011)
New Revision: 35313
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java
Log:
JBIDE-9802 - patch from alexey
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java 2011-10-04 06:33:27 UTC (rev 35312)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java 2011-10-04 07:25:11 UTC (rev 35313)
@@ -16,10 +16,12 @@
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.debug.DebugOptionsListener;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
@@ -67,8 +69,16 @@
UnitedServerListenerManager.getDefault();
UnitedServerListenerManager.getDefault().addListener(XPathModel.getDefault());
UnitedServerListenerManager.getDefault().addListener(ServerListener.getDefault());
- FacetedProjectFramework.addListener( JBoss4xEarFacetInstallListener.getDefault(), IFacetedProjectEvent.Type.POST_INSTALL);
-
+ // It's unsafe to use FacetedProjectFramework in start method in the same thread. If may cause a deadlock. See https://issues.jboss.org/browse/JBIDE-9802
+ Job job = new Job("Adding JBoss4xEarFacetInstallListener") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ FacetedProjectFramework.addListener(JBoss4xEarFacetInstallListener.getDefault(), IFacetedProjectEvent.Type.POST_INSTALL);
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+
// register the debug options listener
final Hashtable<String, String> props = new Hashtable<String, String>(4);
props.put(DebugOptions.LISTENER_SYMBOLICNAME, PLUGIN_ID);
13 years, 3 months
JBoss Tools SVN: r35312 - in trunk/as: tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2 and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-10-04 02:33:27 -0400 (Tue, 04 Oct 2011)
New Revision: 35312
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/StandaloneUtilProjectPublish.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java
Log:
JBIDE-9714 - unit test and slight fix for previous fix in JBIDE-9703
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java 2011-10-04 06:09:58 UTC (rev 35311)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java 2011-10-04 06:33:27 UTC (rev 35312)
@@ -142,7 +142,7 @@
tree2[i] = moduleTree[i];
}
if( tree2.length == 0 )
- return new Path("/"); //$NON-NLS-1$
+ return new Path(publishMethod.getPublishDefaultRootFolder(server.getServer()));
return PublishUtil.getDeployPath(publishMethod, tree2, server);
}
@@ -237,7 +237,7 @@
list.addAll(Arrays.asList(PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile)));
// TODO !!!!! Transfer it
- IPath deployPathInner = getParentDeployPath(moduleTree, server).removeLastSegments(1);
+ IPath deployPathInner = getParentDeployPath(moduleTree, server);
IPublishCopyCallbackHandler handler = getCallbackHandler(getRootPath(deployPathInner).append(deployPathInner));
IPath filePath = deployPath.removeFirstSegments(deployPathInner.segments().length);
IPath parentFolderPath = filePath.removeLastSegments(1);
Added: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/StandaloneUtilProjectPublish.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/StandaloneUtilProjectPublish.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/StandaloneUtilProjectPublish.java 2011-10-04 06:33:27 UTC (rev 35312)
@@ -0,0 +1,64 @@
+package org.jboss.ide.eclipse.as.test.publishing.v2;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.test.ASTest;
+import org.jboss.ide.eclipse.as.test.util.ServerRuntimeUtils;
+import org.jboss.ide.eclipse.as.test.util.wtp.OperationTestCase;
+import org.jboss.ide.eclipse.as.test.util.wtp.ProjectCreationUtil;
+import org.jboss.ide.eclipse.as.test.util.wtp.ProjectUtility;
+
+public class StandaloneUtilProjectPublish extends
+ TestCase {
+ public void setUp() throws Exception {
+ }
+ public void tearDown() throws Exception {
+ ServerRuntimeUtils.deleteAllServers();
+ ServerRuntimeUtils.deleteAllRuntimes();
+ ProjectUtility.deleteAllProjects();
+ ASTest.clearStateLocation();
+ }
+
+ private IServer server;
+ private IProject utilProject;
+ public void testZippedPublish() throws CoreException, IOException, Exception {
+ server = ServerRuntimeUtils.createMockDeployOnlyServer();
+ server = ServerRuntimeUtils.useMockPublishMethod(server);
+ MockPublishMethod.reset();
+
+
+ IDataModel dm = ProjectCreationUtil.getUtilityProjectCreationDataModel("Util", null);
+ OperationTestCase.runAndVerify(dm);
+ utilProject = ResourcesPlugin.getWorkspace().getRoot().getProject("Util");
+ assertTrue(utilProject.exists());
+
+ IModule mod = ServerUtil.getModule(utilProject);
+ server = ServerRuntimeUtils.addModule(server, mod);
+ IStatus s = ServerRuntimeUtils.publish(server);
+ assertTrue(s.isOK());
+ }
+
+ private void setZipFlag() throws IOException, CoreException {
+ IServerWorkingCopy wc = server.createWorkingCopy();
+ ServerAttributeHelper helper = new ServerAttributeHelper(server, wc);
+ helper.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, true);
+ server = wc.save(true, new NullProgressMonitor());
+ }
+
+
+
+}
13 years, 3 months