Author: adietish
Date: 2011-03-09 07:51:33 -0500 (Wed, 09 Mar 2011)
New Revision: 29648
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.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java
Log:
[JBIDE-7523]
* added change notification for username and url
* listening to changes in DeltaCloud and refreshing properties view
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-03-09 12:43:27
UTC (rev 29647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-03-09 12:51:33
UTC (rev 29648)
@@ -1,3 +1,12 @@
+2011-03-09 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
+ (PROP_URL):
+ (PROP_USERNAME):
+ (updateConnectionProperties):
+ * src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
(addPropertyChangeListener):
+ [JBIDE-7523] added change notification for username and url
+
2011-02-18 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
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 2011-03-09
12:43:27 UTC (rev 29647)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2011-03-09
12:51:33 UTC (rev 29648)
@@ -43,6 +43,8 @@
public static final String PROP_INSTANCES_REMOVED = "instancesRemoved";
public static final String PROP_IMAGES = "images";
public static final String PROP_NAME = "name";
+ public static final String PROP_URL = "url";
+ public static final String PROP_USERNAME = "username";
private String name;
private String username;
@@ -124,11 +126,11 @@
private boolean updateConnectionProperties(String url, String username, String password)
throws DeltaCloudException {
boolean changed = false;
if (!equals(this.url, url)) {
- this.url = url;
+ setUrl(url);
changed = true;
}
if (!equals(this.username, username)) {
- this.username = username;
+ setUsername(username);
changed = true;
}
if (!equals(this.passwordStore.getPassword(), password)) {
@@ -161,10 +163,18 @@
return name;
}
+ private void setUrl(String url) {
+ firePropertyChange(PROP_URL, this.url, this.url = url);
+ }
+
public String getURL() {
return url;
}
+ private void setUsername(String username) {
+ firePropertyChange(PROP_USERNAME, this.username, this.username = username);
+ }
+
public String getUsername() {
return username;
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java 2011-03-09
12:43:27 UTC (rev 29647)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java 2011-03-09
12:51:33 UTC (rev 29648)
@@ -37,6 +37,10 @@
propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
}
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(listener);
+ }
+
public void removePropertyChangeListener(String propertyName, PropertyChangeListener
listener) {
propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-09 12:43:27
UTC (rev 29647)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-09 12:51:33
UTC (rev 29648)
@@ -1,3 +1,11 @@
+2011-03-09 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java
(selectionChanged):
+ (addPropertyChangeListener):
+ (removePropertyChangeListener):
+ (cloudPropertyListener):
+ [JBIDE-7523] listening to changes in DeltaCloud and refreshing properties view
+
2011-03-08 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImageWizard.java (addPages):
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java 2011-03-09
12:43:27 UTC (rev 29647)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java 2011-03-09
12:51:33 UTC (rev 29648)
@@ -10,13 +10,61 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.ui.views.cloud.property;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.views.properties.PropertySheetPage;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudItem;
+import org.jboss.tools.internal.deltacloud.ui.utils.WorkbenchUtils;
+/**
+ * @Jeff Johnston
+ * @author André Dietisheim
+ */
public class CVPropertySheetPage extends PropertySheetPage {
-
+
+ private DeltaCloud deltaCloud;
+ private PropertyChangeListener cloudPropertyListener = new PropertyChangeListener() {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ refresh();
+ }
+ };
+
public CVPropertySheetPage() {
super();
setSorter(new CVPropertySheetNonSorter());
}
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ CloudItem cloudItem = WorkbenchUtils.getFirstAdaptedElement(selection,
CloudItem.class);
+ if (cloudItem != null) {
+ removePropertyChangeListener(this.deltaCloud);
+ DeltaCloud deltaCloud = cloudItem.getModel();
+ if (deltaCloud != null) {
+ addPropertyChangeListener(deltaCloud);
+ this.deltaCloud = deltaCloud;
+ }
+ }
+
+ super.selectionChanged(part, selection);
+ }
+
+ private void addPropertyChangeListener(DeltaCloud deltaCloud) {
+ if (deltaCloud != null) {
+ deltaCloud.addPropertyChangeListener(cloudPropertyListener);
+ }
+ }
+
+ private void removePropertyChangeListener(DeltaCloud deltaCloud) {
+ if (deltaCloud != null) {
+ deltaCloud.removePropertyChangeListener(cloudPropertyListener);
+ }
+ }
+
}