Author: adietish
Date: 2012-02-16 16:37:37 -0500 (Thu, 16 Feb 2012)
New Revision: 38847
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/DisposeUtils.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java
Log:
[JBIDE-10941] made sure viewer.refresh() is called within the UI-thread
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java 2012-02-16
21:00:32 UTC (rev 38846)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java 2012-02-16
21:37:37 UTC (rev 38847)
@@ -14,6 +14,7 @@
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import
org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
+import org.jboss.tools.openshift.express.internal.ui.utils.DisposeUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import com.openshift.express.client.IApplication;
@@ -31,8 +32,9 @@
}
/**
- * Operation called when the user clicks on 'Show In>Remote Console'. If no
Console/Worker existed, a new one is
- * created, otherwise, it is displayed. {@inheritDoc}
+ * Operation called when the user clicks on 'Show In>Remote Console'. If no
+ * Console/Worker existed, a new one is created, otherwise, it is displayed.
+ * {@inheritDoc}
*/
@Override
public void run() {
@@ -69,7 +71,7 @@
} finally {
monitor.done();
if (viewer != null) {
- viewer.refresh();
+ refresh();
}
}
return Status.OK_STATUS;
@@ -80,7 +82,7 @@
}
}
if (viewer != null) {
- viewer.refresh();
+ refresh();
}
}
@@ -88,4 +90,15 @@
return selection instanceof IApplication;
}
+ private void refresh() {
+ if (!DisposeUtils.isDisposed(viewer))
+ viewer.getControl().getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ viewer.refresh();
+ }
+ });
+ }
+
}
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/DisposeUtils.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/DisposeUtils.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/DisposeUtils.java 2012-02-16
21:37:37 UTC (rev 38847)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.utils;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Control;
+
+public class DisposeUtils {
+
+ public static boolean isDisposed(Control control) {
+ return control == null
+ || control.isDisposed();
+ }
+
+ public static boolean isDisposed(Viewer viewer) {
+ return viewer == null
+ || isDisposed(viewer.getControl());
+ }
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/DisposeUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain