Author: xcoulon
Date: 2011-11-25 11:31:58 -0500 (Fri, 25 Nov 2011)
New Revision: 36671
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/.options
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/Logger.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT.jar
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
Log:
JBIDE-10096 Application is not removed from available application list in OpenShift
Tooling
https://issues.jboss.org/browse/JBIDE-10096
(adding debug support to trace model refresh in the tableviewer)
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/org.jboss.tools.openshift.express.client-2.3.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/.options
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/.options
(rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/.options 2011-11-25
16:31:58 UTC (rev 36671)
@@ -0,0 +1,2 @@
+# This file enables runtime tracing
+org.jboss.tools.openshift.express.ui/debug=true
\ No newline at end of file
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/.options
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-11-25
16:03:47 UTC (rev 36670)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2011-11-25
16:31:58 UTC (rev 36671)
@@ -60,6 +60,7 @@
import org.jboss.tools.openshift.express.client.NotFoundOpenShiftException;
import org.jboss.tools.openshift.express.client.OpenShiftException;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.utils.Logger;
/**
* @author André Dietisheim
@@ -291,7 +292,8 @@
protected IStatus run(IProgressMonitor monitor) {
try {
model.destroyCurrentApplication();
- refreshViewer();
+ final Collection<IApplication> applications = model.getApplications();
+ setViewerInput(applications);
return Status.OK_STATUS;
} catch (OpenShiftException e) {
return OpenShiftUIActivator.createErrorStatus(
@@ -317,8 +319,14 @@
Shell shell = getContainer().getShell();
NewApplicationWizard applicationDialog = new NewApplicationWizard(model.getUser());
if (WizardUtils.openWizardDialog(applicationDialog, shell) == Dialog.OK) {
- viewer.refresh();
- model.setSelectedApplication(applicationDialog.getApplication());
+ try {
+ final Collection<IApplication> applications = model.getApplications();
+ setViewerInput(applications);
+ model.setSelectedApplication(applicationDialog.getApplication());
+ } catch (OpenShiftException ex) {
+ Logger.error(NLS.bind("Could not delete application \"{0}\"",
+ model.getSelectedApplication().getName()), ex);
+ }
}
}
};
@@ -378,17 +386,8 @@
}
}
- private void refreshViewer() {
- getShell().getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- viewer.refresh();
- }
- });
- }
-
private void clearViewer() {
+ Logger.debug("Clearing applications list in viewer");
setViewerInput(new ArrayList<IApplication>());
}
@@ -397,6 +396,7 @@
@Override
public void run() {
+ Logger.debug("Setting {} application(s) in the viewer",
applications.size());
viewer.setInput(applications);
}
});
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/Logger.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/Logger.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/Logger.java 2011-11-25
16:31:58 UTC (rev 36671)
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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:
+ * Xavier Coulon - Initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.openshift.express.internal.utils;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+
+/*******************************************************************************
+ * Copyright (c) 2008 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:
+ * Xavier Coulon - Initial API and implementation
+ ******************************************************************************/
+
+/**
+ * A logger wrapper utility for classes in the current bundle only.
+ */
+public final class Logger {
+
+ /** The debug name, matching the .options file. */
+ private static final String DEBUG = OpenShiftUIActivator.PLUGIN_ID +
"/debug";
+
+ private static final ThreadLocal<DateFormat> dateFormatter = new
ThreadLocal<DateFormat>() {
+ @Override
+ protected DateFormat initialValue() {
+ return new SimpleDateFormat("HH:mm:ss.SSS");
+ }
+ };
+
+ /**
+ * The private constructor of the static class.
+ */
+ private Logger() {
+ }
+
+ /**
+ * Logs a message with an 'error' severity.
+ *
+ * @param message
+ * the message to log
+ * @param t
+ * the throwable cause
+ */
+ public static void error(final String message, final Throwable t) {
+ OpenShiftUIActivator.getDefault().getLog()
+ .log(new Status(Status.ERROR, OpenShiftUIActivator.PLUGIN_ID, message, t));
+ }
+
+ /**
+ * Logs a message with an 'error' severity.
+ *
+ * @param message
+ * the message to log
+ */
+ public static void error(final String message) {
+ OpenShiftUIActivator.getDefault().getLog()
+ .log(new Status(Status.ERROR, OpenShiftUIActivator.PLUGIN_ID, message));
+ }
+
+ /**
+ * Logs a message with an 'warning' severity.
+ *
+ * @param message
+ * the message to log
+ * @param t
+ * the throwable cause
+ */
+ public static void warn(final String message, final Throwable t) {
+ OpenShiftUIActivator.getDefault().getLog()
+ .log(new Status(Status.WARNING, OpenShiftUIActivator.PLUGIN_ID, message, t));
+ }
+
+ /**
+ * Logs a message with a 'warning' severity.
+ *
+ * @param message
+ * the message to log
+ */
+ public static void warn(final String message) {
+ OpenShiftUIActivator.getDefault().getLog()
+ .log(new Status(Status.WARNING, OpenShiftUIActivator.PLUGIN_ID, message));
+ }
+
+ /**
+ * Logs a message with an 'info' severity.
+ *
+ * @param message
+ * the message to log
+ */
+ public static void info(String message) {
+ OpenShiftUIActivator.getDefault().getLog()
+ .log(new Status(Status.INFO, OpenShiftUIActivator.PLUGIN_ID, message));
+ }
+
+ /**
+ * Outputs a debug message in the trace file (not the error view of the
+ * runtime workbench). Traces must be activated for this plugin in order to
+ * see the output messages.
+ *
+ * @param message
+ * the message to trace.
+ */
+ public static void debug(final String message) {
+ String debugOption = Platform.getDebugOption(DEBUG);
+ if (OpenShiftUIActivator.getDefault().isDebugging() &&
"true".equalsIgnoreCase(debugOption)) {
+ System.out.println("[" + Thread.currentThread().getName() + "] " +
message);
+ }
+
+ }
+
+ /**
+ * Outputs a debug message in the trace file (not the error view of the
+ * runtime workbench). Traces must be activated for this plugin in order to
+ * see the output messages.
+ *
+ * @param message
+ * the message to trace.
+ */
+ public static void debug(final String message, Object... items) {
+ String debugOption = Platform.getDebugOption(DEBUG);
+ String valuedMessage = message;
+ if (OpenShiftUIActivator.getDefault() != null &&
OpenShiftUIActivator.getDefault().isDebugging()
+ && "true".equalsIgnoreCase(debugOption)) {
+ for (Object item : items) {
+ valuedMessage = valuedMessage.replaceFirst("\\{\\}", (item != null ?
item.toString() : "null"));
+ }
+
+ System.out.println(dateFormatter.get().format(new Date()) + " [" +
Thread.currentThread().getName() + "] "
+ + valuedMessage);
+ }
+
+ }
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/utils/Logger.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain