From 7171bec2d24e319999a2ce1810a4be735bc02f22 Mon Sep 17 00:00:00 2001
From: Martin Oberhuber <martin.oberhuber@windriver.com>
Date: Wed, 9 Jul 2008 14:46:26 +0000
Subject: [PATCH] [220306] Improve RXTX Serial Install Instructions

---
 .../feature.xml                               |  5 +-
 .../META-INF/MANIFEST.MF                      |  2 +-
 org.eclipse.tm.terminal.serial/README.txt     | 24 +++++---
 .../terminal/serial/SerialMessages.properties | 21 +++----
 .../terminal/provisional/api/Logger.java      | 59 ++++++++++---------
 5 files changed, 60 insertions(+), 51 deletions(-)

diff --git a/org.eclipse.tm.terminal.serial-feature/feature.xml b/org.eclipse.tm.terminal.serial-feature/feature.xml
index 5721c2a5e61..3056b22bce0 100644
--- a/org.eclipse.tm.terminal.serial-feature/feature.xml
+++ b/org.eclipse.tm.terminal.serial-feature/feature.xml
@@ -2,7 +2,7 @@
 <feature
       id="org.eclipse.tm.terminal.serial"
       label="%featureName"
-      version="2.0.0.qualifier"
+      version="2.0.1.qualifier"
       provider-name="%providerName">
 
    <description>
@@ -20,9 +20,6 @@
    <url>
       <update label="%tmUpdateSiteName" url="http://download.eclipse.org/dsdp/tm/updates/3.0"/>
       <discovery label="%tmUpdateSiteName" url="http://download.eclipse.org/dsdp/tm/updates/3.0"/>
-      <!-- TODO reference the RXTX discovery site once it exists
-      <discovery label="%tmRXTXSiteName" url="http://download.eclipse.org/dsdp/tm/updates/3.0"/>
-      -->
    </url>
 
    <requires>
diff --git a/org.eclipse.tm.terminal.serial/META-INF/MANIFEST.MF b/org.eclipse.tm.terminal.serial/META-INF/MANIFEST.MF
index 9f848f19c8e..9524e3ab09f 100644
--- a/org.eclipse.tm.terminal.serial/META-INF/MANIFEST.MF
+++ b/org.eclipse.tm.terminal.serial/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.tm.terminal.serial;singleton:=true
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.1.qualifier
 Bundle-Localization: plugin
 Import-Package: gnu.io;resolution:=optional
 Require-Bundle: org.eclipse.ui,
diff --git a/org.eclipse.tm.terminal.serial/README.txt b/org.eclipse.tm.terminal.serial/README.txt
index 96b69ce1a03..188bc8f4917 100644
--- a/org.eclipse.tm.terminal.serial/README.txt
+++ b/org.eclipse.tm.terminal.serial/README.txt
@@ -1,9 +1,9 @@
 Important note:
 ---------------
-This README is for terminal.serial version 0.9.100 and later, corresponding
+This README is for terminal.serial version 1.0.0 and later, corresponding
 to RSE downloads after 2.0M4. Instructions for previous versions (using
 Sun javacomm / javax.comm package instead of gnu.io) are still available from
-http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.serial/README.txt?root=DSDP_Project&view=markup&pathrev=R1_0_1  
+http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.serial/README.txt?root=DSDP_Project&view=markup&pathrev=R1_0_1
 
 
 Prerequisites:
@@ -11,16 +11,18 @@ Prerequisites:
 In order to compile and run this plugin, RXTX has to be installed.
 There are two options: Either installing RXTX as an Eclipse plugin,
 or installing RXTX as a JVM extension. For installation as plugin,
-you can download a ZIP archive or use the Update Manager.
+you can download a ZIP archive or use the Update Manager; if an
+Eclipse plugin is not available for your Platform, you'll need
+to install RXTX into the JVM (option B, below).
+
 In either case, once RXTX is installed, you'll need to quit and 
 re-start Eclipse PDE in order to recompute the classpath.
 
 
 Option A.1: Installation as an Eclipse Plugin via Update Manager:
 -----------------------------------------------------------------
-* In Eclipse, choose Help > Software Updates > Find and Install
-  - Search for New Features to Install, Next
-  - New Remote Site: 
+* In Eclipse, choose Help > Software Updates...
+  - Add New Remote Site: 
        Name = RXTX
        URL  = http://rxtx.qbang.org/eclipse/
   - Finish, select proper version, Install All
@@ -30,7 +32,9 @@ Option A.2: Installation as an Eclipse Plugin via Download:
 -----------------------------------------------------------
 * Download RXTX SDK or Runtime ZIP from
      http://rxtx.qbang.org/eclipse/downloads/
-  and extract it into your Eclipse installation.
+  and extract it into your Eclipse installation. The download
+  link mentioned also has a README with version and licensing
+  information.
 
 
 Option B: Installation as a JVM Extension:
@@ -47,8 +51,14 @@ Option B: Installation as a JVM Extension:
   http://users.frii.com/jarvi/rxtx/download.html
 
 
+For help, contact the RXTX mailing list available via the
+RXTX website at http://www.rxtx.org or see the notes on
+https://bugs.eclipse.org/bugs/show_bug.cgi?id=175336
+
+
 Changelog:
 ----------
+2.0.1 - Revised Update Site text to comply with P2 in Eclipse 3.4
 1.0.1 - Added options for installing RXTX as an Eclipse Plugin
 0.9.100 - switched from Sun javax.comm to rxtx gnu.io for serial support
 0.9.0   - first version
\ No newline at end of file
diff --git a/org.eclipse.tm.terminal.serial/src/org/eclipse/tm/internal/terminal/serial/SerialMessages.properties b/org.eclipse.tm.terminal.serial/src/org/eclipse/tm/internal/terminal/serial/SerialMessages.properties
index 79f33b31b81..e12c88fe31d 100644
--- a/org.eclipse.tm.terminal.serial/src/org/eclipse/tm/internal/terminal/serial/SerialMessages.properties
+++ b/org.eclipse.tm.terminal.serial/src/org/eclipse/tm/internal/terminal/serial/SerialMessages.properties
@@ -25,18 +25,19 @@ PARITY                    = Parity
 FLOWCONTROL               = Flow Control
 TIMEOUT                   = Timeout (sec)
 ERROR_LIBRARY_NOT_INSTALLED = The RXTX library has not been installed properly! \n\
+\n\
 Installation:\n\
 -------------\n\
-* Get RXTX binaries from\n\
-    ftp://ftp.qbang.org/pub/rxtx/rxtx-2.1-7-bins-r2.zip\n\
-* Copy RXTXcomm.jar into $JRE/lib/ext\n\
-* Copy the native libs for your Platform (*.so, *.jnilib, *.dll)\n\
-    into the respective native lib folder of your RSE \n\
-* More installation instructions are at\n\
-    http://rxtx.qbang.org/wiki/index.php/Main_Page\n\
-* More downloads for other platforms (currently about 30)\n\
-  are available from the "ToyBox" link on\n\
-    http://users.frii.com/jarvi/rxtx/download.html
+* Either (a) Use Help > Software Updates, Add Site and install from:\n\
+\ \ \ http://rxtx.qbang.org/eclipse/\n\
+* Or (b) Download and install RXTX for Eclipse from:\n\
+\ \ \ http://rxtx.qbang.org/eclipse/downloads/\n\
+\n\
+For other Platforms, more info and help see\n\
+\ \ \ http://www.rxtx.org/\n\
+\ \ \ https://bugs.eclipse.org/bugs/show_bug.cgi?id=175336#c6\n\
+\n\
+This message is also available in your Error Log for Copy & Paste.
 
 # Port Ownership Handling
 PORT_IN_USE       = Serial port \''{0}\'' is currently in use by {1}\!\nDo you want to try and steal the port?
diff --git a/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Logger.java b/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Logger.java
index a45b7fa61d5..debec453f73 100644
--- a/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Logger.java
+++ b/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Logger.java
@@ -1,14 +1,14 @@
 /*******************************************************************************
  * Copyright (c) 2005, 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials 
- * are 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: 
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
  * Fran Litterio (Wind River) - initial API and implementation
  * Ted Williams (Wind River) - refactored into org.eclipse namespace
- * Michael Scharf (Wind River) - split into core, view and connector plugins 
+ * Michael Scharf (Wind River) - split into core, view and connector plugins
  * Martin Oberhuber (Wind River) - fixed copyright headers and beautified
  *******************************************************************************/
 package org.eclipse.tm.internal.terminal.provisional.api;
@@ -26,12 +26,12 @@ import org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin;
  * called from both class and instance methods. To use this class, write code
  * like this:
  * <p>
- * 
+ *
  * <pre>
  * Logger.log(&quot;something has happened&quot;);
  * Logger.log(&quot;counter is &quot; + counter);
  * </pre>
- * 
+ *
  * @author Fran Litterio <francis.litterio@windriver.com>
  * <p>
  * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
@@ -72,10 +72,10 @@ public final class Logger {
 			}
 		}
 	}
-	
+
 	/**
 	 * Encodes a String such that non-printable control characters are
-	 * converted into user-readable escape sequences for logging. 
+	 * converted into user-readable escape sequences for logging.
 	 * @param message String to encode
 	 * @return encoded String
 	 */
@@ -86,38 +86,38 @@ public final class Logger {
 			char c=message.charAt(i);
 			switch(c) {
 				case '\\':
-				case '\'': 
+				case '\'':
 					buf.append('\\'); buf.append(c); encoded=true;
 					break;
 				case '\r':
-					buf.append('\\'); buf.append('r'); encoded=true; 
+					buf.append('\\'); buf.append('r'); encoded=true;
 					break;
 				case '\n':
-					buf.append('\\'); buf.append('n'); encoded=true; 
+					buf.append('\\'); buf.append('n'); encoded=true;
 					break;
 				case '\t':
-					buf.append('\\'); buf.append('t'); encoded=true; 
+					buf.append('\\'); buf.append('t'); encoded=true;
 					break;
 				case '\f':
-					buf.append('\\'); buf.append('f'); encoded=true; 
+					buf.append('\\'); buf.append('f'); encoded=true;
 					break;
 				case '\b':
-					buf.append('\\'); buf.append('b'); encoded=true; 
+					buf.append('\\'); buf.append('b'); encoded=true;
 					break;
 				default:
 					if (c <= '\u000f') {
-						buf.append('\\'); buf.append('x'); buf.append('0'); 
-						buf.append(Integer.toHexString(c)); 
+						buf.append('\\'); buf.append('x'); buf.append('0');
+						buf.append(Integer.toHexString(c));
 						encoded=true;
 					} else if (c>=' ' && c<'\u007f') {
 						buf.append(c);
 					} else if (c <= '\u00ff') {
-							buf.append('\\'); buf.append('x'); 
-							buf.append(Integer.toHexString(c)); 
+							buf.append('\\'); buf.append('x');
+							buf.append(Integer.toHexString(c));
 							encoded=true;
 					} else {
 						buf.append('\\'); buf.append('u');
-						if (c<='\u0fff') { 
+						if (c<='\u0fff') {
 							buf.append('0');
 						}
 						buf.append(Integer.toHexString(c));
@@ -130,7 +130,7 @@ public final class Logger {
 		}
 		return message;
 	}
-	
+
 	/**
 	 * Checks if logging is enabled.
 	 * @return true if logging is enabled.
@@ -142,7 +142,7 @@ public final class Logger {
 	/**
 	 * Logs the specified message. Do not append a newline to parameter
 	 * <i>message</i>. This method does that for you.
-	 * 
+	 *
      * @param message           A String containing the message to log.
 	 */
 	public static final void log(String message) {
@@ -168,11 +168,14 @@ public final class Logger {
 	 */
 	public static final void logException(Exception ex) {
 		// log in eclipse error log
-		if(TerminalPlugin.getDefault()!=null)
+		if (TerminalPlugin.getDefault() != null) {
 			TerminalPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, TerminalPlugin.PLUGIN_ID, IStatus.OK, ex.getMessage(), ex));
+		} else {
+			ex.printStackTrace();
+		}
+		// Additional Tracing for debug purposes:
 		// Read my own stack to get the class name, method name, and line number
-		// of
-		// where this method was called.
+		// of where this method was called
 		if(logStream!=null) {
 			StackTraceElement caller = new Throwable().getStackTrace()[1];
 			int lineNumber = caller.getLineNumber();
@@ -190,8 +193,6 @@ public final class Logger {
 					+ "." + methodName + ":" + lineNumber + ": " + //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
 					"Caught exception: " + ex); //$NON-NLS-1$
 			ex.printStackTrace(tmpStream);
-		} else {
-			ex.printStackTrace();
 		}
 	}
 }