Author: adietish
Date: 2010-11-25 04:33:39 -0500 (Thu, 25 Nov 2010)
New Revision: 26925
Modified:
branches/jbosstools-3.2.0.Beta2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
Log:
[JBIDE-7694] get back to version when branch, creating patch then
Modified:
branches/jbosstools-3.2.0.Beta2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
===================================================================
---
branches/jbosstools-3.2.0.Beta2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-11-25
08:19:44 UTC (rev 26924)
+++
branches/jbosstools-3.2.0.Beta2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-11-25
09:33:39 UTC (rev 26925)
@@ -64,6 +64,7 @@
private Combo cloudSelector;
private Label filterLabel;
+ private DeltaCloud[] clouds;
private DeltaCloud currCloud;
private InstanceViewLabelAndContentProvider contentProvider;
@@ -80,7 +81,7 @@
if (currCloud != null) {
currCloud.removeInstanceListListener(InstanceView.this);
}
- setCurrentCloud(index);
+ currCloud = clouds[index];
storeSelectedCloud();
Display.getCurrent().asyncExec(new Runnable() {
@@ -88,6 +89,7 @@
public void run() {
viewer.setInput(currCloud);
currCloud.addInstanceListListener(InstanceView.this);
+ viewer.refresh();
}
});
@@ -131,7 +133,7 @@
@Override
public void dispose() {
- for (DeltaCloud cloud : getClouds()) {
+ for (DeltaCloud cloud : clouds) {
cloud.removeInstanceListListener(this);
}
DeltaCloudManager.getDefault().removeCloudManagerListener(this);
@@ -146,7 +148,7 @@
layout.marginWidth = 0;
container.setLayout(layout);
- DeltaCloud[] clouds = getClouds();
+ clouds = getClouds();
createCloudSelector();
initCloudSelector(getLastSelectedCloud(), cloudSelector, clouds);
@@ -161,7 +163,6 @@
currCloud = getCurrentCloud(cloudSelector.getSelectionIndex(), clouds);
addInstanceListener(currCloud, viewer);
- setViewerInput(currCloud);
setFilterLabelVisible(currCloud, filterLabel);
Point p1 = cloudSelectorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
@@ -194,18 +195,12 @@
PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(),
"org.jboss.tools.deltacloud.ui.viewer");
hookContextMenu(viewer.getTable());
getSite().setSelectionProvider(viewer);
-
+
DeltaCloudManager.getDefault().addCloudManagerListener(this);
}
- private void setViewerInput(DeltaCloud currentCloud) {
- if (currentCloud != null) {
- viewer.setInput(currentCloud);
- }
- }
-
private DeltaCloud[] getClouds() {
- DeltaCloud[] clouds = new DeltaCloud[] {};
+ DeltaCloud[] clouds = new DeltaCloud[]{};
try {
clouds = DeltaCloudManager.getDefault().getClouds();
} catch (DeltaCloudException e) {
@@ -218,15 +213,6 @@
return clouds;
}
- private void setCurrentCloud(int index) {
- DeltaCloud[] clouds = getClouds();
- if (index >= clouds.length) {
- currCloud = null;
- } else {
- currCloud = getClouds()[index];
- }
- }
-
private void setFilterLabelVisible(DeltaCloud currentCloud, Label filterLabel) {
if (currentCloud == null) {
filterLabel.setVisible(false);
@@ -241,6 +227,7 @@
if (currentCloud != null) {
currentCloud.removeInstanceListListener(this);
currentCloud.addInstanceListListener(this);
+ viewer.setInput(currentCloud);
}
}
@@ -334,7 +321,7 @@
currName = currCloud.getName();
currIndex = cloudSelector.getSelectionIndex();
}
- DeltaCloud[] clouds = getClouds();
+ clouds = getClouds();
String[] cloudNames = new String[clouds.length];
int index = 0;
for (int i = 0; i < clouds.length; ++i) {
@@ -345,22 +332,17 @@
if (type == ICloudManagerListener.RENAME_EVENT) {
index = currIndex; // no change in cloud displayed
}
-
- setCloudSelectorItems(cloudNames);
- setCurrentCloud(index);
-
+ cloudSelector.removeModifyListener(cloudModifyListener);
+ cloudSelector.setItems(cloudNames);
if (cloudNames.length > 0) {
cloudSelector.setText(cloudNames[index]);
+ currCloud = clouds[index];
viewer.setInput(currCloud);
} else {
+ currCloud = null;
cloudSelector.setText("");
viewer.setInput(new DeltaCloudInstance[0]);
}
- }
-
- private void setCloudSelectorItems(String[] cloudNames) {
- cloudSelector.removeModifyListener(cloudModifyListener);
- cloudSelector.setItems(cloudNames);
cloudSelector.addModifyListener(cloudModifyListener);
}
@@ -373,8 +355,11 @@
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
- currCloud.addInstanceListListener(InstanceView.this); // does not add identical
instance twice
+ currCloud.removeInstanceListListener(InstanceView.this);
+
viewer.setInput(instances);
+ currCloud.addInstanceListListener(InstanceView.this);
+ viewer.refresh();
refreshToolbarCommandStates();
}
});
Show replies by date