Author: xcoulon
Date: 2012-05-16 05:29:19 -0400 (Wed, 16 May 2012)
New Revision: 41047
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java
Log:
Fixing invalid condition to trigger refresh at user level
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java 2012-05-16
09:26:23 UTC (rev 41046)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java 2012-05-16
09:29:19 UTC (rev 41047)
@@ -18,6 +18,7 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import
org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
@@ -42,19 +43,25 @@
@Override
public void run() {
if (selection != null && selection instanceof ITreeSelection
- && ((ITreeSelection) selection).getFirstElement() instanceof
IOpenShiftResource) {
- refresh((IOpenShiftResource) ((ITreeSelection) selection).getFirstElement());
+ && (((ITreeSelection) selection).getFirstElement() instanceof UserDelegate)
+ || (((ITreeSelection) selection).getFirstElement() instanceof IOpenShiftResource)){
+ refresh( ((ITreeSelection) selection).getFirstElement());
}
}
- private void refresh(final IOpenShiftResource element) {
+ private void refresh(final Object element) {
Job job = new Job("Loading OpenShift information...") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
monitor.beginTask("Loading OpenShift information...",
IProgressMonitor.UNKNOWN);
- element.refresh();
+ if(element instanceof UserDelegate) {
+ ((UserDelegate)element).refresh();
+ } else if (element instanceof IOpenShiftResource) {
+ ((IOpenShiftResource)element).refresh();
+ }
+
//List<IApplication> applications = user.getApplications();
Display.getDefault().asyncExec(new Runnable() {
public void run() {
Show replies by date