diff options
Diffstat (limited to 'plugins/org.eclipse.jem.proxy/proxyide')
61 files changed, 0 insertions, 6735 deletions
diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEAccessibleObjectProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEAccessibleObjectProxy.java deleted file mode 100644 index 66fdfcf67..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEAccessibleObjectProxy.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - - - */ -package org.eclipse.jem.internal.proxy.ide; - -import java.lang.reflect.AccessibleObject; - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * - * @since 1.0.0 - */ -public class IDEAccessibleObjectProxy extends IDEBeanProxy implements IAccessibleObjectProxy { - - protected IDEAccessibleObjectProxy(IDEProxyFactoryRegistry aProxyFactoryRegistry) { - super(aProxyFactoryRegistry); - } - - protected IDEAccessibleObjectProxy(IDEProxyFactoryRegistry aProxyFactoryRegistry, Object anObject) { - super(aProxyFactoryRegistry, anObject); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IAccessibleObjectProxy#isAccessible() - */ - public boolean isAccessible() throws ThrowableProxy { - return ((AccessibleObject) getBean()).isAccessible(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IAccessibleObjectProxy#setAccessible(boolean) - */ - public void setAccessible(boolean flag) throws ThrowableProxy { - ((AccessibleObject) getBean()).setAccessible(flag); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IBeanProxy#getTypeProxy() - */ - public IBeanTypeProxy getTypeProxy() { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).accessibleType; - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEArrayBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEArrayBeanProxy.java deleted file mode 100644 index 1d3244667..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEArrayBeanProxy.java +++ /dev/null @@ -1,322 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; -import java.lang.reflect.*; -import java.util.Arrays; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -/** - * IDE VM version of the Array proxy - */ - -public final class IDEArrayBeanProxy extends IDEObjectBeanProxy implements IArrayBeanProxy { - - private IDEStandardBeanTypeProxyFactory fBeanTypeProxyFactory; - -IDEArrayBeanProxy(IDEProxyFactoryRegistry aRegistry, Object array,IBeanTypeProxy aType) { - super(aRegistry, array ,aType); - fBeanTypeProxyFactory = (IDEStandardBeanTypeProxyFactory)aRegistry.getBeanTypeProxyFactory(); -} - -/* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.ide.IDEBeanProxy#equals(java.lang.Object) - */ -public boolean equals(Object obj) { - if (super.equals(obj)) - return true; - if (!(obj instanceof IDEArrayBeanProxy)) - return false; - Object arrayBean = ((IDEArrayBeanProxy) obj).getBean(); - - if (getBean() == null || arrayBean == null) - return false; - Object thisArrayBean = getBean(); - Class aclass = thisArrayBean.getClass(); - Class bclass = arrayBean.getClass(); - Class acomp = aclass.getComponentType(); - Class bcomp = bclass.getComponentType(); - if (acomp.isPrimitive() || bcomp.isPrimitive()) { - if (acomp != bcomp) - return false; - if (acomp == Integer.TYPE) - return Arrays.equals((int[]) thisArrayBean, (int[]) arrayBean); - else if (acomp == Boolean.TYPE) - return Arrays.equals((boolean[]) thisArrayBean, (boolean[]) arrayBean); - else if (acomp == Long.TYPE) - return Arrays.equals((long[]) thisArrayBean, (long[]) arrayBean); - else if (acomp == Short.TYPE) - return Arrays.equals((short[]) thisArrayBean, (short[]) arrayBean); - else if (acomp == Double.TYPE) - return Arrays.equals((double[]) thisArrayBean, (double[]) arrayBean); - else if (acomp == Float.TYPE) - return Arrays.equals((float[]) thisArrayBean, (float[]) arrayBean); - else if (acomp == Character.TYPE) - return Arrays.equals((char[]) thisArrayBean, (char[]) arrayBean); - else if (acomp == Byte.TYPE) - return Arrays.equals((byte[]) thisArrayBean, (byte[]) arrayBean); - else - return false; - } else - return Arrays.equals((Object[]) thisArrayBean, (Object[]) arrayBean); -} -/** - * Get the object at the specified index. - */ -public IBeanProxy get(int index) throws ThrowableProxy { - // If the component type is primitive, we need to use the correct getter so that a valid value is returned, - // if we just used the standard get, if the type was "int" the value returned would be an java.lang.Integer. - IBeanTypeProxy compType = ((IArrayBeanTypeProxy) getTypeProxy()).getComponentType(); - if (!compType.isPrimitive()) { - // Use standard getter. - Object result = Array.get(fBean,index); - if ( result == null ) return null; - return ((IDEBeanTypeProxy)fBeanTypeProxyFactory.getBeanTypeProxy(result.getClass())).newBeanProxy(result); - } else { - // Use the correct primitive getter. - int id = ((IDEPrimitiveBeanTypeProxy)compType).getPrimitiveType(); - switch (id) { - case IDEPrimitiveBeanTypeProxy.BYTE: - return fBeanTypeProxyFactory.byteType.createByteBeanProxy(Array.getByte(fBean,index)); - case IDEPrimitiveBeanTypeProxy.BOOLEAN: - return fBeanTypeProxyFactory.booleanType.createBooleanBeanProxy(Array.getBoolean(fBean,index)); - case IDEPrimitiveBeanTypeProxy.CHAR: - return fBeanTypeProxyFactory.charType.createCharBeanProxy(Array.getChar(fBean,index)); - case IDEPrimitiveBeanTypeProxy.DOUBLE: - return fBeanTypeProxyFactory.doubleType.createDoubleBeanProxy(Array.getDouble(fBean,index)); - case IDEPrimitiveBeanTypeProxy.FLOAT: - return fBeanTypeProxyFactory.floatType.createFloatBeanProxy(Array.getFloat(fBean,index)); - case IDEPrimitiveBeanTypeProxy.INTEGER: - return fBeanTypeProxyFactory.intType.createIntegerBeanProxy(Array.getInt(fBean,index)); - case IDEPrimitiveBeanTypeProxy.LONG: - return fBeanTypeProxyFactory.longType.createLongBeanProxy(Array.getLong(fBean,index)); - case IDEPrimitiveBeanTypeProxy.SHORT: - return fBeanTypeProxyFactory.shortType.createShortBeanProxy(Array.getShort(fBean,index)); - default : - return null; // Shouldn't get here, said it was primitive, but not one we understand - } - } -} -/** - * Get the object at the specified multi-dimensional index. - * The array must be at least the number of dimensions specified, - * and each index along the way must exist. - * The number of dimensions can't be greater than the number - * of dimensions of the real object. - */ -public IBeanProxy get(int[] indexes) throws ThrowableProxy { - if (indexes.length == 1) - return get(indexes[0]); - int dims = ((IArrayBeanTypeProxy) getTypeProxy()).getDimensions(); - if (dims < indexes.length) - throw new IllegalArgumentException(); // Too many dimensions - // Get up to the next to last dimension so that we can do the appropriate final get depending upon primitive or not. - Object array = fBean; - int lastArrayDim = indexes.length - 1; - for (int i = 0; i < lastArrayDim; i++) - array = Array.get(array, indexes[i]); - - int index = indexes[lastArrayDim]; // Final array dim to retrieve - - if (dims == indexes.length) { - IBeanTypeProxy finalCompType = ((IArrayBeanTypeProxy) getTypeProxy()).getFinalComponentType(); - if (finalCompType.isPrimitive()) { - // If the component type at the specified dimension is primitive, we need to use the correct getter so that a valid value is returned, - // if we just used the standard get, if the type was "int" the value returned would be an java.lang.Integer. - int id = ((IDEPrimitiveBeanTypeProxy) finalCompType).getPrimitiveType(); - switch (id) { - case IDEPrimitiveBeanTypeProxy.BYTE : - return fBeanTypeProxyFactory.byteType.createByteBeanProxy(Array.getByte(array, index)); - case IDEPrimitiveBeanTypeProxy.BOOLEAN : - return fBeanTypeProxyFactory.booleanType.createBooleanBeanProxy(Array.getBoolean(array, index)); - case IDEPrimitiveBeanTypeProxy.CHAR : - return fBeanTypeProxyFactory.charType.createCharBeanProxy(Array.getChar(array, index)); - case IDEPrimitiveBeanTypeProxy.DOUBLE : - return fBeanTypeProxyFactory.doubleType.createDoubleBeanProxy(Array.getDouble(array, index)); - case IDEPrimitiveBeanTypeProxy.FLOAT : - return fBeanTypeProxyFactory.floatType.createFloatBeanProxy(Array.getFloat(array, index)); - case IDEPrimitiveBeanTypeProxy.INTEGER : - return fBeanTypeProxyFactory.intType.createIntegerBeanProxy(Array.getInt(array, index)); - case IDEPrimitiveBeanTypeProxy.LONG : - return fBeanTypeProxyFactory.longType.createLongBeanProxy(Array.getLong(array, index)); - case IDEPrimitiveBeanTypeProxy.SHORT : - return fBeanTypeProxyFactory.shortType.createShortBeanProxy(Array.getShort(array, index)); - default : - return null; // Shouldn't get here, said it was primitive, but not one we understand - } - } - } - - // Won't be returning a primitive, so use standard accessor - Object result = Array.get(array, index); - if (result == null) - return null; - return ((IDEBeanTypeProxy) fBeanTypeProxyFactory.getBeanTypeProxy(result.getClass())).newBeanProxy( - result); -} - -/** - * Set the object at the specified index. - */ -public void set(IBeanProxy valueProxy, int index) throws ThrowableProxy { - // If the component type is primitive, we need to use the correct getter so that a valid value is returned, - // if we just used the standard get, if the type was "int" the value returned would be an java.lang.Integer. - Object value = ((IIDEBeanProxy)valueProxy).getBean(); - Class valueClass = value.getClass(); - if (!valueClass.isPrimitive()) { - // Use standard getter. - Array.set(fBean,index,value); - } else if (valueClass == Byte.TYPE ) { - Array.setByte(fBean,index,((Byte)value).byteValue()); - } else if (valueClass == Boolean.TYPE ){ - Array.setBoolean(fBean,index,((Boolean)value).booleanValue()); - } else if (valueClass == Character.TYPE) { - Array.setChar(fBean,index,((Character)value).charValue()); - } else if (valueClass == Double.TYPE) { - Array.setDouble(fBean,index,((Double)value).doubleValue()); - } else if (valueClass == Float.TYPE) { - Array.setFloat(fBean,index,((Float)value).floatValue()); - } else if (valueClass == Integer.TYPE) { - Array.setInt(fBean,index,((Integer)value).intValue()); - } else if (valueClass == Long.TYPE ) { - Array.setLong(fBean,index,((Long)value).longValue()); - } else if (valueClass == Short.TYPE ) { - Array.setShort(fBean,index,((Short)value).shortValue()); - } -} -/** - * Set the object at the specified multi-dimensional index. - * The array must be at least the number of dimensions specified, - * and each index along the way must exist. - * The number of dimensions can't be greater than the number - * of dimensions of the real object. - */ -public void set(IBeanProxy valueProxy, int[] indexes) throws ThrowableProxy { - - Object subArray = fBean; - int upTo = indexes.length - 1; - for (int i = 0; i < upTo; i++) - subArray = Array.get(subArray, indexes[i]); - int index = indexes[upTo]; - - // Now set the appropriate value in - // If the component type is primitive, we need to use the correct getter so that a valid value is returned, - // if we just used the standard get, if the type was "int" the value returned would be an java.lang.Integer. - Object value = ((IIDEBeanProxy) valueProxy).getBean(); - Class valueClass = value.getClass(); - if (!valueClass.isPrimitive()) { - // Use standard getter. - Array.set(subArray, index, value); - } else if (valueClass == Byte.TYPE) { - Array.setByte(subArray, index, ((Byte) value).byteValue()); - } else if (valueClass == Boolean.TYPE) { - Array.setBoolean(subArray, index, ((Boolean) value).booleanValue()); - } else if (valueClass == Character.TYPE) { - Array.setChar(subArray, index, ((Character) value).charValue()); - } else if (valueClass == Double.TYPE) { - Array.setDouble(subArray, index, ((Double) value).doubleValue()); - } else if (valueClass == Float.TYPE) { - Array.setFloat(subArray, index, ((Float) value).floatValue()); - } else if (valueClass == Integer.TYPE) { - Array.setInt(subArray, index, ((Integer) value).intValue()); - } else if (valueClass == Long.TYPE) { - Array.setLong(subArray, index, ((Long) value).longValue()); - } else if (valueClass == Short.TYPE) { - Array.setShort(subArray, index, ((Short) value).shortValue()); - } - -} -/** - * Get the length of the first dimension of this array. - * If there are multi-dimensions, you must get the appropriate - * dimension from the get method to see the size of that dimension. - * - * e.g. - * int [3] returns 3 - * int [3][2] returns 3 - * - * ((IArrayBeanProxy) get(1)).getLength() returns 2 - * Since arrays do not have to be homogenous, there could - * be a different length array for each of the arrays - * returned from the first dimension, the returned length - * from get(2) and get(3) could result in a different value - * from get(1). - */ -public int getLength() { - return Array.getLength(fBean); -} - /** - * @see org.eclipse.jem.internal.proxy.core.IArrayBeanProxy#getCatchThrowableException(int) - */ - public IBeanProxy getCatchThrowableException(int index) { - try { - return get(index); - } catch ( ThrowableProxy exc ) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc)); //$NON-NLS-1$ - return null; - } - } - - - public IBeanProxy[] getSnapshot() throws ThrowableProxy { - // If the component type is primitive, we need to use the correct getter so that a valid value is returned, - // if we just used the standard get, if the type was "int" the value returned would be an java.lang.Integer. - IBeanTypeProxy compType = ((IArrayBeanTypeProxy) getTypeProxy()).getComponentType(); - int id = compType.isPrimitive() ? ((IDEPrimitiveBeanTypeProxy)compType).getPrimitiveType() : -1; - IBeanProxy[] result = new IBeanProxy[Array.getLength(fBean)]; - for (int i = 0; i < result.length; i++) { - if (id == -1) { - // Use standard getter. - Object val = Array.get(fBean,i); - if ( val != null ) - result[i] = ((IDEBeanTypeProxy)fBeanTypeProxyFactory.getBeanTypeProxy(val.getClass())).newBeanProxy(val); - } else { - // Use the correct primitive getter. - switch (id) { - case IDEPrimitiveBeanTypeProxy.BYTE: - result[i] = fBeanTypeProxyFactory.byteType.createByteBeanProxy(Array.getByte(fBean,i)); - break; - case IDEPrimitiveBeanTypeProxy.BOOLEAN: - result[i] = fBeanTypeProxyFactory.booleanType.createBooleanBeanProxy(Array.getBoolean(fBean,i)); - break; - case IDEPrimitiveBeanTypeProxy.CHAR: - result[i] = fBeanTypeProxyFactory.charType.createCharBeanProxy(Array.getChar(fBean,i)); - break; - case IDEPrimitiveBeanTypeProxy.DOUBLE: - result[i] = fBeanTypeProxyFactory.doubleType.createDoubleBeanProxy(Array.getDouble(fBean,i)); - break; - case IDEPrimitiveBeanTypeProxy.FLOAT: - result[i] = fBeanTypeProxyFactory.floatType.createFloatBeanProxy(Array.getFloat(fBean,i)); - break; - case IDEPrimitiveBeanTypeProxy.INTEGER: - result[i] = fBeanTypeProxyFactory.intType.createIntegerBeanProxy(Array.getInt(fBean,i)); - break; - case IDEPrimitiveBeanTypeProxy.LONG: - result[i] = fBeanTypeProxyFactory.longType.createLongBeanProxy(Array.getLong(fBean,i)); - break; - case IDEPrimitiveBeanTypeProxy.SHORT: - result[i] = fBeanTypeProxyFactory.shortType.createShortBeanProxy(Array.getShort(fBean,i)); - break; - default : - break; // Shouldn't get here, said it was primitive, but not one we understand - } - } - } - return result; - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEArrayBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEArrayBeanTypeProxy.java deleted file mode 100644 index a9d7cf420..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEArrayBeanTypeProxy.java +++ /dev/null @@ -1,326 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; - -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -import java.lang.reflect.*; - -/** - * Array Type Proxy for the IDE VM. - * - * The class is final because array's are special and shouldn't have any subclasses since the factory would never call it. - */ - -public final class IDEArrayBeanTypeProxy extends IDEBeanTypeProxy implements IArrayBeanTypeProxy { - - IBeanTypeProxy fFinalComponentType; - - IBeanTypeProxy fComponentType; - - String fTypeName; - - /** - * Create with a registry and a class. It is package so that only the factory with this IDE package can call it. - */ - IDEArrayBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, String aTypeName, Class aClass) { - // The class of an Array is always Object - super(aRegistry, aClass); - fTypeName = aTypeName; - } - - /** - * This is an array type! - */ - public boolean isArray() { - return true; - } - - public String getTypeName() { - return fTypeName; - } - - /** - * Return the final component type. - */ - public IBeanTypeProxy getFinalComponentType() { - if (fFinalComponentType == null) { - // Component type is strip off all '[' and return class name (if we ever add classLoader support, this won't work). - // However, if the type is a primitive we need to go through the change table). - int typeStart = getTypeName().lastIndexOf('[') + 1; - if (getTypeName().charAt(typeStart) == 'L') { - // It is a class. - // Strip off up to the 'L', and the trailing ';'. That is the class name. - fFinalComponentType = fProxyFactoryRegistry.getBeanTypeProxyFactory().getBeanTypeProxy( - getTypeName().substring(typeStart + 1, getTypeName().length() - 1)); - } else { - // It is a type. Need to map it. - Class aType = (Class) IDEStandardBeanTypeProxyFactory.MAP_SHORTSIG_TO_TYPE.get(getTypeName().substring(typeStart, typeStart + 1)); - fFinalComponentType = aType != null ? fProxyFactoryRegistry.getBeanTypeProxyFactory().getBeanTypeProxy(aType.getName()) : null; - } - } - return fFinalComponentType; - } - - /** - * Return the component type. - */ - public IBeanTypeProxy getComponentType() { - if (fComponentType == null) { - // Component type is strip off first '[' and return class name (if we ever add classLoader support, this won't work). - // However, if the type is a primitive we need to go through the change table). - if (getTypeName().charAt(1) != '[') { - // It is a one dimensional array, just send to getFinalComponentType to figure out the type. - fComponentType = getFinalComponentType(); - } else { - // It is a multi-dimensional array. Just strip off one '[' and send that to the bean type factory. - fComponentType = fProxyFactoryRegistry.getBeanTypeProxyFactory().getBeanTypeProxy(getTypeName().substring(1)); - } - } - return fComponentType; - } - - /** - * Return the number of dimensions. - */ - public int getDimensions() { - return getTypeName().lastIndexOf('[') + 1; - } - - /** - * Return the null ctor proxy for this method with these arguments. For all of the array types, this is an invalid operation. - */ - public IConstructorProxy getNullConstructorProxy() { - throw new UnsupportedOperationException(); - } - - /** - * Return a proxy to the constructor for the target VM being the same as the REM For all of the array types, this is an invalid operation. - */ - public IConstructorProxy getConstructorProxy(String[] argumentClassNames) { - throw new UnsupportedOperationException(); - } - - /** - * Return a proxy to the constructor for the target VM being the same as the REM For all of the array types, this is an invalid operation. - */ - public IConstructorProxy getConstructorProxy(IBeanTypeProxy[] argumentTypes) { - throw new UnsupportedOperationException(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() For all of the array types, this is an invalid operation. - */ - public IConstructorProxy[] getConstructors() { - throw new UnsupportedOperationException(); - } - - /** - * Return a proxy to the constructor for the target VM being the same as the REM For all of the array types, this is an invalid operation. - */ - public IConstructorProxy getDeclaredConstructorProxy(String[] argumentClassNames) { - throw new UnsupportedOperationException(); - } - - /** - * Return a proxy to the constructor for the target VM being the same as the REM For all of the array types, this is an invalid operation. - */ - public IConstructorProxy getDeclaredConstructorProxy(IBeanTypeProxy[] argumentTypes) { - throw new UnsupportedOperationException(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() For all of the array types, this is an invalid operation. - */ - public IConstructorProxy[] getDeclaredConstructors() { - throw new UnsupportedOperationException(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() For all of the array types, this is an invalid operation. - */ - public IFieldProxy[] getFields() { - throw new UnsupportedOperationException(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getCompatibleConstructor(org.eclipse.jem.internal.proxy.core.IBeanTypeProxy[]) - */ - public IConstructorProxy getCompatibleConstructor(IBeanTypeProxy[] argumentTypes) { - throw new UnsupportedOperationException(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getCompatibleMethod(java.lang.String, - * org.eclipse.jem.internal.proxy.core.IBeanTypeProxy[]) - */ - public IMethodProxy getCompatibleMethod(String methodName, IBeanTypeProxy[] argumentTypes) { - throw new UnsupportedOperationException(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() For all of the array types, this is an invalid operation. - */ - public IFieldProxy[] getDeclaredFields() { - throw new UnsupportedOperationException(); - } - - /** - * Return a proxy to the field for the target VM being the same as the REM For all of the array types, this is an invalid operation. - */ - public IFieldProxy getFieldProxy(String fieldName) { - throw new UnsupportedOperationException(); - } - - /** - * Return the method proxy for this method with these arguments. For all of the array types, this is an invalid operation. - */ - public IMethodProxy getMethodProxy(String methodName, IBeanTypeProxy[] argumentTypes) { - throw new UnsupportedOperationException(); - } - - /** - * Return the method proxy for this method with these arguments. For all of the array types, this is an invalid operation. - */ - public IMethodProxy getMethodProxy(String methodName, String[] argumentClassNames) { - throw new UnsupportedOperationException(); - } - - /** - * Return the method proxy for this method with these arguments. For all of the array types, this is an invalid operation. - */ - public IMethodProxy getMethodProxy(String methodName, String argumentQualifiedTypeName) { - throw new UnsupportedOperationException(); - } - - /** - * Return the method proxy for this method with these arguments. For all of the array types, this is an invalid operation. - */ - public IMethodProxy getMethodProxy(String methodName) { - throw new UnsupportedOperationException(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() For all of the array types, this is an invalid operation. - */ - public IMethodProxy[] getMethods() { - throw new UnsupportedOperationException(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() For all of the array types, this is an invalid operation. - */ - public IMethodProxy[] getDeclaredMethods() { - throw new UnsupportedOperationException(); - } - - /** - * Return the method proxy for this method with these arguments. For all of the array types, this is an invalid operation. - */ - public IMethodProxy getDeclaredMethodProxy(String methodName, IBeanTypeProxy[] argumentTypes) { - throw new UnsupportedOperationException(); - } - - /** - * Return the method proxy for this method with these arguments. For all of the array types, this is an invalid operation. - */ - public IMethodProxy getDeclaredMethodProxy(String methodName, String[] argumentClassNames) { - throw new UnsupportedOperationException(); - } - - /** - * Create an array bean proxy. - * - (int, new int[2] {3, 4}) will create: int [3] [4] - * - (int[], new int[1] {1}) int [1] - * - (int[], new int[2] {2,3}) int [2] [3] - * - * - (int[], null) or (int[], new int[0]) or (int, null) or (int, new int[0]) int [0] (int[][], null) or (int[][], new int[0]) int[0][] This is - * because an array instance with no dimensions specified is not valid. - * - (int[][], new int[1] {3}) int[3][] - * - * It is package protected so that only the REM Factory can call it. - */ - IDEArrayBeanProxy createBeanProxyWith(int[] dimensions) throws ThrowableProxy { - // If the dimensions is null or zero length, then create the - // array as a 0 sized array one dimensional array. - if (dimensions == null || dimensions.length == 0) - return createBeanProxyWith(new int[] { 0}); - - // Remove from this type the number of dimensions specified - // coming in, up to but no further than the final component. - // From here we can then use the appropriate java.lang.reflect.Array - // method to create the array. - IBeanTypeProxy compType = null; // The type of array to create (it may be different number of dimensions). - int numDims = getDimensions(); - if (numDims <= dimensions.length) - compType = getFinalComponentType(); // There are the same or more requested dimensions, so use final component type - else { - // There are fewer requested dimensions, so strip off that many - String compClass = getTypeName().substring(dimensions.length); - compType = fProxyFactoryRegistry.getBeanTypeProxyFactory().getBeanTypeProxy(compClass); - } - - if (dimensions.length == 1) { - // Use the one dimension call - Object array = Array.newInstance(((IDEBeanTypeProxy) compType).fClass, dimensions[0]); - return new IDEArrayBeanProxy(fProxyFactoryRegistry, array, null); - } else { - // Use the multi dimension call - Object array = Array.newInstance(((IDEBeanTypeProxy) compType).fClass, dimensions); - return new IDEArrayBeanProxy(fProxyFactoryRegistry, array, null); - } - } - - /** - * Create a new bean proxy with the specified object - */ - protected IIDEBeanProxy newBeanProxy(Object anObject) { - - return new IDEArrayBeanProxy(fProxyFactoryRegistry, anObject, this); - - } - - /** - * @see IBeanTypeProxy#getFormalTypeName() - */ - public String getFormalTypeName() { - String name = getTypeName(); - int dims = name.lastIndexOf('[') + 1; - String type = getFinalComponentType().getTypeName(); - StringBuffer formalType = new StringBuffer(type.length() + ("[]".length() * dims)); //$NON-NLS-1$ - formalType.append(type); - for (int i = 0; i < dims; i++) - formalType.append("[]"); //$NON-NLS-1$ - return formalType.toString(); - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBeanProxy.java deleted file mode 100644 index 52ed180d3..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBeanProxy.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -public abstract class IDEBeanProxy implements IBeanProxy, IIDEBeanProxy { - - protected Object fBean; - protected final IDEProxyFactoryRegistry fProxyFactoryRegistry; - - protected IDEBeanProxy(IDEProxyFactoryRegistry aProxyFactoryRegistry) { - fProxyFactoryRegistry = aProxyFactoryRegistry; - } - protected IDEBeanProxy(IDEProxyFactoryRegistry aProxyFactoryRegistry, Object anObject) { - fProxyFactoryRegistry = aProxyFactoryRegistry; - fBean = anObject; - } - public boolean isValid() { - return true; - } - public ProxyFactoryRegistry getProxyFactoryRegistry() { - return fProxyFactoryRegistry; - } - /** - * USE with extreme care - */ - public final Object getBean() { - return fBean; - } - /** - * Return the toString() of the bean - */ - public String toBeanString() { - return (fBean != null ? fBean.toString() : "null"); //$NON-NLS-1$ - } - /** - Append the bean's to string to our own name if we have one - */ - public String toString() { - - if (fBean == null) - return super.toString(); - else - return super.toString() + "(" + fBean.toString() + ")"; //$NON-NLS-2$//$NON-NLS-1$ - - } - /** - * equals: If there are identical or if they wrapper the same bean. In the IDE VM this - * can happen if bean proxies are created from a Bean, since proxies aren't cached in - * the beanproxy factory, more than one proxy can be created for the same bean. - */ - public boolean equals(Object obj) { - if (super.equals(obj)) - return true; - if (obj instanceof IIDEBeanProxy) { - return fBean.equals(((IIDEBeanProxy) obj).getBean()); - } - return false; - } - - public int hashCode() { - return 12345 + (getBean() != null ? getBean().hashCode() : 0); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IBeanProxy#sameAs(org.eclipse.jem.internal.proxy.core.IBeanProxy) - */ - public boolean sameAs(IBeanProxy aBeanProxy) { - if (this == aBeanProxy) - return true; - if (aBeanProxy instanceof IIDEBeanProxy) - return getBean() == ((IIDEBeanProxy) aBeanProxy).getBean(); - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IProxy#isBeanProxy() - */ - public final boolean isBeanProxy() { - return true; - } - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IProxy#isExpressionProxy() - */ - public final boolean isExpressionProxy() { - return false; - } -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBeanTypeProxy.java deleted file mode 100644 index 4401b7e2a..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBeanTypeProxy.java +++ /dev/null @@ -1,451 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: IDEBeanTypeProxy.java,v $ $Revision: 1.16 $ $Date: 2006/05/17 20:13:05 $ - */ -package org.eclipse.jem.internal.proxy.ide; - -import org.eclipse.jem.internal.proxy.common.AmbiguousMethodException; -import org.eclipse.jem.internal.proxy.core.*; - -import java.lang.reflect.*; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -public class IDEBeanTypeProxy extends IDEBeanProxy implements IBeanTypeProxy { - - protected IDEProxyFactoryRegistry fProxyFactoryRegistry; - - Class fClass; - - protected IDEBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass); - fProxyFactoryRegistry = aRegistry; - fClass = aClass; - } - - /** - * Get Type Proxy. The type proxy of a BeanType is Class. - */ - public IBeanTypeProxy getTypeProxy() { - return ((IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory()).classClass; - } - - public Class getTypeClass() { - return fClass; - } - - public String toBeanString() { - return fClass.toString(); - } - - public ProxyFactoryRegistry getProxyFactoryRegistry() { - return fProxyFactoryRegistry; - } - - public String getTypeName() { - return fClass.getName(); - } - - public boolean isKindOf(IBeanTypeProxy aBeanTypeProxy) { - return ((IDEBeanTypeProxy) aBeanTypeProxy).fClass.isAssignableFrom(fClass); - } - - public boolean isInterface() { - return fClass.isInterface(); - } - - public boolean isPrimitive() { - return fClass.isPrimitive(); - } - - public boolean isArray() { - return fClass.isArray(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() - */ - public IMethodProxy[] getMethods() { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getMethods(fClass); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() - */ - public IMethodProxy[] getDeclaredMethods() { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getDeclaredMethods(fClass); - } - - /** - * We can use reflection on our class to find the java.reflect.Method instance and create the IDEMethodProxy directly - */ - public IMethodProxy getMethodProxy(String methodName) { - - try { - Method aMethod = fClass.getMethod(methodName, new Class[0]); - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getMethodProxy(aMethod); - } catch (Exception exc) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc)); //$NON-NLS-1$ - } - return null; - - } - - public IMethodProxy getMethodProxy(String methodName, String[] argumentClassNames) { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getMethodProxy(this, methodName, argumentClassNames); - } - - public IMethodProxy getMethodProxy(String methodName, String firstArgClass) { - return getMethodProxy(methodName, new String[] { firstArgClass}); - } - - public IMethodProxy getMethodProxy(String methodName, IBeanTypeProxy[] args) { - Class[] argClasses = new Class[args.length]; - for (int i = 0; i < args.length; i++) { - argClasses[i] = ((IDEBeanTypeProxy) args[i]).fClass; - } - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getMethodProxy(fClass, methodName, argClasses); - } - - public IMethodProxy getDeclaredMethodProxy(String methodName, String[] argumentClassNames) { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getDeclaredMethodProxy(fClass, methodName, argumentClassNames); - } - - public IMethodProxy getDeclaredMethodProxy(String methodName, IBeanTypeProxy[] args) { - Class[] argClasses = null; - if (args != null) { - argClasses = new Class[args.length]; - for (int i = 0; i < args.length; i++) { - argClasses[i] = ((IDEBeanTypeProxy) args[i]).fClass; - } - } - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getDeclaredMethodProxy(fClass, methodName, argClasses); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getInvokable(java.lang.String, org.eclipse.jem.internal.proxy.core.IBeanTypeProxy[]) - */ - public IInvokable getInvokable(String methodName, IBeanTypeProxy[] argumentTypes) { - return getMethodProxy(methodName, argumentTypes); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getInvokable(java.lang.String, java.lang.String) - */ - public IInvokable getInvokable(String methodName, String argumentClassName) { - return getMethodProxy(methodName, argumentClassName); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getInvokable(java.lang.String, java.lang.String[]) - */ - public IInvokable getInvokable(String methodName, String[] argumentClassNames) { - return getMethodProxy(methodName, argumentClassNames); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getInvokable(java.lang.String) - */ - public IInvokable getInvokable(String methodName) { - return getMethodProxy(methodName); - } - - public IConstructorProxy getConstructorProxy(String[] argTypeNames) { - IBeanTypeProxy[] argClasses = new IBeanTypeProxy[argTypeNames.length]; - IStandardBeanTypeProxyFactory btFactory = fProxyFactoryRegistry.getBeanTypeProxyFactory(); - for (int i = 0; i < argTypeNames.length; i++) { - argClasses[i] = btFactory.getBeanTypeProxy(argTypeNames[i]); - if (argClasses[i] == null) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "Constructor not found - " //$NON-NLS-1$ - + fClass.getName() + " args=" + argTypeNames, null)); //$NON-NLS-1$ - return null; - } - } - return getConstructorProxy(argClasses); - } - - public IConstructorProxy getConstructorProxy(IBeanTypeProxy[] args) { - Class[] argClasses = new Class[args.length]; - for (int i = 0; i < args.length; i++) { - argClasses[i] = ((IDEBeanTypeProxy) args[i]).fClass; - } - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getConstructorProxy(fClass, argClasses); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() - */ - public IConstructorProxy[] getConstructors() { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getConstructors(fClass); - } - - public IConstructorProxy getDeclaredConstructorProxy(String[] argTypeNames) { - IBeanTypeProxy[] argClasses = new IBeanTypeProxy[argTypeNames.length]; - IStandardBeanTypeProxyFactory btFactory = fProxyFactoryRegistry.getBeanTypeProxyFactory(); - for (int i = 0; i < argTypeNames.length; i++) { - argClasses[i] = btFactory.getBeanTypeProxy(argTypeNames[i]); - if (argClasses[i] == null) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "Constructor not found - " //$NON-NLS-1$ - + fClass.getName() + " args=" + argTypeNames, null)); //$NON-NLS-1$ - return null; - } - } - return getDeclaredConstructorProxy(argClasses); - } - - public IConstructorProxy getDeclaredConstructorProxy(IBeanTypeProxy[] args) { - Class[] argClasses = new Class[args.length]; - for (int i = 0; i < args.length; i++) { - argClasses[i] = ((IDEBeanTypeProxy) args[i]).fClass; - } - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getDeclaredConstructorProxy(fClass, argClasses); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() - */ - public IConstructorProxy[] getDeclaredConstructors() { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getDeclaredConstructors(fClass); - } - - /** - * Return the supertype for us Use the factory to get it rather than create it directly so that the factory has the chance to cache classes if - * required This is required as part of the interface - */ - public IBeanTypeProxy getSuperBeanTypeProxy() { - - if (fClass.isInterface()) - return null; - else - return fProxyFactoryRegistry.getBeanTypeProxyFactory().getBeanTypeProxy(fClass.getSuperclass().getName()); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() - */ - public IFieldProxy[] getFields() { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getFields(fClass); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructors() - */ - public IFieldProxy[] getDeclaredFields() { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getDeclaredFields(fClass); - } - - public IFieldProxy getFieldProxy(String fieldName) { - try { - Field field = fClass.getField(fieldName); - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getFieldProxy(field); - } catch (NoSuchFieldException exc) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "Field not found " + fClass.getName() //$NON-NLS-1$ - + " - " + fieldName, exc)); //$NON-NLS-1$ - return null; - } - } - - public IFieldProxy getDeclaredFieldProxy(String fieldName) { - try { - Field field = fClass.getDeclaredField(fieldName); - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getFieldProxy(field); - } catch (NoSuchFieldException exc) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "Field not found " + fClass.getName() //$NON-NLS-1$ - + " - " + fieldName, exc)); //$NON-NLS-1$ - return null; - } - } - - /** - * Return a proxy to the constructor for the target VM being the same as the IDE We can use the package protected contstructor on - * IDEConstructorProxy - */ - IConstructorProxy getConstructorProxy(Class[] parameterTypes) { - - Constructor aConstructor = null; - - // Use reflection to try and find a constructor. The argumentClassNames must be converted to classes - try { - aConstructor = fClass.getConstructor(parameterTypes); - } catch (Exception e) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - } - // If we have a constructor return it - if (aConstructor != null) { - return getNewConstructorProxy(aConstructor); - } else { - return null; - } - - } - - /** - * Factored into its own method so subclass can override - */ - protected IConstructorProxy getNewConstructorProxy(Constructor aConstructor) { - - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getConstructorProxy(aConstructor); - - } - - /** - * Return a proxy to the null constructor for the target VM being the same as the IDE We can use the package protected contstructor on - * IDEConstructorProxy - */ - public IConstructorProxy getNullConstructorProxy() { - - Constructor aConstructor = null; - - // Use reflection to try and find a constructor. The argumentClassNames must be converted to classes - try { - aConstructor = fClass.getConstructor(null); - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getConstructorProxy(aConstructor); - } catch (Exception e) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - return null; - } - - } - - public IBeanProxy newInstance(String initializationString) { - return ((IDEStandardBeanProxyFactory) fProxyFactoryRegistry.getBeanProxyFactory()).createBeanProxy(this, initializationString); - } - - public IBeanProxy newInstance() { - return ((IDEStandardBeanProxyFactory) fProxyFactoryRegistry.getBeanProxyFactory()).createBeanProxy(this); - } - - /** - * Create a new bean proxy with the specified object Use the constructor that allows the type proxy to be set as well as the bean because we are - * the type and by setting it now we might avoid it being lookup for in the factory the first time it is asked for - * - * NOTE: All subclasses need to override this to return the appropriate IDEBeanProxy. - */ - protected IIDEBeanProxy newBeanProxy(Object anObject) { - - return new IDEObjectBeanProxy(fProxyFactoryRegistry, anObject, this); - - } - - /** - * Create a subclass beantype proxy. - */ - public IDEBeanTypeProxy newBeanTypeForClass(Class type) { - // Default is just another instance of this same class. - return new IDEBeanTypeProxy(fProxyFactoryRegistry, type); - } - - /** - * @see IBeanTypeProxy#getFormalTypeName() - */ - public String getFormalTypeName() { - return getTypeName(); - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getInitializationError() - */ - public String getInitializationError() { - return null; // By default none have an initialization error. There is a special instance for init errors. - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getCompatibleConstructor(org.eclipse.jem.internal.proxy.core.IBeanTypeProxy[]) - */ - public IConstructorProxy getCompatibleConstructor(IBeanTypeProxy[] argumentTypes) throws AmbiguousMethodException, NoSuchMethodException, IllegalAccessException { - - Class[] argClasses = new Class[argumentTypes.length]; - for (int i = 0; i < argumentTypes.length; i++) { - argClasses[i] = ((IDEBeanTypeProxy) argumentTypes[i]).fClass; - } - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getCompatibleConstructor(fClass, argClasses); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getCompatibleMethod(java.lang.String, - * org.eclipse.jem.internal.proxy.core.IBeanTypeProxy[]) - */ - public IMethodProxy getCompatibleMethod(String methodName, IBeanTypeProxy[] argumentTypes) throws NoSuchMethodException, AmbiguousMethodException { - Class[] argClasses = new Class[argumentTypes.length]; - for (int i = 0; i < argumentTypes.length; i++) { - argClasses[i] = ((IDEBeanTypeProxy) argumentTypes[i]).fClass; - } - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getCompatibleMethod(fClass, methodName, argClasses); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IProxyBeanType#getMethodProxy(org.eclipse.jem.internal.proxy.core.IExpression, java.lang.String, org.eclipse.jem.internal.proxy.core.IProxyBeanType[]) - */ - public IProxyMethod getMethodProxy(IExpression expression, String methodName, IProxyBeanType[] parameterTypes) { - IProxyMethod method = ((IDEExpression) expression).getMethodExpressionProxy(this, methodName, parameterTypes); - if (method == null) { - // Need to go to the expression and create it. - method = ((Expression) expression).createMethodExpressionProxy(this, methodName, parameterTypes); - } - return method; - } - - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IProxyBeanType#getMethodProxy(org.eclipse.jem.internal.proxy.core.IExpression, java.lang.String, java.lang.String[]) - */ - public IProxyMethod getMethodProxy(IExpression expression, String methodName, String[] parameterTypes) { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).getMethodProxy(expression, this, methodName, parameterTypes); - } - - public IProxyMethod getMethodProxy(IExpression expression, String methodName) { - return getMethodProxy(expression, methodName, (IProxyBeanType[]) null); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IProxyBeanType#getFieldProxy(org.eclipse.jem.internal.proxy.core.IExpression, java.lang.String) - */ - public IProxyField getFieldProxy(IExpression expression, String fieldName) { - IProxyField field = ((IDEExpression) expression).getFieldExpressionProxy(this, fieldName); - if (field == null) { - // Need to go to the expression and create it. - field = ((Expression) expression).createFieldExpressionProxy(this, fieldName); - } - return field; - } -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBigDecimalBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBigDecimalBeanTypeProxy.java deleted file mode 100644 index a49926ef7..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBigDecimalBeanTypeProxy.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; -import java.math.*; - -final class IDEBigDecimalBeanTypeProxy extends IDENumberBeanTypeProxy { -// Some values are cache'd for speed -IDEBigDecimalBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass,new BigDecimal(0)); -} -/** - * Static helper to create a bean proxy - * Package protected because everyone should go through the factory API - * that is defined as part of IBeanProxyFactory - */ -INumberBeanProxy createBigDecimalBeanProxy(BigDecimal aBigDecimal) { - if ( aBigDecimal == null || aBigDecimal.intValue() == 0 ) { - return zeroProxy; - } else { - return new IDENumberBeanProxy(fProxyFactoryRegistry,aBigDecimal,this); - } -} -} - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBigIntegerBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBigIntegerBeanTypeProxy.java deleted file mode 100644 index 07e3cae12..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBigIntegerBeanTypeProxy.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; -import java.math.*; -/** - * IDE Implementation of IIntegerBeanTypeProxy - */ -final class IDEBigIntegerBeanTypeProxy extends IDENumberBeanTypeProxy { -// Some values are cache'd for speed -IDEBigIntegerBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass, new BigInteger("0")); //$NON-NLS-1$ -} -/** - * Static helper to create a bean proxy - * Package protected because everyone should go through the factory API - * that is defined as part of IBeanProxyFactory - */ -INumberBeanProxy createBigIntegerBeanProxy(BigInteger aBigInteger) { - if ( aBigInteger == null || aBigInteger.intValue() == 0 ) { - return zeroProxy; - } else { - return new IDENumberBeanProxy(fProxyFactoryRegistry,aBigInteger,this); - } -} -} - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanBeanProxy.java deleted file mode 100644 index 607d78035..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanBeanProxy.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; -/** - * IDE Implementation of IBooleanBeanProxy.. - * Creation date: (2/6/00 9:02:54 AM) - * @author: Joe Winchester - */ -class IDEBooleanBeanProxy extends IDEObjectBeanProxy implements IBooleanBeanProxy { - protected Boolean fBooleanValue; -/** - * As well as storing the bean store the boolean value so that we can return the booleanValue faster - * without the need for repeated re-casting. It is package protected because it is created in - * special way, so no one else should create these. - * @param aBean java.lang.Object - */ -IDEBooleanBeanProxy(IDEProxyFactoryRegistry aRegistry, Object aBean, IBeanTypeProxy aBeanTypeProxy) { - super(aRegistry, aBean,aBeanTypeProxy); - fBooleanValue = (Boolean)aBean; -} -public boolean booleanValue() { - return fBooleanValue.booleanValue(); -} -public Boolean getBooleanValue() { - return fBooleanValue; -} -} - - - - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanBeanTypeProxy.java deleted file mode 100644 index c06f941bc..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanBeanTypeProxy.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * Created on Sep 15, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.jem.internal.proxy.ide; - -import org.eclipse.jem.internal.proxy.core.IBeanProxy; -import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy; - -/** - * @author richkulp - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class IDEBooleanBeanTypeProxy extends IDEBooleanBeanProxy { - - /** - * @param aRegistry - * @param aBean - * @param aBeanTypeProxy - */ - public IDEBooleanBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Object aBean, IBeanTypeProxy aBeanTypeProxy) { - super(aRegistry, aBean, aBeanTypeProxy); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IBeanProxy#sameAs(org.eclipse.jem.internal.proxy.core.IBeanProxy) - */ - public boolean sameAs(IBeanProxy aBeanProxy) { - return (aBeanProxy instanceof IDEBooleanBeanTypeProxy) ? getBooleanValue() == ((IDEBooleanBeanTypeProxy) aBeanProxy).getBooleanValue() : false; - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanClassBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanClassBeanTypeProxy.java deleted file mode 100644 index 8a383952a..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanClassBeanTypeProxy.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -final public class IDEBooleanClassBeanTypeProxy extends IDEBeanTypeProxy { - - // Cache these instances. Since the BeanType proxies are cached also, only one instance - // of true/false will be in system. - protected final IDEBooleanBeanProxy trueProxy; - protected final IDEBooleanBeanProxy falseProxy; - -IDEBooleanClassBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - - super(aRegistry, aClass); - trueProxy = new IDEBooleanBeanProxy( fProxyFactoryRegistry, Boolean.TRUE, this ); - falseProxy = new IDEBooleanBeanProxy( fProxyFactoryRegistry, Boolean.FALSE, this); -} -IBooleanBeanProxy createBooleanBeanProxy(Boolean aBoolean) { - if ( aBoolean.booleanValue() ){ - return trueProxy; - } else { - return falseProxy; - } -} -/* Specialized from IDEBeanTypeProxy to ensure IBooleanBeanProxies are created correctly - */ -protected IIDEBeanProxy newBeanProxy(Object anObject){ - - if ( anObject == null || anObject == Boolean.FALSE ) { - return falseProxy; - } else { - return trueProxy; - } -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanTypeBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanTypeBeanTypeProxy.java deleted file mode 100644 index 29548f538..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEBooleanTypeBeanTypeProxy.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -final public class IDEBooleanTypeBeanTypeProxy extends IDEPrimitiveBeanTypeProxy { - - // Cache these instances. Since the BeanType proxies are cached also, only one instance - // of true/false will be in system. - protected final IDEBooleanBeanProxy trueProxy; - protected final IDEBooleanBeanProxy falseProxy; - -IDEBooleanTypeBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - - super(aRegistry, aClass); - trueProxy = new IDEBooleanBeanTypeProxy( fProxyFactoryRegistry, Boolean.TRUE, this ); - falseProxy = new IDEBooleanBeanTypeProxy( fProxyFactoryRegistry, Boolean.FALSE, this ); - - // TODO Need to go through all of the primitives, separate them out into a separate classes so - // that sameAs can work with them correctly. Currently only boolean type will do sameAs correctly. - // Should also look into storing the primitive in the proxy instead of creating a new wrapper object - // for each for the non-boolean primitives. -} -/** - * Static helper to create a bean proxy - * Package protected because everyone should go through the factory API - * that is defined as part of IBeanProxyFactory - */ -IBooleanBeanProxy createBooleanBeanProxy(boolean aBoolean) { - if ( aBoolean ){ - return trueProxy; - } else { - return falseProxy; - } -} -/* Specialized from IDEBeanTypeProxy to ensure IBooleanBeanProxies are created correctly - */ -protected IIDEBeanProxy newBeanProxy(Object anObject){ - - return (IIDEBeanProxy)createBooleanBeanProxy( anObject != null ? ((Boolean)anObject).booleanValue() : false ); - -} -int getPrimitiveType(){ - return BOOLEAN; -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEByteClassBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEByteClassBeanTypeProxy.java deleted file mode 100644 index a8e3e6af1..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEByteClassBeanTypeProxy.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * Byte BeanType Proxy. - */ -final class IDEByteClassBeanTypeProxy extends IDENumberBeanTypeProxy { - -protected IDEByteClassBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass, new Byte((byte)0)); -} -INumberBeanProxy createByteBeanProxy(Byte aByte){ - return new IDENumberBeanProxy(fProxyFactoryRegistry,aByte,this); -} -} - - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEByteTypeBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEByteTypeBeanTypeProxy.java deleted file mode 100644 index 5017110f1..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEByteTypeBeanTypeProxy.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; -/** - * Byte BeanType Proxy. - */ -final class IDEByteTypeBeanTypeProxy extends IDEPrimitiveBeanTypeProxy { -protected IDEByteTypeBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass); -} -INumberBeanProxy createByteBeanProxy(byte aByte){ - return new IDENumberBeanProxy(fProxyFactoryRegistry,new Byte(aByte),this); -} -int getPrimitiveType(){ - return BYTE; -} -protected IIDEBeanProxy newBeanProxy(Object anObject){ - Number n = anObject instanceof Character ? new Byte((byte)((Character) anObject).charValue()) : (Number) anObject; - return new IDENumberBeanProxy(fProxyFactoryRegistry, n, this); -} -} - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECallbackRegistry.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECallbackRegistry.java deleted file mode 100644 index e25f76765..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECallbackRegistry.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import java.io.*; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -import org.eclipse.jem.internal.proxy.core.*; -import org.eclipse.jem.internal.proxy.core.ExpressionProxy.ProxyEvent; - -public class IDECallbackRegistry implements ICallbackRegistry { - - IDEVMServer fVMServer; - int fNextCallbackID; - IDEProxyFactoryRegistry fProxyFactoryRegistry; - Map fCallbackIDToCallback = new HashMap(25); - Map fBeanProxyToCallbackID = new HashMap(25); - Map fCallbackIDToStream = new HashMap(25); - private IProxyMethod initializeCallbackMethodProxy; - private IBeanProxy vmServerProxy; - -IDECallbackRegistry(IDEProxyFactoryRegistry aRegistry){ - fProxyFactoryRegistry = aRegistry; - fVMServer = new IDEVMServer(this); - - vmServerProxy = aRegistry.getBeanProxy(fVMServer.getClass(), fVMServer); - - try { - Method initializeCallbackMethod = org.eclipse.jem.internal.proxy.common.ICallback.class.getMethod("initializeCallback", new Class[] {org.eclipse.jem.internal.proxy.common.IVMCallbackServer.class, Integer.TYPE}); //$NON-NLS-1$ - initializeCallbackMethodProxy = (IProxyMethod) aRegistry.getBeanProxy(Method.class, initializeCallbackMethod); - } catch (SecurityException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } - -} - - -/** - * Add a callback. aBeanProxy is running on the target VM and ICallback runs on our VM - * aBeanProxy will implement ICallback on the target side - */ -public void registerCallback(IBeanProxy aBeanProxy, ICallback aCallback){ - - // Get a handle to the remote VM callback - org.eclipse.jem.internal.proxy.common.ICallback vmCallback = (org.eclipse.jem.internal.proxy.common.ICallback) ((IIDEBeanProxy)aBeanProxy).getBean(); - fNextCallbackID = fNextCallbackID + 1; - int callbackID = fNextCallbackID; - vmCallback.initializeCallback( - fVMServer, - callbackID); - Integer callbackIntegerID = new Integer(callbackID); - fCallbackIDToCallback.put(callbackIntegerID,aCallback); - fBeanProxyToCallbackID.put(aBeanProxy,callbackIntegerID); - -} - - -/* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.ICallbackRegistry#registerCallback(org.eclipse.jem.internal.proxy.core.IProxy, org.eclipse.jem.internal.proxy.core.ICallback, org.eclipse.jem.internal.proxy.core.IExpression) - */ -public void registerCallback(IProxy callbackProxy, final ICallback cb, IExpression expression) { - final Integer callbackID = new Integer(++fNextCallbackID); - fCallbackIDToCallback.put(callbackID, cb); - if (callbackProxy.isBeanProxy()) { - fBeanProxyToCallbackID.put(callbackProxy, callbackID); - } else { - ((ExpressionProxy) callbackProxy).addProxyListener(new ExpressionProxy.ProxyAdapter() { - public void proxyResolved(ProxyEvent event) { - fBeanProxyToCallbackID.put(event.getProxy(), callbackID); - } - }); - } - expression.createSimpleMethodInvoke(initializeCallbackMethodProxy, callbackProxy, new IProxy[] {vmServerProxy, fProxyFactoryRegistry.getBeanProxyFactory().createBeanProxyWith(callbackID.intValue())}, false); - -} - -OutputStream requestStream(final int aCallbackID, final int aMsgID){ - final PipedOutputStream result = new PipedOutputStream(); - PipedInputStream tempStream = null; - try { - tempStream = new PipedInputStream(result); - } catch ( IOException exc ) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc)); //$NON-NLS-1$ - return null; - } - final PipedInputStream inputStream = tempStream; - Thread streamProcessor = new Thread(){ - public void run(){ - ICallback ideCallback = (ICallback)fCallbackIDToCallback.get(new Integer(aCallbackID)); - if (ideCallback != null) { - try { - ideCallback.calledBackStream(aMsgID, inputStream); - } finally { - try { - inputStream.close(); // Make sure it's closed. - } catch ( IOException exc ){ - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc)); //$NON-NLS-1$ - } - } - } - } - }; - streamProcessor.start(); - return result; -} - -Object vmCallback(int aCallbackID ,int aMsgID, Object[] parms){ - // Find the bean proxy that registered with the ID - ICallback ideCallback = (ICallback) fCallbackIDToCallback.get(new Integer(aCallbackID)); - Object callbackResult = null; - if ( parms.length == 1 ) { - callbackResult = ideCallback.calledBack(aMsgID,(IBeanProxy)parms[0]); - } else { - callbackResult = ideCallback.calledBack(aMsgID,parms); - } - return callbackResult; -} - -Object vmCallback(int aCallbackID ,int aMsgID, Object parm){ - // Find the bean proxy that registered with the ID - ICallback ideCallback = (ICallback) fCallbackIDToCallback.get(new Integer(aCallbackID)); - return ideCallback.calledBack(aMsgID,parm); -} - -public void deregisterCallback(IBeanProxy aBeanProxy){ - // Remove the callback from both maps. The actual unregistering of the callback - // on the target VM is done separately by the object that added the event handler on the target VM - Integer callbackID = (Integer) fBeanProxyToCallbackID.remove(aBeanProxy); - fCallbackIDToCallback.remove(callbackID); -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECharTypeBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECharTypeBeanTypeProxy.java deleted file mode 100644 index 970d7f5a8..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECharTypeBeanTypeProxy.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * char BeanType Proxy. - */ -final class IDECharTypeBeanTypeProxy extends IDEPrimitiveBeanTypeProxy { -protected IDECharTypeBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass); -} -ICharacterBeanProxy createCharBeanProxy(char aChar){ - return new IDECharacterBeanProxy(fProxyFactoryRegistry,new Character(aChar),this); -} -int getPrimitiveType(){ - return CHAR; -} -protected IIDEBeanProxy newBeanProxy(Object anObject){ - Character c = anObject instanceof Character ? (Character) anObject : new Character((char)((Number) anObject).intValue()); - return new IDECharacterBeanProxy(fProxyFactoryRegistry, c, this); - -} -} - - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECharacterBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECharacterBeanProxy.java deleted file mode 100644 index cf5b69b6f..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECharacterBeanProxy.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - * $RCSfile: IDECharacterBeanProxy.java,v $ $Revision: 1.6 $ $Date: 2005/08/24 20:39:06 $ - */ - -import org.eclipse.jem.internal.proxy.core.*; -/** - * IDE Implementation of ICharacterBeanBeanProxy.. - */ -class IDECharacterBeanProxy extends IDEObjectBeanProxy implements ICharacterBeanProxy { - protected Character fCharacterValue; - IDECharacterBeanProxy(IDEProxyFactoryRegistry aRegistry, Object aBean, IBeanTypeProxy aBeanTypeProxy) { - super(aRegistry, aBean, aBeanTypeProxy); - fCharacterValue = (Character) aBean; - } - public char charValue() { - return fCharacterValue.charValue(); - } - public Character characterValue() { - return fCharacterValue; - } - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IIntegerBeanProxy#intValue() - */ - public int intValue() { - return charValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.INumberBeanProxy#byteValue() - */ - public byte byteValue() { - return (byte) charValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.INumberBeanProxy#doubleValue() - */ - public double doubleValue() { - return charValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.INumberBeanProxy#floatValue() - */ - public float floatValue() { - return charValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.INumberBeanProxy#longValue() - */ - public long longValue() { - return charValue(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.INumberBeanProxy#numberValue() - */ - public Number numberValue() { - // This is a kludge. Need to new one up. - return new Integer(charValue()); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.INumberBeanProxy#shortValue() - */ - public short shortValue() { - return (short) charValue(); - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECharacterClassBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECharacterClassBeanTypeProxy.java deleted file mode 100644 index 8698759b0..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDECharacterClassBeanTypeProxy.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * Char BeanType Proxy. - */ -final class IDECharacterClassBeanTypeProxy extends IDEBeanTypeProxy { - -protected IDECharacterClassBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass); -} -ICharacterBeanProxy createCharacterBeanProxy(Character aChar){ - return new IDECharacterBeanProxy(fProxyFactoryRegistry,aChar,this); -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEClassBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEClassBeanTypeProxy.java deleted file mode 100644 index a95a6cfba..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEClassBeanTypeProxy.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - - - */ -package org.eclipse.jem.internal.proxy.ide; - -import org.eclipse.jem.internal.proxy.core.IBeanProxy; - -/** - * For java.lang.Class type. - * @since 1.0.0 - */ -public class IDEClassBeanTypeProxy extends IDEBeanTypeProxy { - - /** - * @param aRegistry - * @param aClass - * - * @since 1.0.0 - */ - public IDEClassBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.ide.IDEBeanTypeProxy#newBeanProxy(java.lang.Object) - */ - protected IIDEBeanProxy newBeanProxy(Object anObject) { - return (IIDEBeanProxy) ((IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory()).getBeanTypeProxy((Class) anObject); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.ide.IDEBeanTypeProxy#newBeanTypeForClass(java.lang.Class) - */ - public IDEBeanTypeProxy newBeanTypeForClass(Class type) { - throw new UnsupportedOperationException(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#newInstance() - */ - public IBeanProxy newInstance() { - throw new UnsupportedOperationException(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#newInstance(java.lang.String) - */ - public IBeanProxy newInstance(String initializationString) { - throw new UnsupportedOperationException(); - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEConstructorProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEConstructorProxy.java deleted file mode 100644 index 1e2723bd2..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEConstructorProxy.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import java.lang.reflect.Constructor; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * This is an implementation of IConstructorProxy where the target VM is the same as - * the IDE. The java.lang.reflect.Constructor instance is held in a field - */ -class IDEConstructorProxy extends IDEAccessibleObjectProxy implements IConstructorProxy { - - /** - * package protected constructor where the instance of java.lang.reflect.Constructor - * can be passed in directly - */ - IDEConstructorProxy(IDEProxyFactoryRegistry aRegistry, Constructor aConstructor) { - super(aRegistry, aConstructor); - } - /** - * The type proxy is constant proxy out of the method factory. - */ - public IBeanTypeProxy getTypeProxy() { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).constructorType; - } - - /** - * This is factored into a special method so that subclasses can override - * if they wish. - */ - protected IBeanProxy getNewIDEBeanProxy(Object aBean) { - - return IDEStandardBeanProxyFactory.createBeanProxy(fProxyFactoryRegistry, aBean); // Use local helper method to do this. - } - /** - * Invoke the constructor and return an IDEBeanProxy with the result - */ - public IBeanProxy newInstance() { - - // Invoke the constructor - try { - Object result = ((Constructor) getBean()).newInstance(null); - return getNewIDEBeanProxy(result); - } catch (Exception e) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - return null; - } - - } - public IBeanProxy newInstanceCatchThrowableExceptions() { - return newInstance(); - } - public IBeanProxy newInstanceCatchThrowableExceptions(IBeanProxy[] args) { - return newInstance(args); - } - /** - * Invoke the constructor and return an IDEBeanProxy with the result - */ - public IBeanProxy newInstance(IBeanProxy[] creationArguments) { - - // Get an array of bean objects from the bean proxy arguments - Object result = null; - Object[] creationObjects = new Object[creationArguments.length]; - for (int i = 0; i < creationArguments.length; i++) { - // It is possible the arguments are null which is perfectly valid - if (creationArguments[i] != null) - creationObjects[i] = ((IIDEBeanProxy) creationArguments[i]).getBean(); - } - - // Invoke the constructor - try { - result = ((Constructor) getBean()).newInstance(creationObjects); - } catch (Exception e) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - } - - // If we have a non-null result create an IDEBeanProxy and return it - if (result != null) { - return getNewIDEBeanProxy(result); - } else { - return null; - } - - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IConstructorProxy#getParameterTypes() - */ - public IBeanTypeProxy[] getParameterTypes() { - Class[] parmClasses = ((Constructor) getBean()).getParameterTypes(); - IBeanTypeProxy[] parmTypes = new IBeanTypeProxy[parmClasses.length]; - IDEStandardBeanTypeProxyFactory factory = (IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory(); - for (int i = 0; i < parmClasses.length; i++) { - parmTypes[i] = factory.getBeanTypeProxy(parmClasses[i]); - } - return parmTypes; - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEConstructorTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEConstructorTypeProxy.java deleted file mode 100644 index cbeb7547d..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEConstructorTypeProxy.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - - -/** - * @version 1.0 - * @author - */ -public class IDEConstructorTypeProxy extends IDEBeanTypeProxy { - - IDEConstructorTypeProxy(IDEProxyFactoryRegistry registry) { - super(registry, java.lang.reflect.Constructor.class); - } - - /* - * @see IDEBeanTypeProxy#newBeanProxy(Object) - */ - protected IIDEBeanProxy newBeanProxy(Object anObject) { - return new IDEConstructorProxy(fProxyFactoryRegistry, (java.lang.reflect.Constructor) anObject); - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEDoubleClassBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEDoubleClassBeanTypeProxy.java deleted file mode 100644 index 4fcb75172..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEDoubleClassBeanTypeProxy.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * Double BeanType Proxy. - */ -final class IDEDoubleClassBeanTypeProxy extends IDENumberBeanTypeProxy { - -protected IDEDoubleClassBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass, new Double(0)); -} -INumberBeanProxy createDoubleBeanProxy(Double aDouble){ - return new IDENumberBeanProxy(fProxyFactoryRegistry,aDouble,this); -} -} - - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEDoubleTypeBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEDoubleTypeBeanTypeProxy.java deleted file mode 100644 index 2945dfb2d..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEDoubleTypeBeanTypeProxy.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * double BeanType Proxy. - */ -final class IDEDoubleTypeBeanTypeProxy extends IDEPrimitiveBeanTypeProxy { -protected IDEDoubleTypeBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass); -} -INumberBeanProxy createDoubleBeanProxy(double aDouble){ - return new IDENumberBeanProxy(fProxyFactoryRegistry,new Double(aDouble),this); -} -int getPrimitiveType(){ - return DOUBLE; -} - -protected IIDEBeanProxy newBeanProxy(Object anObject){ - Number n = anObject instanceof Character ? new Double(((Character) anObject).charValue()) : (Number) anObject; - return new IDENumberBeanProxy(fProxyFactoryRegistry, n, this); -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEExpression.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEExpression.java deleted file mode 100644 index ac8876292..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEExpression.java +++ /dev/null @@ -1,1077 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: IDEExpression.java,v $ $Revision: 1.12 $ $Date: 2005/08/24 20:39:06 $ - */ -package org.eclipse.jem.internal.proxy.ide; - -import java.util.*; - -import org.eclipse.core.runtime.Platform; - -import org.eclipse.jem.internal.proxy.common.MethodHelper; -import org.eclipse.jem.internal.proxy.core.*; -import org.eclipse.jem.internal.proxy.core.ExpressionProxy.ProxyEvent; -import org.eclipse.jem.internal.proxy.initParser.tree.*; - -/** - * IDE expression processing. - * - * @since 1.0.0 - */ -public class IDEExpression extends Expression { - - private final IDEStandardBeanTypeProxyFactory beantypefactory; - protected final ExpressionProcesser eproc; - { - boolean useTracing = !isTraceSet() ? - "true".equalsIgnoreCase(Platform.getDebugOption(ProxyPlugin.getPlugin().getBundle().getSymbolicName() + ProxyLaunchSupport.EXPRESSION_TRACING)) : //$NON-NLS-1$ - isTrace(); - long threshold = Long.getLong(Platform.getDebugOption(ProxyPlugin.getPlugin().getBundle().getSymbolicName() + ProxyLaunchSupport.EXPRESSION_TRACEING_TIMER_THRESHOLD), -1L).longValue(); - eproc = new ExpressionProcesser(useTracing, threshold); - } - - - private void processExpressionError() throws ThrowableProxy, NoExpressionValueException { - if (!eproc.noErrors()) - if (eproc.isNoExpressionValue()) - throw (NoExpressionValueException) eproc.getErrorThrowable(); - else { - Throwable t = eproc.getErrorThrowable(); - if (t instanceof ThrowableProxy) - throw (ThrowableProxy) t; - else - throw new IDEThrowableProxy(eproc.getErrorThrowable(), beantypefactory.getBeanTypeProxy(t.getClass())); - } - } - - /** - * Create the IDEExpression - * - * @param registry - * - * @since 1.0.0 - */ - public IDEExpression(ProxyFactoryRegistry registry) { - super(registry); - beantypefactory = (IDEStandardBeanTypeProxyFactory) registry.getBeanTypeProxyFactory(); - } - - protected final IDEProxyFactoryRegistry getIDERegistry() { - return (IDEProxyFactoryRegistry) registry; - } - - protected final IDEStandardBeanTypeProxyFactory getIDEBeanTypeFactory() { - return beantypefactory; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushToProxy(org.eclipse.jem.internal.proxy.core.IProxy) - */ - protected void pushToProxy(IProxy proxy) { - if (proxy == null) - eproc.pushExpression(null, MethodHelper.NULL_TYPE); - else if (proxy.isBeanProxy()) - eproc.pushExpression(((IDEBeanProxy) proxy).getBean(), ((IDEBeanTypeProxy) ((IBeanProxy) proxy).getTypeProxy()).getTypeClass()); - else - eproc.pushExpressionProxy(((ExpressionProxy) proxy).getProxyID()); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.Expression#closeProxy() - */ - protected void closeProxy() { - methodExpressionProxies = fieldExpressionProxies = null; - eproc.close(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pullProxyValue(int, java.util.List) - */ - protected IBeanProxy pullProxyValue(int proxycount, List expressionProxies) throws ThrowableProxy, NoExpressionValueException { - processExtensionProxies(proxycount, expressionProxies); - processExpressionError(); - Object result[] = new Object[2]; - eproc.pullValue(result); - IBeanProxy resultProxy = getIDERegistry().getBeanProxy((Class) result[1], result[0]); - return resultProxy; - } - - private void processExtensionProxies(int proxycount, List expressionProxies) { - if (proxycount > 0) { - int len = expressionProxies.size(); - Object[] proxyResolution = new Object[2]; - for (int i = 0; i < len; i++) { - ExpressionProxy ep = (ExpressionProxy) expressionProxies.get(i); - if (ep != null) { - try { - eproc.pullExpressionProxyValue(ep.getProxyID(), proxyResolution); - if (proxyResolution[1] != Void.TYPE) - fireProxyResolved(ep, getIDERegistry().getBeanProxy((Class) proxyResolution[1], proxyResolution[0])); - else - fireProxyVoid(ep); - } catch (NoExpressionValueException e) { - fireProxyNotResolved(ep); - } - } - } - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushCastToProxy(org.eclipse.jem.internal.proxy.core.IProxyBeanType) - */ - protected void pushCastToProxy(IProxyBeanType type) { - try { - eproc.pushCast(getIDEBeanTypeProxy(type).getTypeClass()); - } catch (ThrowableProxy e) { - eproc.processException(e); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushInstanceofToProxy(org.eclipse.jem.internal.proxy.core.IProxyBeanType) - */ - protected void pushInstanceofToProxy(IProxyBeanType type) { - try { - eproc.pushInstanceof(getIDEBeanTypeProxy(type).getTypeClass()); - } catch (ThrowableProxy e) { - eproc.processException(e); - } - } - - /** - * Get the BeanType proxy and test if valid. Throw ThrowableProxy if not valid. - * - * @param type - * @return - * @throws ThrowableProxy - * - * @since 1.0.0 - */ - protected IDEBeanTypeProxy getIDEBeanTypeProxy(IProxyBeanType type) throws ThrowableProxy { - IDEBeanTypeProxy typeProxy; - if (type.isExpressionProxy()) { - // It should already be resolved at this point. - typeProxy = ((IDEBeanTypeExpressionProxy) type).getBeanTypeProxy(); - } else - typeProxy = (IDEBeanTypeProxy) type; - if (!typeProxy.isValid()) { - throw new IDEThrowableProxy( - new Exception(typeProxy.getInitializationError()), - getIDEBeanTypeFactory().getBeanTypeProxy(Exception.class)); - } else - return typeProxy; - } - - - /** - * Get the BeanType proxy and test if valid. Throw ThrowableProxy if not valid. - * @param type - * @return - * @throws ThrowableProxy - * - * @since 1.1.0 - */ - protected IDEBeanTypeProxy getIDEBeanTypeProxy(String type) throws ThrowableProxy { - return (IDEBeanTypeProxy) registry.getBeanTypeProxyFactory().getBeanTypeProxy(type); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushPrefixToProxy(org.eclipse.jem.internal.proxy.initParser.tree.PrefixOperator) - */ - protected void pushPrefixToProxy(PrefixOperator operator) { - eproc.pushPrefix(operator); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushInfixToProxy(org.eclipse.jem.internal.proxy.initParser.tree.InfixOperator, org.eclipse.jem.internal.proxy.initParser.tree.InternalInfixOperandType) - */ - protected void pushInfixToProxy(InfixOperator operator, InternalInfixOperandType operandType) { - eproc.pushInfix(operator, operandType); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushArrayAccessToProxy(int) - */ - protected void pushArrayAccessToProxy(int indexCount) { - eproc.pushArrayAccess(indexCount); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushArrayCreationToProxy(org.eclipse.jem.internal.proxy.core.IProxyBeanType, int) - */ - protected void pushArrayCreationToProxy(IProxyBeanType type, int dimensionCount) { - try { - eproc.pushArrayCreation(getIDEBeanTypeProxy(type).getTypeClass(), dimensionCount); - } catch (ThrowableProxy e) { - eproc.processException(e); - } - } - - protected void pushArrayInitializerToProxy(IProxyBeanType type, int stripCount, int expressionCount) { - try { - eproc.pushArrayInitializer(getIDEBeanTypeProxy(type).getTypeClass(), stripCount, expressionCount); - } catch (ThrowableProxy e) { - eproc.processException(e); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushClassInstanceCreationToProxy(org.eclipse.jem.internal.proxy.core.IProxyBeanType, int) - */ - protected void pushClassInstanceCreationToProxy(IProxyBeanType type, int argumentCount) { - try { - eproc.pushClassInstanceCreation(getIDEBeanTypeProxy(type).getTypeClass(), argumentCount); - } catch (ThrowableProxy e) { - eproc.processException(e); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushTypeReceiverToProxy(org.eclipse.jem.internal.proxy.core.IProxyBeanType) - */ - protected void pushTypeReceiverToProxy(IProxyBeanType type) { - try { - Class c = getIDEBeanTypeProxy(type).getTypeClass(); - eproc.pushExpression(c, c); // When as a receiver, the type is the same as the receiver. - } catch (ThrowableProxy e) { - eproc.processException(e); - } catch (RuntimeException e) { - eproc.processException(e); - } - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushFieldAccessToProxy(java.lang.Object, boolean) - */ - protected void pushFieldAccessToProxy(Object field, boolean hasReceiver) { - boolean isString = field instanceof String; - try { - eproc.pushFieldAccess(isString ? field : getIDEFieldProxy((IProxyField) field).getBean(), isString, hasReceiver); - } catch (ThrowableProxy e) { - eproc.processException(e); - } - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushMethodInvocationToProxy(java.lang.Object, boolean, int) - */ - protected void pushMethodInvocationToProxy(Object method, boolean hasReceiver, int argCount) { - boolean isString = method instanceof String; - try { - eproc.pushMethodInvocation(isString ? method : getIDEMethodProxy((IProxyMethod) method).getBean(), isString, hasReceiver, argCount); - } catch (ThrowableProxy e) { - eproc.processException(e); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushConditionalToProxy(org.eclipse.jem.internal.proxy.initParser.tree.InternalConditionalOperandType) - */ - protected void pushConditionalToProxy(InternalConditionalOperandType expressionType) { - eproc.pushConditional(expressionType); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushInvoke() - */ - protected void pushInvoke(int proxycount, List expressionProxies) throws ThrowableProxy, NoExpressionValueException { - // In the IDE case do nothing. Nothing is pending. But still need to handle proxy resolution. - processExtensionProxies(proxycount, expressionProxies); - processExpressionError(); - } - - /** - * This is used as both an ExpressionProxy (i.e. IDE side) and the Expressions expression proxy result on the other side. - * This makes it easier to just use same instance on both sides. - * - * @since 1.1.0 - */ - protected static class IDEExpressionProxy extends ExpressionProxy implements InternalExpressionProxy { - - protected IDEExpressionProxy(int proxyid, int proxyType, Expression expression) { - super(proxyid, proxyType, expression); - } - - private Object value; - private Class type; - private boolean set; - - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.ExpressionProxy#dispose() - */ - protected void dispose() { - super.dispose(); - value = null; - type = null; - set = false; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.initParser.tree.InternalExpressionProxy#getType() - */ - public Class getType() { - return type; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.initParser.tree.InternalExpressionProxy#getValue() - */ - public Object getValue() { - return value; - } - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.initParser.tree.InternalExpressionProxy#setProxy(java.lang.Object, java.lang.Class) - */ - public void setProxy(Object value, Class type) { - this.value = value; - this.type = type; - set = true; - } - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.initParser.tree.InternalExpressionProxy#isSet() - */ - public boolean isSet() { - return set; - } - } - - /** - * The Expression proxy for IDE BeanTypes. - * - * @since 1.1.0 - */ - protected static class IDEBeanTypeExpressionProxy extends IDEExpressionProxy implements IBeanTypeExpressionProxy { - - private String typeName; - private IDEBeanTypeProxy resolvedProxy; - - /** - * @param proxyid - * - * @since 1.1.0 - */ - public IDEBeanTypeExpressionProxy(int proxyid, Expression expression) { - super(proxyid, BEANTYPE_EXPRESSION_PROXY, expression); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeExpressionProxy#setTypeName(java.lang.String) - */ - public void setTypeName(String typeName) { - this.typeName = typeName; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IProxyBeanType#getTypeName() - */ - public String getTypeName() { - return typeName; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.ExpressionProxy#toString() - */ - public String toString() { - return super.toString()+" - "+getTypeName(); //$NON-NLS-1$ - } - - /** - * Called by IDEExpression to resolve the beantype. - * @param beantypeProxy - * - * @since 1.1.0 - */ - void setProxy(IDEBeanTypeProxy beantypeProxy) { - this.resolvedProxy = beantypeProxy; - setProxy(resolvedProxy.getTypeClass(), Class.class); - } - - /** - * Called by IDEExpression to get the resolved beantype proxy. - * @return - * - * @since 1.1.0 - */ - IDEBeanTypeProxy getBeanTypeProxy() { - return resolvedProxy; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IProxyBeanType#getMethodProxy(org.eclipse.jem.internal.proxy.core.IExpression, java.lang.String, org.eclipse.jem.internal.proxy.core.IProxyBeanType[]) - */ - public IProxyMethod getMethodProxy(IExpression expression, String methodName, IProxyBeanType[] parameterTypes) { - IProxyMethod method = ((IDEExpression) expression).getMethodExpressionProxy(this, methodName, parameterTypes); - if (method == null) { - // Need to go to the expression and create it. - method = ((Expression) expression).createMethodExpressionProxy(this, methodName, parameterTypes); - } - return method; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IProxyBeanType#getMethodProxy(org.eclipse.jem.internal.proxy.core.IExpression, java.lang.String, java.lang.String[]) - */ - public IProxyMethod getMethodProxy(IExpression expression, String methodName, String[] parameterTypes) { - return ((IDEMethodProxyFactory) expression.getRegistry().getMethodProxyFactory()).getMethodProxy(expression, this, methodName, parameterTypes); - } - - public IProxyMethod getMethodProxy(IExpression expression, String methodName) { - return getMethodProxy(expression, methodName, (IProxyBeanType[]) null); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IProxyBeanType#getFieldProxy(org.eclipse.jem.internal.proxy.core.IExpression, java.lang.String) - */ - public IProxyField getFieldProxy(IExpression expression, String fieldName) { - IProxyField field = ((IDEExpression) expression).getFieldExpressionProxy(this, fieldName); - if (field == null) { - // Need to go to the expression and create it. - field = ((Expression) expression).createFieldExpressionProxy(this, fieldName); - } - return field; - } - } - - /** - * The Expression proxy for IDE BeanTypes. - * - * @since 1.1.0 - */ - protected static class IDEMethodExpressionProxy extends IDEExpressionProxy implements IProxyMethod { - - private String methodName; - private IDEMethodProxy resolvedProxy; - private ThrowableProxy errorThrowable; - - /** - * @param proxyid - * - * @since 1.1.0 - */ - public IDEMethodExpressionProxy(int proxyid, Expression expression) { - super(proxyid, METHOD_EXPRESSION_PROXY, expression); - } - - /** - * Set by IDEExpression with the method name. - * @param methodName - * - * @since 1.1.0 - */ - void setMethodName(String methodName) { - this.methodName = methodName; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.ExpressionProxy#toString() - */ - public String toString() { - return super.toString()+" - "+methodName; //$NON-NLS-1$ - } - - /** - * Called by IDEExpression to resolve the beantype. - * @param methodProxy - * - * @since 1.1.0 - */ - void setProxy(IDEMethodProxy methodProxy) { - this.resolvedProxy = methodProxy; - setProxy(resolvedProxy.getBean(), Class.class); - } - - /** - * Called by IDEExpression to say there was error in creating the proxy. - * @param errorThrowable - * - * @since 1.1.0 - */ - void setThrowable(ThrowableProxy errorThrowable) { - this.errorThrowable = errorThrowable; - } - - /** - * Called by IDEExpression to get the resolved method proxy. - * @return - * @throws ThrowableProxy - * - * @since 1.1.0 - */ - IDEMethodProxy getMethodProxy() throws ThrowableProxy { - if (errorThrowable != null) - throw errorThrowable; - return resolvedProxy; - } - } - - protected static class IDEFieldExpressionProxy extends IDEExpressionProxy implements IProxyField { - - private String fieldName; - private IDEFieldProxy resolvedProxy; - private ThrowableProxy errorThrowable; - - /** - * @param proxyid - * - * @since 1.1.0 - */ - public IDEFieldExpressionProxy(int proxyid, Expression expression) { - super(proxyid, FIELD_EXPRESSION_PROXY, expression); - } - - /** - * Set by IDEExpression with the method name. - * @param fieldName - * - * @since 1.1.0 - */ - void setField(String fieldName) { - this.fieldName = fieldName; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.ExpressionProxy#toString() - */ - public String toString() { - return super.toString()+" - "+fieldName; //$NON-NLS-1$ - } - - /** - * Called by IDEExpression to resolve the beantype. - * @param fieldProxy - * - * @since 1.1.0 - */ - void setProxy(IDEFieldProxy fieldProxy) { - this.resolvedProxy = fieldProxy; - setProxy(resolvedProxy.getBean(), Class.class); - } - - /** - * Called by IDEExpression to say there was error in creating the proxy. - * @param errorThrowable - * - * @since 1.1.0 - */ - void setThrowable(ThrowableProxy errorThrowable) { - this.errorThrowable = errorThrowable; - } - - /** - * Called by IDEExpression to get the resolved field proxy. - * @return - * @throws ThrowableProxy - * - * @since 1.1.0 - */ - IDEFieldProxy getFieldProxy() throws ThrowableProxy { - if (errorThrowable != null) - throw errorThrowable; - return resolvedProxy; - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#createExpressionProxy(int, int) - */ - protected ExpressionProxy createExpressionProxy(int proxyType, int proxyID) { - switch (proxyType) { - case NORMAL_EXPRESSION_PROXY: - default: - return new IDEExpressionProxy(proxyID, NORMAL_EXPRESSION_PROXY, this); - - case BEANTYPE_EXPRESSION_PROXY: - return new IDEBeanTypeExpressionProxy(proxyID, this); - - case METHOD_EXPRESSION_PROXY: - return new IDEMethodExpressionProxy(proxyID, this); - - case FIELD_EXPRESSION_PROXY: - return new IDEFieldExpressionProxy(proxyID, this); - } - - } - - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushAssignmentToProxy(org.eclipse.jem.internal.proxy.core.ExpressionProxy) - */ - protected void pushAssignmentToProxy(ExpressionProxy proxy) { - eproc.pushAssignment((InternalExpressionProxy) proxy); - } - - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushAssignmentToProxy() - */ - protected void pushAssignmentToProxy() { - eproc.pushAssignment(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushBlockBeginToProxy(int) - */ - protected void pushBlockBeginToProxy(int blockNumber) { - eproc.pushBlockBegin(blockNumber); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushBlockEndToProxy(int) - */ - protected void pushBlockEndToProxy(int blockNumber) { - eproc.pushBlockEnd(blockNumber); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushBlockBreakToProxy(int) - */ - protected void pushBlockBreakToProxy(int blockNumber) { - eproc.pushBlockBreak(blockNumber); - } - - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushTryBeginToProxy(int) - */ - protected void pushTryBeginToProxy(int tryNumber) { - eproc.pushTryBegin(tryNumber); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushTryCatchClauseToProxy(int, org.eclipse.jem.internal.proxy.core.IProxyBeanType, org.eclipse.jem.internal.proxy.core.ExpressionProxy) - */ - protected void pushTryCatchClauseToProxy(int tryNumber, IProxyBeanType exceptionType, ExpressionProxy ep) { - try { - eproc.pushTryCatchClause(tryNumber, getIDEBeanTypeProxy(exceptionType).getTypeClass(), (InternalExpressionProxy) ep); - } catch (ThrowableProxy e) { - eproc.processException(e); - } - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushTryFinallyClauseToProxy(int) - */ - protected void pushTryFinallyClauseToProxy(int tryNumber) { - eproc.pushTryFinallyClause(tryNumber); - } - - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushTryEndToProxy(int) - */ - protected void pushTryEndToProxy(int tryNumber) { - eproc.pushTryEnd(tryNumber); - } - - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushThrowToProxy() - */ - protected void pushThrowToProxy() { - eproc.pushThrowException(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushRethrowToProxy(int) - */ - protected void pushRethrowToProxy(int tryNumber) { - eproc.pushTryRethrow(tryNumber); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushBeanTypeToProxy(org.eclipse.jem.internal.proxy.core.IBeanTypeExpressionProxy) - */ - protected void pushBeanTypeToProxy(IBeanTypeExpressionProxy proxy) { - try { - IDEBeanTypeExpressionProxy ep = (IDEBeanTypeExpressionProxy) proxy; - IDEBeanTypeProxy typeProxy = getIDEBeanTypeProxy(proxy.getTypeName()); - ep.setProxy(typeProxy); - eproc.allocateExpressionProxy(ep); - if (!typeProxy.isValid()) { - Throwable cause = ((IDEInitErrorBeanTypeProxy) typeProxy).getCause(); - if (cause == null) - throw new IDEThrowableProxy( - new Exception(typeProxy.getInitializationError()), - getIDEBeanTypeFactory().getBeanTypeProxy(Exception.class)); - else - throw new IDEThrowableProxy( - cause, - getIDEBeanTypeFactory().getBeanTypeProxy(cause.getClass())); - - } - } catch (ThrowableProxy e) { - eproc.processException(e); - } - } - - /** - * Get the map of IProxyBeanTypes for a beantype name. Meant to be used only in conjunction with IDEStandardBeanTypeFactory. - * It is here so the IDDEStandardBeanTypeFactory can store pending proxies per expression. - * - * @param beanType - * @return - * - * @since 1.1.0 - */ - public IProxyBeanType getBeanType(String beanTypeName) { - if (beanTypeCache == null) - beanTypeCache = new HashMap(); - return (IProxyBeanType) beanTypeCache.get(beanTypeName); - } - - /** - * Add the beantype expression proxy to the map of bean type expression proxies. Used in conjunction with IDEStandardBeanTypeFactory. - * It is here so the IDEStandardBeanTypeFactory can store pending proxies per expression. - * @param beanTypeName - * @param beantype - * - * @since 1.1.0 - */ - public void addBeanType(String beanTypeName, IProxyBeanType beantype) { - beanTypeCache.put(beanTypeName, beantype); - } - - /** - * Remove the beantype expression proxy from the map. This is called because there was a rollback due to an endmark. - * @param beanTypeName - * - * @since 1.1.0 - */ - public void removeBeanType(String beanTypeName) { - beanTypeCache.remove(beanTypeName); - } - - /** - * Keeping a local map of Method Expression Proxies so that we don't keep recreating them for each request from within this expression. - * The map will be: declaringTypeName->(Map) methodName or IDEMethodKey -> method expression proxy. - * @see IDEExpression#pushMethodToProxy(ExpressionProxy, IProxyBeanType, String, IProxyBeanType[]) for the actual implementation. - */ - protected Map methodExpressionProxies; - - /** - * Keeping a local map of Field Expression Proxies so that we don't keep recreating them for each request from within this expression. - * The map will be: declaringTypeName->(Map) fieldname -> field expression proxy. - * @see IDEExpression#pushFieldToProxy(ExpressionProxy, IProxyBeanType, String) - */ - protected Map fieldExpressionProxies; - - /** - * Keeping a local map of BeanType expression proxies so that we don't keep recreating them for each request from within this expression. - * The map will be: typename->beanTypeExpressionProxy - */ - protected Map beanTypeCache; // Use to cache pending BeanTypes. Used in conjunction with IDEStandardBeanTypeFactory. - - /* - * Used as the key to the methodCache when there are parms. - * It allows the parms to be either IProxyBeanType without the - * overhead of creating complicated strings. - * - * It will compare method name and each individual parm name without fluffing - * up a string and building it up. - * - * For no parm methods, just the name of the method as a string will be the key. - * - * @since 1.1.0 - */ - private static class MethodKey { - public String methodName; - public IProxyBeanType[] parmTypes; - public MethodKey(String methodName, IProxyBeanType[] parmTypes) { - this.methodName = methodName; - this.parmTypes = parmTypes; - } - - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - if (this == obj) - return true; - try { - return ((MethodKey) obj).compareParms(parmTypes); - } catch (ClassCastException e) { - return false; - } - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.remote.REMProxyConstants.MethodKey#hashCode() - */ - public int hashCode() { - int h = methodName.hashCode();; - for (int i = 0; i < parmTypes.length; i++) { - h += parmTypes[i].getTypeName().hashCode(); - } - return h; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.remote.REMProxyConstants.MethodKey#compareParms(java.lang.String[]) - */ - protected boolean compareParms(IProxyBeanType[] parms) { - if (parms.length != parmTypes.length) - return false; - for (int i = 0; i < parms.length; i++) { - if (!parmTypes[i].getTypeName().equals(parms[i].getTypeName())) - return false; - } - return true; - } - } - - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushMethodToProxy(org.eclipse.jem.internal.proxy.core.ExpressionProxy, org.eclipse.jem.internal.proxy.core.IProxyBeanType, java.lang.String, org.eclipse.jem.internal.proxy.core.IProxyBeanType[]) - */ - protected void pushMethodToProxy(ExpressionProxy proxy, IProxyBeanType declaringType, String methodName, IProxyBeanType[] parameterTypes) { - try { - final Map methods = getMethods(declaringType); - final Object key = getMethodKey(methodName, parameterTypes); - methods.put(key, proxy); - proxy.addProxyListener(new ExpressionProxy.ProxyAdapter() { - - public void proxyNotResolved(ProxyEvent event) { - methods.remove(key); // Back it out. tis could happen due to endmark rollback. - } - - }); - - IDEMethodExpressionProxy ep = (IDEMethodExpressionProxy) proxy; - ep.setMethodName(methodName); - // We resolve immediately. Any expression proxies should also be resolved at this point too. - Class declaringClass = getIDEBeanTypeProxy(declaringType).getTypeClass(); - Class[] parameterClasses; - if (parameterTypes == null || parameterTypes.length == 0) - parameterClasses = null; - else { - parameterClasses = new Class[parameterTypes.length]; - for (int i = 0; i < parameterClasses.length; i++) { - parameterClasses[i] = getIDEBeanTypeProxy(parameterTypes[i]).getTypeClass(); - } - } - IDEMethodProxy methodProxy = ((IDEMethodProxyFactory) registry.getMethodProxyFactory()).getMethodProxy(declaringClass, methodName, parameterClasses); - if (methodProxy == null) { - String parms = ""; //$NON-NLS-1$ - if (parameterTypes != null && parameterTypes.length > 0) { - StringBuffer st = new StringBuffer(100); - for (int i = 0; i < parameterClasses.length; i++) { - if (i > 0) - st.append(','); - st.append(parameterTypes[i].getTypeName()); - } - parms = st.toString(); - } - throw new IDEThrowableProxy(new NoSuchMethodException("No method: "+declaringType+'.'+methodName+"("+parms+')'), //$NON-NLS-1$ //$NON-NLS-2$ - getIDEBeanTypeFactory().getBeanTypeProxy(NoSuchMethodException.class)); - } - - ep.setProxy(methodProxy); - eproc.allocateExpressionProxy(ep); - } catch (ThrowableProxy e) { - ((IDEMethodExpressionProxy) proxy).setThrowable(e); // So we don't recreate throwable all of the time. - eproc.processException(e); - } - } - - private Map getMethods(IProxyBeanType classtype) { - if (methodExpressionProxies == null) - methodExpressionProxies = new HashMap(); - Map methods = (Map) methodExpressionProxies.get(classtype.getTypeName()); - if (methods == null) - methodExpressionProxies.put(classtype.getTypeName(), methods = new HashMap()); - return methods; - } - - private Object getMethodKey(String methodName, IProxyBeanType[] parameterTypes) { - if (parameterTypes == null || parameterTypes.length == 0) - return methodName; - else - return new MethodKey(methodName, parameterTypes); - } - - private Map getFields(IProxyBeanType classtype) { - if (fieldExpressionProxies == null) - fieldExpressionProxies = new HashMap(); - Map fields = (Map) fieldExpressionProxies.get(classtype.getTypeName()); - if (fields == null) - fieldExpressionProxies.put(classtype.getTypeName(), fields = new HashMap()); - return fields; - } - - /** - * This is used by IDEBeanTypes and IDEBeanTypeExpressionProxy to access any already created Method Expression Proxies. - * - * @param declaringType - * @param methodName - * @param parameterTypes - * @return IProxyMethod or <code>null</code> if not yet created. - * - * @since 1.1.0 - */ - IProxyMethod getMethodExpressionProxy(IProxyBeanType declaringType, String methodName, IProxyBeanType[] parameterTypes) { - Map methods = getMethods(declaringType); - Object key = getMethodKey(methodName, parameterTypes); - return (IProxyMethod) methods.get(key); - } - - /** - * This is used by IDEBeanTypes and IDEBeanTypeExpressionProxy to access any already created Field Expression Proxies. - * @param declaringType - * @param fieldName - * @return - * - * @since 1.1.0 - */ - IProxyField getFieldExpressionProxy(IProxyBeanType declaringType, String fieldName) { - Map fields = getFields(declaringType); - return (IProxyField) fields.get(fieldName); - } - - /** - * Get the IDEMethodProxy out of the already resolved Expression Proxy or IDEMethodProxy itself. - * @param method - * @return - * @throws ThrowableProxy - * - * @since 1.1.0 - */ - protected IDEMethodProxy getIDEMethodProxy(IProxyMethod method) throws ThrowableProxy { - IDEMethodProxy methodProxy; - if (method.isExpressionProxy()) { - // It should already be resolved at this point. - methodProxy = ((IDEMethodExpressionProxy) method).getMethodProxy(); - } else - methodProxy = (IDEMethodProxy) method; - return methodProxy; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushFieldToProxy(org.eclipse.jem.internal.proxy.core.ExpressionProxy, org.eclipse.jem.internal.proxy.core.IProxyBeanType, java.lang.String) - */ - protected void pushFieldToProxy(ExpressionProxy proxy, IProxyBeanType declaringType, final String fieldName) { - - try { - final Map fields = getFields(declaringType); - fields.put(fieldName, proxy); - proxy.addProxyListener(new ExpressionProxy.ProxyAdapter(){ - public void proxyNotResolved(ExpressionProxy.ProxyEvent event) { - fields.remove(fieldName); // this can happen due to an endmark. It could be one of the ones that are rolled back. - } - }); - - - IDEFieldExpressionProxy ep = (IDEFieldExpressionProxy) proxy; - // We resolve immediately. Any expression proxies should also be resolved at this point too. - IDEFieldProxy fieldProxy = (IDEFieldProxy) getIDEBeanTypeProxy(declaringType).getFieldProxy(fieldName); - if (fieldProxy == null) { - throw new IDEThrowableProxy(new NoSuchFieldException("No field: "+declaringType+'.'+fieldName), //$NON-NLS-1$ - getIDEBeanTypeFactory().getBeanTypeProxy(NoSuchFieldException.class)); - } - - ep.setProxy(fieldProxy); - eproc.allocateExpressionProxy(ep); - } catch (ThrowableProxy e) { - ((IDEFieldExpressionProxy) proxy).setThrowable(e); // So we don't recreate throwable all of the time. - eproc.processException(e); - } - - } - - /** - * Get the IDEFieldProxy out of the already resolved Expression Proxy or IDEFieldProxy itself. - * @param field - * @return - * @throws ThrowableProxy - * - * @since 1.1.0 - */ - protected IDEFieldProxy getIDEFieldProxy(IProxyField field) throws ThrowableProxy { - IDEFieldProxy fieldProxy; - if (field.isExpressionProxy()) { - // It should already be resolved at this point. - fieldProxy = ((IDEFieldExpressionProxy) field).getFieldProxy(); - } else - fieldProxy = (IDEFieldProxy) field; - return fieldProxy; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushIfTestToProxy() - */ - protected void pushIfTestToProxy() { - eproc.pushIfElse(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushIfElseToProxy(org.eclipse.jem.internal.proxy.initParser.tree.InternalIfElseOperandType) - */ - protected void pushIfElseToProxy(InternalIfElseOperandType clauseType) { - eproc.pushIfElse(clauseType); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.Expression#pushNewInstanceToProxy(java.lang.String, org.eclipse.jem.internal.proxy.core.IProxyBeanType) - */ - protected void pushNewInstanceToProxy(String initializationString, IProxyBeanType resultType) { - try { - eproc.pushNewInstanceFromString(initializationString, getIDEBeanTypeProxy(resultType).getTypeClass(), getIDERegistry().fClassLoader); - } catch (ThrowableProxy e) { - eproc.processException(e); - } - } - - protected void pushMarkToProxy(int markID) { - eproc.pushMark(markID); - } - - protected void pushEndmarkToProxy(int markID, boolean restore) { - eproc.pushEndmark(markID, restore); - } - - protected void pushBeginTransferThreadToProxy() { - // For IDE it doesn't matter. Just go ahead and continue processing. - } - - protected void pushTransferThreadToProxy() { - // For IDE it doesn't matter. Just go ahead and continue processing. - } - - protected void pushSubexpressionBeginToProxy(int subexpressionNumber) { - eproc.pushSubexpressionBegin(subexpressionNumber); - } - - protected void pushSubexpressionEndToProxy(int subexpressionNumber) { - eproc.pushSubexpressionEnd(subexpressionNumber); - } -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEExtensionBeanTypeProxyFactory.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEExtensionBeanTypeProxyFactory.java deleted file mode 100644 index c3fb27721..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEExtensionBeanTypeProxyFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -public interface IDEExtensionBeanTypeProxyFactory extends IBeanTypeProxyFactory { - -public IDEBeanTypeProxy getExtensionBeanTypeProxy(String className); - -public IDEBeanTypeProxy getExtensionBeanTypeProxy(String typeName, IBeanTypeProxy superType); - -public IProxyBeanType getExtensionBeanTypeProxy(String typeName, IExpression expression); - - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFieldProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFieldProxy.java deleted file mode 100644 index c23081bf2..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFieldProxy.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import java.lang.reflect.Field; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * Implementation of IFieldProxy where the bean vm is the same as the IDE - * Therefore we hold the instance of a java.lang.reflect.Field in a field - * directly and have a package protected constructor to set this - * Creation date: (1/17/00 12:32:24 PM) - * @author: Joe Winchester - */ -public class IDEFieldProxy extends IDEAccessibleObjectProxy implements IFieldProxy { - protected IBeanTypeProxy fFieldType; - /** - * Package protected constructor that takes the field directly - * This is package protected because only classes in the IDE package can construct - * this. Everyone else must go via the typeProxy - */ - IDEFieldProxy(IDEProxyFactoryRegistry aRegistry, Field aField) { - super(aRegistry, aField); - } - /** - * Get the value of the field and return it wrapped in a bean proxy - */ - public IBeanProxy get(IBeanProxy aSubject) { - - Object result = null; - // Get the field value and catch any errors - try { - result = ((Field) getBean()).get(aSubject != null ? ((IIDEBeanProxy) aSubject).getBean() : null); - } catch (Exception e) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - } - - // If we have a non null result wrap it in an IBeanProxy and return it - if (result != null) { - return fProxyFactoryRegistry.getBeanProxy(((Field) getBean()).getType(), result); - } else { - return null; - } - - } - /** - * Get the beans from both of the proxies and invoke the field set method - * Cast to IDEBeanProxy and use package protected method - */ - public void set(IBeanProxy aSubject, IBeanProxy argument) { - - // Set the field value and catch any errors - try { - ((Field) getBean()).set( - aSubject != null ? ((IIDEBeanProxy) aSubject).getBean() : null, - argument != null ? ((IIDEBeanProxy) argument).getBean() : null); - } catch (Exception e) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - } - } - /** - * The type proxy is constant proxy out of the method factory. - */ - public IBeanTypeProxy getTypeProxy() { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).fieldType; - } - /** - * Return the type of the field. - */ - public IBeanTypeProxy getFieldType() { - if (fFieldType == null) { - fFieldType = - ((IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory()).getBeanTypeProxy( - ((Field) getBean()).getType()); - } - return fFieldType; - } -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFieldTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFieldTypeProxy.java deleted file mode 100644 index 6772f1fbe..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFieldTypeProxy.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -/** - * @version 1.0 - * @author - */ -public class IDEFieldTypeProxy extends IDEBeanTypeProxy { - - IDEFieldTypeProxy(IDEProxyFactoryRegistry registry) { - super(registry, java.lang.reflect.Field.class); - } - - /* - * @see IDEBeanTypeProxy#newBeanProxy(Object) - */ - protected IIDEBeanProxy newBeanProxy(Object anObject) { - return new IDEFieldProxy(fProxyFactoryRegistry, (java.lang.reflect.Field) anObject); - } -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFloatClassBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFloatClassBeanTypeProxy.java deleted file mode 100644 index 26de58b9a..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFloatClassBeanTypeProxy.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; -/** - * Float BeanType Proxy. - */ -final class IDEFloatClassBeanTypeProxy extends IDENumberBeanTypeProxy { - -protected IDEFloatClassBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass, new Float(0)); -} -INumberBeanProxy createFloatBeanProxy(Float aFloat){ - return new IDENumberBeanProxy(fProxyFactoryRegistry,aFloat,this); -} -} - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFloatTypeBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFloatTypeBeanTypeProxy.java deleted file mode 100644 index 86dbe3c0e..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEFloatTypeBeanTypeProxy.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * Float BeanType Proxy. - */ -final class IDEFloatTypeBeanTypeProxy extends IDEPrimitiveBeanTypeProxy { -protected IDEFloatTypeBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass); -} -INumberBeanProxy createFloatBeanProxy(float aFloat){ - return new IDENumberBeanProxy(fProxyFactoryRegistry,new Float(aFloat),this); -} -int getPrimitiveType(){ - return FLOAT; -} - -protected IIDEBeanProxy newBeanProxy(Object anObject){ - Number n = anObject instanceof Character ? new Float(((Character) anObject).charValue()) : (Number) anObject; - return new IDENumberBeanProxy(fProxyFactoryRegistry, n, this); - -} -} - - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEInitErrorBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEInitErrorBeanTypeProxy.java deleted file mode 100644 index 3b1337589..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEInitErrorBeanTypeProxy.java +++ /dev/null @@ -1,260 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; - -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * @author richkulp - * - * To change this generated comment edit the template variable "typecomment": Window>Preferences>Java>Templates. To enable and disable the creation of - * type comments go to Window>Preferences>Java>Code Generation. - */ -public class IDEInitErrorBeanTypeProxy extends IDEBeanTypeProxy { - - protected String classname; - - protected String initializationError; - - protected Throwable cause; - - protected IDEInitErrorBeanTypeProxy(IDEProxyFactoryRegistry registry, String classname, String initializationError, Throwable cause) { - super(registry, null); - this.classname = classname; - this.initializationError = initializationError; - this.cause = cause; - } - - /** - * Get the throwable (cause) that made this bean type bad. - * @return the Throwable that was the cause, or null if not caused by an throwable. - * - * @since 1.1.0 - */ - public Throwable getCause() { - return cause; - } - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructorProxy(String[]) - */ - public IConstructorProxy getConstructorProxy(String[] argumentClassNames) { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructorProxy(IBeanTypeProxy[]) - */ - public IConstructorProxy getConstructorProxy(IBeanTypeProxy[] argumentTypes) { - return null; - } - - public IConstructorProxy[] getConstructors() { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructorProxy(String[]) - */ - public IConstructorProxy getDeclaredConstructorProxy(String[] argumentClassNames) { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getConstructorProxy(IBeanTypeProxy[]) - */ - public IConstructorProxy getDeclaredConstructorProxy(IBeanTypeProxy[] argumentTypes) { - return null; - } - - public IConstructorProxy[] getDeclaredConstructors() { - return null; - } - - public IFieldProxy[] getFields() { - return null; - } - - public IFieldProxy[] getDeclaredFields() { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getFieldProxy(String) - */ - public IFieldProxy getFieldProxy(String fieldName) { - return null; - } - - public IMethodProxy[] getMethods() { - return null; - } - - public IMethodProxy[] getDeclaredMethods() { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getMethodProxy(String) - */ - public IMethodProxy getMethodProxy(String methodName) { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getMethodProxy(String, String[]) - */ - public IMethodProxy getMethodProxy(String methodName, String[] argumentClassNames) { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getMethodProxy(String, String) - */ - public IMethodProxy getMethodProxy(String methodName, String argumentClassName) { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getMethodProxy(String, IBeanTypeProxy[]) - */ - public IMethodProxy getMethodProxy(String methodName, IBeanTypeProxy[] argumentTypes) { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getMethodProxy(String, String[]) - */ - public IMethodProxy getDeclaredMethodProxy(String methodName, String[] argumentClassNames) { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getMethodProxy(String, IBeanTypeProxy[]) - */ - public IMethodProxy getDeclaredMethodProxy(String methodName, IBeanTypeProxy[] argumentTypes) { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getNullConstructorProxy() - */ - public IConstructorProxy getNullConstructorProxy() { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getSuperBeanTypeProxy() - */ - public IBeanTypeProxy getSuperBeanTypeProxy() { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getTypeName() - */ - public String getTypeName() { - return classname; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getFormalTypeName() - */ - public String getFormalTypeName() { - return getTypeName(); - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#isArray() - */ - public boolean isArray() { - return false; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#isInterface() - */ - public boolean isInterface() { - return false; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#isPrimitive() - */ - public boolean isPrimitive() { - return false; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#isKindOf(IBeanTypeProxy) - */ - public boolean isKindOf(IBeanTypeProxy aBeanProxyType) { - return false; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#newInstance() - */ - public IBeanProxy newInstance() { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#newInstance(String) - */ - public IBeanProxy newInstance(String initializationString) { - return null; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getInitializationError() - */ - public String getInitializationError() { - return initializationError; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanProxy#toBeanString() - */ - public String toBeanString() { - return classname; - } - - /** - * @see org.eclipse.jem.internal.proxy.core.IBeanProxy#isValid() - */ - public boolean isValid() { - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getCompatibleConstructor(org.eclipse.jem.internal.proxy.core.IBeanTypeProxy[]) - */ - public IConstructorProxy getCompatibleConstructor(IBeanTypeProxy[] argumentTypes) { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanTypeProxy#getCompatibleMethod(java.lang.String, - * org.eclipse.jem.internal.proxy.core.IBeanTypeProxy[]) - */ - public IMethodProxy getCompatibleMethod(String methodName, IBeanTypeProxy[] argumentTypes) { - return null; - } -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEIntegerBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEIntegerBeanProxy.java deleted file mode 100644 index 09e3a43cd..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEIntegerBeanProxy.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * IDE Proxy for Integers. Since Integers were first implemented - * in the VCE, and because they are often referenced, we've created - * a subclass to handle them. That way we wouldn't need to change - * everyone that was using the IIntegerProxy interface and we - * can store the int value to speed up access. - */ -public class IDEIntegerBeanProxy extends IDENumberBeanProxy implements IIntegerBeanProxy { - protected int fIntValue; -IDEIntegerBeanProxy(IDEProxyFactoryRegistry aRegistry, Number anInteger, IBeanTypeProxy aBeanTypeProxy) { - super(aRegistry, anInteger , aBeanTypeProxy); - fIntValue = anInteger.intValue(); -} -/** - * Return the int value - */ -public int intValue() { - return fIntValue; -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEIntegerClassBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEIntegerClassBeanTypeProxy.java deleted file mode 100644 index 5de18c03f..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEIntegerClassBeanTypeProxy.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.IIntegerBeanProxy; - -/** - * IDE Implementation of IIntegerBeanTypeProxy - */ -final class IDEIntegerClassBeanTypeProxy extends IDENumberBeanTypeProxy { -// Some values are cache'd for speed - private final IDEIntegerBeanProxy zeroIntProxy; - private final IDEIntegerBeanProxy oneIntProxy; - private final IDEIntegerBeanProxy twoIntProxy; - private final IDEIntegerBeanProxy threeIntProxy; -IDEIntegerClassBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass, new Integer(0)); - // Create the cached values - zeroIntProxy = new IDEIntegerBeanProxy(aRegistry, new Integer(0), this ); - oneIntProxy = new IDEIntegerBeanProxy(aRegistry, new Integer(1), this ); - twoIntProxy = new IDEIntegerBeanProxy(aRegistry, new Integer(2), this ); - threeIntProxy = new IDEIntegerBeanProxy(aRegistry, new Integer(3), this ); - -} -/** - * Static helper to create a bean proxy - * Package protected because everyone should go through the factory API - * that is defined as part of IBeanProxyFactory - */ -IIntegerBeanProxy createIntegerBeanProxy(Integer anInteger) { - switch(anInteger.intValue()){ - case 0: return zeroIntProxy ; - case 1: return oneIntProxy ; - case 2: return twoIntProxy ; - case 3: return threeIntProxy ; - default: return new IDEIntegerBeanProxy(fProxyFactoryRegistry,anInteger,this); - } -} -protected IIDEBeanProxy newBeanProxy(Object anObject){ - - return (IIDEBeanProxy)createIntegerBeanProxy((Integer)anObject); - -} -} - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEIntegerTypeBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEIntegerTypeBeanTypeProxy.java deleted file mode 100644 index bf93debc7..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEIntegerTypeBeanTypeProxy.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.IIntegerBeanProxy; - -/** - * IDE Implementation of IIntegerBeanTypeProxy - */ -final class IDEIntegerTypeBeanTypeProxy extends IDEPrimitiveBeanTypeProxy { -// Some values are cache'd for speed - private final IDEIntegerBeanProxy zeroProxy; - private final IDEIntegerBeanProxy oneProxy; - private final IDEIntegerBeanProxy twoProxy; - private final IDEIntegerBeanProxy threeProxy; -IDEIntegerTypeBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass); - // Create the cached values - zeroProxy = new IDEIntegerBeanProxy(aRegistry, new Integer(0), this ); - oneProxy = new IDEIntegerBeanProxy(aRegistry, new Integer(1), this ); - twoProxy = new IDEIntegerBeanProxy(aRegistry, new Integer(2), this ); - threeProxy = new IDEIntegerBeanProxy(aRegistry, new Integer(3), this ); - -} -/** - * Static helper to create a bean proxy - * Package protected because everyone should go through the factory API - * that is defined as part of IBeanProxyFactory - */ -IIntegerBeanProxy createIntegerBeanProxy(int anInt) { - switch(anInt){ - case 0: return zeroProxy ; - case 1: return oneProxy ; - case 2: return twoProxy ; - case 3: return threeProxy ; - default: return new IDEIntegerBeanProxy(fProxyFactoryRegistry,new Integer(anInt),this); - } -} -/* Specialized from IDEBeanTypeProxy to ensure IIntegerBeanProxies are created correctly - */ -protected IIDEBeanProxy newBeanProxy(Object anObject){ - Number n = anObject instanceof Character ? new Integer(((Character) anObject).charValue()) : (Number) anObject; - switch(n.intValue()){ - case 0: return zeroProxy ; - case 1: return oneProxy ; - case 2: return twoProxy ; - case 3: return threeProxy ; - default: return new IDEIntegerBeanProxy(fProxyFactoryRegistry, n, this); - } - - -} -int getPrimitiveType(){ - return INTEGER; -} -} - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDELongClassBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDELongClassBeanTypeProxy.java deleted file mode 100644 index 2bef122c4..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDELongClassBeanTypeProxy.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * Long BeanType Proxy. - */ -final class IDELongClassBeanTypeProxy extends IDENumberBeanTypeProxy { - -protected IDELongClassBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass, new Long(0)); -} -INumberBeanProxy createLongBeanProxy(Long aLong){ - return new IDENumberBeanProxy(fProxyFactoryRegistry,aLong,this); -} -} - - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDELongTypeBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDELongTypeBeanTypeProxy.java deleted file mode 100644 index 0c1d10a92..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDELongTypeBeanTypeProxy.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; -/** - * Long BeanType Proxy. - */ -final class IDELongTypeBeanTypeProxy extends IDEPrimitiveBeanTypeProxy { - -protected IDELongTypeBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass); -} -INumberBeanProxy createLongBeanProxy(long aLong){ - return new IDENumberBeanProxy(fProxyFactoryRegistry,new Long(aLong),this); -} -int getPrimitiveType(){ - return LONG; -} - -protected IIDEBeanProxy newBeanProxy(Object anObject){ - Number n = anObject instanceof Character ? new Long(((Character) anObject).charValue()) : (Number) anObject; - return new IDENumberBeanProxy(fProxyFactoryRegistry, n, this); -} -} - - - - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEMethodProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEMethodProxy.java deleted file mode 100644 index 50ed31f8d..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEMethodProxy.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -import org.eclipse.jem.internal.proxy.core.*; - -public class IDEMethodProxy extends IDEAccessibleObjectProxy implements IMethodProxy { - - protected IDEMethodProxy(IDEProxyFactoryRegistry aRegistry, Method aMethod) { - super(aRegistry, aMethod); - } - - public IBeanTypeProxy getClassType() { - return ((IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory()).getBeanTypeProxy( - ((Method) getBean()).getDeclaringClass()); - } - public IBeanTypeProxy getReturnType() { - return ((IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory()).getBeanTypeProxy( - ((Method) getBean()).getReturnType()); - } - public IBeanTypeProxy[] getParameterTypes() { - Class[] parmClasses = ((Method) getBean()).getParameterTypes(); - IBeanTypeProxy[] parmTypes = new IBeanTypeProxy[parmClasses.length]; - IDEStandardBeanTypeProxyFactory factory = (IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory(); - for (int i = 0; i < parmClasses.length; i++) { - parmTypes[i] = factory.getBeanTypeProxy(parmClasses[i]); - } - return parmTypes; - } - public String getName() { - return ((Method) getBean()).getName(); - } - - /** - * The type proxy is constant proxy out of the method factory. - */ - public IBeanTypeProxy getTypeProxy() { - return ((IDEMethodProxyFactory) fProxyFactoryRegistry.getMethodProxyFactory()).methodType; - } - - /** - * Invoke the method directly. Because we are an IDEMethodProxy we can assume that IBeanProxy - * is an IDEBeanProxy and we can get its bean directly - */ - public IBeanProxy invoke(IBeanProxy subject) throws ThrowableProxy { - try { - Object result = ((Method) getBean()).invoke(subject != null ? ((IIDEBeanProxy) subject).getBean() : null, new Object[0]); - if (result == null) { - return null; - } else { - // The result may be a java.lang.Integer when we really want to create an int - // Reflection always give you the big object - Class returnType = ((Method) getBean()).getReturnType(); - return getBeanProxy(returnType, result); - } - } catch (InvocationTargetException e) { - // This is a wrappered exception. Return the wrappered one so it looks like - // it was the real one. - IBeanTypeProxy exceptionTypeProxy = - ((IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory()).getBeanTypeProxy( - e.getTargetException().getClass()); - throw new IDEThrowableProxy(e.getTargetException(), exceptionTypeProxy); - } catch (Exception exc) { - IBeanTypeProxy exceptionTypeProxy = - ((IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory()).getBeanTypeProxy(exc.getClass()); - throw new IDEThrowableProxy(exc, exceptionTypeProxy); - } - } - /** - * Do not throw an exception - */ - public IBeanProxy invokeCatchThrowableExceptions(IBeanProxy subject) { - try { - return invoke(subject); - } catch (ThrowableProxy exc) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc)); //$NON-NLS-1$ - } - return null; - } - /** - * Invoke the method with argument. The argument will be an IDEBeanProxy - * ( because we are an IDEMethodProxy ) so we can cast to it and get the actual bean - * itself and use this to invoke against method which is the actual - * java.lang.Reflect instance - */ - public IBeanProxy invoke(IBeanProxy subject, IBeanProxy argument) throws ThrowableProxy { - try { - Object result = - ((Method) getBean()).invoke( - subject != null ? ((IIDEBeanProxy) subject).getBean() : null, - new Object[] { argument != null ? ((IIDEBeanProxy) argument).getBean() : null }); - if (result == null) { - return null; - } else { - Class returnType = ((Method) getBean()).getReturnType(); - return getBeanProxy(returnType, result); - } - } catch (InvocationTargetException e) { - // This is a wrappered exception. Return the wrappered one so it looks like - // it was the real one. - IBeanTypeProxy exceptionTypeProxy = - ((IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory()).getBeanTypeProxy( - e.getTargetException().getClass()); - throw new IDEThrowableProxy(e.getTargetException(), exceptionTypeProxy); - } catch (Exception exc) { - IBeanTypeProxy exceptionTypeProxy = - ((IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory()).getBeanTypeProxy(exc.getClass()); - throw new IDEThrowableProxy(exc, exceptionTypeProxy); - } - } - /** - * Invoke without throwing an exception - */ - public IBeanProxy invokeCatchThrowableExceptions(IBeanProxy subject, IBeanProxy argument) { - try { - return invoke(subject, argument); - } catch (ThrowableProxy exc) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc)); //$NON-NLS-1$ - } - return null; - } - /** - * Invoke the method with arguments. The arguments will be IDEBeanProxy objects - * ( because we are an IDEMethodProxy ) so we can cast to them and get the actual bean - * objects themselves and use these to invoke against method which is the actual - * java.lang.Reflect instance - */ - public IBeanProxy invoke(IBeanProxy subject, IBeanProxy[] arguments) throws ThrowableProxy { - Object[] beanArguments = new Object[arguments.length]; - for (int i = 0; i < arguments.length; i++) { - if (arguments[i] != null) { - beanArguments[i] = ((IIDEBeanProxy) arguments[i]).getBean(); - } - } - try { - Object result = ((Method) getBean()).invoke(subject != null ? ((IIDEBeanProxy) subject).getBean() : null, beanArguments); - if (result == null) { - return null; - } else { - Class returnType = ((Method) getBean()).getReturnType(); - return getBeanProxy(returnType, result); - } - } catch (InvocationTargetException e) { - // This is a wrappered exception. Return the wrappered one so it looks like - // it was the real one. - IBeanTypeProxy exceptionTypeProxy = - ((IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory()).getBeanTypeProxy( - e.getTargetException().getClass()); - throw new IDEThrowableProxy(e.getTargetException(), exceptionTypeProxy); - } catch (Exception exc) { - IBeanTypeProxy exceptionTypeProxy = - ((IDEStandardBeanTypeProxyFactory) fProxyFactoryRegistry.getBeanTypeProxyFactory()).getBeanTypeProxy(exc.getClass()); - throw new IDEThrowableProxy(exc, exceptionTypeProxy); - } - } - /** - * Invoke without throwing an exception - */ - public IBeanProxy invokeCatchThrowableExceptions(IBeanProxy subject, IBeanProxy[] arguments) { - try { - return invoke(subject, arguments); - } catch (ThrowableProxy exc) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc)); //$NON-NLS-1$ - } - return null; - } - IBeanProxy getBeanProxy(Class returnType, Object bean) { - return fProxyFactoryRegistry.getBeanProxy(returnType, bean); - } -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEMethodProxyFactory.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEMethodProxyFactory.java deleted file mode 100644 index 9122b678a..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEMethodProxyFactory.java +++ /dev/null @@ -1,337 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - * $RCSfile: IDEMethodProxyFactory.java,v $ $Revision: 1.14 $ $Date: 2006/05/17 20:13:05 $ - */ -package org.eclipse.jem.internal.proxy.ide; - -import java.lang.reflect.*; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -import org.eclipse.jem.internal.proxy.common.AmbiguousMethodException; -import org.eclipse.jem.internal.proxy.common.MethodHelper; -import org.eclipse.jem.internal.proxy.core.*; - -public class IDEMethodProxyFactory implements IMethodProxyFactory { - - final protected IDEProxyFactoryRegistry fProxyFactoryRegistry; - - final protected static Map primLookup = new HashMap(); - - IDEBeanTypeProxy accessibleType, fieldType, methodType, constructorType; - // Cached copy of a few typical method type proxies. - static { - primLookup.put("int", Integer.TYPE); //$NON-NLS-1$ - primLookup.put("char", Character.TYPE); //$NON-NLS-1$ - primLookup.put("long", Long.TYPE); //$NON-NLS-1$ - primLookup.put("short", Short.TYPE); //$NON-NLS-1$ - primLookup.put("double", Double.TYPE); //$NON-NLS-1$ - primLookup.put("boolean", Boolean.TYPE); //$NON-NLS-1$ - primLookup.put("byte", Byte.TYPE); //$NON-NLS-1$ - primLookup.put("float", Float.TYPE); //$NON-NLS-1$ - } - - IDEMethodProxyFactory(IDEProxyFactoryRegistry aRegistry) { - fProxyFactoryRegistry = aRegistry; - fProxyFactoryRegistry.registerMethodProxyFactory(this); - accessibleType = new IDEBeanTypeProxy(aRegistry, AccessibleObject.class); - fieldType = new IDEFieldTypeProxy(aRegistry); - methodType = new IDEMethodTypeProxy(aRegistry); - constructorType = new IDEConstructorTypeProxy(aRegistry); - fProxyFactoryRegistry.getBeanTypeProxyFactory().registerBeanTypeProxy(accessibleType, true); - fProxyFactoryRegistry.getBeanTypeProxyFactory().registerBeanTypeProxy(fieldType, true); - fProxyFactoryRegistry.getBeanTypeProxyFactory().registerBeanTypeProxy(methodType, true); - fProxyFactoryRegistry.getBeanTypeProxyFactory().registerBeanTypeProxy(constructorType, true); - } - - /** - * Return an instance of an IDEConstructorProxy This is package protected because the only people who can use this are priveledge objects that - * have the aMethod instance. These are part of the idevm package only. If you have to make this method public you are doing things incorrectly. - * To get a method proxy you must use the interface methods on IMethodProxyFactory to do lookup by string or else on IBeanTypeProxy that has - * getMethod(String) as well - */ - IConstructorProxy getConstructorProxy(Constructor aConstructor) { - - return (IConstructorProxy) constructorType.newBeanProxy(aConstructor); - - } - - IConstructorProxy[] getConstructors(Class aClass) { - Constructor[] ctors = aClass.getConstructors(); - IConstructorProxy[] ctorProxies = new IConstructorProxy[ctors.length]; - for (int i = 0; i < ctors.length; i++) { - ctorProxies[i] = getConstructorProxy(ctors[i]); - } - return ctorProxies; - } - - IConstructorProxy[] getDeclaredConstructors(Class aClass) { - Constructor[] ctors = aClass.getDeclaredConstructors(); - IConstructorProxy[] ctorProxies = new IConstructorProxy[ctors.length]; - for (int i = 0; i < ctors.length; i++) { - ctorProxies[i] = getConstructorProxy(ctors[i]); - } - return ctorProxies; - } - - IConstructorProxy getConstructorProxy(Class aClass, Class[] args) { - - try { - Constructor ctor = aClass.getConstructor(args); - return getConstructorProxy(ctor); - } catch (NoSuchMethodException exc) { - return null; - } - } - - IConstructorProxy getDeclaredConstructorProxy(Class aClass, Class[] args) { - - try { - Constructor ctor = aClass.getDeclaredConstructor(args); - return getConstructorProxy(ctor); - } catch (NoSuchMethodException exc) { - return null; - } - } - - IFieldProxy[] getFields(Class aClass) { - Field[] fields = aClass.getFields(); - IFieldProxy[] fieldProxies = new IFieldProxy[fields.length]; - for (int i = 0; i < fields.length; i++) { - fieldProxies[i] = getFieldProxy(fields[i]); - } - return fieldProxies; - } - - IFieldProxy[] getDeclaredFields(Class aClass) { - Field[] fields = aClass.getDeclaredFields(); - IFieldProxy[] fieldProxies = new IFieldProxy[fields.length]; - for (int i = 0; i < fields.length; i++) { - fieldProxies[i] = getFieldProxy(fields[i]); - } - return fieldProxies; - } - - /** - * Return an instance of an IDEFieldProxy This is package protected because the only people who can use this are priveledge objects that have the - * aField instance. These are part of the idevm package only. If you have to make this method public you are doing things incorrectly. To get a - * field proxy you must use the interface methods on IBeanTypeProxy that has getField(String) as well - */ - IFieldProxy getFieldProxy(Field aField) { - - return (IFieldProxy) fieldType.newBeanProxy(aField); - - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IMethodProxyFactory#getFieldProxy(org.eclipse.jem.internal.proxy.core.IExpression, java.lang.String, java.lang.String) - */ - public IProxyField getFieldProxy(IExpression expression, String className, String fieldName) { - // We are getting the class resolved through the expression. Might as well because it probably will - // be needed again and this way when the expression is finished they will be resolved for later usage. - IStandardBeanTypeProxyFactory beanTypeProxyFactory = fProxyFactoryRegistry.getBeanTypeProxyFactory(); - IProxyBeanType beanType = beanTypeProxyFactory.getBeanTypeProxy(expression, className); - return beanType.getFieldProxy(expression, fieldName); - } - - /** - * Return an instance of an IDEMethodProxy This is package protected because the only people who can use this are priveledge objects that have the - * aMethod instance. These are part of the idevm package only. If you have to make this method public you are doing things incorrectly. To get a - * method proxy you must use the interface methods on IMethodProxyFactory to do lookup by string or else on IBeanTypeProxy that has - * getMethod(String) as well - */ - IDEMethodProxy getMethodProxy(Method aMethod) { - - return (IDEMethodProxy) methodType.newBeanProxy(aMethod); - - } - - public IMethodProxy getMethodProxy(String className, String methodName, String[] parameterTypes) { - try { - Class aClass = fProxyFactoryRegistry.loadClass(className); - return getMethodProxy(aClass, methodName, parameterTypes); - } catch (ClassNotFoundException exc) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc)); //$NON-NLS-1$ - return null; - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IMethodProxyFactory#getMethodProxy(org.eclipse.jem.internal.proxy.core.IExpression, java.lang.String, java.lang.String, java.lang.String[]) - */ - public IProxyMethod getMethodProxy(IExpression expression, String className, String methodName, String[] parameterTypes) { - // We are getting the class and parmtypes resolved through the expression. Might as well because they probably will - // be needed again and this way when the expression is finished they will be resolved for later usage. - IStandardBeanTypeProxyFactory beanTypeProxyFactory = fProxyFactoryRegistry.getBeanTypeProxyFactory(); - IProxyBeanType beanType = beanTypeProxyFactory.getBeanTypeProxy(expression, className); - IProxyBeanType[] parmTypes = getParameterTypes(expression, parameterTypes, beanTypeProxyFactory); - return beanType.getMethodProxy(expression, methodName, parmTypes); - } - - /** - * Helper method for Beantypes and Proxy bean types to get the proxy. - * @param expression - * @param classType - * @param methodName - * @param parameterTypes - * @return - * - * @since 1.1.0 - */ - public IProxyMethod getMethodProxy(IExpression expression, IProxyBeanType classType, String methodName, String[] parameterTypes) { - // We are getting the parmtypes resolved through the expression. Might as well because they probably will - // be needed again and this way when the expression is finished they will be resolved for later usage. - IStandardBeanTypeProxyFactory beanTypeProxyFactory = fProxyFactoryRegistry.getBeanTypeProxyFactory(); - IProxyBeanType[] parmTypes = getParameterTypes(expression, parameterTypes, beanTypeProxyFactory); - return classType.getMethodProxy(expression, methodName, parmTypes); - } - - /** - * @param expression - * @param parameterTypes - * @param beanTypeProxyFactory - * @return - * - * @since 1.1.0 - */ - protected IProxyBeanType[] getParameterTypes(IExpression expression, String[] parameterTypes, IStandardBeanTypeProxyFactory beanTypeProxyFactory) { - IProxyBeanType[] parmTypes; - if (parameterTypes == null || parameterTypes.length == 0) - parmTypes = null; - else { - parmTypes = new IProxyBeanType[parameterTypes.length]; - for (int i = 0; i < parameterTypes.length; i++) { - parmTypes[i] = beanTypeProxyFactory.getBeanTypeProxy(expression, parameterTypes[i]); - } - } - return parmTypes; - } - - public IMethodProxy getMethodProxy(Class cls, String methodName, String[] parameterTypes) { - try { - Class[] parmClasses = null; - if (parameterTypes != null) { - parmClasses = new Class[parameterTypes.length]; - for (int i = 0; i < parmClasses.length; i++) { - Class temp = (Class) primLookup.get(parameterTypes[i]); - if (temp == null) - temp = fProxyFactoryRegistry.loadClass(parameterTypes[i]); - parmClasses[i] = temp; - } - } - return getMethodProxy(cls.getMethod(methodName, parmClasses)); - } catch (ClassNotFoundException e) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - } catch (NoSuchMethodException e) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - } - return null; - } - - IMethodProxy getDeclaredMethodProxy(Class cls, String methodName, String[] parameterTypes) { - try { - Class[] parmClasses = null; - if (parameterTypes != null) { - parmClasses = new Class[parameterTypes.length]; - for (int i = 0; i < parmClasses.length; i++) { - Class temp = (Class) primLookup.get(parameterTypes[i]); - if (temp == null) - temp = fProxyFactoryRegistry.loadClass(parameterTypes[i]); - parmClasses[i] = temp; - } - } - return getMethodProxy(cls.getDeclaredMethod(methodName, parmClasses)); - } catch (ClassNotFoundException e) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - } catch (NoSuchMethodException e) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - } - return null; - } - - IDEMethodProxy getMethodProxy(Class aClass, String methodName, Class[] args) { - try { - Method method = aClass.getMethod(methodName, args); - return getMethodProxy(method); - } catch (NoSuchMethodException exc) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "Unable to find method " + aClass.getName() //$NON-NLS-1$ - + ":" + methodName + " args=" + args, exc)); //$NON-NLS-1$ //$NON-NLS-2$ - return null; - } - } - - IMethodProxy getDeclaredMethodProxy(Class aClass, String methodName, Class[] args) { - try { - Method method = aClass.getDeclaredMethod(methodName, args); - return getMethodProxy(method); - } catch (NoSuchMethodException exc) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "Unable to find method " + aClass.getName() //$NON-NLS-1$ - + ":" + methodName + " args=" + args, exc)); //$NON-NLS-1$ //$NON-NLS-2$ - return null; - } - } - - IMethodProxy getMethodProxy(IDEBeanTypeProxy aTypeProxy, String methodName, String[] parameterTypes) { - return getMethodProxy(aTypeProxy.fClass, methodName, parameterTypes); - } - - IMethodProxy[] getMethods(Class aClass) { - Method[] methods = aClass.getMethods(); - IMethodProxy[] methodProxies = new IMethodProxy[methods.length]; - for (int i = 0; i < methods.length; i++) { - methodProxies[i] = getMethodProxy(methods[i]); - } - return methodProxies; - } - - IMethodProxy getCompatibleMethod(Class aClass, String methodName, Class[] parmTypes) throws NoSuchMethodException, AmbiguousMethodException { - Method method = MethodHelper.findCompatibleMethod(aClass, methodName, parmTypes); - return getMethodProxy(method); - } - - IConstructorProxy getCompatibleConstructor(Class aClass, Class[] parmTypes) throws AmbiguousMethodException, NoSuchMethodException, IllegalAccessException { - Constructor method = MethodHelper.findCompatibleConstructor(aClass, parmTypes); - return getConstructorProxy(method); - } - - - IMethodProxy[] getDeclaredMethods(Class aClass) { - Method[] methods = aClass.getDeclaredMethods(); - IMethodProxy[] methodProxies = new IMethodProxy[methods.length]; - for (int i = 0; i < methods.length; i++) { - methodProxies[i] = getMethodProxy(methods[i]); - } - return methodProxies; - } - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IMethodProxyFactory#getInvokable(java.lang.String, java.lang.String, java.lang.String[]) - */ - public IInvokable getInvokable(String className, String methodName, String[] parameterTypes) { - return getMethodProxy(className, methodName, parameterTypes); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IBeanProxyFactory#terminateFactory(boolean) - */ - public void terminateFactory(boolean wait) { - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEMethodTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEMethodTypeProxy.java deleted file mode 100644 index 681daca0b..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEMethodTypeProxy.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - - -/** - * @version 1.0 - * @author - */ -public class IDEMethodTypeProxy extends IDEBeanTypeProxy { - - IDEMethodTypeProxy(IDEProxyFactoryRegistry registry) { - super(registry, java.lang.reflect.Method.class); - } - - /* - * @see IDEBeanTypeProxy#newBeanProxy(Object) - */ - protected IIDEBeanProxy newBeanProxy(Object anObject) { - return new IDEMethodProxy(fProxyFactoryRegistry, (java.lang.reflect.Method) anObject); - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDENumberBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDENumberBeanProxy.java deleted file mode 100644 index 00069a214..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDENumberBeanProxy.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; -/** - * IDE Implementation of INumberBeanProxy for any Number (i.e. the non-primitives) - * It can answer all of the primitive number types (int, long, short, byte, double, float). - * Creation date: (2/6/00 9:02:54 AM) - * @author: Joe Winchester - */ -public class IDENumberBeanProxy extends IDEBeanProxy implements INumberBeanProxy { - private final Number fNumberValue; - protected IBeanTypeProxy fBeanTypeProxy; - -/** - * It is package protected because they are created - * in a special way and no one else should create them. - * @param aBean java.lang.Object - */ -IDENumberBeanProxy(IDEProxyFactoryRegistry aRegistry, Number aNumber , IBeanTypeProxy aBeanTypeProxy) { - super(aRegistry,aNumber); - fNumberValue = aNumber; - fBeanTypeProxy = aBeanTypeProxy; -} -/** - * equals: Equal if: - * 1) This proxy == (identity) to the other object - * 2) Else if other is an IBeanProxy and not a constant one, then if - * equals on the server. - * 3) If this is a constant proxy and the other is too or is a constant - * value (e.g. IStringBeanProxy.equals(String), then true if values are equals. - */ -public boolean equals(Object anObject) { - if (this == anObject) - return true; // Identity - if (anObject instanceof IDENumberBeanProxy) - return fNumberValue.equals(((IDENumberBeanProxy) anObject).numberValue()); - if (anObject instanceof Number) - return fNumberValue.equals(anObject); - return false; -} -/** - * byteValue method comment. - */ -public byte byteValue() { - return fNumberValue.byteValue(); -} -/** - * doubleValue method comment. - */ -public double doubleValue() { - return fNumberValue.doubleValue(); -} -/** - * floatValue method comment. - */ -public float floatValue() { - return fNumberValue.floatValue(); -} -/** - * Return the int value - */ -public int intValue() { - return fNumberValue.intValue(); -} -/** - * longValue method comment. - */ -public long longValue() { - return fNumberValue.longValue(); -} -/** - * numberValue method comment. - */ -public Number numberValue() { - return fNumberValue; -} -/** - * shortValue method comment. - */ -public short shortValue() { - return fNumberValue.shortValue(); -} - -/** - * The bean's toString. - */ -public String toBeanString() { - return fNumberValue.toString(); -} -public IBeanTypeProxy getTypeProxy(){ - return fBeanTypeProxy; -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDENumberBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDENumberBeanTypeProxy.java deleted file mode 100644 index 0a96946d4..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDENumberBeanTypeProxy.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; -/** - * Number BeanType Proxy. - */ -public abstract class IDENumberBeanTypeProxy extends IDEBeanTypeProxy { - protected final IDENumberBeanProxy zeroProxy; -/** - * IDENumberBeanTypeProxy constructor comment. - * @param aRegistry com.ibm.etools.vce.proxy.ProxyFactoryRegistry - * @param aClass java.lang.Class - */ -protected IDENumberBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass, Number zeroNumber) { - super(aRegistry, aClass); - // Cache a zero proxy of this type (though the number will be Long). - zeroProxy = new IDENumberBeanProxy(aRegistry, zeroNumber , this); -} -/** - * Helper to create a bean proxy - * Package protected because everyone should go through the factory API - * that is defined as part of IBeanProxyFactory - */ -INumberBeanProxy createNumberBeanProxy(Number aNumber) { - if (aNumber == null || zeroProxy.fBean.equals(aNumber)) - return zeroProxy; - return new IDENumberBeanProxy(fProxyFactoryRegistry, aNumber, this); -} -/** - * Specialized from IDEBeanTypeProxy to ensure INumberBeanProxies are created correctly. - */ -protected IIDEBeanProxy newBeanProxy(Object anObject){ - - return (IIDEBeanProxy)createNumberBeanProxy((Number) anObject); - -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEObjectBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEObjectBeanProxy.java deleted file mode 100644 index 55215e1e9..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEObjectBeanProxy.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -public class IDEObjectBeanProxy extends IDEBeanProxy { - - protected IBeanTypeProxy fBeanTypeProxy; // Cache the type proxy for speed - -protected IDEObjectBeanProxy(IDEProxyFactoryRegistry aRegistry){ - super(aRegistry); -} -/** - * Constructor that lets the bean type be set on creation. - * This saves the overhead of it being looked up the first time it is asked for. - * - * This is protected because the only person - * who should use it is the IDEBeanTypeProxy or a subclass. Making it package protected stops people from - * writing bogus code and doing casts and slamming new beans in without going through the proper API - * that is based around any kind of VM artifact being proxied to support target VMs and pluggable JDK - * levels - */ -protected IDEObjectBeanProxy(IDEProxyFactoryRegistry aRegistry, Object aBean, IBeanTypeProxy aBeanTypeProxy){ - - this(aRegistry, aBean); - fBeanTypeProxy = aBeanTypeProxy; - -} -/** - * Set the bean we are proxying. We are a proxy for a bean running on the same IDE - * so we hold the bean directly and can return it. - */ -protected IDEObjectBeanProxy(IDEProxyFactoryRegistry aRegistry, Object aBean){ - this(aRegistry); - - fBean = aBean; - -} -/** - * The type proxy is got from our class name - * If we have the type return it, otherwise go the factory for it - * Don't new it up because the factory must be responsible for creating type proxies as it - * has to perform instance management on them - */ -public IBeanTypeProxy getTypeProxy() { - - if ( fBeanTypeProxy == null ) { - fBeanTypeProxy = fProxyFactoryRegistry.getBeanTypeProxyFactory().getBeanTypeProxy( fBean.getClass().getName() ); - } - return fBeanTypeProxy; -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEPrimitiveBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEPrimitiveBeanTypeProxy.java deleted file mode 100644 index 36e970390..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEPrimitiveBeanTypeProxy.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - - -public abstract class IDEPrimitiveBeanTypeProxy extends IDEBeanTypeProxy { - - static final int BOOLEAN = 1; - static final int BYTE = 2; - static final int CHAR = 3; - static final int DOUBLE = 4; - static final int FLOAT = 5; - static final int INTEGER = 6; - static final int LONG = 7; - static final int SHORT = 8; - -public IDEPrimitiveBeanTypeProxy(IDEProxyFactoryRegistry aRegistry,Class aClass){ - super(aRegistry,aClass); -} -public boolean isPrimitive() { - return true; -} -abstract int getPrimitiveType(); -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEProxyFactoryRegistry.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEProxyFactoryRegistry.java deleted file mode 100644 index fd2726e2f..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEProxyFactoryRegistry.java +++ /dev/null @@ -1,205 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import java.net.URL; -import java.net.URLClassLoader; -import java.util.*; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.Platform; -import org.osgi.framework.Bundle; - -import org.eclipse.jem.internal.proxy.common.IVMServer; -import org.eclipse.jem.internal.proxy.core.*; -/** - * This implementation runs the Beans inside the Eclipse IDE - * It should only be used by plugins that can guarantee their their beans do - * not change during the lifetime of the IDE and can run at the same JDK level - * that the Eclipse IDE is running - */ - -public class IDEProxyFactoryRegistry extends BaseProxyFactoryRegistry implements IVMServer { - - public static final String IDE_REGISTRY_TYPE_ID = "org.eclipse.jem.IDE"; //$NON-NLS-1$ - protected String fName; - protected ClassLoader fClassLoader; - protected IDECallbackRegistry fCallbackRegistry; - - /* - * Special classloader that firsts tries to load from bundle then tries from url paths so - * that bundle is treated as being at the head of the url paths. - * - * @since 1.0.0 - */ - private static class IDESpecialClassLoader extends URLClassLoader { - - private Bundle bundle; - // This is the bundle that contains the IDE Eclipse code. - // This must be checked first because there are IDE specific stuff that is used on the "remote vm" too and - // so must be common. - private Bundle ideBundle; - - public IDESpecialClassLoader(URL[] urls, Bundle bundle) { - super(urls, null); - ideBundle = ProxyPlugin.getPlugin().getBundle(); - this.bundle = bundle; - } - - public IDESpecialClassLoader(URL[] urls) { - this(urls, null); - } - - /* (non-Javadoc) - * @see java.lang.ClassLoader#findClass(java.lang.String) - */ - protected Class findClass(String name) throws ClassNotFoundException { - try { - return ideBundle.loadClass(name); - } catch (ClassNotFoundException e) { - if (bundle != null) { - try { - return bundle.loadClass(name); - } catch (ClassNotFoundException e1) { - } - } - return super.findClass(name); - } - } - - /* - * (non-Javadoc) - * - * @see java.lang.ClassLoader#findResource(java.lang.String) - */ - public URL findResource(String name) { - URL r = ideBundle.getResource(name); - if (r == null && bundle != null) - r = bundle.getResource(name); - return r != null ? r : super.findResource(name); - } -} - -/** - * Create a special loader that has the plugin classloader of the passed in plugin - * as the parent loader, plus all of the urls, plus the remotevm.jar file that is - * needed by IDE Proxy to work. - */ -public static ClassLoader createSpecialLoader(String pluginName, URL[] otherURLs) { - Bundle bundle = pluginName != null ? Platform.getBundle(pluginName) : null; - - URL[] mustHaveUrls = ProxyPlugin.getPlugin().urlLocalizeAllFromBundleAndFragments(ProxyPlugin.getPlugin().getBundle(), "vm/remotevm.jar"); //$NON-NLS-1$ - - URL[] urls = null; - if (otherURLs != null) { - urls = new URL[otherURLs.length+mustHaveUrls.length]; - System.arraycopy(mustHaveUrls, 0, urls, 0, mustHaveUrls.length); - System.arraycopy(otherURLs, 0, urls, mustHaveUrls.length, otherURLs.length); - } else - urls = mustHaveUrls; - - return bundle != null ? new IDESpecialClassLoader(urls, bundle) : new IDESpecialClassLoader(urls); -} - -public IDEProxyFactoryRegistry(String aName, ClassLoader loader) { - super(IDE_REGISTRY_TYPE_ID); - fName = aName; - fClassLoader = loader; -} - -ClassLoader getPluginClassLoader(){ - return fClassLoader; -} - -protected void registryTerminated(boolean wait){ - List runnables = null; - synchronized (this) { - runnables = shutdownRunnables; - shutdownRunnables = null; - } - if (runnables != null) { - for (Iterator itr = runnables.iterator(); itr.hasNext();) { - try { - ((Runnable) itr.next()).run(); - } catch (RuntimeException e) { - e.printStackTrace(); - } - } - } -} - -Class loadClass(String aClassName) throws ClassNotFoundException, ExceptionInInitializerError, LinkageError { - return fClassLoader.loadClass(aClassName); -} - -public ICallbackRegistry getCallbackRegistry(){ - if ( fCallbackRegistry == null ){ - fCallbackRegistry = new IDECallbackRegistry(this); - } - return fCallbackRegistry; -} - - -/** - * Get a bean proxy from the bean of the correct type. - * - * @param returnType - * @param bean - * @return - * - * @since 1.0.0 - */ -IBeanProxy getBeanProxy(Class returnType, Object bean) { - IDEStandardBeanTypeProxyFactory proxyFactory = (IDEStandardBeanTypeProxyFactory) this.getBeanTypeProxyFactory(); - if (!returnType.isPrimitive()) { - return IDEStandardBeanProxyFactory.createBeanProxy(this, bean); - } else if (returnType == Integer.TYPE) { - return proxyFactory.intType.newBeanProxy(bean); - } else if (returnType == Boolean.TYPE) { - return proxyFactory.booleanType.newBeanProxy(bean); - } else if (returnType == Float.TYPE) { - return proxyFactory.floatType.newBeanProxy(bean); - } else if (returnType == Long.TYPE) { - return proxyFactory.longType.newBeanProxy(bean); - } else if (returnType == Short.TYPE) { - return proxyFactory.shortType.newBeanProxy(bean); - } else if (returnType == Double.TYPE) { - return proxyFactory.doubleType.newBeanProxy(bean); - } else if (returnType == Byte.TYPE) { - return proxyFactory.byteType.newBeanProxy(bean); - } else if (returnType == Character.TYPE) { - return proxyFactory.charType.newBeanProxy(bean); - } else { - throw new RuntimeException("Unknown primitive type " + returnType.getName()); //$NON-NLS-1$ - } -} - -List shutdownRunnables; - -public synchronized void addShutdownListener(Runnable runnable) { - if (shutdownRunnables == null) { - shutdownRunnables = new ArrayList(); - } else if (shutdownRunnables.contains(runnable)) - return; - shutdownRunnables.add(runnable); -} - -public synchronized void removeShutdownListener(Runnable runnable) { - if (shutdownRunnables != null) - shutdownRunnables.remove(runnable); -} - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDERegistration.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDERegistration.java deleted file mode 100644 index 8af6861c9..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDERegistration.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import java.net.URL; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.*; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.launching.JavaRuntime; - -import org.eclipse.jem.internal.proxy.core.*; -import org.eclipse.jem.internal.proxy.ide.awt.IDERegisterAWT; -import org.eclipse.jem.internal.proxy.remote.LocalFileConfigurationContributorController; -/** - * This is the registration class for starting an IDERemote VM. - */ - -public class IDERegistration { - - public static ProxyFactoryRegistry startAnImplementation( - IConfigurationContributor[] contributors, - boolean attachAWT, - IProject project, - String vmName, - String pluginName, - IProgressMonitor pm) throws CoreException { - IDERegistration idereg = new IDERegistration(pluginName); - return idereg.startImplementation(contributors, attachAWT, project, vmName, pm); - } - - public IDERegistration() { - } - - private IDERegistration(String pluginName) { - this.pluginName = pluginName; - } - private String pluginName; - - /** - * This will create a remote VM and return an initialized REMProxyFactoryRegistry. - * Passed in are: - * project: The project this is being started on. Must not be null and must be a JavaProject. (Currently ignored for IDE). - * attachAWT: Should AWT be attached to this implementation. - * contributors: Contributors to the configuration. Can be null. - * pm: ProgressMonitor to use. Must not be null. - * vmName: Name for the vm. Can be null. - */ - public ProxyFactoryRegistry startImplementation( - IConfigurationContributor[] contributors, - boolean attachAWT, - IProject project, - String vmName, - IProgressMonitor pm) - throws CoreException { - - URL[] classPaths = null; - IJavaProject javaProject = null; - if (project != null) { - javaProject = JavaCore.create(project); - // Add in the paths for the project - classPaths = ProxyLaunchSupport.convertStringPathsToURL(JavaRuntime.computeDefaultRuntimeClassPath(javaProject)); - } else - classPaths = new URL[0]; - - final IJavaProject jp = javaProject; - - final ProxyLaunchSupport.LaunchInfo launchInfo = new ProxyLaunchSupport.LaunchInfo(); - contributors = ProxyLaunchSupport.fillInLaunchInfo(contributors == null ? ProxyLaunchSupport.EMPTY_CONFIG_CONTRIBUTORS : contributors, launchInfo, jp != null ? jp.getElementName() : null); - final LocalFileConfigurationContributorController controller = new LocalFileConfigurationContributorController(classPaths, new URL[3][], launchInfo); - final IConfigurationContributor[] contribs = contributors; - for (int i = 0; i < contributors.length; i++) { - final int ii = i; - // Run in safe mode so that anything happens we don't go away. - SafeRunner.run(new ISafeRunnable() { - public void handleException(Throwable exception) { - // Don't need to do anything. Platform.run logs it for me. - } - - public void run() throws Exception { - contribs[ii].initialize(launchInfo.getConfigInfo()); - } - }); - } - for (int i = 0; i < contributors.length; i++) { - final int ii = i; - // Run in safe mode so that anything happens we don't go away. - SafeRunner.run(new ISafeRunnable() { - public void handleException(Throwable exception) { - // Don't need to do anything. Platform.run logs it for me. - } - - public void run() throws Exception { - contribs[ii].contributeClasspaths(controller); - } - }); - } - classPaths = controller.getFinalClasspath(); - - final BaseProxyFactoryRegistry registry = (BaseProxyFactoryRegistry) createIDEProxyFactoryRegistry(vmName, pluginName, classPaths); - ProxyLaunchSupport.performExtensionRegistrations(registry, launchInfo); - for (int i = 0; i < contribs.length; i++) { - final int ii = i; - // Run in safe mode so that anything happens we don't go away. - SafeRunner.run(new ISafeRunnable() { - public void handleException(Throwable exception) { - // Don't need to do anything. Platform.run logs it for me. - } - - public void run() throws Exception { - contribs[ii].contributeToRegistry(registry); - } - }); - } - - return registry; - } - - public static ProxyFactoryRegistry createIDEProxyFactoryRegistry(String aName, String aPluginName, URL[] otherURLs) { - // Create the registry. - IDEProxyFactoryRegistry registry = - new IDEProxyFactoryRegistry(aName, IDEProxyFactoryRegistry.createSpecialLoader(aPluginName, otherURLs)); - initRegistry(registry); - return registry; - } - - public static ProxyFactoryRegistry createIDEProxyFactoryRegistry(String aName, ClassLoader loader) { - // Create the registry. - IDEProxyFactoryRegistry registry = new IDEProxyFactoryRegistry(aName, loader); - initRegistry(registry); - return registry; - } - - private static void initRegistry(IDEProxyFactoryRegistry registry) { - new IDEStandardBeanTypeProxyFactory(registry); - new IDEStandardBeanProxyFactory(registry); - new IDEMethodProxyFactory(registry); - // Always support AWT for now - IDERegisterAWT.registerAWT(registry); - } -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEShortClassBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEShortClassBeanTypeProxy.java deleted file mode 100644 index 2bac55d2a..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEShortClassBeanTypeProxy.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; -/** - * Short BeanType Proxy. - */ -final class IDEShortClassBeanTypeProxy extends IDENumberBeanTypeProxy { -protected IDEShortClassBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass, new Short((short)0)); -} -INumberBeanProxy createShortBeanProxy(Short aShort){ - return new IDENumberBeanProxy(fProxyFactoryRegistry,aShort,this); -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEShortTypeBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEShortTypeBeanTypeProxy.java deleted file mode 100644 index 3ae6dfb64..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEShortTypeBeanTypeProxy.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -/** - * Short BeanType Proxy. - */ -final class IDEShortTypeBeanTypeProxy extends IDEPrimitiveBeanTypeProxy { -protected IDEShortTypeBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass); -} -INumberBeanProxy createShortBeanProxy(short aShort){ - return new IDENumberBeanProxy(fProxyFactoryRegistry,new Short(aShort),this); -} -int getPrimitiveType(){ - return SHORT; -} -protected IIDEBeanProxy newBeanProxy(Object anObject){ - Number n = anObject instanceof Character ? new Short((short) ((Character) anObject).charValue()) : (Number) anObject; - return new IDENumberBeanProxy(fProxyFactoryRegistry, n, this); -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStandardBeanProxyFactory.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStandardBeanProxyFactory.java deleted file mode 100644 index 85a852b28..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStandardBeanProxyFactory.java +++ /dev/null @@ -1,262 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - * $RCSfile: IDEStandardBeanProxyFactory.java,v $ $Revision: 1.11 $ $Date: 2005/08/24 20:39:06 $ - */ - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -import org.eclipse.jem.internal.proxy.common.IVMServer; -import org.eclipse.jem.internal.proxy.core.*; -import org.eclipse.jem.internal.proxy.initParser.InitializationStringParser; - -public class IDEStandardBeanProxyFactory implements IStandardBeanProxyFactory { - - - protected IDEProxyFactoryRegistry fRegistry; - protected IDEStandardBeanTypeProxyFactory fBeanTypeProxyFactory; - private IBeanProxy ivmServerProxy; - - /* - * Return a bean proxy for the argument. To do this create through the correct BeanTypeProxy - * Which ensures that special subclasses of IDEBeanProxy are created. This is just a local - * helper method. - */ - static IIDEBeanProxy createBeanProxy(ProxyFactoryRegistry aRegistry, Object anObject) { - - return ((IDEStandardBeanProxyFactory) aRegistry.getBeanProxyFactory()).createIDEBeanProxyWith(anObject); - } - - IDEStandardBeanProxyFactory(IDEProxyFactoryRegistry aRegistry) { - fRegistry = aRegistry; - fRegistry.registerBeanProxyFactory(this); - fBeanTypeProxyFactory = (IDEStandardBeanTypeProxyFactory) aRegistry.getBeanTypeProxyFactory(); - ivmServerProxy = fRegistry.getBeanProxy(IVMServer.class, fRegistry); - } - - public IStringBeanProxy createBeanProxyWith(String aString) { - return fBeanTypeProxyFactory.stringClass.createStringBeanProxy(aString); - } - - public INumberBeanProxy createBeanProxyWith(float aFloat) { - return fBeanTypeProxyFactory.floatType.createFloatBeanProxy(aFloat); - } - - public INumberBeanProxy createBeanProxyWith(short aShort) { - return fBeanTypeProxyFactory.shortType.createShortBeanProxy(aShort); - } - - public ICharacterBeanProxy createBeanProxyWith(char aChar) { - return fBeanTypeProxyFactory.charType.createCharBeanProxy(aChar); - } - - public ICharacterBeanProxy createBeanProxyWith(Character aCharacter) { - return fBeanTypeProxyFactory.charClass.createCharacterBeanProxy(aCharacter); - } - - public IIntegerBeanProxy createBeanProxyWith(int anInt) { - return fBeanTypeProxyFactory.intType.createIntegerBeanProxy(anInt); - } - - public IIntegerBeanProxy createBeanProxyWith(Integer anInteger) { - return fBeanTypeProxyFactory.integerClass.createIntegerBeanProxy(anInteger); - } - - public INumberBeanProxy createBeanProxyWith(long aLong) { - return fBeanTypeProxyFactory.longType.createLongBeanProxy(aLong); - } - - public INumberBeanProxy createBeanProxyWith(Number aNumber) { - IDENumberBeanTypeProxy numberTypeProxy = (IDENumberBeanTypeProxy) fBeanTypeProxyFactory.getBeanTypeProxy(aNumber.getClass()); - return numberTypeProxy.createNumberBeanProxy(aNumber); - } - - public IBooleanBeanProxy createBeanProxyWith(boolean aBoolean) { - return fBeanTypeProxyFactory.booleanType.createBooleanBeanProxy(aBoolean); - } - - public IBooleanBeanProxy createBeanProxyWith(Boolean aBoolean) { - return fBeanTypeProxyFactory.booleanClass.createBooleanBeanProxy(aBoolean); - } - - public INumberBeanProxy createBeanProxyWith(byte aByte) { - return fBeanTypeProxyFactory.byteType.createByteBeanProxy(aByte); - } - - public INumberBeanProxy createBeanProxyWith(double aDouble) { - return fBeanTypeProxyFactory.doubleType.createDoubleBeanProxy(aDouble); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanProxyFactory#convertToPrimitiveBeanProxy(org.eclipse.jem.internal.proxy.core.IBeanProxy) - */ - public IBeanProxy convertToPrimitiveBeanProxy(IBeanProxy nonPrimitiveProxy) { - if (nonPrimitiveProxy == null) - return null; - if (!nonPrimitiveProxy.isValid()) - return nonPrimitiveProxy; - IDEBeanTypeProxy type = (IDEBeanTypeProxy) nonPrimitiveProxy.getTypeProxy(); - if (type.getClass() == Boolean.class) - return this.createBeanProxyWith(((IBooleanBeanProxy) nonPrimitiveProxy).booleanValue()); - else if (type.getClass() == Byte.class) - return this.createBeanProxyWith(((INumberBeanProxy) nonPrimitiveProxy).byteValue()); - else if (type.getClass() == Character.class) - return this.createBeanProxyWith(((ICharacterBeanProxy) nonPrimitiveProxy).charValue()); - else if (type.getClass() == Double.class) - return this.createBeanProxyWith(((INumberBeanProxy) nonPrimitiveProxy).doubleValue()); - else if (type.getClass() == Float.class) - return this.createBeanProxyWith(((INumberBeanProxy) nonPrimitiveProxy).floatValue()); - else if (type.getClass() == Integer.class) - return this.createBeanProxyWith(((INumberBeanProxy) nonPrimitiveProxy).intValue()); - else if (type.getClass() == Long.class) - return this.createBeanProxyWith(((INumberBeanProxy) nonPrimitiveProxy).longValue()); - else if (type.getClass() == Short.class) - return this.createBeanProxyWith(((INumberBeanProxy) nonPrimitiveProxy).shortValue()); - else - return nonPrimitiveProxy; - } - - /** - * Create a one-dimensional array. The result will be the same as calling - * createBeanProxyWith(IBeanTypeProxy type, new int[1] {x}) where 'x' is the value passed in as - * the dimension. - */ - public IArrayBeanProxy createBeanProxyWith(IBeanTypeProxy type, int dimension) throws ThrowableProxy { - return createBeanProxyWith(type, new int[] { dimension }); - } - - /** - * Create an array bean proxy. - * - (int, new int[2] {3, 4}) will create: int [3] [4] - * - (int[], new int[1] {1}) int [1] - * - (int[], new int[2] {2,3}) int [2] [3] - * - * - (int[], null) or (int[], new int[0]) or (int, null) or (int, new int[0]) int [0]... or - * (int[][]..., null) or (int[][]..., new int[0]) int[0][]... This is because an array instance - * with no specified dimensions is not valid. - * - (int[][], new int[1] {3}) int[3][] - */ - public IArrayBeanProxy createBeanProxyWith(IBeanTypeProxy type, int[] dimensions) throws ThrowableProxy { - if (type.isArray()) - return ((IDEArrayBeanTypeProxy) type).createBeanProxyWith(dimensions); // Already an - // array type, - // just pass it - // on. - else { - // It is not an array type, so we need to get an array of this type and dimensions. - IDEArrayBeanTypeProxy arrayType = - (IDEArrayBeanTypeProxy) fBeanTypeProxyFactory.getBeanTypeProxy(type.getTypeName(), dimensions.length); - return arrayType.createBeanProxyWith(dimensions); - } - } - - public void releaseProxy(IBeanProxy aProxy) { - // Do nothing. This is more for remote proxies - } - - /** - * createIDEBeanProxyWith method comment. This is not part of the IStandardBeanProxyFactory - * interface. It is available only from IDEBeanProxyFactory so that IDE registered extensions - * can wrapper a bean. They will need to get current and explicitly cast to - * IDEBeanProxyFactory, so they should only be IDE types themselves. - */ - public IIDEBeanProxy createIDEBeanProxyWith(Object anObject) { - if (anObject == null) - return null; - return ((IDEBeanTypeProxy) fBeanTypeProxyFactory.getBeanTypeProxy(anObject.getClass())).newBeanProxy(anObject); - } - - /** - * For the IDE Factory we will create an IDEBeanProxy using the initializationString. If the - * format of the string is not one we understand, pass it onto the evaluator. The - * initStringParser is passed to allow shortcut evaluation. Package protected so only - * IDEBeanTypeProxies can create instances. - */ - IBeanProxy createBeanProxy(IDEBeanTypeProxy aTypeProxy, String initializationString) { - if (initializationString.equals("null")) //$NON-NLS-1$ - return null; // Value is initialized as null. - // We have to evaluate the result of the initializationString - try { - ClassLoader pluginClassLoader = fRegistry.getPluginClassLoader(); - Object newValue = InitializationStringParser.evaluate(initializationString, pluginClassLoader); - return newValue != null ? aTypeProxy.newBeanProxy(newValue) : null; - } catch (Exception exc) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc)); //$NON-NLS-1$ - return null; - } - } - - /** - * For the IDE Factory we will create an IDEBeanProxy using the null constructor Package - * protected so only IDEBeanTypeProxies can create instances. - */ - IBeanProxy createBeanProxy(IDEBeanTypeProxy aTypeProxy) { - - Class beanType = aTypeProxy.fClass; - - // If the beanType is a primitive, the creation will fail because you can't - // create a primitive without a value. - try { - return aTypeProxy.newBeanProxy(!(aTypeProxy.isPrimitive()) ? beanType.newInstance() : null); - } catch (Exception exc) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc)); //$NON-NLS-1$ - return null; - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IBeanProxyFactory#terminateFactory(boolean) - */ - public void terminateFactory(boolean wait) { - // Nothing really to do here - more applicable to remote proxy factories - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanProxyFactory#createExpression() - */ - public IExpression createExpression() { - return new IDEExpression(this.fRegistry); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanProxyFactory#createBeanProxyFrom(java.lang.String) - */ - public IBeanProxy createBeanProxyFrom(String initializationString) throws ThrowableProxy { - if (initializationString.equals("null")) //$NON-NLS-1$ - return null; // Value is initialized as null. - // We have to evaluate the result of the initializationString - try { - ClassLoader pluginClassLoader = fRegistry.getPluginClassLoader(); - InitializationStringParser parser = InitializationStringParser.createParser(initializationString, pluginClassLoader); - Object newValue = parser.evaluate(); - if (newValue != null) { - return fRegistry.getBeanProxy(parser.getExpectedType(), newValue); - } else - return null; - } catch (Exception exc) { - ProxyPlugin.getPlugin().getLogger().log( - new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc)); //$NON-NLS-1$ - return null; - } - } - - public IBeanProxy getIVMServerProxy() { - return ivmServerProxy; - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStandardBeanTypeProxyFactory.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStandardBeanTypeProxyFactory.java deleted file mode 100644 index 2dfd7fbc3..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStandardBeanTypeProxyFactory.java +++ /dev/null @@ -1,465 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; - -/* - * $RCSfile: IDEStandardBeanTypeProxyFactory.java,v $ $Revision: 1.12 $ $Date: 2005/08/24 20:39:06 $ - */ - -import java.lang.reflect.Array; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.text.MessageFormat; -import java.util.*; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -import org.eclipse.jem.internal.proxy.common.MapTypes; -import org.eclipse.jem.internal.proxy.core.*; -import org.eclipse.jem.internal.proxy.core.ExpressionProxy.ProxyEvent; - -public class IDEStandardBeanTypeProxyFactory implements IStandardBeanTypeProxyFactory { - - protected final IDEProxyFactoryRegistry fFactoryRegistry; - - // Hashtable to cache proxies for classes so they are found on second and subsequent lookups - protected Map beanProxies; - - public static Map MAP_SHORTSIG_TO_TYPE = new HashMap(8); - - public static Map MAP_TYPENAME_TO_SHORTSIG = new HashMap(8); - - static { - MAP_SHORTSIG_TO_TYPE.put("B", Byte.TYPE); //$NON-NLS-1$ - MAP_SHORTSIG_TO_TYPE.put("C", Character.TYPE); //$NON-NLS-1$ - MAP_SHORTSIG_TO_TYPE.put("D", Double.TYPE); //$NON-NLS-1$ - MAP_SHORTSIG_TO_TYPE.put("F", Float.TYPE); //$NON-NLS-1$ - MAP_SHORTSIG_TO_TYPE.put("I", Integer.TYPE); //$NON-NLS-1$ - MAP_SHORTSIG_TO_TYPE.put("J", Long.TYPE); //$NON-NLS-1$ - MAP_SHORTSIG_TO_TYPE.put("S", Short.TYPE); //$NON-NLS-1$ - MAP_SHORTSIG_TO_TYPE.put("Z", Boolean.TYPE); //$NON-NLS-1$ - - MAP_TYPENAME_TO_SHORTSIG.put("byte", "B"); //$NON-NLS-1$ //$NON-NLS-2$ - MAP_TYPENAME_TO_SHORTSIG.put("char", "C"); //$NON-NLS-1$ //$NON-NLS-2$ - MAP_TYPENAME_TO_SHORTSIG.put("double", "D"); //$NON-NLS-1$ //$NON-NLS-2$ - MAP_TYPENAME_TO_SHORTSIG.put("float", "F"); //$NON-NLS-1$ //$NON-NLS-2$ - MAP_TYPENAME_TO_SHORTSIG.put("int", "I"); //$NON-NLS-1$ //$NON-NLS-2$ - MAP_TYPENAME_TO_SHORTSIG.put("long", "J"); //$NON-NLS-1$ //$NON-NLS-2$ - MAP_TYPENAME_TO_SHORTSIG.put("short", "S"); //$NON-NLS-1$ //$NON-NLS-2$ - MAP_TYPENAME_TO_SHORTSIG.put("boolean", "Z"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - // Cached copy of a few typical bean type proxies. - IDEBeanTypeProxy objectClass; - - IDEBooleanTypeBeanTypeProxy booleanType; - - IDEBooleanClassBeanTypeProxy booleanClass; - - IDEIntegerTypeBeanTypeProxy intType; - - IDEIntegerClassBeanTypeProxy integerClass; - - IDEFloatTypeBeanTypeProxy floatType; - - IDEFloatClassBeanTypeProxy floatClass; - - IDELongTypeBeanTypeProxy longType; - - IDELongClassBeanTypeProxy longClass; - - IDEShortTypeBeanTypeProxy shortType; - - IDEShortClassBeanTypeProxy shortClass; - - IDEByteTypeBeanTypeProxy byteType; - - IDEByteClassBeanTypeProxy byteClass; - - IDECharTypeBeanTypeProxy charType; - - IDECharacterClassBeanTypeProxy charClass; - - IDEDoubleTypeBeanTypeProxy doubleType; - - IDEDoubleClassBeanTypeProxy doubleClass; - - IDEStringBeanTypeProxy stringClass; - - IDEClassBeanTypeProxy classClass; - - IDEBeanTypeProxy voidType; - - public IDEStandardBeanTypeProxyFactory(IDEProxyFactoryRegistry aRegistry) { - fFactoryRegistry = aRegistry; - aRegistry.registerBeanTypeProxyFactory(this); - - // Now initialize the cache. - objectClass = new IDEBeanTypeProxy(fFactoryRegistry, Object.class); - booleanType = new IDEBooleanTypeBeanTypeProxy(fFactoryRegistry, Boolean.TYPE); - booleanClass = new IDEBooleanClassBeanTypeProxy(fFactoryRegistry, Boolean.class); - intType = new IDEIntegerTypeBeanTypeProxy(fFactoryRegistry, Integer.TYPE); - integerClass = new IDEIntegerClassBeanTypeProxy(fFactoryRegistry, Integer.class); - floatType = new IDEFloatTypeBeanTypeProxy(fFactoryRegistry, Float.TYPE); - floatClass = new IDEFloatClassBeanTypeProxy(fFactoryRegistry, Float.class); - longType = new IDELongTypeBeanTypeProxy(fFactoryRegistry, Long.TYPE); - longClass = new IDELongClassBeanTypeProxy(fFactoryRegistry, Long.class); - shortType = new IDEShortTypeBeanTypeProxy(fFactoryRegistry, Short.TYPE); - shortClass = new IDEShortClassBeanTypeProxy(fFactoryRegistry, Short.class); - byteType = new IDEByteTypeBeanTypeProxy(fFactoryRegistry, Byte.TYPE); - byteClass = new IDEByteClassBeanTypeProxy(fFactoryRegistry, Byte.class); - charType = new IDECharTypeBeanTypeProxy(fFactoryRegistry, Character.TYPE); - charClass = new IDECharacterClassBeanTypeProxy(fFactoryRegistry, Character.class); - doubleType = new IDEDoubleTypeBeanTypeProxy(fFactoryRegistry, Double.TYPE); - doubleClass = new IDEDoubleClassBeanTypeProxy(fFactoryRegistry, Double.class); - stringClass = new IDEStringBeanTypeProxy(fFactoryRegistry, String.class); - classClass = new IDEClassBeanTypeProxy(fFactoryRegistry, java.lang.Class.class); - voidType = new IDEBeanTypeProxy(fFactoryRegistry, Void.TYPE); - - // Initialize the hashtable with the primitives, their lang equivalents, and also common classes like String - beanProxies = new HashMap(20); - - // Primitives - beanProxies.put(intType.getTypeName(), intType); - beanProxies.put(booleanType.getTypeName(), booleanType); - beanProxies.put(charType.getTypeName(), charType); - beanProxies.put(byteType.getTypeName(), byteType); - beanProxies.put(shortType.getTypeName(), shortType); - beanProxies.put(longType.getTypeName(), longType); - beanProxies.put(floatType.getTypeName(), floatType); - beanProxies.put(doubleType.getTypeName(), doubleType); - - // java.lang primitive peers - // Note that special classes are used for some of these which allow the IDE to get the - // lang objects from the objects that are holding proxies - beanProxies.put(integerClass.getTypeName(), integerClass); - beanProxies.put(booleanClass.getTypeName(), booleanClass); - beanProxies.put(charClass.getTypeName(), charClass); - beanProxies.put(byteClass.getTypeName(), byteClass); - beanProxies.put(shortClass.getTypeName(), shortClass); - beanProxies.put(longClass.getTypeName(), longClass); - beanProxies.put(floatClass.getTypeName(), floatClass); - beanProxies.put(doubleClass.getTypeName(), doubleClass); - beanProxies.put(BigDecimal.class.getName(), new IDEBigDecimalBeanTypeProxy(fFactoryRegistry, BigDecimal.class));//$NON-NLS-1$ - beanProxies.put(BigInteger.class.getName(), new IDEBigIntegerBeanTypeProxy(fFactoryRegistry, BigInteger.class));//$NON-NLS-1$ - beanProxies.put(stringClass.getTypeName(), stringClass); - - beanProxies.put(classClass.getTypeName(), classClass); - beanProxies.put(voidType.getTypeName(), voidType); - } - - /** - * We are an IDE proxy and know that the type is in the same VM as the IDE. the IDEBeanTypeProxy object NOTE This is package protected because the - * only person who can call it are priveledged classes that are also creating things in an IDEProxy environment. If anyone needs to make this - * method public they are doing the wrong thing as they should use the public method getBeanTypeProxy(String) that is on the interface. The only - * other object that can guarantee that they have the class for the argument are those that are part of the idevm package - */ - IBeanTypeProxy getBeanTypeProxy(Class anIDEClass) { - return getBeanTypeProxy(anIDEClass.getName()); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory#getBeanTypeProxy(java.lang.String) - */ - public synchronized IBeanTypeProxy getBeanTypeProxy(String typeName) { - typeName = MapTypes.getJNIFormatName(typeName); - - // See whether we already have the proxy for the argument name - IProxyBeanType beanTypeProxy = (IProxyBeanType) beanProxies.get(typeName); - // See if there and resolved, if so, return it. If not resolved, that means we need it NOW - // so we must go for it. When finally resolved the original ExpressionProxy will be deregistered and - // the resolved beantypeproxy will be in its place. - if (beanTypeProxy != null && beanTypeProxy.isBeanProxy()) { - return (IBeanTypeProxy) beanTypeProxy; - } - - // If not an array, then see if the package extension mechanism can find it. - // Do this here so that if it is found in the package extension we won't necessarily create an - // extra connection when not needed. - if (typeName.charAt(0) != '[') { - // It is not an array - // First check with the factory for the package of the class. - // Inner classes have to use the dollar notation since if they didn't we couldn't tell where - // the package ended and the class started. - int packageIndex = typeName.lastIndexOf('.'); - if (packageIndex != -1) { - String packageName = typeName.substring(0, packageIndex); - IDEExtensionBeanTypeProxyFactory packageFactory = (IDEExtensionBeanTypeProxyFactory) fFactoryRegistry - .getBeanTypeProxyFactoryExtension(packageName); - if (packageFactory != null) { - beanTypeProxy = packageFactory.getExtensionBeanTypeProxy(typeName); - if (beanTypeProxy != null) { - registerBeanTypeProxy((IBeanTypeProxy) beanTypeProxy, false); - return (IBeanTypeProxy) beanTypeProxy; - } - } - } - // There was not a registered factory that dealt with the class. Load it using the factory - // registry which has the plugin's class loader - try { - Class ideClass = fFactoryRegistry.loadClass(typeName); - IDEBeanTypeProxy superTypeProxy = null; - if (ideClass.getSuperclass() != null) { - // Get the beantype proxy of the superclass. - superTypeProxy = (IDEBeanTypeProxy) getBeanTypeProxy(ideClass.getSuperclass()); - } - - // Ask the supertype - // to create a beantype proxy of the same beantype proxy class. - // This is so that any subclasses will get the same beantype proxy class - // for it if it is special. - if (superTypeProxy != null) - beanTypeProxy = superTypeProxy.newBeanTypeForClass(ideClass); - - if (beanTypeProxy == null) - beanTypeProxy = new IDEBeanTypeProxy(fFactoryRegistry, ideClass); - } catch (ClassNotFoundException e) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.INFO, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - String msg = MessageFormat.format("{0}({1})", new Object[] { e.getClass(), e.getMessage()}); //$NON-NLS-1$ - beanTypeProxy = new IDEInitErrorBeanTypeProxy(fFactoryRegistry, typeName, msg, e); - } catch (ExceptionInInitializerError e) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - String msg = MessageFormat.format("{0}({1})", new Object[] { e.getClass(), e.getMessage()}); //$NON-NLS-1$ - beanTypeProxy = new IDEInitErrorBeanTypeProxy(fFactoryRegistry, typeName, msg, e.getCause()); - } catch (LinkageError e) { - ProxyPlugin.getPlugin().getLogger().log(new Status(IStatus.WARNING, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e)); //$NON-NLS-1$ - String msg = MessageFormat.format("{0}({1})", new Object[] { e.getClass(), e.getMessage()}); //$NON-NLS-1$ - beanTypeProxy = new IDEInitErrorBeanTypeProxy(fFactoryRegistry, typeName, msg, e); - } - - // Cache the instance so we can re-use it again - beanProxies.put(typeName, beanTypeProxy); - return (IBeanTypeProxy) beanTypeProxy; - } else { - // need to create a array of this many dimensions so that we can get the appropriate class for it. - int dims = typeName.lastIndexOf('[') + 1; - Class finalComponentType = null; - if (typeName.charAt(dims) == 'L') { - // It is a class. - // Strip off up to the 'L', and the trailing ';'. That is the class name. - IDEBeanTypeProxy finalType = (IDEBeanTypeProxy) getBeanTypeProxy(typeName.substring(dims + 1, typeName.length() - 1)); - if (finalType != null) - finalComponentType = finalType.fClass; - } else { - // It is a type. Need to map it. - finalComponentType = (Class) IDEStandardBeanTypeProxyFactory.MAP_SHORTSIG_TO_TYPE.get(typeName.substring(dims, dims + 1)); - } - - if (finalComponentType != null) { - Object dummyArray = Array.newInstance(finalComponentType, new int[dims]); - beanTypeProxy = new IDEArrayBeanTypeProxy(fFactoryRegistry, typeName, dummyArray.getClass()); - beanProxies.put(typeName, beanTypeProxy); - } - return (IBeanTypeProxy) beanTypeProxy; - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory#getBeanTypeProxy(org.eclipse.jem.internal.proxy.core.IExpression, - * java.lang.String) - */ - public synchronized IProxyBeanType getBeanTypeProxy(IExpression expression, String typeName) { - typeName = MapTypes.getJNIFormatName(typeName); - - // See whether we already have the proxy for the argument name - IProxyBeanType beanTypeProxy = (IProxyBeanType) beanProxies.get(typeName); - if (beanTypeProxy != null) { return beanTypeProxy; } - - // Now see if an expression proxy cached. - beanTypeProxy = ((IDEExpression) expression).getBeanType(typeName); - if (beanTypeProxy != null) - return beanTypeProxy; - - - // If not an array, then see if the package extension mechanism can find it. - // Do this here so that if it is found in the package extension we won't necessarily create an - // extra connection when not needed. - if (typeName.charAt(0) != '[') { - // It is not an array - // First check with the factory for the package of the class. - // Inner classes have to use the dollar notation since if they didn't we couldn't tell where - // the package ended and the class started. - int packageIndex = typeName.lastIndexOf('.'); - if (packageIndex != -1) { - String packageName = typeName.substring(0, packageIndex); - IDEExtensionBeanTypeProxyFactory packageFactory = (IDEExtensionBeanTypeProxyFactory) fFactoryRegistry - .getBeanTypeProxyFactoryExtension(packageName); - if (packageFactory != null) { - beanTypeProxy = packageFactory.getExtensionBeanTypeProxy(typeName, expression); - if (beanTypeProxy != null) { - registerBeanTypeProxy(beanTypeProxy, false); - return beanTypeProxy; - } - } - } - } - - // There was not a registered factory that dealt with the class. So create the expression proxy. - beanTypeProxy = ((Expression) expression).createBeanTypeExpressionProxy(typeName); - registerBeanTypeProxy(beanTypeProxy, false); - return beanTypeProxy; - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory#getBeanTypeProxy(java.lang.String, int) - */ - public IBeanTypeProxy getBeanTypeProxy(String componentClassName, int dimensions) { - return getBeanTypeProxy(getArrayClassname(componentClassName, dimensions)); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory#getBeanTypeProxy(org.eclipse.jem.internal.proxy.core.IExpression, - * java.lang.String, int) - */ - public IProxyBeanType getBeanTypeProxy(IExpression expression, String componentClassName, int dimensions) { - return getBeanTypeProxy(expression, getArrayClassname(componentClassName, dimensions)); - } - - /** - * @param componentClassName - * @param dimensions - * @return - * - * @since 1.1.0 - */ - protected String getArrayClassname(String componentClassName, int dimensions) { - String jniComponentTypeName = MapTypes.getJNIFormatName(componentClassName); - String compType = jniComponentTypeName; - if (jniComponentTypeName.charAt(0) != '[') { - // We're not already an array, so create correct template. - compType = (String) MAP_TYPENAME_TO_SHORTSIG.get(componentClassName); - if (compType == null) { - // It is a class, and not a type. - compType = "L" + jniComponentTypeName + ";"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - // Now create it with the appropriate number of '[' in front. - StringBuffer buffer = new StringBuffer(dimensions + compType.length()); - for (int i = 0; i < dimensions; i++) - buffer.append('['); - buffer.append(compType); - return buffer.toString(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IBeanProxyFactory#terminateFactory(boolean) - */ - public void terminateFactory(boolean wait) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory#registerBeanTypeProxy(org.eclipse.jem.internal.proxy.core.IBeanTypeProxy, - * boolean) - */ - public synchronized void registerBeanTypeProxy(IBeanTypeProxy aBeanTypeProxy, boolean permanent) { - beanProxies.put(aBeanTypeProxy.getTypeName(), aBeanTypeProxy); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory#registerBeanTypeProxy(org.eclipse.jem.internal.proxy.core.IProxyBeanType, - * boolean) - */ - public void registerBeanTypeProxy(IProxyBeanType aProxyBeanType, boolean permanent) { - if (aProxyBeanType.isBeanProxy()) - registerBeanTypeProxy((IBeanTypeProxy) aProxyBeanType, permanent); // A regular kind, do regular registration. - else { - ExpressionProxy beanExpressionProxy = ((ExpressionProxy) aProxyBeanType); - final String typeName = aProxyBeanType.getTypeName(); - ((IDEExpression) beanExpressionProxy.getExpression()).addBeanType(typeName, aProxyBeanType); - beanExpressionProxy.addProxyListener(new ExpressionProxy.ProxyAdapter() { - - public void proxyResolved(ProxyEvent event) { - String typeName = ((IProxyBeanType) event.getSource()).getTypeName(); - synchronized (IDEStandardBeanTypeProxyFactory.this) { - if (!beanProxies.containsKey(typeName)) { - // It hasn't been resolved through some other means. So this is good. Actually this should never - // occur because upon resolution we've already registered the bean type proxy through the - // normal mechanisms. But to be safe, we'll do it here. - beanProxies.put(typeName, event.getProxy()); - } - } - } - - public void proxyNotResolved(ExpressionProxy.ProxyEvent event) { - ((IDEExpression) ((ExpressionProxy) event.getSource()).getExpression()).removeBeanType(typeName); - } - }); - } - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory#isBeanTypeRegistered(String) - */ - public synchronized boolean isBeanTypeRegistered(String className) { - return beanProxies.containsKey(MapTypes.getJNIFormatName(className)); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory#registeredTypes() - */ - public Set registeredTypes() { - return beanProxies.keySet(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory#isBeanTypeNotFound(String) - */ - public boolean isBeanTypeNotFound(String className) { - // Do nothing. No need for it in IDE system because there will always be a proxy, even when not found. - // In that case an IDEInitErrorBeanTypeProxy will be created. - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory#isMaintainNotFoundTypes() - */ - public boolean isMaintainNotFoundTypes() { - // Do nothing. No need for it in IDE system because there will always be a proxy, even when not found. - // In that case an IDEInitErrorBeanTypeProxy will be created. - return false; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory#setMaintainNotFoundTypes(boolean) - */ - public void setMaintainNotFoundTypes(boolean maintain) { - // Do nothing. No need for it in IDE system because there will always be a proxy, even when not found. - // In that case an IDEInitErrorBeanTypeProxy will be created. - } -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStringBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStringBeanProxy.java deleted file mode 100644 index 7dfaa9c05..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStringBeanProxy.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; -/** - * IDE Implementation of IStringBeanProxy - * Creation date: (2/6/00 9:02:42 AM) - * @author: Joe Winchester - */ -final class IDEStringBeanProxy extends IDEObjectBeanProxy implements IStringBeanProxy { - protected String fString; -/** - * Store the bean in the string field to save re-casting each time it is asked for. - * It is package protected because they are created - * in a special way and no one else should create them. - */ -IDEStringBeanProxy(IDEProxyFactoryRegistry aRegistry, Object aBean, IBeanTypeProxy aBeanTypeProxy) { - super(aRegistry, aBean,aBeanTypeProxy); - fString = (String)aBean; -} -/** - * Return the cache'd string that is a java.lang.String that the IDE can use - */ -public String stringValue() { - return fString; -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStringBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStringBeanTypeProxy.java deleted file mode 100644 index 7df370dab..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEStringBeanTypeProxy.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.IStringBeanProxy; -/** - * IDE Implementation of the BeanType proxy for java.lang.String - */ -final class IDEStringBeanTypeProxy extends IDEBeanTypeProxy { - // Cache a proxy to an empty string for speed - protected final IDEStringBeanProxy emptyStringProxy; - -IDEStringBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass) { - super(aRegistry, aClass); - // Cache a proxy to an empty string for speed - emptyStringProxy = new IDEStringBeanProxy(aRegistry, "",this); //$NON-NLS-1$ -} -/** - * Helper to create string beans - * Package protected because no-one else outside the package should use this, they - * must go through the API where you look up a factory first. - */ -IStringBeanProxy createStringBeanProxy(String aString){ - if ( aString.equals("") ) {//$NON-NLS-1$ - return emptyStringProxy; - } else { - return new IDEStringBeanProxy(fProxyFactoryRegistry,aString,this); - } -} -/* Specialized from IDEBeanTypeProxy to ensure IStringBeanProxies are created correctly - */ -protected IIDEBeanProxy newBeanProxy(Object anObject){ - - return (IIDEBeanProxy)createStringBeanProxy( (String)anObject ); - -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEThrowableProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEThrowableProxy.java deleted file mode 100644 index 0ad0e81f6..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEThrowableProxy.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.*; - -public class IDEThrowableProxy extends ThrowableProxy implements IIDEBeanProxy { - - /** - * Comment for <code>serialVersionUID</code> - * - * @since 1.1.0 - */ - private static final long serialVersionUID = 7162757961175978338L; - protected IBeanTypeProxy fBeanTypeProxy; - - protected IDEThrowableProxy(Throwable exc, IBeanTypeProxy aBeanTypeProxy) { - super(exc); - fBeanTypeProxy = aBeanTypeProxy; - } - - public boolean equals(Object obj) { - if (super.equals(obj)) - return true; - if (obj instanceof IIDEBeanProxy) { - return getCause().equals(((IIDEBeanProxy) obj).getBean()); - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IBeanProxy#sameAs(org.eclipse.jem.internal.proxy.core.IBeanProxy) - */ - public boolean sameAs(IBeanProxy aBeanProxy) { - if (this == aBeanProxy) - return true; - if (aBeanProxy instanceof IIDEBeanProxy) - return getCause() == ((IIDEBeanProxy) aBeanProxy).getBean(); - return false; - } - - public String getProxyLocalizedMessage() { - return getCause().getLocalizedMessage(); - } - public String getProxyMessage() { - return getCause().getMessage(); - } - public void printProxyStackTrace(java.io.PrintWriter writer) { - getCause().printStackTrace(writer); - } - public void printProxyStackTrace(java.io.PrintStream stream) { - getCause().printStackTrace(stream); - } - public void printProxyStackTrace() { - getCause().printStackTrace(); - } - public IBeanTypeProxy getTypeProxy() { - return fBeanTypeProxy; - } - public ProxyFactoryRegistry getProxyFactoryRegistry() { - return fBeanTypeProxy.getProxyFactoryRegistry(); - } - public String toBeanString() { - return getCause().toString(); - } - public boolean isValid() { - return true; - } - /** - * Return the exception which is the live bean - */ - public Object getBean() { - return getCause(); - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IProxy#isBeanProxy() - */ - public final boolean isBeanProxy() { - return true; - } - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IProxy#isExpressionProxy() - */ - public final boolean isExpressionProxy() { - return false; - } -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEVMServer.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEVMServer.java deleted file mode 100644 index 7ded239c5..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IDEVMServer.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import java.io.OutputStream; - -import org.eclipse.jem.internal.proxy.common.*; - -public class IDEVMServer implements IVMCallbackServer { - - IDECallbackRegistry fCallbackRegistry; - IDEStandardBeanProxyFactory fBeanProxyFactory; - -IDEVMServer(IDECallbackRegistry aCallbackRegistry){ - fCallbackRegistry = aCallbackRegistry; - fBeanProxyFactory = (IDEStandardBeanProxyFactory)fCallbackRegistry.fProxyFactoryRegistry.getBeanProxyFactory(); - -} -public Object doCallback(ICallbackRunnable aRunnable){ - try { - return aRunnable.run(new ICallbackHandler(){ - public Object callbackWithParms(int callbackID, int msgID, Object[] parms){ - // We are running in the same IDE so just call the registry directly - // although we must convert the parms to bean proxies - Object[] proxyParms = null; - // If we have any parms then convert them to bean proxies - if ( parms != null ) { - proxyParms = new Object[parms.length]; - for ( int i=0;i<parms.length;i++){ - Object p = parms[i]; - proxyParms[i] = createNextParm(p); - } - } - return fCallbackRegistry.vmCallback(callbackID,msgID,proxyParms); - } - - private Object createNextParm(Object p) { - if (!(p instanceof ICallbackHandler.TransmitableArray)) { - return fBeanProxyFactory.createIDEBeanProxyWith(p); - } else { - Object[] array = ((ICallbackHandler.TransmitableArray) p).getArray(); - Object[] parm = new Object[array.length]; - for (int i = 0; i < array.length; i++) { - parm[i] = createNextParm(array[i]); - } - return parm; - } - } - - /* (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.common.ICallbackHandler#callbackAsConstants(int, int, java.lang.Object) - */ - public Object callbackAsConstants(int callbackID, int msgID, Object parm) throws CommandException { - return fCallbackRegistry.vmCallback(callbackID,msgID,parm); - } - }); - - } catch ( CommandException exc ) { - return null; - } -} - -public OutputStream requestStream(int callbackID, int msgID) throws CommandException { - return fCallbackRegistry.requestStream(callbackID,msgID); -} -public IVMServer getIVMServer() { - return fCallbackRegistry.fProxyFactoryRegistry; -} - - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IIDEBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IIDEBeanProxy.java deleted file mode 100644 index a0fc42db3..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/IIDEBeanProxy.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide; -/* - - - */ - -import org.eclipse.jem.internal.proxy.core.IBeanProxy; - - -/** - * Interface that allows the IDE VM to get the actual bean. - */ -public interface IIDEBeanProxy extends IBeanProxy { -/** - * Get the actual live bean. - * USE with extreme care. - */ -public Object getBean(); -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEDimensionBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEDimensionBeanProxy.java deleted file mode 100644 index d42440dd5..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEDimensionBeanProxy.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide.awt; -/* - - - */ - -import java.awt.Dimension; - -import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy; -import org.eclipse.jem.internal.proxy.core.IDimensionBeanProxy; -import org.eclipse.jem.internal.proxy.ide.IDEObjectBeanProxy; -import org.eclipse.jem.internal.proxy.ide.IDEProxyFactoryRegistry; - -public class IDEDimensionBeanProxy extends IDEObjectBeanProxy implements IDimensionBeanProxy { - - protected Dimension fDimension; - -IDEDimensionBeanProxy(IDEProxyFactoryRegistry aRegistry,Object aDimension, IBeanTypeProxy aBeanTypeProxy){ - super(aRegistry,aDimension,aBeanTypeProxy); - fDimension = (Dimension)aDimension; -} -public int getWidth(){ - return fDimension.width; -} -public void setWidth(int aWidth){ - fDimension.width = aWidth; -} -public int getHeight(){ - return fDimension.height; -} -public void setHeight(int aHeight){ - fDimension.height = aHeight; -} -public void setSize(IDimensionBeanProxy aBeanProxy){ - fDimension.setSize(new Dimension(aBeanProxy.getWidth(),aBeanProxy.getHeight())); -} -public void setSize(int width, int height){ - fDimension.width = width; - fDimension.height = height; -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEDimensionBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEDimensionBeanTypeProxy.java deleted file mode 100644 index 30ca7e308..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEDimensionBeanTypeProxy.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide.awt; -/* - - - */ - -import java.awt.Dimension; - -import org.eclipse.jem.internal.proxy.ide.*; - -public class IDEDimensionBeanTypeProxy extends IDEBeanTypeProxy { - -IDEDimensionBeanTypeProxy(IDEProxyFactoryRegistry aRegistry){ - this(aRegistry,Dimension.class); -} - -private IDEDimensionBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class type){ - super(aRegistry, type); -} - -protected IIDEBeanProxy newBeanProxy(Object anObject){ - - return new IDEDimensionBeanProxy(fProxyFactoryRegistry, anObject, this); - -} -IDEDimensionBeanProxy createDimensionBeanProxy(int width, int height){ - return new IDEDimensionBeanProxy(fProxyFactoryRegistry,new Dimension(width,height),this); -} - /* - * @see IDEBeanTypeProxy#newBeanTypeForClass(Class) - */ - public IDEBeanTypeProxy newBeanTypeForClass(Class type) { - return new IDEDimensionBeanTypeProxy(fProxyFactoryRegistry, type); - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEPointBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEPointBeanProxy.java deleted file mode 100644 index 8d7ae78e9..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEPointBeanProxy.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide.awt; -/* - - - */ - -import java.awt.Point; - -import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy; -import org.eclipse.jem.internal.proxy.core.IPointBeanProxy; -import org.eclipse.jem.internal.proxy.ide.IDEObjectBeanProxy; -import org.eclipse.jem.internal.proxy.ide.IDEProxyFactoryRegistry; - -public class IDEPointBeanProxy extends IDEObjectBeanProxy implements IPointBeanProxy { - - protected Point fPoint; - -IDEPointBeanProxy(IDEProxyFactoryRegistry aRegistry,Object aPoint, IBeanTypeProxy aBeanTypeProxy){ - super(aRegistry,aPoint,aBeanTypeProxy); - fPoint = (Point)aPoint; -} -public int getX(){ - return fPoint.x; -} -public void setX(int anX){ - fPoint.x = anX; -} -public int getY(){ - return fPoint.y; -} -public void setY(int aY){ - fPoint.y = aY; -} -public void setLocation(IPointBeanProxy aBeanProxy){ - fPoint.setLocation(new Point(aBeanProxy.getX(),aBeanProxy.getY())); -} -public void setLocation(int anX, int aY){ - fPoint.x = anX; - fPoint.y = aY; -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEPointBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEPointBeanTypeProxy.java deleted file mode 100644 index 0d4fb9178..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEPointBeanTypeProxy.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide.awt; -/* - - - */ - -import java.awt.Point; - -import org.eclipse.jem.internal.proxy.ide.*; - -public class IDEPointBeanTypeProxy extends IDEBeanTypeProxy { - -IDEPointBeanTypeProxy(IDEProxyFactoryRegistry aRegistry){ - this(aRegistry,Point.class); -} -private IDEPointBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class type){ - super(aRegistry,type); -} -protected IIDEBeanProxy newBeanProxy(Object anObject){ - - return new IDEPointBeanProxy(fProxyFactoryRegistry, anObject, this); - -} -IDEPointBeanProxy createPointBeanProxy(int x, int y){ - return new IDEPointBeanProxy(fProxyFactoryRegistry,new Point(x,y),this); -} - /* - * @see IDEBeanTypeProxy#newBeanTypeForClass(Class) - */ - public IDEBeanTypeProxy newBeanTypeForClass(Class type) { - return new IDEPointBeanTypeProxy(fProxyFactoryRegistry, type); - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDERectangleBeanProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDERectangleBeanProxy.java deleted file mode 100644 index baa2f6f82..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDERectangleBeanProxy.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide.awt; -/* - - - */ - -import java.awt.Rectangle; - -import org.eclipse.jem.internal.proxy.core.*; -import org.eclipse.jem.internal.proxy.ide.IDEObjectBeanProxy; -import org.eclipse.jem.internal.proxy.ide.IDEProxyFactoryRegistry; - -public class IDERectangleBeanProxy extends IDEObjectBeanProxy implements IRectangleBeanProxy { - - protected Rectangle fRectangle; - -IDERectangleBeanProxy(IDEProxyFactoryRegistry aRegistry,Object aRectangle, IBeanTypeProxy aBeanTypeProxy){ - super(aRegistry,aRectangle,aBeanTypeProxy); - fRectangle = (Rectangle)aRectangle; -} -public int getX(){ - return fRectangle.x; -} -public void setX(int anX){ - fRectangle.x = anX; -} -public int getY(){ - return fRectangle.y; -} -public void setY(int aY){ - fRectangle.y = aY; -} -public int getHeight(){ - return fRectangle.height; -} -public void setHeight(int aHeight){ - fRectangle.height = aHeight; -} -public void setWidth(int aWidth){ - fRectangle.width = aWidth; -} -public int getWidth(){ - return fRectangle.width; -} -public void setBounds(IRectangleBeanProxy aBeanProxy){ - fRectangle.setBounds(aBeanProxy.getX(),aBeanProxy.getY(),aBeanProxy.getWidth(),aBeanProxy.getHeight()); -} -public void setBounds(int x, int y, int width, int height){ - fRectangle.setBounds(x,y,width,height); -} -public void setSize(IDimensionBeanProxy aBeanProxy){ - fRectangle.setSize(aBeanProxy.getWidth(),aBeanProxy.getWidth()); -} -public void setLocation(IPointBeanProxy aBeanProxy){ - fRectangle.setLocation(aBeanProxy.getX(),aBeanProxy.getY()); -} -public void setLocation(int x, int y){ - fRectangle.setLocation(x,y); -} -public void setSize(int width, int height){ - fRectangle.setSize(width,height); -} -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDERectangleBeanTypeProxy.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDERectangleBeanTypeProxy.java deleted file mode 100644 index fd533177f..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDERectangleBeanTypeProxy.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide.awt; -/* - - - */ - -import java.awt.Rectangle; - -import org.eclipse.jem.internal.proxy.ide.*; - -public class IDERectangleBeanTypeProxy extends IDEBeanTypeProxy { - -IDERectangleBeanTypeProxy(IDEProxyFactoryRegistry aRegistry){ - this(aRegistry,Rectangle.class); -} - -private IDERectangleBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class type){ - super(aRegistry,type); -} -protected IIDEBeanProxy newBeanProxy(Object anObject){ - - return new IDERectangleBeanProxy(fProxyFactoryRegistry, anObject, this); - -} -IDERectangleBeanProxy createRectangleBeanProxy(int x, int y, int width, int height){ - return new IDERectangleBeanProxy(fProxyFactoryRegistry,new Rectangle(x,y,width,height),this); -} - /* - * @see IDEBeanTypeProxy#newBeanTypeForClass(Class) - */ - public IDEBeanTypeProxy newBeanTypeForClass(Class type) { - return new IDERectangleBeanTypeProxy(fProxyFactoryRegistry, type); - } - -} diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDERegisterAWT.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDERegisterAWT.java deleted file mode 100644 index 657487cc0..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDERegisterAWT.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide.awt; -/* - - - */ - - -import org.eclipse.jem.internal.proxy.ide.IDEProxyFactoryRegistry; -/** - * This class is used to register the AWT factories. - */ -public final class IDERegisterAWT { - public static void registerAWT(IDEProxyFactoryRegistry registry) { - new IDEStandardAWTBeanTypeProxyFactory(registry); - new IDEStandardAWTBeanProxyFactory(registry); - } -} - - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEStandardAWTBeanProxyFactory.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEStandardAWTBeanProxyFactory.java deleted file mode 100644 index 77c36f934..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEStandardAWTBeanProxyFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jem.internal.proxy.ide.awt; -/* - - - */ - - -import org.eclipse.jem.internal.proxy.awt.*; -import org.eclipse.jem.internal.proxy.core.*; -import org.eclipse.jem.internal.proxy.ide.IDEProxyFactoryRegistry; -/** - * Standard AWT Bean Proxy Factory. - * Package protected because it should not referenced - * outside of the package other than through the interface. - */ -class IDEStandardAWTBeanProxyFactory implements IStandardAwtBeanProxyFactory { - - final IDEStandardAWTBeanTypeProxyFactory fAWTBeanTypeFactory; - -public IDEStandardAWTBeanProxyFactory(IDEProxyFactoryRegistry factory) { - factory.registerBeanProxyFactory(IStandardAwtBeanProxyFactory.REGISTRY_KEY, this); - fAWTBeanTypeFactory = (IDEStandardAWTBeanTypeProxyFactory)factory.getBeanTypeProxyFactoryExtension(IDEStandardAWTBeanTypeProxyFactory.BEAN_TYPE_FACTORY_KEY); -} -public IDimensionBeanProxy createDimensionBeanProxyWith(int width, int height){ - return fAWTBeanTypeFactory.dimensionType.createDimensionBeanProxy(width,height); -} - -public IPointBeanProxy createPointBeanProxyWith(int x, int y){ - return fAWTBeanTypeFactory.pointType.createPointBeanProxy(x,y); -} -public IRectangleBeanProxy createBeanProxyWith(int x, int y, int width, int height){ - return fAWTBeanTypeFactory.rectangleType.createRectangleBeanProxy(x,y,width,height); -} -public void terminateFactory(boolean wait) { -} -} - diff --git a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEStandardAWTBeanTypeProxyFactory.java b/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEStandardAWTBeanTypeProxyFactory.java deleted file mode 100644 index e98a622a2..000000000 --- a/plugins/org.eclipse.jem.proxy/proxyide/org/eclipse/jem/internal/proxy/ide/awt/IDEStandardAWTBeanTypeProxyFactory.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/* - - - */ -package org.eclipse.jem.internal.proxy.ide.awt; - -import org.eclipse.jem.internal.proxy.core.*; -import org.eclipse.jem.internal.proxy.ide.*; - -/** - * BeanType factory standard AWT bean types. This is package protected because it shouldn't be referenced outside the package. It should only be - * accessed through the interface. - */ -class IDEStandardAWTBeanTypeProxyFactory implements IDEExtensionBeanTypeProxyFactory { - - static final String BEAN_TYPE_FACTORY_KEY = "java.awt"; //$NON-NLS-1$ - - protected final IDEProxyFactoryRegistry fFactoryRegistry; - - protected final IDEDimensionBeanTypeProxy dimensionType; - - protected final IDEPointBeanTypeProxy pointType; - - protected final IDERectangleBeanTypeProxy rectangleType; - - IDEStandardAWTBeanTypeProxyFactory(IDEProxyFactoryRegistry aRegistry) { - fFactoryRegistry = aRegistry; - fFactoryRegistry.registerBeanTypeProxyFactory(BEAN_TYPE_FACTORY_KEY, this); - dimensionType = new IDEDimensionBeanTypeProxy(fFactoryRegistry); - pointType = new IDEPointBeanTypeProxy(fFactoryRegistry); - rectangleType = new IDERectangleBeanTypeProxy(fFactoryRegistry); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.ide.IDEExtensionBeanTypeProxyFactory#getExtensionBeanTypeProxy(java.lang.String) - */ - public IDEBeanTypeProxy getExtensionBeanTypeProxy(String className) { - - if ("java.awt.Dimension".equals(className)) //$NON-NLS-1$ - return dimensionType; - else if ("java.awt.Point".equals(className)) //$NON-NLS-1$ - return pointType; - else if ("java.awt.Rectangle".equals(className)) //$NON-NLS-1$ - return rectangleType; - else - return null; - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.ide.IDEExtensionBeanTypeProxyFactory#getExtensionBeanTypeProxy(java.lang.String, org.eclipse.jem.internal.proxy.core.IBeanTypeProxy) - */ - public IDEBeanTypeProxy getExtensionBeanTypeProxy(String className, IBeanTypeProxy beanTypeProxy) { - - return getExtensionBeanTypeProxy(className); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jem.internal.proxy.ide.IDEExtensionBeanTypeProxyFactory#getExtensionBeanTypeProxy(java.lang.String, - * org.eclipse.jem.internal.proxy.core.IExpression) - */ - public IProxyBeanType getExtensionBeanTypeProxy(String typeName, IExpression expression) { - return getExtensionBeanTypeProxy(typeName); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jem.internal.proxy.core.IBeanProxyFactory#terminateFactory(boolean) - */ - public void terminateFactory(boolean wait) { - } -} |