Author: adietish
Date: 2011-03-14 11:49:10 -0400 (Mon, 14 Mar 2011)
New Revision: 29761
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
Log:
[JBIDE-7862] setting all items again so that the combo shrinks to the space needed to
display the largest cloud name
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-14 13:41:40
UTC (rev 29760)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-14 15:49:10
UTC (rev 29761)
@@ -1,6 +1,8 @@
2011-03-14 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
- *
src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
(updateCloudSelector):
+ *
src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
+ (updateCloudSelector) (.run):
+ [JBIDE-7862] setting all items again so that the combo shrinks to the space needed to
display the largest cloud name
* src/org/jboss/tools/deltacloud/ui/views/cloud/CloudItem.java (propertyChange):
[JBIDE-8584] ensured updates to widgets happens in display thread
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-14
13:41:40 UTC (rev 29760)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-14
15:49:10 UTC (rev 29761)
@@ -13,6 +13,7 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
@@ -371,13 +372,24 @@
if (index >= 0) {
int selectionIndex = currentCloudSelector.getSelectionIndex();
currentCloudSelector.removeModifyListener(currentCloudModifyListener);
- currentCloudSelector.setItem(index, cloud.getName());
+ /*
+ * @see [JBIDE-7862]
+ * setting all items seems necessary so that the combo uses the space needed to
display the largest cloud name.
+ * If you just replace the item that was renamed, the combo will not shrink (it
would only get larger if needed).
+ */
+ currentCloudSelector.setItems(getSelectorItems(cloud, index));
currentCloudSelector.select(selectionIndex);
currentCloudSelector.addModifyListener(currentCloudModifyListener);
}
container.layout(true, true);
}
+
+ private String[] getSelectorItems(final DeltaCloud cloud, final int index) {
+ List<String> names = new
ArrayList<String>(Arrays.asList(currentCloudSelector.getItems()));
+ names.set(index, cloud.getName());
+ return names.toArray(new String[names.size()]);
+ }
});
}
Show replies by date