Author: adietish
Date: 2010-11-17 11:45:31 -0500 (Wed, 17 Nov 2010)
New Revision: 26680
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractCloudJob.java
Log:
[JBIDE-7544] clearing images and instances before refreshing them (to avoid conflicting
user actions)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-11-17 16:28:42
UTC (rev 26679)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-11-17 16:45:31
UTC (rev 26680)
@@ -27,8 +27,14 @@
(testConnection):
[JBIDE-7597] made sure no DeltaCloudClientException gets outside of DeltaCloud
(destroyInstance):
- [JBIDE-7597] added exception to destroy instance
-
+ [JBIDE-7597] added exception to destroy instance
+ (clearInstances):
+ (clearImages):
+ (loadInstances):
+ (loadImages):
+ (loadChildren):
+ [JBIDE-7544] clearing images and instances before refreshing them (to avoid conflicting
user actions)
+
2010-11-16 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (DeltaCloudManager):
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-11-17
16:28:42 UTC (rev 26679)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-11-17
16:45:31 UTC (rev 26680)
@@ -244,6 +244,8 @@
public void loadChildren() throws DeltaCloudException {
DeltaCloudMultiException multiException = new
DeltaCloudMultiException(MessageFormat.format(
"Could not load children from cloud {0}", getName()));
+ clearImages();
+ clearInstances();
try {
loadImages();
} catch (DeltaCloudException e) {
@@ -294,6 +296,12 @@
return images;
}
+ public DeltaCloudInstance[] notifyInstanceListeners() {
+ DeltaCloudInstance[] instances = cloneInstancesArray();
+ notifyInstanceListListeners(instances);
+ return instances;
+ }
+
private DeltaCloudImage[] cloneImagesArray() {
DeltaCloudImage[] imageArray = new DeltaCloudImage[images.size()];
return images.toArray(imageArray);
@@ -384,7 +392,7 @@
*/
public DeltaCloudInstance[] loadInstances() throws DeltaCloudException {
synchronized (instanceLock) {
- instances = new ArrayList<DeltaCloudInstance>();
+ clearInstances();
try {
List<Instance> list = getClient().listInstances();
for (Iterator<Instance> i = list.iterator(); i.hasNext();) {
@@ -393,9 +401,7 @@
}
// TODO: remove notification with all instances, replace by
// notifying the changed instance
- DeltaCloudInstance[] instancesArray = instances.toArray(new
DeltaCloudInstance[instances.size()]);
- notifyInstanceListListeners(instancesArray);
- return instancesArray;
+ return notifyInstanceListeners();
} catch (DeltaCloudClientException e) {
throw new DeltaCloudException(MessageFormat.format("Could not load instances of
cloud {0}: {1}",
getName(), e.getMessage()), e);
@@ -403,6 +409,13 @@
}
}
+ private void clearInstances() {
+ synchronized (instanceLock) {
+ instances = new ArrayList<DeltaCloudInstance>();
+ notifyInstanceListeners();
+ }
+ }
+
public DeltaCloudInstance[] getCurrInstances() throws DeltaCloudException {
synchronized (instanceLock) {
if (instances == null) {
@@ -556,7 +569,7 @@
public DeltaCloudImage[] loadImages() throws DeltaCloudException {
synchronized (imageLock) {
try {
- images = new ArrayList<DeltaCloudImage>();
+ clearImages();
List<Image> list = getClient().listImages();
for (Iterator<Image> i = list.iterator(); i.hasNext();) {
addImage(i.next());
@@ -569,6 +582,13 @@
}
}
+ private void clearImages() {
+ synchronized (imageLock) {
+ images = new ArrayList<DeltaCloudImage>();
+ notifyImageListListeners();
+ }
+ }
+
private DeltaCloudImage addImage(Image image) {
DeltaCloudImage deltaCloudImage = new DeltaCloudImage(image, this);
images.add(deltaCloudImage);
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-11-17 16:28:42
UTC (rev 26679)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-11-17 16:45:31
UTC (rev 26680)
@@ -1,5 +1,7 @@
2010-11-17 André Dietisheim <adietish(a)redhat.com>
+ * src/org/jboss/tools/deltacloud/ui/commands/AbstractCloudJob.java (AbstractCloudJob):
+ [JBIDE-7554] removed 'blocking' dialog since I now clear instances and images
before reloading
* src/org/jboss/tools/deltacloud/ui/views/PerformDestroyInstanceActionThread.java
(.run):
[JBIDE-7597] added exception reporting
* src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java (refresh):
@@ -110,7 +112,7 @@
* src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
(getStatusIcon):
* src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java:
[JBIDE-7566] renamed running.gif to run.gif, stopped to stop.gif, added running.gif and
stopped.gif
-
+to destroy instance
2010-11-11 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/ui/views/ImageView.java
(ColumnListener.widgetSelected):
Modified:
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-11-17
16:28:42 UTC (rev 26679)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractCloudJob.java 2010-11-17
16:45:31 UTC (rev 26680)
@@ -18,7 +18,7 @@
public AbstractCloudJob(String name) {
super(name);
- setUser(true);
+// setUser(true);
}
@Override
Show replies by date