Author: adietish
Date: 2010-12-06 05:31:10 -0500 (Mon, 06 Dec 2010)
New Revision: 27185
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractCloudJob.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshInstancesHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java
Log:
[JBIDE-7688][JBIDE-7813] now getting images and instances in async manner by commands
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-06 10:23:19
UTC (rev 27184)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-06 10:31:10
UTC (rev 27185)
@@ -1,3 +1,11 @@
+2010-12-06 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java (validate):
+ * src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java
(asyncGetCloudElements):
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
(asyncGetCloudElements):
+ * src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java (getChildren):
+ * src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java (getChildren):
+
2010-12-03 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java (filter):
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2010-12-06
10:23:19 UTC (rev 27184)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2010-12-06
10:31:10 UTC (rev 27185)
@@ -6,19 +6,19 @@
Bundle-Activator: org.jboss.tools.deltacloud.ui.Activator
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
-Require-Bundle: org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
- org.eclipse.equinox.security;bundle-version="1.0.100",
+Require-Bundle: org.jboss.tools.common;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
+ org.eclipse.equinox.security;bundle-version="[1.0.100,2.0.0)",
org.eclipse.core.runtime;bundle-version="[3.6.0,4.0.0)",
org.eclipse.ui.views;bundle-version="[3.4.1,4.0.0)",
- org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.0",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="[3.5.0,4.0.0)",
org.jboss.tools.deltacloud.core;bundle-version="[0.0.1,1.0.0]",
org.eclipse.rse.core;bundle-version="[3.1.1,4.0.0)",
org.eclipse.jface.databinding;bundle-version="[1.4.0,2.0.0)",
org.eclipse.core.databinding;bundle-version="[1.3.100,2.0.0)",
org.eclipse.core.databinding.observable;bundle-version="[1.3.0,2.0.0)",
org.eclipse.core.databinding.property;bundle-version="[1.3.0,2.0.0)",
- org.eclipse.core.databinding.beans;bundle-version="1.2.100",
- org.jboss.tools.common;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.databinding.beans;bundle-version="[1.2.100,2.0.0)",
org.eclipse.core.expressions;bundle-version="[3.4.200,4.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -31,7 +31,6 @@
import org.eclipse.ui.PartInitException;
import org.jboss.tools.common.log.StatusFactory;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.commands.AbstractCloudJob;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
@@ -101,9 +100,9 @@
"Remote System Explorer could not connect: connection name is not
defined");
Assert.isLegal(service != null, "Remote System Explorer could not connect:
connector service not found.");
- Job job = new AbstractCloudJob(CVMessages.getFormattedString(RSE_CONNECTING_MSG,
connectionName)) {
+ Job job = new Job(CVMessages.getFormattedString(RSE_CONNECTING_MSG, connectionName)) {
@Override
- protected IStatus doRun(IProgressMonitor monitor) {
+ protected IStatus run(IProgressMonitor monitor) {
try {
monitor.worked(1);
service.connect(monitor);
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractCloudJob.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractCloudJob.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractCloudJob.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.deltacloud.ui.commands;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.Job;
-
-public abstract class AbstractCloudJob extends Job {
-
- public AbstractCloudJob(String name) {
- super(name);
-// setUser(true);
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(getName(), IProgressMonitor.UNKNOWN);
- monitor.worked(1);
- return doRun(monitor);
- }
-
- protected abstract IStatus doRun(IProgressMonitor monitor);
-
-}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -20,10 +20,10 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
-import org.jboss.tools.common.log.StatusFactory;
+import org.jboss.tools.deltacloud.core.AbstractCloudJob;
import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudMultiException;
-import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
@@ -53,17 +53,13 @@
new AbstractCloudJob("Refreshing images and instances on " +
cloud.getName()) {
@Override
- protected IStatus doRun(IProgressMonitor monitor) {
+ protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
try {
monitor.worked(1);
cloud.loadChildren();
monitor.done();
} catch (DeltaCloudMultiException e) {
return ErrorUtils.createMultiStatus(e);
- } catch (Exception e) {
- // TODO internationalize strings
- return StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID,
- "Could not load children of cloud " + cloud.getName(), e);
}
return Status.OK_STATUS;
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -20,10 +20,10 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
-import org.jboss.tools.common.log.StatusFactory;
+import org.jboss.tools.deltacloud.core.AbstractCloudJob;
import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
/**
@@ -50,16 +50,11 @@
new AbstractCloudJob("Refreshing images on cloud " + cloud.getName()) {
@Override
- protected IStatus doRun(IProgressMonitor monitor) {
- try {
+ protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
monitor.worked(1);
cloud.loadChildren();
monitor.done();
return Status.OK_STATUS;
-
- } catch (Exception e) {
- return StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID,
e.getMessage(), e);
- }
}
}.schedule();
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshInstancesHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshInstancesHandler.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshInstancesHandler.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -20,10 +20,10 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
-import org.jboss.tools.common.log.StatusFactory;
+import org.jboss.tools.deltacloud.core.AbstractCloudJob;
import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
/**
@@ -50,15 +50,11 @@
new AbstractCloudJob("Refreshing instances on cloud " + cloud.getName()) {
@Override
- protected IStatus doRun(IProgressMonitor monitor) {
- try {
- monitor.worked(1);
- cloud.loadChildren();
- monitor.done();
- return Status.OK_STATUS;
- } catch (Exception e) {
- return StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID,
e.getMessage(), e);
- }
+ protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
+ monitor.worked(1);
+ cloud.loadChildren();
+ monitor.done();
+ return Status.OK_STATUS;
}
}.setUser(true);
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -10,23 +10,15 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.ui.views;
-import java.text.MessageFormat;
-
import org.eclipse.core.runtime.Assert;
-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.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Display;
-import org.jboss.tools.common.log.StatusFactory;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.ICloudElementFilter;
import org.jboss.tools.deltacloud.core.IDeltaCloudElement;
-import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
/**
@@ -63,27 +55,7 @@
this.currentCloud = (DeltaCloud) newInput;
addListener(currentCloud);
// TODO internationalize strings
- final String workTitle = MessageFormat.format("Loading elements of cloud
\"{0}\"", currentCloud.getName());
- new Job(workTitle) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.beginTask(workTitle, IProgressMonitor.UNKNOWN);
- /*
- * trigger load of elements, data will get in through
- * notification (#listChanged)
- */
- getCloudElements(currentCloud);
- monitor.done();
- return Status.OK_STATUS;
- } catch (DeltaCloudException e) {
- return StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID,
- MessageFormat.format("Could not get elements of cloud
\"{0}\"", currentCloud.getName()), e);
- }
- }
-
- }.schedule();
+ asyncGetCloudElements(currentCloud);
}
public void listChanged(final DeltaCloud cloud, final CLOUDELEMENT[] cloudElements) {
@@ -134,7 +106,7 @@
if (filter == null) {
return cloudElements;
} else {
- return filter.filter(cloudElements).toArray();
+ return filter.filter().toArray();
}
}
@@ -149,5 +121,5 @@
protected abstract ICloudElementFilter<CLOUDELEMENT> getCloudFilter(DeltaCloud
cloud);
- protected abstract CLOUDELEMENT[] getCloudElements(DeltaCloud cloud) throws
DeltaCloudException;
+ protected abstract void asyncGetCloudElements(DeltaCloud cloud);
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -176,5 +176,9 @@
};
}
+ protected DeltaCloud getCloud() {
+ return (DeltaCloud) getElement();
+ }
+
protected abstract void dispose();
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -10,9 +10,13 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.ui.views;
+import java.text.MessageFormat;
+
import org.eclipse.jface.viewers.TreeViewer;
import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.GetImagesCommand;
import org.jboss.tools.deltacloud.core.IImageFilter;
import org.jboss.tools.deltacloud.core.IImageListListener;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
@@ -27,7 +31,7 @@
public CVImagesCategoryElement(Object element, TreeViewer viewer) {
super(element, viewer);
- DeltaCloud cloud = (DeltaCloud) getElement();
+ DeltaCloud cloud = getCloud();
cloud.addImageListListener(this);
}
@@ -38,20 +42,7 @@
@Override
public synchronized Object[] getChildren() {
if (!initialized) {
- DeltaCloud cloud = (DeltaCloud) getElement();
- try {
- cloud.removeImageListListener(this);
- DeltaCloudImage[] images = filter(cloud.getImages());
- addChildren(images);
- initialized = true;
- } catch (Exception e) {
- ErrorUtils.handleError(
- "Error",
- "Colud not get images from cloud " + cloud.getName(),
- e, getViewer().getControl().getShell());
- } finally {
- cloud.addImageListListener(this);
- }
+ new GetImagesCommand(getCloud()).execute();
}
return super.getChildren();
}
@@ -64,25 +55,37 @@
}
return elements;
}
-
+
@Override
public synchronized void listChanged(DeltaCloud cloud, DeltaCloudImage[] newImages) {
- clearChildren();
- initialized = false;
- DeltaCloudImage[] images = filter(newImages);
- addChildren(images);
- initialized = true;
+ try {
+ clearChildren();
+ initialized = false;
+ DeltaCloudImage[] images = filter();
+ addChildren(images);
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ MessageFormat.format("Could not get images from cloud \"{0}\"",
cloud.getName()), e,
+ getViewer().getControl().getShell());
+ } finally {
+ initialized = true;
+ }
// refresh();
}
- public DeltaCloudImage[] filter(DeltaCloudImage[] images) {
+ public DeltaCloudImage[] filter() throws DeltaCloudException {
DeltaCloud cloud = (DeltaCloud) getElement();
IImageFilter f = cloud.getImageFilter();
- return f.filter(images).toArray(new DeltaCloudImage[images.length]);
+ return f.filter().toArray(new DeltaCloudImage[] {});
}
+ @Override
protected void dispose() {
DeltaCloud cloud = (DeltaCloud) getElement();
- cloud.removeImageListListener(this);
+ if (cloud != null) {
+ cloud.removeImageListListener(this);
+ }
}
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -10,10 +10,13 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.ui.views;
+import java.text.MessageFormat;
+
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Display;
import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.GetInstancesCommand;
import org.jboss.tools.deltacloud.core.IInstanceFilter;
import org.jboss.tools.deltacloud.core.IInstanceListListener;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
@@ -35,26 +38,11 @@
public String getName() {
return CVMessages.getString(INSTANCE_CATEGORY_NAME);
}
-
@Override
public Object[] getChildren() {
if (!initialized) {
- DeltaCloud cloud = (DeltaCloud) getElement();
- try {
- cloud.removeInstanceListListener(this);
- DeltaCloudInstance[] instances = filter(cloud.getInstances());
- addChildren(instances);
- initialized = true;
- } catch (Exception e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- "Colud not get instances from cloud " + cloud.getName(),
- e, Display.getDefault().getActiveShell());
- } finally {
- cloud.addInstanceListListener(this);
- }
+ new GetInstancesCommand(getCloud()).execute();
}
return super.getChildren();
}
@@ -76,19 +64,27 @@
@Override
public void listChanged(DeltaCloud cloud, DeltaCloudInstance[] newInstances) {
- clearChildren();
- final DeltaCloudInstance[] instances = filter(newInstances);
- addChildren(instances);
- initialized = true;
-// refresh();
+ try {
+ clearChildren();
+ final DeltaCloudInstance[] instances = filter();
+ addChildren(instances);
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ MessageFormat.format("Could not get instanceso from cloud
\"{0}\"", cloud.getName()), e,
+ getViewer().getControl().getShell());
+ } finally {
+ initialized = true;
+ }
}
- public DeltaCloudInstance[] filter(DeltaCloudInstance[] instances) {
- DeltaCloud cloud = (DeltaCloud) getElement();
- IInstanceFilter f = cloud.getInstanceFilter();
- return f.filter(instances).toArray(new DeltaCloudInstance[instances.length]);
+ public DeltaCloudInstance[] filter() throws DeltaCloudException {
+ IInstanceFilter f = getCloud().getInstanceFilter();
+ return f.filter().toArray(new DeltaCloudInstance[] {});
}
+ @Override
protected void dispose() {
DeltaCloud cloud = (DeltaCloud) getElement();
if (cloud != null) {
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -16,8 +16,8 @@
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.GetImagesCommand;
import org.jboss.tools.deltacloud.core.ICloudElementFilter;
import org.jboss.tools.deltacloud.core.IImageListListener;
@@ -93,8 +93,8 @@
}
@Override
- protected DeltaCloudImage[] getCloudElements(DeltaCloud cloud) throws
DeltaCloudException {
- return cloud.getImages();
+ protected void asyncGetCloudElements(DeltaCloud cloud) {
+ new GetImagesCommand(cloud).execute();
}
@Override
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -18,8 +18,8 @@
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.GetInstancesCommand;
import org.jboss.tools.deltacloud.core.ICloudElementFilter;
import org.jboss.tools.deltacloud.core.IInstanceListListener;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
@@ -122,8 +122,8 @@
}
@Override
- protected DeltaCloudInstance[] getCloudElements(DeltaCloud cloud) throws
DeltaCloudException {
- return cloud.getInstances();
+ protected void asyncGetCloudElements(DeltaCloud cloud) {
+ new GetInstancesCommand(cloud).execute();
}
@Override
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -1,7 +1,5 @@
package org.jboss.tools.internal.deltacloud.ui.wizards;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -19,24 +17,23 @@
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.common.log.StatusFactory;
import org.jboss.tools.deltacloud.core.AllImageFilter;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.GetImagesCommand;
import org.jboss.tools.deltacloud.core.IImageFilter;
+import org.jboss.tools.deltacloud.core.IImageListListener;
import org.jboss.tools.deltacloud.core.ImageFilter;
-import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
import org.jboss.tools.deltacloud.ui.views.ImageViewLabelAndContentProvider;
import org.jboss.tools.deltacloud.ui.views.TableViewerColumnComparator;
-public class FindImagePage extends WizardPage {
+public class FindImagePage extends WizardPage implements IImageListListener {
private final static String NAME = "FindImage.name"; //$NON-NLS-1$
private final static String TITLE = "FindImage.title"; //$NON-NLS-1$
@@ -46,22 +43,22 @@
private final static String ARCH_LABEL = "Arch.label"; //$NON-NLS-1$
private final static String DESC_LABEL = "Desc.label"; //$NON-NLS-1$
private final static String INVALID_SEMICOLON = "ErrorFilterSemicolon.msg";
//$NON-NLS-1$
-
+
private DeltaCloud cloud;
private TableViewer viewer;
private Composite container;
private ImageViewLabelAndContentProvider contentProvider;
-
+
private Text nameText;
private Text idText;
private Text archText;
private Text descText;
-
+
private IImageFilter filter;
private DeltaCloudImage selectedElement;
private String oldRules;
-
+
private ModifyListener textListener = new ModifyListener() {
@Override
@@ -69,59 +66,60 @@
// TODO Auto-generated method stub
validate();
}
-
+
};
-
+
private class ColumnListener extends SelectionAdapter {
-
+
private int column;
private TableViewer viewer;
-
+
public ColumnListener(int column, TableViewer viewer) {
this.column = column;
this.viewer = viewer;
}
+
@Override
public void widgetSelected(SelectionEvent e) {
- TableViewerColumnComparator comparator =
(TableViewerColumnComparator)viewer.getComparator();
+ TableViewerColumnComparator comparator = (TableViewerColumnComparator)
viewer.getComparator();
Table t = viewer.getTable();
if (comparator.getColumn() == column) {
comparator.reverseDirection();
}
comparator.setColumn(column);
- TableColumn tc = (TableColumn)e.getSource();
+ TableColumn tc = (TableColumn) e.getSource();
t.setSortColumn(tc);
t.setSortDirection(SWT.NONE);
viewer.refresh();
}
-
+
};
public FindImagePage(DeltaCloud cloud) {
super(WizardMessages.getString(NAME));
this.cloud = cloud;
- filter = new AllImageFilter();
+ filter = new AllImageFilter(cloud);
setDescription(WizardMessages.getString(DESC));
setTitle(WizardMessages.getString(TITLE));
setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
setPageComplete(false);
}
-
+
public String getImageId() {
if (selectedElement != null)
return selectedElement.getId();
return "";
}
-
+
private void validate() {
boolean hasError = false;
boolean isComplete = true;
-
+
String name = nameText.getText();
String id = idText.getText();
String arch = archText.getText();
String desc = descText.getText();
-
+
if (name.contains(";") || //$NON-NLS-1$
id.contains(";") || //$NON-NLS-1$
arch.contains(";") || //$NON-NLS-1$
@@ -129,48 +127,27 @@
setErrorMessage(WizardMessages.getString(INVALID_SEMICOLON));
hasError = true;
}
-
+
if (selectedElement == null)
isComplete = false;
-
+
if (!hasError) {
setErrorMessage(null);
String newRules = name + "*;" //$NON-NLS-1$
- + id + "*;" //$NON-NLS-1$
- + arch + "*;" //$NON-NLS-1$
- + desc + "*"; //$NON-NLS-1$
-
+ + id + "*;" //$NON-NLS-1$
+ + arch + "*;" //$NON-NLS-1$
+ + desc + "*"; //$NON-NLS-1$
+
if (!newRules.equals(oldRules)) {
- filter = new ImageFilter();
+ filter = new ImageFilter(cloud);
filter.setRules(newRules);
oldRules = newRules;
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- try {
- contentProvider.setFilter(filter);
- viewer.setInput(cloud.getImages());
- viewer.refresh();
- } catch (Exception e) {
- IStatus status = StatusFactory.getInstance(
- IStatus.ERROR,
- Activator.PLUGIN_ID,
- e.getMessage(),
- e);
- // TODO: internationalize strings
- ErrorDialog.openError(viewer.getControl().getShell(),
- "Error",
- "Cloud not get images from cloud " + cloud.getName(), status);
- }
- }
-
- });
+ new GetImagesCommand(cloud).execute();
}
}
setPageComplete(isComplete && !hasError);
}
-
+
@Override
public void createControl(Composite parent) {
// TODO Auto-generated method stub
@@ -179,18 +156,17 @@
layout.marginHeight = 5;
layout.marginWidth = 5;
container.setLayout(layout);
-
Label nameLabel = new Label(container, SWT.NULL);
nameLabel.setText(WizardMessages.getString(NAME_LABEL));
-
+
nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
nameText.setText(filter.getNameRule().toString());
nameText.addModifyListener(textListener);
Label idLabel = new Label(container, SWT.NULL);
idLabel.setText(WizardMessages.getString(ID_LABEL));
-
+
idText = new Text(container, SWT.BORDER | SWT.SINGLE);
idText.setText(filter.getIdRule().toString());
idText.addModifyListener(textListener);
@@ -208,11 +184,11 @@
descText = new Text(container, SWT.BORDER | SWT.SINGLE);
descText.setText(filter.getDescRule().toString());
descText.addModifyListener(textListener);
-
+
Composite tableArea = new Composite(container, SWT.NULL);
TableColumnLayout tableLayout = new TableColumnLayout();
tableArea.setLayout(tableLayout);
-
+
viewer = new TableViewer(tableArea, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL |
SWT.BORDER);
Table table = viewer.getTable();
table.setHeaderVisible(true);
@@ -222,10 +198,10 @@
viewer.setLabelProvider(contentProvider);
TableViewerColumnComparator comparator = new TableViewerColumnComparator();
viewer.setComparator(comparator);
-
+
for (int i = 0; i < ImageViewLabelAndContentProvider.Column.getSize(); ++i) {
- ImageViewLabelAndContentProvider.Column c =
- ImageViewLabelAndContentProvider.Column.getColumn(i);
+ ImageViewLabelAndContentProvider.Column c =
+ ImageViewLabelAndContentProvider.Column.getColumn(i);
TableColumn tc = new TableColumn(table, SWT.NONE);
if (i == 0)
table.setSortColumn(tc);
@@ -234,21 +210,21 @@
tc.addSelectionListener(new ColumnListener(i, viewer));
}
table.setSortDirection(SWT.NONE);
-
+
Point p1 = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Point p2 = nameText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int centering = (p2.y - p1.y + 1) / 2;
FormData f = new FormData();
-// f.left = new FormAttachment(0, 5);
-// f.top = new FormAttachment(0, 5 + centering);
-// filterLabel.setLayoutData(f);
+ // f.left = new FormAttachment(0, 5);
+ // f.top = new FormAttachment(0, 5 + centering);
+ // filterLabel.setLayoutData(f);
f = new FormData();
f.left = new FormAttachment(0, 10);
f.top = new FormAttachment(0, 5 + centering);
nameLabel.setLayoutData(f);
-
+
f = new FormData();
f.left = new FormAttachment(nameLabel, 5);
f.top = new FormAttachment(0, 5);
@@ -287,7 +263,7 @@
f.top = new FormAttachment(0, 5);
f.right = new FormAttachment(100, -10);
descText.setLayoutData(f);
-
+
f = new FormData();
f.top = new FormAttachment(nameText, 13);
f.left = new FormAttachment(0, 0);
@@ -300,7 +276,7 @@
hookSelection();
validate();
}
-
+
private void hookSelection() {
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
@@ -312,8 +288,18 @@
private void handleSelection() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- selectedElement = (DeltaCloudImage)selection.getFirstElement();
+ selectedElement = (DeltaCloudImage) selection.getFirstElement();
validate();
}
+ @Override
+ public void listChanged(DeltaCloud cloud, final DeltaCloudImage[] images) {
+ viewer.getControl().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ viewer.setInput(images);
+ }});
+ }
+
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceModel.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -77,7 +77,7 @@
private String getArch(String imageId) throws DeltaCloudException {
String arch = "";
if (imageId != null && imageId.length() > 0) {
- DeltaCloudImage image = getImage(imageId, arch);
+ DeltaCloudImage image = cloud.getImage(imageId);
if (image != null) {
imageContainer.setImage(image);
arch = image.getArchitecture();
@@ -85,25 +85,6 @@
}
return arch;
}
-
- private DeltaCloudImage getImage(String imageId, String arch) throws
DeltaCloudException {
- DeltaCloudImage image = getFromcachedImage(imageId, cloud.getImages());
- if (image == null) {
- image = cloud.loadImage(imageId);
- }
- return image;
- }
-
- private DeltaCloudImage getFromcachedImage(String id, DeltaCloudImage[] images) {
- for (int i = 0; i < images.length; ++i) {
- DeltaCloudImage image = images[i];
- if (image.getId().equals(id)) {
- return image;
- }
- }
- return null;
- }
-
}
public static class ArchValidator implements IValidator {
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java 2010-12-06
10:23:19 UTC (rev 27184)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage2.java 2010-12-06
10:31:10 UTC (rev 27185)
@@ -106,16 +106,15 @@
private Label imageLabel, archLabel, nameLabel, realmLabel;
private Group groupContainer;
-
private ModifyListener comboListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
int index = hardware.getSelectionIndex();
String id = index > -1 ? hardware.getItem(hardware.getSelectionIndex()) : null;
- if( currPage != null )
+ if (currPage != null)
currPage.setVisible(false);
- if( id != null ) {
+ if (id != null) {
currPage = profilePages.get(id);
currPage.setVisible(true);
}
@@ -236,12 +235,12 @@
}
public void filterProfiles() {
- if( allProfiles == null )
+ if (allProfiles == null)
return;
-
+
ArrayList<DeltaCloudHardwareProfile> profiles = new
ArrayList<DeltaCloudHardwareProfile>();
for (DeltaCloudHardwareProfile p : allProfiles) {
- if (p.getArchitecture() == null ||
image.getArchitecture().equals(p.getArchitecture())) {
+ if (p.getArchitecture() == null || image == null ||
image.getArchitecture().equals(p.getArchitecture())) {
profiles.add(p);
}
}
@@ -260,8 +259,7 @@
hardware.addModifyListener(comboListener);
}
}
-
-
+
@Override
public void createControl(Composite parent) {
DataBindingContext dbc = new DataBindingContext();
@@ -271,21 +269,21 @@
launchFetchRealms();
launchFetchProfiles();
-
+
// We have to set the image id here instead of in the constructor
// of the model because the image id triggers other items to fill
// in their values such as the architecture and hardware profiles.
String defaultImage = cloud.getLastImageId();
model.setImageId(defaultImage);
setControl(container);
-
+
// lastly, if there's already an image set, use it
- if( image != null ) {
+ if (image != null) {
imageText.setText(image.getId());
filterProfiles();
}
}
-
+
private void bindWidgets(DataBindingContext dbc) {
bindText(dbc, nameText, NewInstanceModel.PROPERTY_NAME, MUST_ENTER_A_NAME);
dbc.bindValue(
@@ -310,7 +308,7 @@
model));
bindText(dbc, keyText, NewInstanceModel.PROPERTY_KEYNAME, MUST_ENTER_A_KEYNAME);
}
-
+
private Composite createWidgets(Composite parent) {
final Composite container = new Composite(parent, SWT.NULL);
FormLayout layout = new FormLayout();
@@ -333,9 +331,9 @@
nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
- //createRealmsControl(container, getRealmNames(realms));
+ // createRealmsControl(container, getRealmNames(realms));
createRealmsControl(container);
-
+
imageText = new Text(container, SWT.BORDER | SWT.SINGLE);
findImage = new Button(container, SWT.NULL);
@@ -349,7 +347,7 @@
hardware = new Combo(container, SWT.READ_ONLY);
hardware.setEnabled(false);
- hardware.setItems(new String[]{WizardMessages.getString(LOADING_VALUE)});
+ hardware.setItems(new String[] { WizardMessages.getString(LOADING_VALUE) });
hardware.select(0);
groupContainer = new Group(container, SWT.BORDER);
@@ -359,11 +357,11 @@
groupLayout.marginWidth = 0;
groupContainer.setLayout(groupLayout);
hardware.setEnabled(false);
-
+
// add invisible dummy widget to guarantee a min size
dummyLabel = new Label(groupContainer, SWT.NONE);
dummyLabel.setText("\n\n\n\n\n");
- FormData dummyData = UIUtils.createFormData(0,0,0,150,null,0,null,0);
+ FormData dummyData = UIUtils.createFormData(0, 0, 0, 150, null, 0, null, 0);
dummyLabel.setLayoutData(dummyData);
dummyLabel.setVisible(false);
@@ -379,16 +377,16 @@
int centering = (p2.y - p1.y + 1) / 2;
int centering2 = (p3.y - p2.y + 1) / 2;
- FormData f = UIUtils.createFormData(null,0,null,0,0,0,100,0);
+ FormData f = UIUtils.createFormData(null, 0, null, 0, 0, 0, 100, 0);
dummyLabel.setLayoutData(f);
- f = UIUtils.createFormData(dummyLabel, 8+centering, null, 0, 0,0,null,0);
+ f = UIUtils.createFormData(dummyLabel, 8 + centering, null, 0, 0, 0, null, 0);
nameLabel.setLayoutData(f);
f = UIUtils.createFormData(dummyLabel, 8, null, 0, hardwareLabel, 5, 100, 0);
nameText.setLayoutData(f);
- f = UIUtils.createFormData(nameText, 8+centering+centering2, null, 0, 0,0,null,0);
+ f = UIUtils.createFormData(nameText, 8 + centering + centering2, null, 0, 0, 0, null,
0);
imageLabel.setLayoutData(f);
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
@@ -403,16 +401,16 @@
f.width = buttonWidth;
findImage.setLayoutData(f);
- f = UIUtils.createFormData(nameText, 8+centering2, null, 0, hardwareLabel, 5,
findImage, -10);
+ f = UIUtils.createFormData(nameText, 8 + centering2, null, 0, hardwareLabel, 5,
findImage, -10);
imageText.setLayoutData(f);
- f = UIUtils.createFormData(imageLabel, 8+centering, null, 0, 0, 0, null, 0);
+ f = UIUtils.createFormData(imageLabel, 8 + centering, null, 0, 0, 0, null, 0);
archLabel.setLayoutData(f);
- f = UIUtils.createFormData(imageLabel, 8+centering, null, 0, hardwareLabel, 5, 100,
0);
+ f = UIUtils.createFormData(imageLabel, 8 + centering, null, 0, hardwareLabel, 5, 100,
0);
arch.setLayoutData(f);
- f = UIUtils.createFormData(arch, 8+centering, null, 0, 0, 0, null, 0);
+ f = UIUtils.createFormData(arch, 8 + centering, null, 0, 0, 0, null, 0);
realmLabel.setLayoutData(f);
f = UIUtils.createFormData(arch, 8, null, 0, hardwareLabel, 5, 100, 0);
@@ -425,7 +423,7 @@
keyText = new Text(container, SWT.BORDER | SWT.SINGLE);
- f = UIUtils.createFormData(realmCombo, 8+centering+centering2, null, 0, 0,0,null,0);
+ f = UIUtils.createFormData(realmCombo, 8 + centering + centering2, null, 0, 0, 0, null,
0);
keyLabel.setLayoutData(f);
f = new FormData();
@@ -434,22 +432,22 @@
f.right = new FormAttachment(realmCombo, 0, SWT.RIGHT);
keyManage.setLayoutData(f);
- f = UIUtils.createFormData(realmCombo, 8+centering2, null, 0, hardwareLabel, 5,
keyManage, -10);
+ f = UIUtils.createFormData(realmCombo, 8 + centering2, null, 0, hardwareLabel, 5,
keyManage, -10);
keyText.setLayoutData(f);
control = keyText;
- f = UIUtils.createFormData(control, 8+centering, null,0, 0,0, null,0);
+ f = UIUtils.createFormData(control, 8 + centering, null, 0, 0, 0, null, 0);
hardwareLabel.setLayoutData(f);
- f = UIUtils.createFormData(control,8, null,0, hardwareLabel,5, 100,0);
+ f = UIUtils.createFormData(control, 8, null, 0, hardwareLabel, 5, 100, 0);
hardware.setLayoutData(f);
- f = UIUtils.createFormData(hardware,10, 100,0, 0,0, 100,0);
+ f = UIUtils.createFormData(hardware, 10, 100, 0, 0, 0, 100, 0);
groupContainer.setLayoutData(f);
return container;
}
-
+
private void createProfileComposites() {
for (DeltaCloudHardwareProfile p : allProfiles) {
ProfileComposite pc = new ProfileComposite(p, groupContainer);
@@ -463,7 +461,7 @@
Thread t = new Thread() {
public void run() {
realms = getRealms();
- Display.getDefault().asyncExec(new Runnable(){
+ Display.getDefault().asyncExec(new Runnable() {
public void run() {
updateRealmCombo();
}
@@ -472,7 +470,7 @@
};
t.start();
}
-
+
private void launchFetchProfiles() {
Thread t = new Thread() {
public void run() {
@@ -482,7 +480,7 @@
public void run() {
createProfileComposites();
clearProfiles();
- if( allProfiles.length > 0 )
+ if (allProfiles.length > 0)
hardware.setEnabled(true);
filterProfiles();
}
@@ -491,7 +489,7 @@
};
t.start();
}
-
+
/**
* Displays the arch in the given label if the given binding is valid.
*
@@ -617,18 +615,18 @@
Combo combo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
realmCombo = combo;
combo.setEnabled(false);
- combo.setItems(new String[]{WizardMessages.getString(LOADING_VALUE)});
+ combo.setItems(new String[] { WizardMessages.getString(LOADING_VALUE) });
combo.select(0);
}
-
+
private void updateRealmCombo() {
List<String> names = getRealmNames(realms != null ? realms : new
ArrayList<DeltaCloudRealm>());
- if( names.size() > 0 ) {
+ if (names.size() > 0) {
realmCombo.setItems(names.toArray(new String[names.size()]));
realmCombo.setEnabled(true);
realmCombo.select(0);
} else {
- realmCombo.setItems(new String[]{WizardMessages.getString(NONE_RESPONSE)});
+ realmCombo.setItems(new String[] { WizardMessages.getString(NONE_RESPONSE) });
realmCombo.select(0);
}
}