Author: rob.stryker(a)jboss.com
Date: 2012-01-26 04:05:38 -0500 (Thu, 26 Jan 2012)
New Revision: 38194
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/WizardUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressMessages.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServer.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/expressMessages.properties
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftApplicationWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
Log:
JBIDE-10716 - impl for the wizrd fragment
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/WizardUtils.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/WizardUtils.java 2012-01-26
00:56:22 UTC (rev 38193)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/WizardUtils.java 2012-01-26
09:05:38 UTC (rev 38194)
@@ -80,6 +80,16 @@
public static Future<IStatus> runInWizard(final Job job, final
DelegatingProgressMonitor delegatingMonitor,
IWizardContainer container) throws InvocationTargetException, InterruptedException {
JobResultFuture future = new JobResultFuture(job);
+ // Currently this impl is wrong and does not return the future immediately. Not sure
how to fix
+ runInWizardSynchronous(job, delegatingMonitor, container);
+ return future;
+ }
+
+ /**
+ * @since 3.3
+ */
+ public static void runInWizardSynchronous(final Job job, final DelegatingProgressMonitor
delegatingMonitor,
+ IWizardContainer container) throws InvocationTargetException, InterruptedException {
container.run(true, false, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
@@ -100,7 +110,6 @@
}
}
});
- return future;
}
/**
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-01-26
00:56:22 UTC (rev 38193)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-01-26
09:05:38 UTC (rev 38194)
@@ -262,5 +262,13 @@
order="10"
typeIds="org.jboss.tools.openshift.express.openshift.server.type">
</section>
+ </extension>
+ <extension
+ point="org.eclipse.wst.server.ui.wizardFragments">
+ <fragment
+
class="org.jboss.tools.openshift.express.internal.ui.behaviour.ExpressWizardFragment"
+ id="org.jboss.tools.openshift.express.ui.server.fragment"
+
typeIds="org.jboss.tools.openshift.express.openshift.server.type">
+ </fragment>
</extension>
</plugin>
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressMessages.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressMessages.java 2012-01-26
00:56:22 UTC (rev 38193)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressMessages.java 2012-01-26
09:05:38 UTC (rev 38194)
@@ -16,5 +16,6 @@
public static String cannotModifyModules;
public static String shareProjectTitle;
public static String shareProjectMessage;
+ public static String additionNotRequiredModule;
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServer.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServer.java 2012-01-26
00:56:22 UTC (rev 38193)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServer.java 2012-01-26
09:05:38 UTC (rev 38194)
@@ -16,9 +16,10 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.model.IURLProvider;
import org.eclipse.wst.server.core.model.ServerDelegate;
-import org.eclipse.wst.server.core.model.IURLProvider;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
@@ -40,10 +41,20 @@
if( mods.length == 1 && add.length == 1 && add[0].equals(mods[0]))
return Status.OK_STATUS;
+
boolean canModify = mods.length == 0 && add.length == 1;
canModify &= remove.length == 0;
- return canModify ? Status.OK_STATUS : new Status(IStatus.ERROR,
- OpenShiftUIActivator.PLUGIN_ID, ExpressMessages.cannotModifyModules);
+
+ if(!canModify )
+ return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
ExpressMessages.cannotModifyModules);
+
+ // Make sure if there's a requried mod, the one being added matches it
+ String requiredMod = getAttribute(ExpressServerUtils.ATTRIBUTE_APPLICATION_NAME,
(String)null);
+ if( requiredMod != null && !requiredMod.equals(add[0].getName())) {
+ return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
+ NLS.bind(ExpressMessages.additionNotRequiredModule, requiredMod));
+ }
+ return Status.OK_STATUS;
}
public IModule[] getRootModules(IModule module) throws CoreException {
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-01-26
00:56:22 UTC (rev 38193)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-01-26
09:05:38 UTC (rev 38194)
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.jboss.tools.openshift.express.internal.core.behaviour;
-import static org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants.SERVER_PASSWORD;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.wst.server.core.IRuntime;
@@ -27,6 +25,10 @@
import org.jboss.ide.eclipse.as.core.util.ServerCreationUtils;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
+import com.openshift.express.client.IApplication;
+import com.openshift.express.client.IUser;
+import com.openshift.express.client.OpenShiftException;
+
/**
* This class holds the attribute names whose values will be
* stored inside a server object, as well as the utility methods
@@ -36,8 +38,8 @@
*/
public class ExpressServerUtils {
public static final String ATTRIBUTE_EXPRESS_MODE =
"org.jboss.tools.openshift.express.internal.core.behaviour.ExpressMode";
- public static final String EXPRESS_BINARY_MODE =
"org.jboss.tools.openshift.express.internal.core.behaviour.ExpressBinaryMode";
- public static final String EXPRESS_SOURCE_MODE =
"org.jboss.tools.openshift.express.internal.core.behaviour.ExpressSourceMode";
+ public static final String EXPRESS_BINARY_MODE = "publishBinary";
+ public static final String EXPRESS_SOURCE_MODE = "publishSource";
public static final String ATTRIBUTE_APPLICATION_NAME =
"org.jboss.tools.openshift.express.internal.core.behaviour.ApplicationName";
public static final String ATTRIBUTE_APPLICATION_ID =
"org.jboss.tools.openshift.express.internal.core.behaviour.ApplicationId";
public static final String ATTRIBUTE_DOMAIN =
"org.jboss.tools.openshift.express.internal.core.behaviour.Domain";
@@ -176,7 +178,22 @@
IServer server = createServer(runtime, IJBossToolingConstants.SERVER_AS_70);
return fillServerWithOpenShiftDetails(server, host, username, password, domain,
appName, appId, sourceOrBinary, remoteName);
}
+
+ public static IServer fillServerWithOpenShiftDetails(IServer server, IApplication
application,
+ IUser user, String mode, String remoteName) throws CoreException, OpenShiftException
{
+ return fillServerWithOpenShiftDetails(server, application.getApplicationUrl(),
+ user.getRhlogin(), user.getPassword(), user.getDomain().getNamespace(),
+ application.getName(), application.getUUID(), mode, remoteName);
+ }
+
+ public static void fillServerWithOpenShiftDetails(IServerWorkingCopy wc, IApplication
application,
+ IUser user, String mode, String remoteName) throws CoreException, OpenShiftException
{
+ fillServerWithOpenShiftDetails(wc, application.getApplicationUrl(),
+ user.getRhlogin(), user.getDomain().getNamespace(),
+ application.getName(), application.getUUID(), mode, remoteName);
+ }
+
/**
* Fills an already-created server with the proper openshift details.
*
@@ -194,11 +211,21 @@
public static IServer fillServerWithOpenShiftDetails(IServer server, String host,
String username, String password, String domain, String appName, String appId,
String mode, String remoteName) throws CoreException {
+ ServerWorkingCopy wc = (ServerWorkingCopy)server.createWorkingCopy();
+ fillServerWithOpenShiftDetails(wc, host, username, domain, appName, appId, mode,
remoteName);
+ IServer saved = wc.save(true, new NullProgressMonitor());
+ ExpressServerUtils.setExpressPassword(wc, password);
+ return saved;
+ }
+
+ public static void fillServerWithOpenShiftDetails(IServerWorkingCopy wc, String host,
+ String username, String domain, String appName, String appId,
+ String mode, String remoteName) throws CoreException {
+
if( host.indexOf("://") != -1)
host = host.substring(host.indexOf("://") + 3);
if( host.endsWith("/"))
host = host.substring(0, host.length()-1);
- ServerWorkingCopy wc = (ServerWorkingCopy)server.createWorkingCopy();
wc.setHost(host);
wc.setAttribute(IDeployableServer.SERVER_MODE, "openshift");
wc.setAttribute(ATTRIBUTE_USERNAME, username);
@@ -207,13 +234,10 @@
wc.setAttribute(ATTRIBUTE_APPLICATION_ID, appId);
wc.setAttribute(ATTRIBUTE_EXPRESS_MODE, mode);
wc.setAttribute(ATTRIBUTE_REMOTE_NAME, remoteName);
- wc.setAutoPublishSetting(Server.AUTO_PUBLISH_DISABLE);
+ ((ServerWorkingCopy)wc).setAutoPublishSetting(Server.AUTO_PUBLISH_DISABLE);
wc.setAttribute(IJBossToolingConstants.IGNORE_LAUNCH_COMMANDS, "true");
wc.setAttribute(IJBossToolingConstants.WEB_PORT, 80);
wc.setAttribute(IJBossToolingConstants.WEB_PORT_DETECT, "false");
- IServer saved = wc.save(true, new NullProgressMonitor());
- ExpressServerUtils.setExpressPassword(wc, password);
- return saved;
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/expressMessages.properties
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/expressMessages.properties 2012-01-26
00:56:22 UTC (rev 38193)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/expressMessages.properties 2012-01-26
09:05:38 UTC (rev 38194)
@@ -3,5 +3,6 @@
requestPushTitle=Publish {0}?
requestPushMsg=The are no local changes in "{0}". Do you want to publish to
OpenShift by pushing its Git repository?
cannotModifyModules=Openshift Express servers cannot be modified.
+additionNotRequiredModule=This server requires the {0} application.
shareProjectTitle=Share projects?
shareProjectMessage="There are {0} projects that are not connected to any git
repository. Would you like to share them now?
\ No newline at end of file
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-01-26
00:56:22 UTC (rev 38193)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-01-26
09:05:38 UTC (rev 38194)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are 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 Incorporated - initial API and implementation
+ *******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.behaviour;
import org.eclipse.core.runtime.CoreException;
@@ -15,9 +25,7 @@
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.ui.editor.ServerEditorSection;
-import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.Messages;
import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyCommand;
import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java 2012-01-26
09:05:38 UTC (rev 38194)
@@ -0,0 +1,240 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are 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 Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.behaviour;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.TaskModel;
+import org.eclipse.wst.server.ui.wizard.IWizardHandle;
+import org.eclipse.wst.server.ui.wizard.WizardFragment;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
+import org.jboss.tools.openshift.express.internal.ui.wizard.CredentialsWizardPageModel;
+
+import com.openshift.express.client.IApplication;
+import com.openshift.express.client.IUser;
+import com.openshift.express.client.OpenShiftException;
+
+public class ExpressWizardFragment extends WizardFragment {
+ private IWizardHandle handle;
+ private IApplication fapplication;
+ private IUser fuser;
+ private String[] appListNames;
+ private String error;
+
+ private Button verifyButton;
+ public ExpressWizardFragment() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public boolean hasComposite() {
+ return true;
+ }
+
+ private String user, pass, app, remote;
+ private Text userText, passText, remoteText;
+ private Combo appNameCombo;
+ public Composite createComposite(Composite parent, IWizardHandle handle) {
+ this.handle = handle;
+ handle.setTitle("Create an Openshift Server");
+ handle.setDescription("Create an Openshift Server adapter by typing in your
credentials and choosing an application.");
+ Composite composite = createWidgets(parent);
+ addListeners();
+ setComplete(false);
+ handle.update();
+ return composite;
+ }
+
+ private Composite createWidgets(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(2, false));
+ Label userLabel = new Label(composite, SWT.NONE);
+ userText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).applyTo(userText);
+ Label passLabel = new Label(composite, SWT.NONE);
+ passText = new Text(composite, SWT.PASSWORD | SWT.BORDER);
+ GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).applyTo(passText);
+ Label appNameLabel = new Label(composite, SWT.NONE);
+ appNameCombo = new Combo(composite, SWT.SINGLE);
+ Label remoteLabel = new Label(composite, SWT.NONE);
+ remoteText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).applyTo(remoteText);
+ verifyButton = new Button(composite, SWT.PUSH);
+
+ // Text
+ userLabel.setText("Username: ");
+ passLabel.setText("Password: ");
+ appNameLabel.setText("Application Name: ");
+ remoteLabel.setText("Remote: ");
+ verifyButton.setText("Verify...");
+ return composite;
+ }
+
+ private void addListeners() {
+ // add listeners
+ ModifyListener l = new ModifyListener(){
+ public void modifyText(ModifyEvent e) {
+ widgetsUpdated();
+ }
+ };
+ userText.addModifyListener(l);
+ passText.addModifyListener(l);
+ appNameCombo.addModifyListener(l);
+ remoteText.addModifyListener(l);
+ appNameCombo.addSelectionListener(new SelectionListener(){
+ public void widgetSelected(SelectionEvent e) {
+ widgetsUpdated();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetsUpdated();
+ }
+ });
+ verifyButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ verifyPressed();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ verifyPressed();
+ }
+
+ });
+ }
+
+ public void enter() {
+ // do nothing
+ }
+
+ private void widgetsUpdated() {
+ this.user = userText.getText();
+ this.pass = passText.getText();
+ this.app = appNameCombo.getText();
+ this.remote = remoteText.getText();
+ this.verifyButton.setEnabled(true);
+ setComplete(false);
+ handle.update();
+ }
+
+ private void verifyPressed() {
+ final CredentialsWizardPageModel model = new CredentialsWizardPageModel(null);
+ this.fapplication = null;
+ this.fuser = null;
+ this.appListNames = null;
+ model.setPassword(pass);
+ model.setRhLogin(user);
+ verifyButton.setEnabled(false);
+ setComplete(false);
+ handle.update();
+ final Runnable runnable = getVerifyingCredentialsJob(model);
+ Job j = new Job("Verify Pressed") {
+ protected IStatus run(IProgressMonitor monitor) {
+ runnable.run();
+ return Status.OK_STATUS;
+ }
+ };
+ IWizardContainer container = ((WizardPage)handle).getWizard().getContainer();
+ try {
+ WizardUtils.runInWizardSynchronous(j, null, container);
+ postLongRunningValidate();
+ } catch(Exception e) {
+
+ }
+ }
+
+ private void postLongRunningValidate() {
+ if( appListNames == null ) {
+ appListNames = new String[0];
+ }
+ int index = Arrays.asList(appListNames).indexOf(app);
+ appNameCombo.setItems(appListNames);
+ if( index != -1 )
+ appNameCombo.select(index);
+ handle.setMessage(error, IMessageProvider.ERROR);
+ verifyButton.setEnabled(true);
+ setComplete(ExpressWizardFragment.this.fapplication != null );
+ handle.update();
+ }
+
+ private Runnable getVerifyingCredentialsJob(final CredentialsWizardPageModel model) {
+ return new Runnable() {
+ public void run() {
+ final IStatus s = model.validateCredentials();
+ String error = null;
+ String[] appNames = new String[]{};
+ if( !s.isOK() ) {
+ error = "Credentials Failed";
+ } else {
+ // now check the app name and cartridge
+ try {
+ final List<IApplication> allApps = model.getUser().getApplications();
+ appNames = getAppNamesAsStrings(allApps);
+ int index = Arrays.asList(appNames).indexOf(app);
+ IApplication application = index == -1 ? null : allApps.get(index);
+ appListNames = appNames;
+ if( application == null ) {
+ error = "Application " + app + " not found";
+ } else {
+ // Fill with new data
+ try {
+ ExpressWizardFragment.this.fapplication = application;
+ ExpressWizardFragment.this.fuser = model.getUser();
+
+ // update the values
+ IServerWorkingCopy wc =
(IServerWorkingCopy)getTaskModel().getObject(TaskModel.TASK_SERVER);
+ ExpressServerUtils.fillServerWithOpenShiftDetails(wc, application,
model.getUser(),
+ ExpressServerUtils.EXPRESS_SOURCE_MODE, remote);
+ } catch(CoreException ce) {
+ // TODO FIX HANDLE
+ }
+ }
+ } catch(OpenShiftException ose) {
+ error = "Application \"" + app + "\" not found: " +
ose.getMessage();
+ }
+ ExpressWizardFragment.this.error = error;
+ }
+ }
+ };
+ }
+
+ private String[] getAppNamesAsStrings(List<IApplication> allApps) {
+ String[] appNames = new String[allApps.size()];
+ for( int i = 0; i < allApps.size(); i++ ) {
+ appNames[i] = allApps.get(i).getName();
+ }
+ return appNames;
+ }
+
+ public void performFinish(IProgressMonitor monitor) throws CoreException {
+ // do nothing
+ }
+
+}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftApplicationWizardModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftApplicationWizardModel.java 2012-01-26
00:56:22 UTC (rev 38193)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftApplicationWizardModel.java 2012-01-26
09:05:38 UTC (rev 38194)
@@ -18,6 +18,7 @@
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.egit.core.EGitUtils;
import org.jboss.tools.openshift.egit.ui.util.EGitUIUtils;
+import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
import
org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ConfigureGitSharedProject;
import
org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ConfigureUnsharedProject;
import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportNewProject;
@@ -42,8 +43,8 @@
public static final String CREATE_SERVER_ADAPTER = "createServerAdapter";
public static final String PUBLICATION_MODE = "serverMode";
- public static final String PUBLISH_SOURCE = "publishSource";
- public static final String PUBLISH_BINARY = "publishBinary";
+ public static final String PUBLISH_SOURCE = ExpressServerUtils.EXPRESS_SOURCE_MODE;
+ public static final String PUBLISH_BINARY = ExpressServerUtils.EXPRESS_BINARY_MODE;
public static final String SERVER_TYPE = "serverType";
public static final String NEW_PROJECT_REMOTE_NAME_DEFAULT = "origin";
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-01-26
00:56:22 UTC (rev 38193)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-01-26
09:05:38 UTC (rev 38194)
@@ -145,7 +145,8 @@
} catch (Exception e) {
this.user = null;
}
- wizardModel.setUser(user);
+ if( wizardModel != null )
+ wizardModel.setUser(user);
setCredentialsStatus(status);
return status;
}