Author: rob.stryker(a)jboss.com
Date: 2012-02-23 10:13:36 -0500 (Thu, 23 Feb 2012)
New Revision: 39066
Modified:
branches/jbosstools-3.3.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java
branches/jbosstools-3.3.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleLabelProvider.java
Log:
JBIDE-10994 - to branch beta1
Modified:
branches/jbosstools-3.3.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java
===================================================================
---
branches/jbosstools-3.3.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java 2012-02-23
14:54:13 UTC (rev 39065)
+++
branches/jbosstools-3.3.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleContentProvider.java 2012-02-23
15:13:36 UTC (rev 39066)
@@ -11,6 +11,7 @@
package org.jboss.tools.openshift.express.internal.ui.viewer;
import java.util.ArrayList;
+import java.util.HashMap;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -55,12 +56,14 @@
// Keep track of what's loading and what's finished
private ArrayList<IUser> loadedUsers = new ArrayList<IUser>();
private ArrayList<IUser> loadingUsers = new ArrayList<IUser>();
+ private HashMap<IUser, OpenShiftException> errors = new HashMap<IUser,
OpenShiftException>();
@Override
public Object[] getElements(final Object parentElement) {
// A refresh on the whole model... clear our cache
loadedUsers.clear();
loadingUsers.clear();
+ errors.clear();
if (parentElement instanceof IWorkspaceRoot) {
return UserModel.getDefault().getUsers();
}
@@ -82,22 +85,35 @@
// return a stub object that says loading...
return new Object[] { new LoadingStub() };
}
+ OpenShiftException ose = errors.get((IUser)parentElement);
+ if( ose != null ) {
+ return new Object[]{ose};
+ }
}
- return getChildrenFor(parentElement, false);
+ return getChildrenForElement_LogException(parentElement, false);
}
// Force the children to load completely
private void getChildrenFor(Object[] parentElements) {
for (int i = 0; i < parentElements.length; i++) {
- getChildrenFor(parentElements[i], true);
+ getChildrenForElement_LogException(parentElements[i], true);
}
}
// Get the children without the protection of a "loading..." situation
- private Object[] getChildrenFor(Object parentElement, boolean recurse) {
+ private Object[] getChildrenForElement_LogException(Object parentElement, boolean
recurse) {
+ try {
+ return getChildrenForElement(parentElement, recurse);
+ } catch (OpenShiftException e) {
+ Logger.error("Unable to retrieve OpenShift Express information", e);
+ }
+ return new Object[0];
+ }
+
+ private Object[] getChildrenForElement(Object parentElement, boolean recurse) throws
OpenShiftException {
// .... the actual work is done here...
Object[] children = new Object[0];
- try {
+// try {
if (parentElement instanceof OpenShiftExpressConsoleContentCategory) {
IUser user = ((OpenShiftExpressConsoleContentCategory) parentElement).getUser();
children = new Object[] { user };
@@ -115,9 +131,9 @@
if (recurse) {
getChildrenFor(children);
}
- } catch (OpenShiftException e) {
- Logger.error("Unable to retrieve OpenShift Express information", e);
- }
+// } catch (OpenShiftException e) {
+// Logger.error("Unable to retrieve OpenShift Express information", e);
+// }
return children;
}
@@ -130,10 +146,14 @@
monitor.worked(1);
// Get the actual children, with the delay
loadingUsers.add(user);
- getChildrenFor(user, true);
+ try {
+ getChildrenForElement(user, true);
+ } catch(OpenShiftException e) {
+ errors.put(user, e);
+ }
loadedUsers.add(user);
loadingUsers.remove(user);
- refreshViewerObject(user);
+ refreshViewerObject(user);
monitor.done();
return Status.OK_STATUS;
}
Modified:
branches/jbosstools-3.3.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleLabelProvider.java
===================================================================
---
branches/jbosstools-3.3.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleLabelProvider.java 2012-02-23
14:54:13 UTC (rev 39065)
+++
branches/jbosstools-3.3.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleLabelProvider.java 2012-02-23
15:13:36 UTC (rev 39066)
@@ -8,19 +8,22 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.openshift.express.internal.ui.viewer;
+package org.jboss.tools.openshift.express.internal.ui.viewer;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import
org.jboss.tools.openshift.express.internal.ui.viewer.OpenShiftExpressConsoleContentProvider.LoadingStub;
import com.openshift.express.client.IApplication;
import com.openshift.express.client.IEmbeddableCartridge;
import com.openshift.express.client.IUser;
+import com.openshift.express.client.OpenShiftException;
/**
* @author Xavier Coulon
@@ -65,7 +68,9 @@
if (element instanceof LoadingStub) {
return OpenShiftUIActivator.getDefault().createImage("systemprocess.gif");
}
-
+ if (element instanceof OpenShiftException ) {
+ return
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ }
return null;
}
@@ -104,6 +109,9 @@
if (element instanceof LoadingStub) {
return new StyledString("Loading...");
}
+ if (element instanceof OpenShiftException ) {
+ return new StyledString( ((OpenShiftException)element).getMessage());
+ }
return null;
}
Show replies by date