Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-05-21 07:28:22 +0000
committerUwe Stieber2013-05-21 07:28:22 +0000
commit6a61bccef492e5d9513c5876db2ebc80e8b32bda (patch)
tree1a18f58e538066bfe643781b9ad31c58c3eef35e /target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/src
parenta208df59737db0fa329bc999094b621c3b30a4fb (diff)
downloadorg.eclipse.tcf-6a61bccef492e5d9513c5876db2ebc80e8b32bda.tar.gz
org.eclipse.tcf-6a61bccef492e5d9513c5876db2ebc80e8b32bda.tar.xz
org.eclipse.tcf-6a61bccef492e5d9513c5876db2ebc80e8b32bda.zip
Target Explorer: Fix copyright years in file headers
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/src')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/src/org/eclipse/tcf/te/runtime/statushandler/StatusHandlerUtil.java236
1 files changed, 118 insertions, 118 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/src/org/eclipse/tcf/te/runtime/statushandler/StatusHandlerUtil.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/src/org/eclipse/tcf/te/runtime/statushandler/StatusHandlerUtil.java
index 508ab53ec..80af56237 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/src/org/eclipse/tcf/te/runtime/statushandler/StatusHandlerUtil.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.statushandler/src/org/eclipse/tcf/te/runtime/statushandler/StatusHandlerUtil.java
@@ -1,118 +1,118 @@
-/**
- * StatusHandlerUtil.java
- * Created on May 21, 2012
- *
- * Copyright (c) 2012 Wind River Systems, Inc.
- *
- * The right to copy, distribute, modify, or otherwise make use
- * of this software may be licensed only pursuant to the terms
- * of an applicable Wind River license agreement.
- */
-package org.eclipse.tcf.te.runtime.statushandler;
-
-import java.lang.reflect.Field;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.statushandler.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler;
-import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants;
-
-/**
- * Status handler utility implementations.
- */
-public final class StatusHandlerUtil {
-
- /**
- * Handle the given status for the given context.
- *
- * @param status The status. Must not be <code>null</code>.
- * @param context The context. Must not be <code>null</code>.
- * @param template The message template or <code>null</code>.
- * @param title The dialog title or <code>null</code>.
- * @param contextHelpId The context help id or <code>null</code>.
- * @param caller The caller or <code>null</code>.
- * @param callback The callback or <code>null</code>.
- */
- public static void handleStatus(IStatus status, Object context, String template, String title, String contextHelpId, Object caller, ICallback callback) {
- Assert.isNotNull(status);
- Assert.isNotNull(context);
-
- IStatusHandler[] handlers = StatusHandlerManager.getInstance().getHandler(context);
- if (handlers.length > 0) {
- IPropertiesContainer data = new PropertiesContainer();
-
- if (title != null) data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, title);
- if (contextHelpId != null) data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, contextHelpId);
- if (caller != null) data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, caller);
-
- updateMessage(status, template);
-
- handlers[0].handleStatus(status, data, callback);
- } else {
- Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
- callback.done(caller, status);
- }
- }
-
- private static void updateMessage(IStatus status, String template) {
- Assert.isNotNull(status);
-
- StringBuilder message = new StringBuilder();
- String msg = status.getMessage();
-
- if (msg != null && msg.contains("Error text:")) { //$NON-NLS-1$
- StringTokenizer tokenizer = new StringTokenizer(msg, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreElements()) {
- String token = tokenizer.nextToken();
- if (token.trim().startsWith("Error text:")) { //$NON-NLS-1$
- token = token.replaceAll("Error text:", " "); //$NON-NLS-1$ //$NON-NLS-2$
- message.append(token.trim());
- break;
- }
- }
- } else if (msg != null) {
- message.append(msg.trim());
- }
-
- // If the status is associated with an exception, the exception message may contain additional
- // detailed information. Append it to the message
- if (status.getException() != null && status.getException().getLocalizedMessage() != null
- && !status.getException().getLocalizedMessage().contains(message.toString())) {
- message.append("\n\n"); //$NON-NLS-1$
- message.append(status.getException().getLocalizedMessage());
- }
-
- // Construct the final message string
- String fullMsg = null;
- if (message.length() > 0) fullMsg = message.toString().trim();
-
- // Apply the template if any
- if (template != null) fullMsg = NLS.bind(template, fullMsg != null ? fullMsg : ""); //$NON-NLS-1$
-
- if (fullMsg != null) {
- // Normalize any possible "\r\n"
- fullMsg = fullMsg.replaceAll("\r\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- final Field f = status.getClass().getDeclaredField("message"); //$NON-NLS-1$
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- @Override
- public Object run() {
- f.setAccessible(true);
- return null;
- }
- });
- f.set(status, fullMsg);
- }
- catch (Exception e) {}
- }
- }
-}
+/**
+ * StatusHandlerUtil.java
+ * Created on May 21, 2012
+ *
+ * Copyright (c) 2012, 2013 Wind River Systems, Inc.
+ *
+ * The right to copy, distribute, modify, or otherwise make use
+ * of this software may be licensed only pursuant to the terms
+ * of an applicable Wind River license agreement.
+ */
+package org.eclipse.tcf.te.runtime.statushandler;
+
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
+import org.eclipse.tcf.te.runtime.statushandler.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandler;
+import org.eclipse.tcf.te.runtime.statushandler.interfaces.IStatusHandlerConstants;
+
+/**
+ * Status handler utility implementations.
+ */
+public final class StatusHandlerUtil {
+
+ /**
+ * Handle the given status for the given context.
+ *
+ * @param status The status. Must not be <code>null</code>.
+ * @param context The context. Must not be <code>null</code>.
+ * @param template The message template or <code>null</code>.
+ * @param title The dialog title or <code>null</code>.
+ * @param contextHelpId The context help id or <code>null</code>.
+ * @param caller The caller or <code>null</code>.
+ * @param callback The callback or <code>null</code>.
+ */
+ public static void handleStatus(IStatus status, Object context, String template, String title, String contextHelpId, Object caller, ICallback callback) {
+ Assert.isNotNull(status);
+ Assert.isNotNull(context);
+
+ IStatusHandler[] handlers = StatusHandlerManager.getInstance().getHandler(context);
+ if (handlers.length > 0) {
+ IPropertiesContainer data = new PropertiesContainer();
+
+ if (title != null) data.setProperty(IStatusHandlerConstants.PROPERTY_TITLE, title);
+ if (contextHelpId != null) data.setProperty(IStatusHandlerConstants.PROPERTY_CONTEXT_HELP_ID, contextHelpId);
+ if (caller != null) data.setProperty(IStatusHandlerConstants.PROPERTY_CALLER, caller);
+
+ updateMessage(status, template);
+
+ handlers[0].handleStatus(status, data, callback);
+ } else {
+ Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status);
+ callback.done(caller, status);
+ }
+ }
+
+ private static void updateMessage(IStatus status, String template) {
+ Assert.isNotNull(status);
+
+ StringBuilder message = new StringBuilder();
+ String msg = status.getMessage();
+
+ if (msg != null && msg.contains("Error text:")) { //$NON-NLS-1$
+ StringTokenizer tokenizer = new StringTokenizer(msg, ","); //$NON-NLS-1$
+ while (tokenizer.hasMoreElements()) {
+ String token = tokenizer.nextToken();
+ if (token.trim().startsWith("Error text:")) { //$NON-NLS-1$
+ token = token.replaceAll("Error text:", " "); //$NON-NLS-1$ //$NON-NLS-2$
+ message.append(token.trim());
+ break;
+ }
+ }
+ } else if (msg != null) {
+ message.append(msg.trim());
+ }
+
+ // If the status is associated with an exception, the exception message may contain additional
+ // detailed information. Append it to the message
+ if (status.getException() != null && status.getException().getLocalizedMessage() != null
+ && !status.getException().getLocalizedMessage().contains(message.toString())) {
+ message.append("\n\n"); //$NON-NLS-1$
+ message.append(status.getException().getLocalizedMessage());
+ }
+
+ // Construct the final message string
+ String fullMsg = null;
+ if (message.length() > 0) fullMsg = message.toString().trim();
+
+ // Apply the template if any
+ if (template != null) fullMsg = NLS.bind(template, fullMsg != null ? fullMsg : ""); //$NON-NLS-1$
+
+ if (fullMsg != null) {
+ // Normalize any possible "\r\n"
+ fullMsg = fullMsg.replaceAll("\r\n", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ final Field f = status.getClass().getDeclaredField("message"); //$NON-NLS-1$
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ f.setAccessible(true);
+ return null;
+ }
+ });
+ f.set(status, fullMsg);
+ }
+ catch (Exception e) {}
+ }
+ }
+}

Back to the top