checkstyle passes
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@39 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java b/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java
index ed20a30..bb52b54 100644
--- a/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java
+++ b/dev/linux/src/com/google/gwt/dev/BootStrapPlatform.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev;
/**
diff --git a/dev/linux/src/com/google/gwt/dev/shell/moz/BrowserWidgetMoz.java b/dev/linux/src/com/google/gwt/dev/shell/moz/BrowserWidgetMoz.java
index 499511a..92bd41e 100644
--- a/dev/linux/src/com/google/gwt/dev/shell/moz/BrowserWidgetMoz.java
+++ b/dev/linux/src/com/google/gwt/dev/shell/moz/BrowserWidgetMoz.java
@@ -22,10 +22,6 @@
private class ExternalObjectImpl implements ExternalObject {
- public int resolveReference(String ident) {
- return LowLevelMoz.JSVAL_VOID;
- }
-
public boolean gwtOnLoad(int scriptObject, String moduleName) {
try {
if (moduleName == null) {
@@ -38,7 +34,7 @@
// Attach a new ModuleSpace to make it programmable.
//
ModuleSpaceHost msh = getHost().createModuleSpaceHost(
- BrowserWidgetMoz.this, moduleName);
+ BrowserWidgetMoz.this, moduleName);
ModuleSpace moduleSpace = new ModuleSpaceMoz(msh, scriptObject);
attachModuleSpace(moduleName, moduleSpace);
return true;
@@ -48,21 +44,28 @@
// things like NoClassDefFoundError.
//
getHost().getLogger().log(TreeLogger.ERROR,
- "Failure to load module '" + moduleName + "'", e);
+ "Failure to load module '" + moduleName + "'", e);
return false;
}
}
+
+ public int resolveReference(String ident) {
+ return LowLevelMoz.JSVAL_VOID;
+ }
}
public BrowserWidgetMoz(Shell shell, BrowserWidgetHost host) {
super(shell, host);
// Expose a 'window.external' object factory. The created object's
- // gwtOnLoad() method will be called when a hosted mode application's wrapper
+ // gwtOnLoad() method will be called when a hosted mode application's
+ // wrapper
// HTML is done loading.
//
final ExternalFactory externalFactory = new ExternalFactory() {
+ private ExternalObject externalObject = null;
+
public ExternalObject createExternalObject() {
if (externalObject == null) {
externalObject = new ExternalObjectImpl();
@@ -71,8 +74,8 @@
}
public boolean matchesDOMWindow(int domWindow) {
- nsIWebBrowser webBrowser = (nsIWebBrowser) LowLevel
- .snatchFieldObjectValue(browser.getClass(), browser, "webBrowser");
+ nsIWebBrowser webBrowser = (nsIWebBrowser) LowLevel.snatchFieldObjectValue(
+ browser.getClass(), browser, "webBrowser");
int[] aContentDOMWindow = new int[1];
webBrowser.GetContentDOMWindow(aContentDOMWindow);
if (aContentDOMWindow[0] == domWindow) {
@@ -81,8 +84,6 @@
return false;
}
- private ExternalObject externalObject = null;
-
};
LowLevelMoz.registerExternalFactory(externalFactory);
diff --git a/dev/linux/src/com/google/gwt/dev/shell/moz/CheckForUpdatesMoz.java b/dev/linux/src/com/google/gwt/dev/shell/moz/CheckForUpdatesMoz.java
index 4261f53..d42ceb1 100644
--- a/dev/linux/src/com/google/gwt/dev/shell/moz/CheckForUpdatesMoz.java
+++ b/dev/linux/src/com/google/gwt/dev/shell/moz/CheckForUpdatesMoz.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.moz;
import com.google.gwt.dev.shell.CheckForUpdates;
diff --git a/dev/linux/src/com/google/gwt/dev/shell/moz/GeckoDispatchAdapter.java b/dev/linux/src/com/google/gwt/dev/shell/moz/GeckoDispatchAdapter.java
index 7265b20..c6d6252 100644
--- a/dev/linux/src/com/google/gwt/dev/shell/moz/GeckoDispatchAdapter.java
+++ b/dev/linux/src/com/google/gwt/dev/shell/moz/GeckoDispatchAdapter.java
@@ -19,18 +19,11 @@
*/
class GeckoDispatchAdapter implements DispatchObject {
- /**
- * This constructor initializes a dispatcher, around a particular instance.
- *
- * @param cl this class's classLoader
- * @param aScriptObject the execution iframe's window
- * @param target the object being wrapped as an IDispatch
- */
- GeckoDispatchAdapter(CompilingClassLoader cl, int aScriptObject, Object target) {
- javaDispatch = new JavaDispatchImpl(cl, target);
- classLoader = cl;
- scriptObject = aScriptObject;
- }
+ private final CompilingClassLoader classLoader;
+
+ private final JavaDispatch javaDispatch;
+
+ private final int scriptObject;
/**
* This constructor initializes as the static dispatcher, which handles only
@@ -45,6 +38,19 @@
scriptObject = aScriptObject;
}
+ /**
+ * This constructor initializes a dispatcher, around a particular instance.
+ *
+ * @param cl this class's classLoader
+ * @param aScriptObject the execution iframe's window
+ * @param target the object being wrapped as an IDispatch
+ */
+ GeckoDispatchAdapter(CompilingClassLoader cl, int aScriptObject, Object target) {
+ javaDispatch = new JavaDispatchImpl(cl, target);
+ classLoader = cl;
+ scriptObject = aScriptObject;
+ }
+
public int getField(String name) {
int dispId = classLoader.getDispId(name);
if (dispId < 0) {
@@ -85,8 +91,4 @@
field.getType(), value);
javaDispatch.setFieldValue(dispId, val);
}
-
- private final CompilingClassLoader classLoader;
- private final JavaDispatch javaDispatch;
- private final int scriptObject;
}
diff --git a/dev/linux/src/com/google/gwt/dev/shell/moz/HandleMoz.java b/dev/linux/src/com/google/gwt/dev/shell/moz/HandleMoz.java
index 8a46b50..c5bc609 100644
--- a/dev/linux/src/com/google/gwt/dev/shell/moz/HandleMoz.java
+++ b/dev/linux/src/com/google/gwt/dev/shell/moz/HandleMoz.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.moz;
import com.google.gwt.dev.shell.Handle;
@@ -10,16 +24,20 @@
new HandleMoz();
}
+ public static Object createHandle(Class type, int ptr) {
+ return Handle.createHandle(type, ptr);
+ }
+
+ public static int getJSObjectFromHandle(Object o) {
+ return LowLevelMoz.unwrapJSObject(getPtrFromHandle(o));
+ }
+
/**
* Not instantiable.
*/
private HandleMoz() {
}
- public static Object createHandle(Class type, int ptr) {
- return Handle.createHandle(type, ptr);
- }
-
protected void lockPtr(int ptr) {
SwtGeckoGlue.addRefInt(ptr);
}
@@ -28,8 +46,4 @@
SwtGeckoGlue.releaseInt(ptr);
}
- public static int getJSObjectFromHandle(Object o) {
- return LowLevelMoz.unwrapJSObject(getPtrFromHandle(o));
- }
-
}
diff --git a/dev/linux/src/com/google/gwt/dev/shell/moz/LowLevelMoz.java b/dev/linux/src/com/google/gwt/dev/shell/moz/LowLevelMoz.java
index f373803..5a35e2d 100644
--- a/dev/linux/src/com/google/gwt/dev/shell/moz/LowLevelMoz.java
+++ b/dev/linux/src/com/google/gwt/dev/shell/moz/LowLevelMoz.java
@@ -400,7 +400,8 @@
/**
* @param scriptObject An opaque handle to the script frame window
- * @param dispObj the DispatchMethod to wrap
+ * @param name the name of the function to be wrapped
+ * @param dispMeth the DispatchMethod to wrap
* @return the wrapped method as a jsval JSObject
*/
public static int wrapFunction(int scriptObject, String name,
diff --git a/dev/linux/src/com/google/gwt/dev/shell/moz/MethodDispatch.java b/dev/linux/src/com/google/gwt/dev/shell/moz/MethodDispatch.java
index bb14c4d..8c2521a 100644
--- a/dev/linux/src/com/google/gwt/dev/shell/moz/MethodDispatch.java
+++ b/dev/linux/src/com/google/gwt/dev/shell/moz/MethodDispatch.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.moz;
import com.google.gwt.dev.shell.CompilingClassLoader;
@@ -14,6 +28,12 @@
*/
class MethodDispatch implements DispatchMethod {
+ private final CompilingClassLoader classLoader;
+
+ private final Method method;
+
+ private final int scriptObject;
+
public MethodDispatch(CompilingClassLoader classLoader, Method method,
int scriptObject) {
this.scriptObject = scriptObject;
@@ -64,8 +84,4 @@
return LowLevelMoz.JSVAL_VOID;
}
}
-
- private final CompilingClassLoader classLoader;
- private final Method method;
- private final int scriptObject;
}
\ No newline at end of file
diff --git a/dev/linux/src/com/google/gwt/dev/shell/moz/ModuleSpaceMoz.java b/dev/linux/src/com/google/gwt/dev/shell/moz/ModuleSpaceMoz.java
index f50d6fd..8e90c1c 100644
--- a/dev/linux/src/com/google/gwt/dev/shell/moz/ModuleSpaceMoz.java
+++ b/dev/linux/src/com/google/gwt/dev/shell/moz/ModuleSpaceMoz.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.moz;
import com.google.gwt.dev.shell.ModuleSpace;
@@ -11,6 +25,10 @@
*/
public class ModuleSpaceMoz extends ModuleSpace {
+ private DispatchObject staticDispatch;
+
+ private final int window;
+
/**
* Constructs a browser interface for use with a Mozilla global window object.
*/
@@ -38,8 +56,7 @@
}
public void exceptionCaught(int number, String name, String message) {
- RuntimeException thrown = (RuntimeException) sThrownJavaExceptionObject
- .get();
+ RuntimeException thrown = (RuntimeException) sThrownJavaExceptionObject.get();
// See if the caught exception is null (thus thrown by us)
if (thrown != null) {
@@ -51,7 +68,7 @@
}
sCaughtJavaExceptionObject.set(createJavaScriptException(
- getIsolatedClassLoader(), name, message));
+ getIsolatedClassLoader(), name, message));
}
public boolean invokeNativeBoolean(String name, Object jthis, Class[] types,
@@ -159,20 +176,19 @@
}
protected void initializeStaticDispatcher() {
- staticDispatch = new GeckoDispatchAdapter(getIsolatedClassLoader(),
- window);
+ staticDispatch = new GeckoDispatchAdapter(getIsolatedClassLoader(), window);
// Define the static dispatcher for use by JavaScript.
//
createNative("initializeStaticDispatcher", 0, "__defineStatic",
- new String[]{"__arg0"}, "window.__static = __arg0;");
- invokeNativeVoid("__defineStatic", null, new Class[]{Object.class},
- new Object[]{staticDispatch});
+ new String[] {"__arg0"}, "window.__static = __arg0;");
+ invokeNativeVoid("__defineStatic", null, new Class[] {Object.class},
+ new Object[] {staticDispatch});
}
int wrapObjectAsJSObject(Object o) {
return SwtGeckoGlue.wrapObjectAsJSObject(getIsolatedClassLoader(), window,
- o);
+ o);
}
/**
@@ -196,7 +212,7 @@
int argv[] = new int[argc];
for (int i = 0; i < argc; ++i) {
argv[i] = SwtGeckoGlue.convertObjectToJSVal(window,
- getIsolatedClassLoader(), types[i], args[i]);
+ getIsolatedClassLoader(), types[i], args[i]);
}
int result = LowLevelMoz.invoke(window, name, jsthis, argv);
@@ -214,8 +230,4 @@
throw thrown;
}
- private DispatchObject staticDispatch;
-
- private final int window;
-
}
diff --git a/dev/linux/src/com/google/gwt/dev/shell/moz/SwtGeckoGlue.java b/dev/linux/src/com/google/gwt/dev/shell/moz/SwtGeckoGlue.java
index fdd5a4b..46b8e29 100644
--- a/dev/linux/src/com/google/gwt/dev/shell/moz/SwtGeckoGlue.java
+++ b/dev/linux/src/com/google/gwt/dev/shell/moz/SwtGeckoGlue.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.moz;
import com.google.gwt.dev.shell.CompilingClassLoader;
@@ -42,93 +56,6 @@
}
/**
- * Wrapper for XPCOM's nsISupports::Release().
- */
- public static int releaseInt(int nsISupports) {
- ensureMethodsInitialized();
- Throwable rethrow = null;
- try {
- Object retVal = XPCOMVtblCall.invoke(null, new Object[] {
- new Integer(2), new Integer(nsISupports)});
- return ((Integer) retVal).intValue();
- } catch (IllegalArgumentException e) {
- rethrow = e;
- } catch (IllegalAccessException e) {
- rethrow = e;
- } catch (InvocationTargetException e) {
- rethrow = e;
- }
- throw new RuntimeException(ERRMSG_CANNOT_INVOKE, rethrow);
- }
-
- /**
- * Converts a java object to its equivalent variant. A ClassLoader is passed
- * here so that Handles can be manipulated properly.
- */
- public static int convertObjectToJSVal(int scriptObject,
- CompilingClassLoader cl, Class type, Object o) {
- if (o == null) {
- return LowLevelMoz.JSVAL_NULL;
- }
-
- if (type.equals(String.class)) {
- return LowLevelMoz.convertString(scriptObject, (String) o);
- } else if (type.equals(boolean.class)) {
- return LowLevelMoz.convertBoolean(scriptObject,
- ((Boolean) o).booleanValue());
- } else if (type.equals(byte.class)) {
- return LowLevelMoz.convertByte(scriptObject, ((Byte) o).byteValue());
- } else if (type.equals(short.class)) {
- return LowLevelMoz.convertShort(scriptObject, ((Short) o).shortValue());
- } else if (type.equals(char.class)) {
- return LowLevelMoz.convertChar(scriptObject, ((Character) o).charValue());
- } else if (type.equals(int.class)) {
- return LowLevelMoz.convertInt(scriptObject, ((Integer) o).intValue());
- } else if (type.equals(long.class)) {
- return LowLevelMoz.convertLong(scriptObject, ((Long) o).longValue());
- } else if (type.equals(float.class)) {
- return LowLevelMoz.convertFloat(scriptObject, ((Float) o).floatValue());
- } else if (type.equals(double.class)) {
- return LowLevelMoz.convertDouble(scriptObject, ((Double) o).doubleValue());
- }
-
- // Handle
- try {
- Class jso = Class.forName(HandleMoz.HANDLE_CLASS, true, cl);
- if (jso.isAssignableFrom(type) && jso.isAssignableFrom(o.getClass())) {
- // Variant never AddRef's its contents.
- //
- return HandleMoz.getJSObjectFromHandle(o);
- }
- } catch (ClassNotFoundException e) {
- // Ignore the exception, if we can't find the class then obviously we
- // don't have to worry about o being one
- }
-
- // Fallthrough case: Object.
- //
- return wrapObjectAsJSObject(cl, scriptObject, o);
- }
-
- /**
- * Wraps a Java object as a JSObject.
- */
- public static int wrapObjectAsJSObject(CompilingClassLoader cl,
- int scriptObject, Object jthis) {
- if (jthis == null) {
- return LowLevelMoz.JSVAL_NULL;
- }
-
- DispatchObject dispObj;
- if (jthis instanceof DispatchObject) {
- dispObj = (DispatchObject) jthis;
- } else {
- dispObj = new GeckoDispatchAdapter(cl, scriptObject, jthis);
- }
- return LowLevelMoz.wrapDispatch(scriptObject, dispObj);
- }
-
- /**
* Try to convert based on the Java method parameter type.
*/
public static Object convertJSValToObject(int scriptObject, Class paramType,
@@ -198,28 +125,90 @@
}
/**
- * Decides what to do with an incoming JSObject arg. Two possibilities here:
- * (1) We received a true javascript object (e.g. DOM object), in which case
- * we wrap it in a Handle. (2) We received a Java object that was passed
- * through the outside world and back, in which case we use black magic to get
- * it back.
+ * Converts a java object to its equivalent variant. A ClassLoader is passed
+ * here so that Handles can be manipulated properly.
*/
- private static Object translateJSObject(int scriptObject, Class type,
- int jsval) {
- if (LowLevelMoz.isWrappedDispatch(scriptObject, jsval)) {
- DispatchObject dispObj = LowLevelMoz.unwrapDispatch(scriptObject, jsval);
- return dispObj.getTarget();
+ public static int convertObjectToJSVal(int scriptObject,
+ CompilingClassLoader cl, Class type, Object o) {
+ if (o == null) {
+ return LowLevelMoz.JSVAL_NULL;
}
- int wrapper = 0;
+
+ if (type.equals(String.class)) {
+ return LowLevelMoz.convertString(scriptObject, (String) o);
+ } else if (type.equals(boolean.class)) {
+ return LowLevelMoz.convertBoolean(scriptObject,
+ ((Boolean) o).booleanValue());
+ } else if (type.equals(byte.class)) {
+ return LowLevelMoz.convertByte(scriptObject, ((Byte) o).byteValue());
+ } else if (type.equals(short.class)) {
+ return LowLevelMoz.convertShort(scriptObject, ((Short) o).shortValue());
+ } else if (type.equals(char.class)) {
+ return LowLevelMoz.convertChar(scriptObject, ((Character) o).charValue());
+ } else if (type.equals(int.class)) {
+ return LowLevelMoz.convertInt(scriptObject, ((Integer) o).intValue());
+ } else if (type.equals(long.class)) {
+ return LowLevelMoz.convertLong(scriptObject, ((Long) o).longValue());
+ } else if (type.equals(float.class)) {
+ return LowLevelMoz.convertFloat(scriptObject, ((Float) o).floatValue());
+ } else if (type.equals(double.class)) {
+ return LowLevelMoz.convertDouble(scriptObject, ((Double) o).doubleValue());
+ }
+
+ // Handle
try {
- wrapper = LowLevelMoz.wrapJSObject(scriptObject, jsval);
- return HandleMoz.createHandle(type, wrapper);
- } finally {
- // Handle should AddRef
- if (wrapper != 0) {
- releaseInt(wrapper);
+ Class jso = Class.forName(HandleMoz.HANDLE_CLASS, true, cl);
+ if (jso.isAssignableFrom(type) && jso.isAssignableFrom(o.getClass())) {
+ // Variant never AddRef's its contents.
+ //
+ return HandleMoz.getJSObjectFromHandle(o);
}
+ } catch (ClassNotFoundException e) {
+ // Ignore the exception, if we can't find the class then obviously we
+ // don't have to worry about o being one
}
+
+ // Fallthrough case: Object.
+ //
+ return wrapObjectAsJSObject(cl, scriptObject, o);
+ }
+
+ /**
+ * Wrapper for XPCOM's nsISupports::Release().
+ */
+ public static int releaseInt(int nsISupports) {
+ ensureMethodsInitialized();
+ Throwable rethrow = null;
+ try {
+ Object retVal = XPCOMVtblCall.invoke(null, new Object[] {
+ new Integer(2), new Integer(nsISupports)});
+ return ((Integer) retVal).intValue();
+ } catch (IllegalArgumentException e) {
+ rethrow = e;
+ } catch (IllegalAccessException e) {
+ rethrow = e;
+ } catch (InvocationTargetException e) {
+ rethrow = e;
+ }
+ throw new RuntimeException(ERRMSG_CANNOT_INVOKE, rethrow);
+ }
+
+ /**
+ * Wraps a Java object as a JSObject.
+ */
+ public static int wrapObjectAsJSObject(CompilingClassLoader cl,
+ int scriptObject, Object jthis) {
+ if (jthis == null) {
+ return LowLevelMoz.JSVAL_NULL;
+ }
+
+ DispatchObject dispObj;
+ if (jthis instanceof DispatchObject) {
+ dispObj = (DispatchObject) jthis;
+ } else {
+ dispObj = new GeckoDispatchAdapter(cl, scriptObject, jthis);
+ }
+ return LowLevelMoz.wrapDispatch(scriptObject, dispObj);
}
private static void ensureMethodsInitialized() {
@@ -244,4 +233,29 @@
}
}
+ /**
+ * Decides what to do with an incoming JSObject arg. Two possibilities here:
+ * (1) We received a true javascript object (e.g. DOM object), in which case
+ * we wrap it in a Handle. (2) We received a Java object that was passed
+ * through the outside world and back, in which case we use black magic to get
+ * it back.
+ */
+ private static Object translateJSObject(int scriptObject, Class type,
+ int jsval) {
+ if (LowLevelMoz.isWrappedDispatch(scriptObject, jsval)) {
+ DispatchObject dispObj = LowLevelMoz.unwrapDispatch(scriptObject, jsval);
+ return dispObj.getTarget();
+ }
+ int wrapper = 0;
+ try {
+ wrapper = LowLevelMoz.wrapJSObject(scriptObject, jsval);
+ return HandleMoz.createHandle(type, wrapper);
+ } finally {
+ // Handle should AddRef
+ if (wrapper != 0) {
+ releaseInt(wrapper);
+ }
+ }
+ }
+
}
diff --git a/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java b/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java
index c029eb7..05f9b78 100644
--- a/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java
+++ b/dev/windows/src/com/google/gwt/dev/BootStrapPlatform.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev;
/**
@@ -9,5 +23,4 @@
public static void go() {
// nothing to do
}
-
}
diff --git a/dev/windows/src/com/google/gwt/dev/shell/ie/BrowserWidgetIE6.java b/dev/windows/src/com/google/gwt/dev/shell/ie/BrowserWidgetIE6.java
index 7450308..8cefd40 100644
--- a/dev/windows/src/com/google/gwt/dev/shell/ie/BrowserWidgetIE6.java
+++ b/dev/windows/src/com/google/gwt/dev/shell/ie/BrowserWidgetIE6.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.ie;
import com.google.gwt.core.ext.TreeLogger;
@@ -42,7 +56,7 @@
// Attach a new ModuleSpace to make it programmable.
//
ModuleSpaceHost msh = getHost().createModuleSpaceHost(
- BrowserWidgetIE6.this, moduleName);
+ BrowserWidgetIE6.this, moduleName);
ModuleSpaceIE6 moduleSpace = new ModuleSpaceIE6(msh, frameWnd);
attachModuleSpace(moduleName, moduleSpace);
return true;
@@ -52,7 +66,7 @@
// things like NoClassDefFoundError.
//
getHost().getLogger().log(TreeLogger.ERROR,
- "Failure to load module '" + moduleName + "'", e);
+ "Failure to load module '" + moduleName + "'", e);
return false;
}
}
@@ -83,9 +97,9 @@
if ((flags & COM.DISPATCH_METHOD) != 0) {
// Invoke
Object[] javaParams = SwtOleGlue.convertVariantsToObjects(
- new Class[]{
- IDispatch.class, String.class, String.class, String.class},
- params, "Calling method 'gwtOnLoad'");
+ new Class[] {
+ IDispatch.class, String.class, String.class, String.class},
+ params, "Calling method 'gwtOnLoad'");
IDispatch frameWnd = (IDispatch) javaParams[0];
String moduleName = (String) javaParams[1];
@@ -97,7 +111,7 @@
// property get on the method itself
try {
Method gwtOnLoadMethod = getClass().getMethod("gwtOnLoad",
- new Class[]{IDispatch.class, String.class});
+ new Class[] {IDispatch.class, String.class});
IDispatchImpl funcObj = new MethodDispatch(null, gwtOnLoadMethod);
IDispatch disp = new IDispatch(funcObj.getAddress());
disp.AddRef();
diff --git a/dev/windows/src/com/google/gwt/dev/shell/ie/COMObjectProxy.java b/dev/windows/src/com/google/gwt/dev/shell/ie/COMObjectProxy.java
index 4fc180d..53bb5f2 100644
--- a/dev/windows/src/com/google/gwt/dev/shell/ie/COMObjectProxy.java
+++ b/dev/windows/src/com/google/gwt/dev/shell/ie/COMObjectProxy.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.ie;
import com.google.gwt.dev.shell.LowLevel;
@@ -40,7 +54,7 @@
// Make sure the interface isn't too big.
if (argCounts != null && argCounts.length >= MAX_METHODS_WRAPPED) {
throw new IllegalArgumentException("No more than " + MAX_METHODS_WRAPPED
- + " methods can be wrapped right now.");
+ + " methods can be wrapped right now.");
}
}
@@ -57,7 +71,7 @@
// Get the COMObject ObjectMap so that we can hijack the target's slot.
Map objectMap = (Map) LowLevel.snatchFieldObjectValue(COMObject.class,
- null, "ObjectMap");
+ null, "ObjectMap");
Integer ppVtableTarget = new Integer(target.getAddress());
// First, make sure that the target is still actually in the map.
diff --git a/dev/windows/src/com/google/gwt/dev/shell/ie/HandleIE6.java b/dev/windows/src/com/google/gwt/dev/shell/ie/HandleIE6.java
index 3038feb..95784bd 100644
--- a/dev/windows/src/com/google/gwt/dev/shell/ie/HandleIE6.java
+++ b/dev/windows/src/com/google/gwt/dev/shell/ie/HandleIE6.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.ie;
import com.google.gwt.dev.shell.Handle;
@@ -11,12 +25,6 @@
// put myself in Handle's sImpl field
new HandleIE6();
}
-
- /**
- * Not instantiable.
- */
- private HandleIE6() {
- }
public static Object createHandle(Class type, int ptr) {
return Handle.createHandle(type, ptr);
@@ -27,6 +35,12 @@
return new IDispatch(ptr);
}
+ /**
+ * Not instantiable.
+ */
+ private HandleIE6() {
+ }
+
protected void lockPtr(int ptr) {
SwtOleGlue.addRefInt(ptr);
}
diff --git a/dev/windows/src/com/google/gwt/dev/shell/ie/IDispatchImpl.java b/dev/windows/src/com/google/gwt/dev/shell/ie/IDispatchImpl.java
index 02dc773..6cc4b81 100644
--- a/dev/windows/src/com/google/gwt/dev/shell/ie/IDispatchImpl.java
+++ b/dev/windows/src/com/google/gwt/dev/shell/ie/IDispatchImpl.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.ie;
import com.google.gwt.dev.shell.CompilingClassLoader;
@@ -28,6 +42,10 @@
* An exception for wrapping bad HR's.
*/
protected static class HResultException extends Exception {
+ private int fHR;
+
+ private String fSource;
+
/**
* Constructs a standard bad HR exception.
*/
@@ -71,9 +89,6 @@
public int getHResult() {
return fHR;
}
-
- private int fHR;
- private String fSource;
}
// This one isn't defined in SWT for some reason.
@@ -83,8 +98,8 @@
Variant[] params, Method method) throws InvocationTargetException,
HResultException {
Object[] javaParams = SwtOleGlue.convertVariantsToObjects(
- method.getParameterTypes(), params, "Calling method '" + method.getName()
- + "'");
+ method.getParameterTypes(), params, "Calling method '"
+ + method.getName() + "'");
Object result = null;
try {
@@ -125,15 +140,18 @@
return SwtOleGlue.convertObjectToVariant(cl, returnType, result);
}
+ protected int refCount;
+
public IDispatchImpl() {
- super(new int[]{2, 0, 0, 1, 3, 5, 8});
+ super(new int[] {2, 0, 0, 1, 3, 5, 8});
}
-//CHECKSTYLE_OFF
+ // CHECKSTYLE_OFF
public int AddRef() {
return ++refCount;
}
-//CHECKSTYLE_ON
+
+ // CHECKSTYLE_ON
public int method0(int[] args) {
return QueryInterface(args[0], args[1]);
@@ -143,24 +161,24 @@
return AddRef();
}
- public int method2(int[] args) {
- return Release();
- }
-
// method3 GetTypeInfoCount - not implemented
// method4 GetTypeInfo - not implemented
+ public int method2(int[] args) {
+ return Release();
+ }
+
public int method5(int[] args) {
return GetIDsOfNames(args[0], args[1], args[2], args[3], args[4]);
}
public int method6(int[] args) {
return Invoke(args[0], args[1], args[2], args[3], args[4], args[5],
- args[6], args[7]);
+ args[6], args[7]);
}
-//CHECKSTYLE_OFF
+ // CHECKSTYLE_OFF
public int QueryInterface(int riid, int ppvObject) {
if (riid == 0 || ppvObject == 0) {
return COM.E_NOINTERFACE;
@@ -169,18 +187,18 @@
COM.MoveMemory(guid, riid, GUID.sizeof);
if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- COM.MoveMemory(ppvObject, new int[]{getAddress()}, 4);
+ COM.MoveMemory(ppvObject, new int[] {getAddress()}, 4);
AddRef();
return COM.S_OK;
}
if (COM.IsEqualGUID(guid, COM.IIDIDispatch)) {
- COM.MoveMemory(ppvObject, new int[]{getAddress()}, 4);
+ COM.MoveMemory(ppvObject, new int[] {getAddress()}, 4);
AddRef();
return COM.S_OK;
}
- COM.MoveMemory(ppvObject, new int[]{0}, 4);
+ COM.MoveMemory(ppvObject, new int[] {0}, 4);
return COM.E_NOINTERFACE;
}
@@ -190,7 +208,8 @@
}
return refCount;
}
-//CHECKSTYLE_ON
+
+ // CHECKSTYLE_ON
/**
* Override this method to implement GetIDsOfNames().
@@ -216,7 +235,7 @@
return variants;
}
-//CHECKSTYLE_OFF
+ // CHECKSTYLE_OFF
private final int GetIDsOfNames(int riid, int rgszNames, int cNames,
int lcid, int rgDispId) {
@@ -228,7 +247,7 @@
// Extract the requested names and build an answer array init'ed with -1.
//
String[] names = SwtOleGlue.extractStringArrayFromOleCharPtrPtr(
- rgszNames, cNames);
+ rgszNames, cNames);
int[] ids = new int[names.length];
Arrays.fill(ids, -1);
@@ -272,7 +291,7 @@
re = (RuntimeException) t;
} else {
re = new RuntimeException("Checked exception thrown into JavaScript"
- + " (web mode behavior may differ)", t);
+ + " (web mode behavior may differ)", t);
}
ex = new HResultException(re);
ModuleSpace.setThrownJavaException(re);
@@ -304,7 +323,5 @@
return COM.S_OK;
}
-//CHECKSTYLE_ON
-
- protected int refCount;
+ // CHECKSTYLE_ON
}
diff --git a/dev/windows/src/com/google/gwt/dev/shell/ie/IDispatchProxy.java b/dev/windows/src/com/google/gwt/dev/shell/ie/IDispatchProxy.java
index 7398376..5accc16 100644
--- a/dev/windows/src/com/google/gwt/dev/shell/ie/IDispatchProxy.java
+++ b/dev/windows/src/com/google/gwt/dev/shell/ie/IDispatchProxy.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.ie;
import com.google.gwt.dev.shell.CompilingClassLoader;
@@ -44,6 +58,14 @@
// A magic dispid for getting a global ref to this object.
public static final int DISPID_MAGIC_GETGLOBALREF = 0xC131FB56;
+ private final CompilingClassLoader classLoader;
+
+ private boolean isDisposed = false;
+
+ private final JavaDispatch javaDispatch;
+
+ private final int myGlobalRef;
+
/**
* This constructor initializes as the static dispatcher, which handles only
* static method calls and field references.
@@ -116,7 +138,7 @@
if ((flags & COM.DISPATCH_METHOD) != 0) {
// This is a method call.
return callMethod(classLoader, javaDispatch.getTarget(), params,
- method);
+ method);
} else if (flags == COM.DISPATCH_PROPERTYGET) {
// The function is being accessed as a property.
IDispatchImpl funcObj = new MethodDispatch(classLoader, method);
@@ -128,11 +150,11 @@
Field field = javaDispatch.getField(dispId);
if (flags == COM.DISPATCH_PROPERTYGET) {
return SwtOleGlue.convertObjectToVariant(classLoader,
- field.getType(), javaDispatch.getFieldValue(dispId));
+ field.getType(), javaDispatch.getFieldValue(dispId));
} else if ((flags & (COM.DISPATCH_PROPERTYPUT | COM.DISPATCH_PROPERTYPUTREF)) != 0) {
javaDispatch.setFieldValue(dispId,
- SwtOleGlue.convertVariantToObject(field.getType(), params[0],
- "Setting field '" + field.getName() + "'"));
+ SwtOleGlue.convertVariantToObject(field.getType(), params[0],
+ "Setting field '" + field.getName() + "'"));
return new Variant();
}
}
@@ -147,12 +169,7 @@
}
System.err.println("IDispatchProxy cannot be invoked with flags: "
- + Integer.toHexString(flags));
+ + Integer.toHexString(flags));
throw new HResultException(COM.E_NOTSUPPORTED);
}
-
- private final CompilingClassLoader classLoader;
- private boolean isDisposed = false;
- private final JavaDispatch javaDispatch;
- private final int myGlobalRef;
}
diff --git a/dev/windows/src/com/google/gwt/dev/shell/ie/LowLevelIE6.java b/dev/windows/src/com/google/gwt/dev/shell/ie/LowLevelIE6.java
index 80f675b..0a95c60 100644
--- a/dev/windows/src/com/google/gwt/dev/shell/ie/LowLevelIE6.java
+++ b/dev/windows/src/com/google/gwt/dev/shell/ie/LowLevelIE6.java
@@ -23,17 +23,6 @@
class LowLevelIE6 {
/**
- * Not instantiable.
- */
- private LowLevelIE6() {
- }
-
- public static synchronized void init() {
- // Force LowLevel initialization to load gwt-ll
- LowLevel.init();
- }
-
- /**
* Does an HTTP GET that works with Windows proxy settings. Set the system
* property <code>gwt.debugLowLevelHttpGet</code> to print failure status
* codes to stderr.
@@ -57,8 +46,20 @@
}
}
+ public static synchronized void init() {
+ // Force LowLevel initialization to load gwt-ll
+ LowLevel.init();
+ }
+
// CHECKSTYLE_OFF
// out must be an array of size 1 to receive the array answer
private static native int _httpGet(String userAgent, String url, byte[][] out);
+
// CHECKSTYLE_ON
+
+ /**
+ * Not instantiable.
+ */
+ private LowLevelIE6() {
+ }
}
diff --git a/dev/windows/src/com/google/gwt/dev/shell/ie/MethodDispatch.java b/dev/windows/src/com/google/gwt/dev/shell/ie/MethodDispatch.java
index 2b76089..d4ab64e 100644
--- a/dev/windows/src/com/google/gwt/dev/shell/ie/MethodDispatch.java
+++ b/dev/windows/src/com/google/gwt/dev/shell/ie/MethodDispatch.java
@@ -32,6 +32,10 @@
*/
class MethodDispatch extends IDispatchImpl {
+ private final CompilingClassLoader classLoader;
+
+ private final Method method;
+
public MethodDispatch(CompilingClassLoader classLoader, Method method) {
this.classLoader = classLoader;
this.method = method;
@@ -86,7 +90,7 @@
* methods). If method is static, it can be null.
*/
Object jthis = SwtOleGlue.convertVariantToObject(
- method.getDeclaringClass(), params[0], "this");
+ method.getDeclaringClass(), params[0], "this");
Variant[] otherParams = new Variant[params.length - 1];
System.arraycopy(params, 1, otherParams, 0, otherParams.length);
return callMethod(classLoader, jthis, otherParams, method);
@@ -98,7 +102,4 @@
}
throw new HResultException(COM.E_NOTSUPPORTED);
}
-
- private final CompilingClassLoader classLoader;
- private final Method method;
}
\ No newline at end of file
diff --git a/dev/windows/src/com/google/gwt/dev/shell/ie/ModuleSpaceIE6.java b/dev/windows/src/com/google/gwt/dev/shell/ie/ModuleSpaceIE6.java
index 15ca94f..3638eb4 100644
--- a/dev/windows/src/com/google/gwt/dev/shell/ie/ModuleSpaceIE6.java
+++ b/dev/windows/src/com/google/gwt/dev/shell/ie/ModuleSpaceIE6.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.ie;
import com.google.gwt.core.ext.TreeLogger;
@@ -19,11 +33,11 @@
*/
public class ModuleSpaceIE6 extends ModuleSpace {
-//CHECKSTYLE_OFF
+ // CHECKSTYLE_OFF
private static int CODE(int hresult) {
return hresult & 0xFFFF;
}
-//CHECKSTYLE_ON
+ // CHECKSTYLE_ON
private Variant fStaticDispatch;
@@ -55,8 +69,8 @@
}
} catch (RuntimeException e) {
throw new RuntimeException(file + "(" + line
- + "): Failed to create JSNI method with signature '" + jsniSignature
- + "'", e);
+ + "): Failed to create JSNI method with signature '" + jsniSignature
+ + "'", e);
}
}
@@ -93,14 +107,13 @@
}
public void exceptionCaught(int number, String name, String message) {
- RuntimeException thrown = (RuntimeException) sThrownJavaExceptionObject
- .get();
+ RuntimeException thrown = (RuntimeException) sThrownJavaExceptionObject.get();
// See if the caught exception matches the thrown exception
if (thrown != null) {
HResultException hre = new HResultException(thrown);
if (CODE(hre.getHResult()) == CODE(number)
- && hre.getMessage().equals(message)) {
+ && hre.getMessage().equals(message)) {
sCaughtJavaExceptionObject.set(thrown);
sThrownJavaExceptionObject.set(null);
return;
@@ -108,7 +121,7 @@
}
sCaughtJavaExceptionObject.set(createJavaScriptException(
- getIsolatedClassLoader(), name, message));
+ getIsolatedClassLoader(), name, message));
}
public boolean invokeNativeBoolean(String name, Object jthis, Class[] types,
@@ -205,8 +218,8 @@
return null;
}
- return HandleIE6.createHandle(returnType, result.getDispatch()
- .getAddress());
+ return HandleIE6.createHandle(returnType,
+ result.getDispatch().getAddress());
} finally {
if (result != null) {
result.dispose();
@@ -255,7 +268,7 @@
return null;
} else {
return SwtOleGlue.convertVariantToObject(Object.class, result,
- "Returning from method '" + name + "'");
+ "Returning from method '" + name + "'");
}
} finally {
if (result != null) {
@@ -321,13 +334,13 @@
// Define the static dispatcher for use by JavaScript.
//
createNative("initializeStaticDispatcher", 0, "__defineStatic",
- new String[]{"__arg0"}, "window.__static = __arg0;");
- invokeNativeVoid("__defineStatic", null, new Class[]{Variant.class},
- new Object[]{fStaticDispatch});
+ new String[] {"__arg0"}, "window.__static = __arg0;");
+ invokeNativeVoid("__defineStatic", null, new Class[] {Variant.class},
+ new Object[] {fStaticDispatch});
}
private Variant execute(OleAutomation window, String code) {
- int[] dispIds = window.getIDsOfNames(new String[]{"execScript", "code"});
+ int[] dispIds = window.getIDsOfNames(new String[] {"execScript", "code"});
Variant[] vArgs = new Variant[1];
vArgs[0] = new Variant(code);
int[] namedArgs = new int[1];
@@ -337,7 +350,7 @@
if (result == null) {
String lastError = window.getLastError();
throw new RuntimeException("Error (" + lastError
- + ") executing JavaScript:\n" + code);
+ + ") executing JavaScript:\n" + code);
}
return result;
}
@@ -365,25 +378,24 @@
//
int len = args.length;
vArgs = new Variant[len + 1];
- vArgs[0] = SwtOleGlue
- .wrapObjectAsVariant(getIsolatedClassLoader(), jthis);
+ vArgs[0] = SwtOleGlue.wrapObjectAsVariant(getIsolatedClassLoader(), jthis);
for (int i = 0; i < len; ++i) {
vArgs[i + 1] = SwtOleGlue.convertObjectToVariant(
- getIsolatedClassLoader(), types[i], args[i]);
+ getIsolatedClassLoader(), types[i], args[i]);
}
// Get the function object and its 'call' method.
//
- int[] ids = fWindow.getIDsOfNames(new String[]{name});
+ int[] ids = fWindow.getIDsOfNames(new String[] {name});
if (ids == null) {
throw new RuntimeException(
- "Could not find a native method with the signature '" + name + "'");
+ "Could not find a native method with the signature '" + name + "'");
}
int functionId = ids[0];
funcObjVar = fWindow.getProperty(functionId);
funcObj = funcObjVar.getAutomation();
- int callDispId = funcObj.getIDsOfNames(new String[]{"call"})[0];
+ int callDispId = funcObj.getIDsOfNames(new String[] {"call"})[0];
// Invoke it and return the result.
//
@@ -393,19 +405,21 @@
if (result.getType() == OLE.VT_EMPTY) {
// Function was required to return something.
//
- throw new RuntimeException("JavaScript method '" + name
- + "' returned 'undefined'. This can happen either because of a "
- + "missing return statement, or explicitly returning a value "
- + "of 'undefined' (e.g. 'return element[nonexistent property]')");
+ throw new RuntimeException(
+ "JavaScript method '"
+ + name
+ + "' returned 'undefined'. This can happen either because of a "
+ + "missing return statement, or explicitly returning a value "
+ + "of 'undefined' (e.g. 'return element[nonexistent property]')");
}
} else {
if (result.getType() != OLE.VT_EMPTY) {
// Function is not allowed to return something.
//
getLogger().log(
- TreeLogger.WARN,
- "JavaScript method '" + name
- + "' is not supposed to return a value", null);
+ TreeLogger.WARN,
+ "JavaScript method '" + name
+ + "' is not supposed to return a value", null);
}
}
return result;
diff --git a/dev/windows/src/com/google/gwt/dev/shell/ie/OS2.java b/dev/windows/src/com/google/gwt/dev/shell/ie/OS2.java
index 2cd1877..f65f872 100644
--- a/dev/windows/src/com/google/gwt/dev/shell/ie/OS2.java
+++ b/dev/windows/src/com/google/gwt/dev/shell/ie/OS2.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.ie;
/**
diff --git a/dev/windows/src/com/google/gwt/dev/shell/ie/SwtOleGlue.java b/dev/windows/src/com/google/gwt/dev/shell/ie/SwtOleGlue.java
index 652582b..09f74e3 100644
--- a/dev/windows/src/com/google/gwt/dev/shell/ie/SwtOleGlue.java
+++ b/dev/windows/src/com/google/gwt/dev/shell/ie/SwtOleGlue.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.shell.ie;
import com.google.gwt.dev.shell.CompilingClassLoader;
@@ -243,6 +257,11 @@
COMObjectProxy webSiteProxy = new COMObjectProxy(new int[] {
2, 0, 0, 4, 1, 5, 0, 0, 1, 1, 1, 3, 3, 2, 2, 1, 3, 2}) {
+ {
+ // make sure we hold onto a ref on the external object
+ external.AddRef();
+ }
+
public int method15(int[] args) {
// GetExternal() is method 15.
//
@@ -257,9 +276,9 @@
return result;
}
-//CHECKSTYLE_OFF
+ // CHECKSTYLE_OFF
int GetExternal(int ppDispatch) {
-//CHECKSTYLE_ON
+ // CHECKSTYLE_ON
if (ppDispatch != 0) {
try {
// Return the 'external' object.
@@ -276,11 +295,6 @@
}
}
- {
- // make sure we hold onto a ref on the external object
- external.AddRef();
- }
-
};
// Interpose the proxy in front of the browser's iDocHostUiHandler.