Author: adietish
Date: 2011-09-30 19:05:57 -0400 (Fri, 30 Sep 2011)
New Revision: 35248
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/error.png
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/ok.png
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-dark-icon.png
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-dark.png
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-white-icon.png
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-white.png
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/warning.png
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/OpenshiftImages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/OpenshiftUIActivator.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/common/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/common/ImageRepository.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/
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/ServerAdapterWizard.java
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/ServerWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/TrimTrailingSlashConverter.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/OpenshiftUIActivator.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/build.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/plugin.xml
Log:
[JBIDE-9793] implemented ServerConnectionWizardPage, started
ApplicationSelectionWizardPage
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/META-INF/MANIFEST.MF 2011-09-30
23:04:48 UTC (rev 35247)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/META-INF/MANIFEST.MF 2011-09-30
23:05:57 UTC (rev 35248)
@@ -3,8 +3,17 @@
Bundle-Name: Openshift UI
Bundle-SymbolicName: org.jboss.ide.eclipse.as.openshift.ui;singleton:=true
Bundle-Version: 2.3.0.qualifier
-Bundle-Activator: org.jboss.ide.eclipse.as.openshift.ui.OpenshiftUIActivator
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime
+Bundle-Activator: org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator
+Require-Bundle:
org.jboss.ide.eclipse.as.openshift.core;bundle-version="[2.3.0,3.0.0)",
+ org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.databinding;bundle-version="1.4.0",
+ org.eclipse.core.databinding.beans;bundle-version="1.2.100",
+ org.eclipse.core.databinding.observable;bundle-version="1.4.0",
+ org.eclipse.core.databinding.property;bundle-version="1.4.0",
+ org.eclipse.jface.databinding;bundle-version="1.5.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.jboss.tools.common.databinding,
+ org.jboss.tools.common.ui,
+ org.jboss.tools.common.ui.databinding
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/build.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/build.properties 2011-09-30
23:04:48 UTC (rev 35247)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/build.properties 2011-09-30
23:05:57 UTC (rev 35248)
@@ -1,4 +1,11 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ plugin.xml
+src.includes = .classpath,\
+ .project,\
+ META-INF/,\
+ build.properties,\
+ plugin.xml,\
+ pom.xml
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/error.png
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/error.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/ok.png
===================================================================
(Binary files differ)
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/ok.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-dark-icon.png
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-dark-icon.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-dark.png
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-dark.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-white-icon.png
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-white-icon.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-white.png
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/openshift-logo-white.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/warning.png
===================================================================
(Binary files differ)
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/icons/warning.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/plugin.xml 2011-09-30 23:04:48
UTC (rev 35247)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/plugin.xml 2011-09-30 23:05:57
UTC (rev 35248)
@@ -1,4 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.category"
+ name="Openshift Express">
+ </category>
+ <wizard
+
category="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.category"
+
class="org.jboss.ide.eclipse.as.openshift.ui.internal.wizard.ServerAdapterWizard"
+ icon="icons/openshift-logo-white-icon.png"
+
id="org.jboss.ide.eclipse.as.openshift.express.ui.wizard.NewServerAdapter"
+ name="New Server Adapter">
+ </wizard>
+ </extension>
</plugin>
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/OpenshiftUIActivator.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/OpenshiftUIActivator.java 2011-09-30
23:04:48 UTC (rev 35247)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/OpenshiftUIActivator.java 2011-09-30
23:05:57 UTC (rev 35248)
@@ -1,50 +0,0 @@
-package org.jboss.ide.eclipse.as.openshift.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class OpenshiftUIActivator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID =
"org.jboss.ide.eclipse.as.openshift.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static OpenshiftUIActivator plugin;
-
- /**
- * The constructor
- */
- public OpenshiftUIActivator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static OpenshiftUIActivator getDefault() {
- return plugin;
- }
-
-}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/OpenshiftImages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/OpenshiftImages.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/OpenshiftImages.java 2011-09-30
23:05:57 UTC (rev 35248)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.ide.eclipse.as.openshift.ui.internal;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.ide.eclipse.as.openshift.ui.internal.common.ImageRepository;
+
+public class OpenshiftImages {
+
+ private static final String ICONS_FOLDER = "icons/";
+
+ private static final ImageRepository repo =
+ new ImageRepository(ICONS_FOLDER, OpenshiftUIActivator.getDefault(),
OpenshiftUIActivator.getDefault().getImageRegistry());
+
+ public static final ImageDescriptor OPENSHIFT_LOGO_DARK =
repo.create("openshift-logo-dark.png"); //$NON-NLS-1$
+ public static final ImageDescriptor OPENSHIFT_LOGO_WHITE =
repo.create("openshift-logo-white.png"); //$NON-NLS-1$
+
+ public static final ImageDescriptor OK = repo.create("ok.png"); //$NON-NLS-1$
+ public static final ImageDescriptor ERROR = repo.create("error.png");
//$NON-NLS-1$
+ public static final ImageDescriptor WARNING = repo.create("warning.png");
//$NON-NLS-1$
+
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/OpenshiftImages.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/OpenshiftUIActivator.java
(from rev 35151,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/OpenshiftUIActivator.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/OpenshiftUIActivator.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/OpenshiftUIActivator.java 2011-09-30
23:05:57 UTC (rev 35248)
@@ -0,0 +1,60 @@
+package org.jboss.ide.eclipse.as.openshift.ui.internal;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class OpenshiftUIActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID =
"org.jboss.ide.eclipse.as.openshift.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static OpenshiftUIActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public OpenshiftUIActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static OpenshiftUIActivator getDefault() {
+ return plugin;
+ }
+
+ public static void log(IStatus status) {
+ plugin.getLog().log(status);
+ }
+
+ public static void log(Throwable e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/OpenshiftUIActivator.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/common/ImageRepository.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/common/ImageRepository.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/common/ImageRepository.java 2011-09-30
23:05:57 UTC (rev 35248)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.ide.eclipse.as.openshift.ui.internal.common;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
+
+public class ImageRepository {
+
+ private ImageRegistry imageRegistry;
+ private URL baseUrl;
+ private Plugin plugin;
+ private String imageFolder;
+
+ public ImageRepository(String imageFolder, Plugin plugin, ImageRegistry imageRegistry)
{
+ this.imageFolder = imageFolder;
+ this.plugin = plugin;
+ this.imageRegistry = imageRegistry;
+ }
+
+ protected URL getBaseUrl() {
+ try {
+ if (baseUrl == null) {
+ this.baseUrl = new URL(plugin.getBundle().getEntry("/"), imageFolder);
+ }
+ return baseUrl;
+ } catch (MalformedURLException e) {
+ OpenshiftUIActivator.log(e);
+ return null;
+ }
+ }
+
+ public ImageDescriptor create(String name) {
+ return create(imageRegistry, name);
+ }
+
+ private ImageDescriptor create(ImageRegistry registry,String name) {
+ return create(registry, name, getBaseUrl());
+ }
+
+ private ImageDescriptor create(ImageRegistry registry, String name, URL baseUrl) {
+ if (baseUrl == null) {
+ return null;
+ }
+
+ ImageDescriptor imageDescriptor =
+ ImageDescriptor.createFromURL(createFileURL(name, baseUrl));
+ registry.put(name, imageDescriptor);
+ return imageDescriptor;
+ }
+
+ private URL createFileURL(String name, URL baseUrl) {
+ try {
+ return new URL(baseUrl, name);
+ } catch (MalformedURLException e) {
+ plugin.getLog().log(
+ new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), NLS.bind(
+ "Could not create URL for image {0}", name), e));
+ return null;
+ }
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/common/ImageRepository.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/AbstractOpenshiftWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java 2011-09-30
23:05:57 UTC (rev 35248)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.DataBindingContext;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftImages;
+import org.jboss.tools.common.ui.databinding.ParametrizableWizardPageSupport;
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractOpenshiftWizardPage extends WizardPage {
+
+ protected ServerAdapterWizardModel model;
+
+ protected AbstractOpenshiftWizardPage(String title, String description, String pageName,
IWizard wizard, ServerAdapterWizardModel model) {
+ super(pageName);
+ this.model = model;
+ setWizard(wizard);
+ setTitle(title);
+ setDescription(description);
+ setImageDescriptor(OpenshiftImages.OPENSHIFT_LOGO_WHITE);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ DataBindingContext dbc = new DataBindingContext();
+ ParametrizableWizardPageSupport.create(
+ IStatus.ERROR | IStatus.INFO | IStatus.WARNING | IStatus.CANCEL, this,
+ dbc);
+ Composite container = new Composite(parent, SWT.NONE);
+ setControl(container);
+ doCreateControls(container, dbc);
+ }
+
+ protected abstract void doCreateControls(Composite parent, DataBindingContext dbc);
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.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/ApplicationWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java 2011-09-30
23:05:57 UTC (rev 35248)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.DataBindingContext;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationWizardPage extends AbstractOpenshiftWizardPage {
+
+ protected ApplicationWizardPage(IWizard wizard, ServerAdapterWizardModel model) {
+ super("Application selection", "Please select an Openshift Express
application to use", "Application selection", wizard, model);
+ }
+
+ @Override
+ protected void doCreateControls(Composite container, DataBindingContext dbc) {
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(10, 10).applyTo(container);
+
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.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/ServerAdapterWizard.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java 2011-09-30
23:05:57 UTC (rev 35248)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.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 ServerAdapterWizard() {
+ }
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ setWindowTitle("Create new Openshift Express Server Adapter");
+ setNeedsProgressMonitor(true);
+ }
+
+ @Override
+ public boolean performFinish() {
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ ServerAdapterWizardModel model = new ServerAdapterWizardModel();
+ addPage(new ServerWizardPage(this, model));
+ addPage(new ApplicationWizardPage(this, model));
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.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/ServerAdapterWizardModel.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java 2011-09-30
23:05:57 UTC (rev 35248)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.User;
+import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+
+/**
+ * @author André Dietisheim
+ */
+public class ServerAdapterWizardModel extends ObservableUIPojo {
+
+ 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_CREDENTIALSVALIDITY =
"credentialsValidity";
+
+ private String serverUrl;
+ private String rhLogin;
+ private String password;
+ private IStatus credentialsValidity;
+
+ public ServerAdapterWizardModel() {
+ this.serverUrl = IOpenshiftService.BASE_URL;
+ }
+
+ 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) {
+ firePropertyChange(PROPERTY_RHLOGIN, this.rhLogin, this.rhLogin = rhLogin);
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ firePropertyChange(PROPERTY_PASSWORD, this.password, this.password = password);
+ }
+
+ private void setCredentialsStatus(IStatus status) {
+ firePropertyChange(PROPERTY_CREDENTIALSVALIDITY, 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 {
+ IUser user = new User(getRhLogin(), getPassword());
+ if(user.isValid()) {
+ status = Status.OK_STATUS;
+ }
+ } catch (OpenshiftException e) {
+ // do nothing
+ }
+ setCredentialsStatus(status);
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.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/ServerWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java 2011-09-30
23:05:57 UTC (rev 35248)
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * 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.AggregateValidationStatus;
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.ValidationStatusProvider;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.observable.IObservableCollection;
+import org.eclipse.core.databinding.observable.list.WritableList;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.MandatoryStringValidator;
+import org.jboss.tools.common.ui.databinding.Status2BooleanConverter;
+
+/**
+ * @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 = 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 = 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);
+ bindValidateButtonEnablement(validateButton, dbc, toObservableCollection(rhLoginBining,
passwordBinding));
+ validateButton.addSelectionListener(onValidate(dbc));
+ dbc.bindValue(
+ new WritableValue(null, IStatus.class),
+ BeanProperties.value(ServerAdapterWizardModel.PROPERTY_CREDENTIALSVALIDITY).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 Binding bindMandatoryTextField(Text text, String fieldName, String
modelProperty,
+ ServerAdapterWizardModel model,
+ DataBindingContext dbc) {
+ Binding binding = dbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observe(text),
+ BeanProperties.value(modelProperty).observe(model),
+ new UpdateValueStrategy().setAfterGetValidator(
+ new MandatoryStringValidator(NLS.bind("You have to provide a value for the
{0}.", fieldName))),
+ null);
+ ControlDecorationSupport.create(binding, SWT.LEFT | SWT.TOP);
+ return binding;
+ }
+
+ private void bindValidateButtonEnablement(final Button testButton, DataBindingContext
dbc,
+ IObservableCollection validationStatusProviders) {
+ dbc.bindValue(
+ WidgetProperties.enabled().observe(testButton),
+ new AggregateValidationStatus(validationStatusProviders,
AggregateValidationStatus.MAX_SEVERITY),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy().setConverter(new Status2BooleanConverter(IStatus.ERROR)));
+ }
+
+ protected IObservableCollection toObservableCollection(ValidationStatusProvider...
validationStatusProviders) {
+ WritableList validationProviders = new WritableList();
+ for (ValidationStatusProvider provider : validationStatusProviders) {
+ validationProviders.add(provider);
+ }
+ return validationProviders;
+ }
+
+ 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/ServerWizardPage.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/TrimTrailingSlashConverter.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/TrimTrailingSlashConverter.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/TrimTrailingSlashConverter.java 2011-09-30
23:05:57 UTC (rev 35248)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.conversion.Converter;
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * @author André Dietisheim
+ */
+public class TrimTrailingSlashConverter extends Converter {
+
+ public TrimTrailingSlashConverter() {
+ super(String.class, String.class);
+ }
+
+ @Override
+ public Object convert(Object fromObject) {
+ Assert.isLegal(fromObject instanceof String);
+ String url = (String) fromObject;
+ if (url.charAt(url.length() - 1) == '/') {
+ return url.substring(0, url.length() - 1);
+ }
+ return url;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/TrimTrailingSlashConverter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain