summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Wilson <malice>2001-09-28 19:37:18 +0000
committerMike Wilson <malice>2001-09-28 19:37:18 +0000
commitea98401c38a92737337a27f0e234598003de6843 (patch)
treefbf4c1dd0fb58240d6d3dcf63739c51e0364364b
parent3245a6af48e12a9be1044b4b6a9ed7134b225205 (diff)
downloadeclipse.platform.swt-ea98401c38a92737337a27f0e234598003de6843.tar.gz
eclipse.platform.swt-ea98401c38a92737337a27f0e234598003de6843.tar.xz
eclipse.platform.swt-ea98401c38a92737337a27f0e234598003de6843.zip
*** empty log message ***
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java35
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TypedEvent.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoader.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderEvent.java3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java11
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java10
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/CloneableCompatability.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatability.java93
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatability.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatability.java92
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java6
17 files changed, 241 insertions, 50 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java
index 92ba747e51..109d2dab6b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/motif/org/eclipse/swt/printing/Printer.java
@@ -378,7 +378,7 @@ public Point getDPI() {
OS.memmove(buffer, pool, length);
OS.XtFree(pool);
int n = 0;
- while (!Character.isWhitespace((char)buffer[n]) && n < buffer.length) n++;
+ while (!Compatability.isWhitespace((char)buffer[n]) && n < buffer.length) n++;
resolution = new String(buffer, 0, n);
}
if (resolution.length() != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java
index 5f58b97556..f91333a713 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java
@@ -183,7 +183,7 @@ private static String[] getExtensions( Display display ) {
Vector mimeExts = (Vector) mimeInfo.get( mimeType );
for (int index = 0; index < mimeExts.size(); index++){
if (!extensions.contains( mimeExts.elementAt( index ) )) {
- extensions.add( mimeExts.elementAt( index ) );
+ extensions.addElement( mimeExts.elementAt( index ) );
}
}
}
@@ -237,7 +237,7 @@ private static Program[] getPrograms( Display display ) {
program.command = command;
program.extension = extension;
program.display = display;
- programs.add( program );
+ programs.addElement( program );
}
}
@@ -431,7 +431,7 @@ private static String[] parseCommand( String cmd ) {
int eIndex;
while (sIndex < cmd.length()) {
// Trim initial white space of argument.
- while (sIndex < cmd.length() && Character.isWhitespace( cmd.charAt(sIndex) )) {
+ while (sIndex < cmd.length() && Compatability.isWhitespace( cmd.charAt(sIndex) )) {
sIndex++;
}
if (sIndex < cmd.length()) {
@@ -445,11 +445,11 @@ private static String[] parseCommand( String cmd ) {
}
if (eIndex >= cmd.length()) { // the terminating quote was not found
// Add the argument as is with only one initial quote.
- args.add( cmd.substring( sIndex, eIndex ) );
+ args.addElement( cmd.substring( sIndex, eIndex ) );
}
// else add the argument, trimming off the quotes.
else {
- args.add( cmd.substring( sIndex+1, eIndex ) );
+ args.addElement( cmd.substring( sIndex+1, eIndex ) );
}
sIndex = eIndex + 1;
}
@@ -457,10 +457,10 @@ private static String[] parseCommand( String cmd ) {
// else use white space for the delimiters.
else {
eIndex = sIndex;
- while (eIndex < cmd.length() && !Character.isWhitespace( cmd.charAt(eIndex) )) {
+ while (eIndex < cmd.length() && !Compatability.isWhitespace( cmd.charAt(eIndex) )) {
eIndex++;
}
- args.add( cmd.substring( sIndex, eIndex ) );
+ args.addElement( cmd.substring( sIndex, eIndex ) );
sIndex = eIndex + 1;
}
}
@@ -524,9 +524,7 @@ static String gnome_getMimeValue(String mimeType, String key) {
}
static boolean kde_init () {
- try {
- Callback.loadLibrary("swt-kde");
- } catch (UnsatisfiedLinkError e) {
+ if (!Compatability.loadLibrary("swt-kde")) {
return false;
}
@@ -586,7 +584,7 @@ private static Hashtable kde_getMimeInfo() {
extension = kde_convertQStringAndFree( patString );
int period = extension.indexOf( '.' );
if (period != -1) {
- mimeExts.add( extension.substring( period ) );
+ mimeExts.addElement( extension.substring( period ) );
}
// Advance to the next pattern.
@@ -651,7 +649,7 @@ private static boolean launch( Display display, String fileName ) {
if (fileName == null) SWT.error( SWT.ERROR_NULL_ARGUMENT );
// If the argument appears to be a data file (it has an extension)
- int index = fileName.lastIndexOf(".");
+ int index = fileName.lastIndexOf('.');
if (index > 0) {
// Find the associated program, if one is defined.
@@ -861,12 +859,7 @@ public String toString () {
return "Program {" + name + "}";
}
static boolean gnome_init () {
- try {
- Callback.loadLibrary("swt-gnome");
- } catch (UnsatisfiedLinkError e) {
- return false;
- }
- return true;
+ return Compatability.loadLibrary("swt-gnome");
}
/* CDE - Get Attribute Value
@@ -959,7 +952,7 @@ static Hashtable cde_getDataTypeInfo() {
if (!CDE.DtDtsDataTypeIsAction( dataTypeBuf ) &&
extension != null && cde_getAction( dataTypeName ) != null) {
Vector exts = new Vector();
- exts.add( extension );
+ exts.addElement( extension );
dataTypeInfo.put( dataTypeName, exts );
}
dataType = CDE.listElementAt( dataTypeList, index++ );
@@ -1031,9 +1024,7 @@ ImageData cde_getImageData() {
* The shell created fo DtAppInitialize is kept for DtActionInvoke calls.
*/
static boolean cde_init( Display display ) {
- try {
- Callback.loadLibrary("swt-cde");
- } catch (UnsatisfiedLinkError e) {
+ if (!Compatability.loadLibrary("swt-cde")) {
return false;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TypedEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TypedEvent.java
index a862f771a4..8fb8fc22e1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TypedEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/events/TypedEvent.java
@@ -6,7 +6,7 @@ package org.eclipse.swt.events;
*/
import org.eclipse.swt.widgets.*;
-import java.util.EventObject;
+import org.eclipse.swt.internal.EventObjectCompatability;
/**
* This is the super class for all typed event classes provided
@@ -15,7 +15,7 @@ import java.util.EventObject;
*
* @see org.eclipse.swt.widgets.Event
*/
-public class TypedEvent extends EventObject {
+public class TypedEvent extends EventObjectCompatability {
/**
* the widget that issued the event
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java
index b7b1e8c927..f553ed49df 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageData.java
@@ -9,6 +9,8 @@ import java.io.*;
import java.util.*;
import org.eclipse.swt.*;
import org.eclipse.swt.internal.image.*;
+import org.eclipse.swt.internal.*;
+
/**
* Instances of this class are device-independent descriptions
@@ -26,7 +28,7 @@ import org.eclipse.swt.internal.image.*;
* @see ImageLoader
*/
-public final class ImageData implements Cloneable {
+public final class ImageData implements CloneableCompatability {
/**
* the width of the image, in pixels
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoader.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoader.java
index a892742646..5109293ebf 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoader.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoader.java
@@ -9,6 +9,7 @@ import java.io.*;
import java.util.*;
import org.eclipse.swt.*;
import org.eclipse.swt.internal.image.*;
+import org.eclipse.swt.internal.*;
/**
* Instances of this class are used to load images from,
@@ -139,7 +140,7 @@ public ImageData[] load(String filename) {
if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
InputStream stream = null;
try {
- stream = new FileInputStream(filename);
+ stream = Compatability.newFileInputStream(filename);
return load(stream);
} catch (IOException e) {
SWT.error(SWT.ERROR_IO, e);
@@ -220,7 +221,7 @@ public void save(String filename, int format) {
if (filename == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
OutputStream stream = null;
try {
- stream = new FileOutputStream(filename);
+ stream = Compatability.newFileOutputStream(filename);
} catch (IOException e) {
SWT.error(SWT.ERROR_IO, e);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderEvent.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderEvent.java
index 614a97b341..3664420cfe 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/ImageLoaderEvent.java
@@ -6,6 +6,7 @@ package org.eclipse.swt.graphics;
*/
import java.util.*;
+import org.eclipse.swt.internal.*;
/**
* Instances of this class are sent as a result of the incremental
@@ -25,7 +26,7 @@ import java.util.*;
* @see ImageLoaderListener
*/
-public class ImageLoaderEvent extends EventObject {
+public class ImageLoaderEvent extends EventObjectCompatability {
/**
* if the <code>endOfImage</code> flag is false, then this is a
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java
index 373ae3d652..40c68b5458 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/Callback.java
@@ -254,14 +254,9 @@ public static void loadLibrary (String name) {
/* No "r" until first revision */
if (REVISION > 0) newName += "r" + REVISION;
- try {
- System.loadLibrary (newName);
- } catch (UnsatisfiedLinkError e) {
- try {
- System.loadLibrary (name);
- } catch (UnsatisfiedLinkError e2) {
- throw e;
- }
+ if (!Compatability.loadLibrary (newName)) {
+ if (Compatability.loadLibrary (name))
+ SWT.error (SWT.ERROR_INVALID_ARGUMENT);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java
index 90c6f27d79..e8faf5dc72 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngChunk.java
@@ -298,7 +298,15 @@ void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
// All characters must be letters.
for (int i = 0; i < TYPE_FIELD_LENGTH; i++) {
- if (!Character.isLetter((char) type[i])) SWT.error(SWT.ERROR_INVALID_IMAGE);
+ /* MVM - CLDC changes
+ - Character.isLetter() not available
+ - note: this is also a fix as isLetter is more than just upper and lower
+ case letters, however the PNG spec says only upper or lower case letters allowed
+ */
+ //if (!Character.isLetter((char) type[i])) SWT.error(SWT.ERROR_INVALID_IMAGE);
+ if (!Character.isUpperCase((char) type[i]) && !Character.isLowerCase((char) type[i]))
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ /* MVM - CLDC changes end */
}
// The stored CRC must match the data's computed CRC.
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java
index 15be5b80cf..786241b20a 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngIhdrChunk.java
@@ -7,6 +7,7 @@ package org.eclipse.swt.internal.image;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
class PngIhdrChunk extends PngChunk {
static final int EXPECTED_DATA_LENGTH = 13;
@@ -343,7 +344,7 @@ boolean usesDirectColor() {
PaletteData createGrayscalePalette() {
int bitDepth = Math.min(getBitDepth(), 8);
- int max = (int) (Math.pow(2, bitDepth) - 1);
+ int max = (int) (Compatability.pow(2, bitDepth) - 1);
int delta = 255 / max;
int gray = 0;
RGB[] rgbs = new RGB[max + 1];
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java
index 677dbf83be..f81b53c066 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/PngPlteChunk.java
@@ -7,6 +7,7 @@ package org.eclipse.swt.internal.image;
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.internal.*;
class PngPlteChunk extends PngChunk {
@@ -71,7 +72,7 @@ void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
// Palettes cannot have more entries than 2^bitDepth
// where bitDepth is the bit depth of the image given
// in the IHDR chunk.
- if (Math.pow(2, headerChunk.getBitDepth()) < getPaletteSize()) {
+ if (Compatability.pow(2, headerChunk.getBitDepth()) < getPaletteSize()) {
SWT.error(SWT.ERROR_INVALID_IMAGE);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/CloneableCompatability.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/CloneableCompatability.java
new file mode 100644
index 0000000000..db53bc9b56
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/CloneableCompatability.java
@@ -0,0 +1,6 @@
+package org.eclipse.swt.internal;
+
+public interface CloneableCompatability {
+
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatability.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatability.java
index 583f5f7d4a..7de8d03ba8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatability.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2me/org/eclipse/swt/internal/Compatability.java
@@ -1,5 +1,8 @@
package org.eclipse.swt.internal;
+import java.io.*;
+import org.eclipse.swt.*;
+
public class Compatability {
/**
@@ -7,9 +10,6 @@ public class Compatability {
* closest to negative infinity) integer value which is
* greater than the argument.
*
- * @author OTI
- * @version initial
- *
* @param d the value to be converted
* @return the ceiling of the argument.
*/
@@ -22,5 +22,92 @@ public static double ceil (double d) {
return (double) l + 1;
}
+/** Returns the power function.
+ *
+ * @param a1
+ * @param a2
+ * @return the power
+ */
+public static int pow (int a1, int a2) {
+ int answer = 1;
+ for (int i = 1; i < a2; i++) {
+ answer = answer * a1;
+ }
+ return answer;
+}
+
+/**
+ * Loads a library if the underlying platform supports this.
+ * If not, it is assumed that the library in question was
+ * properly made available in some other fashion (that is,
+ * it returns true in this case).
+ *
+ * @param name the name of the library to load
+ * @return true if the library is available
+ */
+public static boolean loadLibrary (String name) {
+ return true;
+}
+
+/**
+ * Test if the character is a whitespace character.
+ *
+ * @param ch the character to test
+ * @return true if the character is whitespace
+ */
+public static boolean isWhitespace (char ch) {
+ return ch == ' ' || ch == '\t';
+}
+
+/**
+ * Open a file if such things are supported.
+ *
+ * @param filename the name of the file to open
+ * @return a stream on the file if it could be opened.
+ */
+public static InputStream newFileInputStream (String filename) throws IOException {
+ throw new IOException ();
}
+/**
+ * Open a file if such things are supported.
+ *
+ * @param filename the name of the file to open
+ * @return a stream on the file if it could be opened.
+ */
+public static OutputStream newFileOutputStream (String filename) throws IOException {
+ throw new IOException ();
+}
+
+/**
+ * Returns the NLS'ed message for the given argument.
+ *
+ * @param key the key to look up
+ * @return the message for the given key
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ */
+public static String getMessage(String key) {
+ String answer = key;
+
+ if (key == null) {
+ error (ERROR_NULL_ARGUMENT);
+ }
+ if (msgs == null) {
+ try {
+ msgs = ResourceBundle.getBundle("org.eclipse.swt.SWTMessages");
+ } catch (MissingResourceException ex) {
+ answer = key + " (no resource bundle)";
+ }
+ }
+ if (msgs != null) {
+ try {
+ answer = msgs.getString(key);
+ } catch (MissingResourceException ex2) {}
+ }
+ return answer;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatability.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatability.java
new file mode 100644
index 0000000000..d305881a10
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/CloneableCompatability.java
@@ -0,0 +1,6 @@
+package org.eclipse.swt.internal;
+
+public interface CloneableCompatability implements Cloneable {
+
+}
+
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatability.java b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatability.java
index a4304c28e6..206ddce48a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatability.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/common_j2se/org/eclipse/swt/internal/Compatability.java
@@ -1,5 +1,8 @@
package org.eclipse.swt.internal;
+import java.util.*;
+import java.io.*;
+
public class Compatability {
/**
@@ -17,5 +20,94 @@ public static double ceil (double d) {
return Math.ceil(d);
}
+/** Returns the power function.
+ *
+ * @param a1
+ * @param a2
+ * @return the power
+ */
+public static int pow (int a1, int a2) {
+ return Math.pow (a1, a2);
+}
+
+/**
+ * Loads a library if the underlying platform supports this.
+ * If not, it is assumed that the library in question was
+ * properly made available in some other fashion (that is,
+ * it returns true in this case).
+ *
+ * @param name the name of the library to load
+ * @return true if the library is available
+ */
+public static boolean loadLibrary (String name) {
+ try {
+ System.loadLibrary (name);
+ } catch (UnsatisfiedLinkError e) {
+ return false;
+ }
+ return true;
+}
+
+/**
+ * Test if the character is a whitespace character.
+ *
+ * @param ch the character to test
+ * @return true if the character is whitespace
+ */
+public static boolean isWhitespace (char ch) {
+ return Character.isWhitespace (ch);
+}
+
+/**
+ * Open a file if such things are supported.
+ *
+ * @param filename the name of the file to open
+ * @return a stream on the file if it could be opened.
+ */
+public static InputStream newFileInputStream (String filename) throws IOError {
+ return new FileInputStream(filename);
+}
+
+/**
+ * Open a file if such things are supported.
+ *
+ * @param filename the name of the file to open
+ * @return a stream on the file if it could be opened.
+ */
+public static OutputStream newFileOutputStream (String filename) throws IOError {
+ return new FileOutputStream(filename);
+}
+
+/**
+ * Returns the NLS'ed message for the given argument.
+ *
+ * @param key the key to look up
+ * @return the message for the given key
+ *
+ * @exception IllegalArgumentException <ul>
+ * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
+ * </ul>
+ */
+public static String getMessage(String key) {
+ String answer = key;
+
+ if (key == null) {
+ error (ERROR_NULL_ARGUMENT);
+ }
+ if (msgs == null) {
+ try {
+ msgs = ResourceBundle.getBundle("org.eclipse.swt.SWTMessages");
+ } catch (MissingResourceException ex) {
+ answer = key + " (no resource bundle)";
+ }
+ }
+ if (msgs != null) {
+ try {
+ answer = msgs.getString(key);
+ } catch (MissingResourceException ex2) {}
+ }
+ return answer;
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java
index a6af8a5afb..7405e24a79 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/GC.java
@@ -361,8 +361,8 @@ void drawImageAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHei
/* Optimization. Recalculate the src and dest rectangles so that
* only the clipping area is drawn.
*/
- rect.width = Math.max(rect.width, (int)Math.ceil(destWidth / (float)srcWidth));
- rect.height = Math.max(rect.height, (int)Math.ceil(destHeight / (float)srcHeight));
+ rect.width = Math.max(rect.width, (int)Compatability.ceil(destWidth / (float)srcWidth));
+ rect.height = Math.max(rect.height, (int)Compatability.ceil(destHeight / (float)srcHeight));
int sx1 = srcX + (((rect.x - destX) * srcWidth) / destWidth);
int sx2 = srcX + ((((rect.x + rect.width) - destX) * srcWidth) / destWidth);
int sy1 = srcY + (((rect.y - destY) * srcHeight) / destHeight);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java
index 92c4eb637f..4fda9b9620 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/CoolBar.java
@@ -350,7 +350,7 @@ void moveDown(CoolItem item, int x_root) {
/* Create a new bottom row for the item. */
Vector newRow = new Vector(10);
insertItemIntoRow(item, newRow, x_root, newRowY);
- rows.add(newRow);
+ rows.addElement(newRow);
adjustItemHeights(oldRowIndex);
return;
}
@@ -424,7 +424,7 @@ void moveUp(CoolItem item, int x_root) {
/* Create a new top row for the item. */
Vector newRow = new Vector(10);
insertItemIntoRow(item, newRow, x_root, newRowY);
- rows.add(0, newRow);
+ rows.insertElementAt(newRow, 0);
adjustItemHeights(0);
return;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java
index e4c765dca1..3d971151a2 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Display.java
@@ -1883,7 +1883,7 @@ String wrapText (String text, int fontList, int width) {
boolean noLf = lineEnd == -1;
if (noLf) lineEnd = length;
int nextStart = lineEnd + Lf.length ();
- while (lineEnd > lineStart + 1 && Character.isWhitespace (text.charAt (lineEnd - 1))) {
+ while (lineEnd > lineStart + 1 && Compatability.isWhitespace (text.charAt (lineEnd - 1))) {
lineEnd--;
}
int wordStart = lineStart, wordEnd = lineStart;
@@ -1891,13 +1891,13 @@ String wrapText (String text, int fontList, int width) {
while (i < lineEnd) {
int lastStart = wordStart, lastEnd = wordEnd;
wordStart = i;
- while (i < lineEnd && !Character.isWhitespace (text.charAt (i))) {
+ while (i < lineEnd && !Compatability.isWhitespace (text.charAt (i))) {
i++;
}
wordEnd = i - 1;
String line = text.substring (lineStart, wordEnd + 1);
int lineWidth = textWidth (line, fontList);
- while (i < lineEnd && Character.isWhitespace (text.charAt (i))) {
+ while (i < lineEnd && Compatability.isWhitespace (text.charAt (i))) {
i++;
}
if (lineWidth > width) {