[jbosstools-commits] JBoss Tools SVN: r43582 - branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Tue Sep 11 05:44:45 EDT 2012
Author: adietish
Date: 2012-09-11 05:44:44 -0400 (Tue, 11 Sep 2012)
New Revision: 43582
Added:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshViewerJob.java
Modified:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java
Log:
[JBIDE-12142] extracted viewer refresh to UIJob
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java 2012-09-11 09:43:13 UTC (rev 43581)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java 2012-09-11 09:44:44 UTC (rev 43582)
@@ -95,7 +95,7 @@
}
}
} finally {
- refreshViewer();
+ RefreshViewerJob.refresh(viewer);
monitor.done();
}
@@ -123,17 +123,4 @@
private boolean isApplication(Object selection) {
return selection instanceof IApplication;
}
-
- private void refreshViewer() {
- if (viewer == null) {
- return;
- }
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- viewer.refresh();
- }
- });
- }
-
}
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java 2012-09-11 09:43:13 UTC (rev 43581)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java 2012-09-11 09:44:44 UTC (rev 43582)
@@ -98,6 +98,7 @@
}
} finally {
monitor.done();
+ RefreshViewerJob.refresh(viewer);
}
}
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java 2012-09-11 09:43:13 UTC (rev 43581)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/EditCartridgesAction.java 2012-09-11 09:44:44 UTC (rev 43582)
@@ -44,7 +44,7 @@
EmbedCartridgeWizard wizard = new EmbedCartridgeWizard(application, user);
int result = WizardUtils.openWizardDialog(wizard, Display.getCurrent().getActiveShell());
if(result == Dialog.OK) {
- viewer.refresh(application);
+ RefreshViewerJob.refresh(viewer);
}
} catch (OpenShiftException e) {
Logger.error("Failed to edit cartridges", e);
Modified: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java 2012-09-11 09:43:13 UTC (rev 43581)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshElementAction.java 2012-09-11 09:44:44 UTC (rev 43582)
@@ -15,7 +15,6 @@
import org.eclipse.core.runtime.Status;
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.OpenShiftImages;
import org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
@@ -61,11 +60,7 @@
}
//List<IApplication> applications = user.getApplications();
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- viewer.refresh(element);
- }
- });
+ RefreshViewerJob.refresh(viewer);
} catch (OpenShiftException e) {
Logger.error("Failed to refresh element", e);
} finally {
Added: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshViewerJob.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshViewerJob.java (rev 0)
+++ branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshViewerJob.java 2012-09-11 09:44:44 UTC (rev 43582)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.action;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.ui.progress.UIJob;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class RefreshViewerJob extends UIJob {
+
+ private StructuredViewer viewer;
+
+ public RefreshViewerJob(StructuredViewer viewer) {
+ super("Refreshing viewer...");
+ this.viewer = viewer;
+ }
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ viewer.refresh();
+ return Status.OK_STATUS;
+ }
+
+ public static void refresh(StructuredViewer viewer) {
+ new RefreshViewerJob(viewer).schedule();
+ }
+}
Property changes on: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshViewerJob.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
More information about the jbosstools-commits
mailing list