Author: adietish
Date: 2012-02-22 04:04:54 -0500 (Wed, 22 Feb 2012)
New Revision: 38961
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java
Log:
cleanup
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-22
08:57:17 UTC (rev 38960)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteApplicationAction.java 2012-02-22
09:04:54 UTC (rev 38961)
@@ -1,10 +1,8 @@
package org.jboss.tools.openshift.express.internal.ui.action;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -12,6 +10,7 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
@@ -19,7 +18,6 @@
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import com.openshift.express.client.IApplication;
-import com.openshift.express.client.IUser;
import com.openshift.express.client.OpenShiftException;
public class DeleteApplicationAction extends AbstractAction {
@@ -34,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() {
@@ -61,31 +60,22 @@
+ "This is NOT reversible, all remote data for those applications will be
removed.");
}
if (confirm) {
- // rework here... loop inside the job, refresh required users only. Equals() and
hashcode() in IUser ?
+ // rework here... loop inside the job, refresh required users only.
+ // Equals() and hashcode() in IUser ?
Job job = new Job("Deleting OpenShift Application(s)...") {
protected IStatus run(IProgressMonitor monitor) {
- Set<String> usersToRefresh = new HashSet<String>();
try {
for (final IApplication application : appsToDelete) {
final String appName = application.getName();
try {
- application.destroy();
- usersToRefresh.add(application.getUser().getRhlogin());
+ application.destroy();
} catch (OpenShiftException e) {
- Logger.error("Failed to delete application '" + appName +
"'", e);
+ Logger.error(NLS.bind("Failed to delete application \"{0}\"",
appName), e);
}
}
} finally {
+ refreshViewer();
monitor.done();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (viewer != null) {
- //viewer.g
- viewer.refresh();
- }
- }
- });
}
return Status.OK_STATUS;
@@ -100,4 +90,16 @@
return selection instanceof IApplication;
}
+ private void refreshViewer() {
+ if (viewer == null) {
+ return;
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ viewer.refresh();
+ }
+ });
+ }
+
}