mass rename and rebranding from xwt to ibex - fixed to use ixt files
[org.ibex.core.git] / src / org / ibex / Platform.java
similarity index 87%
rename from src/org/xwt/Platform.java
rename to src/org/ibex/Platform.java
index 6e76b3f..15f87a6 100644 (file)
@@ -1,12 +1,11 @@
 // Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
-package org.xwt;
+package org.ibex;
 
 import java.lang.reflect.*;
 import java.net.*;
 import java.io.*;
-import java.util.*;
-import org.xwt.js.*;
-import org.xwt.util.*;
+import org.ibex.js.*;
+import org.ibex.util.*;
 
 /** 
  *  Abstracts away the small irregularities in JVM implementations.
@@ -15,7 +14,7 @@ import org.xwt.util.*;
  *  JVM. Subclasses are provided for other VMs. Methods whose names
  *  start with an underscore are meant to be overridden by
  *  subclasses. If you create a subclass of Platform, you should put
- *  it in the org.xwt.plat package, and add code to this file's static
+ *  it in the org.ibex.plat package, and add code to this file's static
  *  block to detect the new platform.
  */
 public abstract class Platform {
@@ -27,7 +26,7 @@ public abstract class Platform {
     static boolean clipboardReadEnabled = false;       ///< true iff inside a C-v/A-v/Press3 trap handler
     static Platform platform = null;                   ///< The appropriate Platform object for this JVM
     static boolean alreadyDetectedProxy = false;       ///< true if proxy autodetection has already been run
-    static org.xwt.HTTP.Proxy cachedProxyInfo = null;  ///< the result of proxy autodetection
+    static org.ibex.HTTP.Proxy cachedProxyInfo = null;  ///< the result of proxy autodetection
     public static String build = "unknown";            ///< the current build
 
     // VM Detection Logic /////////////////////////////////////////////////////////////////////
@@ -59,9 +58,9 @@ public abstract class Platform {
                 criticalAbort("Unable to detect JVM");
             }
             
-            System.err.println(" " + os_name + " ==> org.xwt.plat." + platform_class);
+            System.err.println(" " + os_name + " ==> org.ibex.plat." + platform_class);
             try {
-                if (platform_class != null) Class.forName("org.xwt.plat." + platform_class).newInstance();
+                if (platform_class != null) Class.forName("org.ibex.plat." + platform_class).newInstance();
             } catch (InstantiationException e) {
                 throw e.getCause();
             }
@@ -70,16 +69,16 @@ public abstract class Platform {
             Log.color = term != null && term.length() != 0 && !term.equals("cygwin");
             
             try {
-                build = (String)Class.forName("org.xwt.Build").getField("build").get(null);
-                Log.diag(Platform.class, "XWT build: " + build);
+                build = (String)Class.forName("org.ibex.Build").getField("build").get(null);
+                Log.diag(Platform.class, "Ibex build: " + build);
             } catch (ClassNotFoundException cnfe) {
-                Log.warn(Platform.class, "XWT build: unknown");
+                Log.warn(Platform.class, "Ibex build: unknown");
             } catch (Exception e) {
                 Log.info(Platform.class, "exception while detecting build:");
                 Log.info(Platform.class, e);
             }
 
-            Log.diag(Platform.class, "XWT VM detection:   vendor = " + vendor);
+            Log.diag(Platform.class, "Ibex VM detection:   vendor = " + vendor);
             Log.diag(Platform.class, "                   version = " + version);
             Log.diag(Platform.class, "                        os = " + os_name + " [version " + os_version + "]");
             Log.diag(Platform.class, "                  platform = " + platform.getDescriptiveName());
@@ -100,11 +99,11 @@ public abstract class Platform {
     protected Surface _createSurface(Box b, boolean framed) { return null; }
     protected Picture _createPicture(JS r) { return null; }
     protected PixelBuffer _createPixelBuffer(int w, int h, Surface owner) { return null; }
-    protected Font.Glyph _createGlyph(org.xwt.Font f, char c) { return new DefaultGlyph(f, c); }
+    protected Font.Glyph _createGlyph(org.ibex.Font f, char c) { return new DefaultGlyph(f, c); }
 
     public static PixelBuffer createPixelBuffer(int w, int h, Surface s) { return platform._createPixelBuffer(w, h, s); }
     public static Picture createPicture(JS r) { return platform._createPicture(r); }
-    public static Font.Glyph createGlyph(org.xwt.Font f, char c) { return platform._createGlyph(f, c); }
+    public static Font.Glyph createGlyph(org.ibex.Font f, char c) { return platform._createGlyph(f, c); }
     public static Surface createSurface(Box b, boolean framed, boolean refreshable) {
         Surface ret = platform._createSurface(b, framed);
         ret.setInvisible(false);
@@ -127,7 +126,7 @@ public abstract class Platform {
     /** invoked after initialization messages have been printed; useful for additional platform detection log messages */
     protected void postInit() { }
 
-    /** the human-readable name of the key mapped to XWT's 'alt' key */
+    /** the human-readable name of the key mapped to Ibex's 'alt' key */
     public static String altKeyName() { return platform._altKeyName(); }
     protected String _altKeyName() { return "alt"; }
 
@@ -155,11 +154,11 @@ public abstract class Platform {
         platform._criticalAbort(message);
     }
 
-    /** if true, org.xwt.Surface will generate a Click automatically after a press and a release */
+    /** if true, org.ibex.Surface will generate a Click automatically after a press and a release */
     public static boolean needsAutoClick() { return platform._needsAutoClick(); }
     protected boolean _needsAutoClick() { return false; }
 
-    /** if true, org.xwt.Surface will generate a DoubleClick automatically after recieving two clicks in a short period of time */
+    /** if true, org.ibex.Surface will generate a DoubleClick automatically after recieving two clicks in a short period of time */
     public static boolean needsAutoDoubleClick() { return platform._needsAutoDoubleClick(); }
     protected boolean _needsAutoDoubleClick() { return false; }
 
@@ -169,7 +168,7 @@ public abstract class Platform {
 
     /** returns an InputStream to the builtin xwar */
     public static InputStream getBuiltinInputStream() { return platform._getBuiltinInputStream(); }
-    protected InputStream _getBuiltinInputStream() {return getClass().getClassLoader().getResourceAsStream("org/xwt/builtin.jar");}
+    protected InputStream _getBuiltinInputStream() {return getClass().getClassLoader().getResourceAsStream("org/ibex/builtin.jar");}
 
     /** returns the value of the environment variable key, or null if no such key exists */
     public static String getEnv(String key) { return platform._getEnv(key); }
@@ -206,7 +205,7 @@ public abstract class Platform {
 
     /** displays a platform-specific "open file" dialog and returns the chosen filename, or null if the user hit cancel */
     protected String _fileDialog(String suggestedFileName, boolean write) { return null; }
-    public static String fileDialog(String suggestedFileName, boolean write) throws org.xwt.js.JSExn {
+    public static String fileDialog(String suggestedFileName, boolean write) throws org.ibex.js.JSExn {
         return platform._fileDialog(suggestedFileName, write);
     }
 
@@ -225,7 +224,7 @@ public abstract class Platform {
     /** opens a new browser window */
     public static void newBrowserWindow(String url) {
         if (!(url.startsWith("https://") || url.startsWith("http://") || url.startsWith("ftp://") || url.startsWith("mailto:"))) {
-            Log.info(Platform.class, "xwt.newBrowserWindow() only supports http and https urls");
+            Log.info(Platform.class, "ibex.newBrowserWindow() only supports http and https urls");
             return;
         }
         // check the URL for well-formedness, as a defense against buffer overflow attacks
@@ -242,15 +241,15 @@ public abstract class Platform {
     }
 
     /** detects proxy settings */
-    protected synchronized org.xwt.HTTP.Proxy _detectProxy() { return null; }
-    public static synchronized org.xwt.HTTP.Proxy detectProxy() {
+    protected synchronized org.ibex.HTTP.Proxy _detectProxy() { return null; }
+    public static synchronized org.ibex.HTTP.Proxy detectProxy() {
 
         if (cachedProxyInfo != null) return cachedProxyInfo;
         if (alreadyDetectedProxy) return null;
         alreadyDetectedProxy = true;
 
         Log.info(Platform.class, "attempting environment-variable DNS proxy detection");
-        cachedProxyInfo = org.xwt.HTTP.Proxy.detectProxyViaManual();
+        cachedProxyInfo = org.ibex.HTTP.Proxy.detectProxyViaManual();
         if (cachedProxyInfo != null) return cachedProxyInfo;
 
         Log.info(Platform.class, "attempting " + platform.getClass().getName() + " proxy detection");
@@ -267,7 +266,7 @@ public abstract class Platform {
     // FEATURE: be more efficient for many of the subclasses
     public static class DefaultGlyph extends Font.Glyph {
         private Picture p = null;
-        public DefaultGlyph(org.xwt.Font f, char c) { super(f, c); }
+        public DefaultGlyph(org.ibex.Font f, char c) { super(f, c); }
         public Picture getPicture() {
             if (p == null && isLoaded) {
                 Picture p = createPicture(null);