diff options
author | Noel Grandin <noel@peralex.com> | 2012-08-20 17:05:35 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-08-20 19:04:33 +0100 |
commit | 8bfe47960f60e1dc2e6bcf0f3c3f7e43dfd3fc0b (patch) | |
tree | 12399f5232ff90f000bb58e213629140e564f0ce /accessibility/bridge | |
parent | Use PassWord property in impdialog.src for certificate Edit widget. (diff) | |
download | core-8bfe47960f60e1dc2e6bcf0f3c3f7e43dfd3fc0b.tar.gz core-8bfe47960f60e1dc2e6bcf0f3c3f7e43dfd3fc0b.zip |
Java5 updates - convert to generics
Change-Id: I039e51958865a7ea000034e7bf765f64d49689cd
Diffstat (limited to 'accessibility/bridge')
29 files changed, 105 insertions, 137 deletions
diff --git a/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java b/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java index 1d99feb231c8..d4aff6b5dfcb 100644 --- a/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java +++ b/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java @@ -34,6 +34,7 @@ import com.sun.star.uno.*; import org.openoffice.java.accessibility.*; +import java.awt.Window; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -42,7 +43,7 @@ import javax.accessibility.Accessible; public class AccessBridge { // - protected static java.util.Hashtable topWindowMap = new java.util.Hashtable(); + protected static java.util.Hashtable<String, Window> topWindowMap = new java.util.Hashtable<String, Window>(); private static java.awt.Window getTopWindowImpl(XAccessible xAccessible) { // Because it can not be garantied that @@ -51,7 +52,7 @@ public class AccessBridge { // atomic. synchronized (topWindowMap) { String oid = UnoRuntime.generateOid(xAccessible); - java.awt.Window w = (java.awt.Window) topWindowMap.get(oid); + java.awt.Window w = topWindowMap.get(oid); if (w == null) { w = AccessibleObjectFactory.getTopWindow(xAccessible); @@ -107,7 +108,7 @@ public class AccessBridge { case AccessibleRole.WINDOW: case AccessibleRole.FRAME: case AccessibleRole.DIALOG: - return (java.awt.Window) topWindowMap.remove(UnoRuntime.generateOid(xAccessible)); + return topWindowMap.remove(UnoRuntime.generateOid(xAccessible)); default: break; @@ -156,7 +157,7 @@ public class AccessBridge { // FIXME this should be done in VCL unoToolkit.addTopWindowListener(this); - String os = (String) System.getProperty("os.name"); + String os = System.getProperty("os.name"); // Try to initialize the WindowsAccessBridgeAdapter if (os.startsWith("Windows")) { @@ -177,7 +178,7 @@ public class AccessBridge { * XTopWindowListener */ public void windowOpened(com.sun.star.lang.EventObject event) { - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(XAccessible.class, + XAccessible xAccessible = UnoRuntime.queryInterface(XAccessible.class, event.Source); java.awt.Window w = getTopWindow(xAccessible); } @@ -198,7 +199,7 @@ public class AccessBridge { } public void windowClosed(com.sun.star.lang.EventObject event) { - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(XAccessible.class, + XAccessible xAccessible = UnoRuntime.queryInterface(XAccessible.class, event.Source); java.awt.Window w = removeTopWindow(xAccessible); diff --git a/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java b/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java index 15fded22cece..41e0e0381da6 100644 --- a/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java +++ b/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java @@ -34,7 +34,7 @@ import javax.accessibility.*; public class WindowsAccessBridgeAdapter { private static Method registerVirtualFrame; private static Method revokeVirtualFrame; - private static java.util.Hashtable frameMap; + private static java.util.Hashtable<Integer, Accessible> frameMap; protected static native byte[] getProcessID(); @@ -44,9 +44,9 @@ public class WindowsAccessBridgeAdapter { // Therefor the bridge exports two methods that we try to find here. protected static void attach(XComponentContext xComponentContext) { try { - Class bridge = Class.forName( + Class<?> bridge = Class.forName( "com.sun.java.accessibility.AccessBridge"); - Class[] parameterTypes = { + Class<?>[] parameterTypes = { javax.accessibility.Accessible.class, Integer.class }; @@ -63,7 +63,7 @@ public class WindowsAccessBridgeAdapter { "/singletons/com.sun.star.java.theJavaVirtualMachine"); if (AnyConverter.isObject(any)) { - XJavaVM xJavaVM = (XJavaVM) UnoRuntime.queryInterface(XJavaVM.class, + XJavaVM xJavaVM = UnoRuntime.queryInterface(XJavaVM.class, AnyConverter.toObject(new Type(XJavaVM.class), any)); if (xJavaVM != null) { @@ -71,7 +71,7 @@ public class WindowsAccessBridgeAdapter { if (AnyConverter.isLong(any)) { createMapping(AnyConverter.toLong(any)); - frameMap = new java.util.Hashtable(); + frameMap = new java.util.Hashtable<Integer, Accessible>(); } } } @@ -149,7 +149,7 @@ public class WindowsAccessBridgeAdapter { break; default: - a = (Accessible) AccessBridge.getTopWindow(xAccessible); + a = AccessBridge.getTopWindow(xAccessible); break; } } @@ -201,7 +201,7 @@ public class WindowsAccessBridgeAdapter { public static void revokeTopWindow(int handle, XAccessible xAccessible) { Integer hwnd = new Integer(handle); - Accessible a = (Accessible) frameMap.remove(hwnd); + Accessible a = frameMap.remove(hwnd); if (a != null) { Object[] args = { a, hwnd }; diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java b/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java index e4b4f17250d3..530a5dd59d2b 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java @@ -57,8 +57,7 @@ public abstract class AbstractButton extends Component { return null; try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent); + XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent); if (unoAccessibleText != null) { return new AccessibleTextImpl(unoAccessibleText); } else { @@ -137,8 +136,7 @@ public abstract class AbstractButton extends Component { XAccessibleContext xAccessibleContext = unoAccessibleContext; if (xAccessibleContext != null) { // Query for XAccessibleAction interface - XAccessibleAction xAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, xAccessibleContext); + XAccessibleAction xAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, xAccessibleContext); if (xAccessibleAction != null) { return xAccessibleAction.doAccessibleAction(0); diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java index 557bae23689c..03e1fa56c5b1 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java @@ -36,8 +36,7 @@ public class AccessibleComponentImpl implements javax.accessibility.AccessibleCo protected boolean hasState(short state) { try { - XAccessibleContext unoAccessibleContext = (XAccessibleContext) - UnoRuntime.queryInterface(XAccessibleContext.class, unoObject); + XAccessibleContext unoAccessibleContext = UnoRuntime.queryInterface(XAccessibleContext.class, unoObject); // All UNO accessibility implementations must support XAccessibleContext // and return a valid XAccessibleStateSet .. return unoAccessibleContext.getAccessibleStateSet().contains(state); diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java index c99608144910..a12f08db7165 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java @@ -23,6 +23,7 @@ import com.sun.star.style.*; import com.sun.star.uno.*; import com.sun.star.accessibility.AccessibleTextType; import com.sun.star.accessibility.XAccessibleEditableText; +import com.sun.star.beans.PropertyValue; import javax.accessibility.AccessibleText; import javax.swing.text.StyleConstants; @@ -104,7 +105,7 @@ public class AccessibleEditableTextImpl extends AccessibleTextImpl implements ja /** Sets the attributes for the text between two indices */ public void setAttributes(int startIndex, int endIndex, javax.swing.text.AttributeSet as) { - java.util.ArrayList propertyValues = new java.util.ArrayList(); + java.util.ArrayList<PropertyValue> propertyValues = new java.util.ArrayList<PropertyValue>(); // Convert Alignment attribute Object attribute = as.getAttribute(StyleConstants.Alignment); @@ -298,7 +299,7 @@ public class AccessibleEditableTextImpl extends AccessibleTextImpl implements ja propertyValue.Name = "ParaTabStops"; javax.swing.text.TabSet tabSet = StyleConstants.getTabSet(as); - java.util.ArrayList tabStops = new java.util.ArrayList(tabSet.getTabCount()); + java.util.ArrayList<TabStop> tabStops = new java.util.ArrayList<TabStop>(tabSet.getTabCount()); for (int i = 0, max = tabSet.getTabCount(); i < max; i++) { javax.swing.text.TabStop tab = tabSet.getTab(i); @@ -323,7 +324,7 @@ public class AccessibleEditableTextImpl extends AccessibleTextImpl implements ja tabStops.add(unoTab); } - propertyValue.Value = (com.sun.star.style.TabStop[]) tabStops.toArray(); + propertyValue.Value = tabStops.toArray(); propertyValues.add(propertyValue); } diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java index 11223eda1cda..24ab5efe0687 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java @@ -136,14 +136,12 @@ public class AccessibleHypertextImpl extends AccessibleTextImpl public static javax.accessibility.AccessibleText get(com.sun.star.uno.XInterface unoObject) { try { - XAccessibleHypertext unoAccessibleHypertext = (XAccessibleHypertext) - UnoRuntime.queryInterface(XAccessibleHypertext.class, unoObject); + XAccessibleHypertext unoAccessibleHypertext = UnoRuntime.queryInterface(XAccessibleHypertext.class, unoObject); if (unoAccessibleHypertext != null) { return new AccessibleHypertextImpl(unoAccessibleHypertext); } - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class, unoObject); + XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoObject); if (unoAccessibleText != null) { return new AccessibleTextImpl(unoAccessibleText); } diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java index b3f876c21484..29cdfe609d04 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java @@ -18,6 +18,7 @@ package org.openoffice.java.accessibility; +import java.awt.Component; import java.lang.ref.WeakReference; import javax.accessibility.Accessible; import javax.accessibility.AccessibleStateSet; @@ -32,7 +33,7 @@ public class AccessibleObjectFactory { // This type is needed for conversions from/to uno Any public static final Type XAccessibleType = new Type(XAccessible.class); - private static java.util.Hashtable objectList = new java.util.Hashtable(); + private static java.util.Hashtable<String, WeakReference<Component>> objectList = new java.util.Hashtable<String, WeakReference<Component>>(); private static java.awt.FocusTraversalPolicy focusTraversalPolicy = new FocusTraversalPolicy(); private static java.awt.EventQueue theEventQueue = java.awt.Toolkit.getDefaultToolkit(). @@ -93,9 +94,9 @@ public class AccessibleObjectFactory { // Check if we already have a wrapper object for this context synchronized (objectList) { - WeakReference r = (WeakReference) objectList.get(oid); + WeakReference<java.awt.Component> r = objectList.get(oid); if(r != null) { - c = (java.awt.Component) r.get(); + c = r.get(); } } } @@ -450,7 +451,7 @@ public class AccessibleObjectFactory { if (c != null) { // Add the newly created object to the cache list synchronized (objectList) { - objectList.put(c.toString(), new WeakReference(c)); + objectList.put(c.toString(), new WeakReference<Component>(c)); if (Build.DEBUG) { // System.out.println("Object cache now contains " + objectList.size() + " objects."); } @@ -483,8 +484,7 @@ public class AccessibleObjectFactory { if (xAccessibleContext != null) { short role = xAccessibleContext.getAccessibleRole(); XAccessibleStateSet xAccessibleStateSet = xAccessibleContext.getAccessibleStateSet(); - XAccessibleComponent xAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext); + XAccessibleComponent xAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext); java.awt.Window w; if (role == AccessibleRole.DIALOG) { diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java index e0a9a9463fab..fd522ae6dd05 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java @@ -74,8 +74,7 @@ public class AccessibleTextImpl implements javax.accessibility.AccessibleText { public static javax.accessibility.AccessibleText get(com.sun.star.uno.XInterface unoObject) { try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class, unoObject); + XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoObject); if (unoAccessibleText != null) { return new AccessibleTextImpl(unoAccessibleText); } diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java b/accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java index fb7535de8061..4d4718b50200 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java @@ -68,7 +68,7 @@ public class ComboBox extends Container { /** Gets the AccessibleAction associated with this object that supports one or more actions */ public javax.accessibility.AccessibleAction getAccessibleAction() { if (unoAccessibleAction == null) { - unoAccessibleAction = (XAccessibleAction) UnoRuntime.queryInterface(XAccessibleAction.class, + unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext); if (unoAccessibleAction == null) { diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Component.java b/accessibility/bridge/org/openoffice/java/accessibility/Component.java index c78fba29b314..d2f7873b21bb 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Component.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Component.java @@ -38,13 +38,11 @@ public abstract class Component extends java.awt.Component { super(); unoAccessible = xAccessible; unoAccessibleContext = xAccessibleContext; - unoAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext); + unoAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext); // Add the event listener right away, because the global focus notification doesn't // work yet .. - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, - unoAccessibleComponent); + XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, + unoAccessibleComponent); if (broadcaster != null) { broadcaster.addEventListener(createEventListener()); } @@ -122,10 +120,10 @@ public abstract class Component extends java.awt.Component { public Object[] getAccessibleComponents(Object[] targetSet) { try { - java.util.ArrayList list = new java.util.ArrayList(targetSet.length); + java.util.ArrayList<java.awt.Component> list = new java.util.ArrayList<java.awt.Component>(targetSet.length); for (int i=0; i < targetSet.length; i++) { java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent( - (XAccessible) UnoRuntime.queryInterface(XAccessible.class, targetSet[i])); + UnoRuntime.queryInterface(XAccessible.class, targetSet[i])); if (c != null) { list.add(c); } @@ -659,8 +657,7 @@ public abstract class Component extends java.awt.Component { public String getToolTipText() { try { - XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent) - UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent); + XAccessibleExtendedComponent unoAccessibleExtendedComponent = UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent); if (unoAccessibleExtendedComponent != null) { return unoAccessibleExtendedComponent.getToolTipText(); } @@ -672,8 +669,7 @@ public abstract class Component extends java.awt.Component { public String getTitledBorderText() { try { - XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent) - UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent); + XAccessibleExtendedComponent unoAccessibleExtendedComponent = UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent); if (unoAccessibleExtendedComponent != null) { return unoAccessibleExtendedComponent.getTitledBorderText(); } @@ -685,8 +681,7 @@ public abstract class Component extends java.awt.Component { public javax.accessibility.AccessibleKeyBinding getAccessibleKeyBinding() { try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent); + XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent); if (unoAccessibleAction != null) { XAccessibleKeyBinding unoAccessibleKeyBinding = unoAccessibleAction.getAccessibleActionKeyBinding(0); if (unoAccessibleKeyBinding != null) { diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Container.java b/accessibility/bridge/org/openoffice/java/accessibility/Container.java index 65d894c3fa5f..7b2298b46cf0 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Container.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Container.java @@ -18,6 +18,8 @@ package org.openoffice.java.accessibility; +import java.awt.Component; + import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleState; @@ -39,15 +41,13 @@ public class Container extends java.awt.Container implements javax.accessibility accessibleRole = role; unoAccessible = xAccessible; unoAccessibleContext = xAccessibleContext; - unoAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, - xAccessibleContext); + unoAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class, + xAccessibleContext); // Add the event listener right away, because the global focus notification doesn't // work yet .. - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, - unoAccessibleContext); + XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, + unoAccessibleContext); if (broadcaster != null) { broadcaster.addEventListener(createEventListener()); } @@ -125,10 +125,10 @@ public class Container extends java.awt.Container implements javax.accessibility public Object[] getAccessibleComponents(Object[] targetSet) { try { - java.util.ArrayList list = new java.util.ArrayList(targetSet.length); + java.util.ArrayList<Component> list = new java.util.ArrayList<Component>(targetSet.length); for (int i=0; i < targetSet.length; i++) { java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent( - (XAccessible) UnoRuntime.queryInterface(XAccessible.class, targetSet[i])); + UnoRuntime.queryInterface(XAccessible.class, targetSet[i])); if (c != null) { list.add(c); } @@ -567,8 +567,7 @@ public class Container extends java.awt.Container implements javax.accessibility /** Returns the AccessibleSelection interface for this object */ public javax.accessibility.AccessibleSelection getAccessibleSelection() { try { - XAccessibleSelection unoAccessibleSelection = (XAccessibleSelection) - UnoRuntime.queryInterface(XAccessibleSelection.class, unoAccessibleContext); + XAccessibleSelection unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class, unoAccessibleContext); if (unoAccessibleSelection != null) { return new AccessibleSelectionImpl(unoAccessibleSelection); } diff --git a/accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java b/accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java index b8e6f159a7f8..3ac7f428b944 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java @@ -46,7 +46,7 @@ public abstract class DescendantManager extends Component { protected class AccessibleDescendantManagerListener extends AccessibleUNOComponentListener { protected AccessibleDescendantManagerListener() { - unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class, + unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class, unoAccessibleContext); } @@ -69,7 +69,7 @@ public abstract class DescendantManager extends Component { extends AccessibleUNOComponent implements javax.accessibility.AccessibleSelection { protected AccessibleDescendantManager() { - unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class, + unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class, unoAccessibleContext); } diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java b/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java index a34d343cfc8c..9bebc7e38b53 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java @@ -50,9 +50,8 @@ public class Dialog extends java.awt.Dialog implements javax.accessibility.Acces private void initialize(XAccessibleComponent xAccessibleComponent) { unoAccessibleComponent = xAccessibleComponent; eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, - xAccessibleComponent); + XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, + xAccessibleComponent); if (broadcaster != null) { broadcaster.addEventListener(new AccessibleDialogListener()); } diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Frame.java b/accessibility/bridge/org/openoffice/java/accessibility/Frame.java index f36d35851460..311a32f2e2f6 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Frame.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Frame.java @@ -42,9 +42,8 @@ public class Frame extends java.awt.Frame implements javax.accessibility.Accessi private void initialize(XAccessibleComponent xAccessibleComponent) { unoAccessibleComponent = xAccessibleComponent; eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, - unoAccessibleComponent); + XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, + unoAccessibleComponent); if (broadcaster != null) { broadcaster.addEventListener(new AccessibleFrameListener()); } diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Icon.java b/accessibility/bridge/org/openoffice/java/accessibility/Icon.java index 0e2cd5990560..a20bc3126bcc 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Icon.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Icon.java @@ -47,7 +47,7 @@ public class Icon extends Component implements javax.accessibility.Accessible { /** Gets the AccessibleText associated with this object presenting text on the display */ public javax.accessibility.AccessibleIcon[] getAccessibleIcon() { try { - XAccessibleImage unoAccessibleImage = (XAccessibleImage) UnoRuntime.queryInterface(XAccessibleImage.class, + XAccessibleImage unoAccessibleImage = UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleComponent); if (unoAccessibleImage != null) { diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Label.java b/accessibility/bridge/org/openoffice/java/accessibility/Label.java index 718739e36a2f..a5ced04424fa 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Label.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Label.java @@ -60,7 +60,7 @@ public class Label extends Component implements javax.accessibility.Accessible { return null; try { - XAccessibleText unoAccessibleText = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, + XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext); if (unoAccessibleText != null) { diff --git a/accessibility/bridge/org/openoffice/java/accessibility/List.java b/accessibility/bridge/org/openoffice/java/accessibility/List.java index 38d9ff6b0ea5..bc4fd666fa5e 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/List.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/List.java @@ -231,9 +231,9 @@ public class List extends DescendantManager implements javax.accessibility.Acces public Object[] create(Object[] targetSet) { try { - java.util.ArrayList list = new java.util.ArrayList(targetSet.length); + java.util.ArrayList<ListItem> list = new java.util.ArrayList<ListItem>(targetSet.length); for (int i=0; i < targetSet.length; i++) { - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface( + XAccessible xAccessible = UnoRuntime.queryInterface( XAccessible.class, targetSet[i]); if (xAccessible != null) { list.add(new ListItem(xAccessible)); @@ -375,8 +375,7 @@ public class List extends DescendantManager implements javax.accessibility.Acces /** Gets the AccessibleComponent associated with this object that has a graphical representation */ public javax.accessibility.AccessibleComponent getAccessibleComponent() { try { - XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext); + XAccessibleComponent unoAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext); return (unoAccessibleComponent != null) ? new AccessibleComponentImpl(unoAccessibleComponent) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -387,8 +386,7 @@ public class List extends DescendantManager implements javax.accessibility.Acces /** Gets the AccessibleAction associated with this object that has a graphical representation */ public javax.accessibility.AccessibleAction getAccessibleAction() { try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext); + XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext); return (unoAccessibleAction != null) ? new AccessibleActionImpl(unoAccessibleAction) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -403,8 +401,7 @@ public class List extends DescendantManager implements javax.accessibility.Acces return null; try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext); + XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext); return (unoAccessibleText != null) ? new AccessibleTextImpl(unoAccessibleText) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -415,8 +412,7 @@ public class List extends DescendantManager implements javax.accessibility.Acces /** Gets the AccessibleValue associated with this object that has a graphical representation */ public javax.accessibility.AccessibleValue getAccessibleValue() { try { - XAccessibleValue unoAccessibleValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); + XAccessibleValue unoAccessibleValue = UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); return (unoAccessibleValue != null) ? new AccessibleValueImpl(unoAccessibleValue) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -427,8 +423,7 @@ public class List extends DescendantManager implements javax.accessibility.Acces /** Gets the AccessibleText associated with this object presenting text on the display */ public javax.accessibility.AccessibleIcon[] getAccessibleIcon() { try { - XAccessibleImage unoAccessibleImage = (XAccessibleImage) - UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext); + XAccessibleImage unoAccessibleImage = UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext); if (unoAccessibleImage != null) { javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) }; return icons; diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Menu.java b/accessibility/bridge/org/openoffice/java/accessibility/Menu.java index ecf2df9497d3..005657172b1d 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Menu.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Menu.java @@ -17,6 +17,8 @@ */ package org.openoffice.java.accessibility; +import java.awt.Component; + import com.sun.star.accessibility.*; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.UnoRuntime; @@ -24,7 +26,7 @@ import com.sun.star.uno.UnoRuntime; public class Menu extends AbstractButton implements javax.accessibility.Accessible { - private java.util.ArrayList children; + private java.util.ArrayList<Component> children; protected XAccessibleSelection unoAccessibleSelection = null; protected Menu(XAccessible xAccessible, @@ -34,7 +36,7 @@ public class Menu extends AbstractButton try { // Create a vector with the correct initial capacity int count = unoAccessibleContext.getAccessibleChildCount(); - children = new java.util.ArrayList(count); + children = new java.util.ArrayList<Component>(count); // Fill the vector with objects for (int i = 0; i < count; i++) { @@ -52,7 +54,7 @@ public class Menu extends AbstractButton } if (children == null) { - children = new java.util.ArrayList(0); + children = new java.util.ArrayList<Component>(0); } } catch (com.sun.star.lang.IndexOutOfBoundsException e) { } @@ -172,7 +174,7 @@ public class Menu extends AbstractButton protected class AccessibleMenu extends AccessibleAbstractButton implements javax.accessibility.AccessibleSelection { protected AccessibleMenu() { - unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class, + unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class, unoAccessibleContext); } diff --git a/accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java b/accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java index 892cb55139f8..79741ad57558 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java @@ -67,7 +67,7 @@ public class MenuContainer extends Container implements javax.accessibility.Acce protected class AccessibleMenuContainer extends AccessibleContainer implements javax.accessibility.AccessibleSelection { protected AccessibleMenuContainer() { - unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class, + unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class, unoAccessibleContext); } diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java b/accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java index d1b18721ded2..a37831121c9e 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java @@ -128,9 +128,8 @@ public class Paragraph extends Container implements javax.accessibility.Accessib return null; try { - XAccessibleEditableText unoAccessibleText = (XAccessibleEditableText) - UnoRuntime.queryInterface(XAccessibleEditableText.class, - unoAccessibleComponent); + XAccessibleEditableText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleEditableText.class, + unoAccessibleComponent); if (unoAccessibleText != null) { return new AccessibleEditableTextImpl(unoAccessibleText); } else { @@ -144,8 +143,7 @@ public class Paragraph extends Container implements javax.accessibility.Accessib /** Gets the AccessibleAction associated with this object that has a graphical representation */ public javax.accessibility.AccessibleAction getAccessibleAction() { try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent); + XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent); return (unoAccessibleAction != null) ? new AccessibleActionImpl(unoAccessibleAction) : null; } catch (com.sun.star.uno.RuntimeException e) { diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java b/accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java index 80a3c16fc17e..2d586eca7c31 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java @@ -49,7 +49,7 @@ public class ScrollBar extends Component implements SwingConstants, javax.access */ protected AccessibleScrollBar() { super(); - unoAccessibleAction = (XAccessibleAction) UnoRuntime.queryInterface( + unoAccessibleAction = UnoRuntime.queryInterface( XAccessibleAction.class, unoAccessibleContext); if (unoAccessibleAction != null) { actionCount = unoAccessibleAction.getAccessibleActionCount(); @@ -68,8 +68,7 @@ public class ScrollBar extends Component implements SwingConstants, javax.access /** Gets the AccessibleValue associated with this object that has a graphical representation */ public javax.accessibility.AccessibleValue getAccessibleValue() { try { - XAccessibleValue unoAccessibleValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); + XAccessibleValue unoAccessibleValue = UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); return (unoAccessibleValue != null) ? new AccessibleValueImpl(unoAccessibleValue) : null; } catch (com.sun.star.uno.RuntimeException e) { diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Table.java b/accessibility/bridge/org/openoffice/java/accessibility/Table.java index 93c457a28e06..fdb84ece84af 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Table.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Table.java @@ -130,7 +130,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce protected XAccessibleTable unoAccessibleTable; public AccessibleTable() { - unoAccessibleTable = (XAccessibleTable) UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext); + unoAccessibleTable = UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext); } /** Gets the role of this object */ @@ -457,9 +457,9 @@ public class Table extends DescendantManager implements javax.accessibility.Acce public Object[] create(Object[] targetSet) { try { - java.util.ArrayList list = new java.util.ArrayList(targetSet.length); + java.util.ArrayList<TableCell> list = new java.util.ArrayList<TableCell>(targetSet.length); for (int i=0; i < targetSet.length; i++) { - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface( + XAccessible xAccessible = UnoRuntime.queryInterface( XAccessible.class, targetSet[i]); if (xAccessible != null) { list.add(new TableCell(xAccessible)); @@ -650,8 +650,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce /** Gets the AccessibleComponent associated with this object that has a graphical representation */ public javax.accessibility.AccessibleComponent getAccessibleComponent() { try { - XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext); + XAccessibleComponent unoAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext); return (unoAccessibleComponent != null) ? new AccessibleComponentImpl(unoAccessibleComponent) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -662,8 +661,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce /** Gets the AccessibleAction associated with this object that has a graphical representation */ public javax.accessibility.AccessibleAction getAccessibleAction() { try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext); + XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext); return (unoAccessibleAction != null) ? new AccessibleActionImpl(unoAccessibleAction) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -678,8 +676,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce return null; try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext); + XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext); return (unoAccessibleText != null) ? new AccessibleTextImpl(unoAccessibleText) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -690,8 +687,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce /** Gets the AccessibleValue associated with this object that has a graphical representation */ public javax.accessibility.AccessibleValue getAccessibleValue() { try { - XAccessibleValue unoAccessibleValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); + XAccessibleValue unoAccessibleValue = UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); return (unoAccessibleValue != null) ? new AccessibleValueImpl(unoAccessibleValue) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -702,8 +698,7 @@ public class Table extends DescendantManager implements javax.accessibility.Acce /** Gets the AccessibleText associated with this object presenting text on the display */ public javax.accessibility.AccessibleIcon[] getAccessibleIcon() { try { - XAccessibleImage unoAccessibleImage = (XAccessibleImage) - UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext); + XAccessibleImage unoAccessibleImage = UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext); if (unoAccessibleImage != null) { javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) }; return icons; diff --git a/accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java b/accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java index cead76bb59a6..a9c27d280772 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java @@ -86,8 +86,7 @@ public class TextComponent extends Component implements javax.accessibility.Acce return null; try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent); + XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent); if (unoAccessibleText != null) { return new AccessibleTextImpl(unoAccessibleText); } else { @@ -101,8 +100,7 @@ public class TextComponent extends Component implements javax.accessibility.Acce /** Gets the AccessibleEditableText associated with this object presenting text on the display */ public javax.accessibility.AccessibleEditableText getAccessibleEditableText() { try { - XAccessibleEditableText unoAccessibleText = (XAccessibleEditableText) - UnoRuntime.queryInterface(XAccessibleEditableText.class,unoAccessibleComponent); + XAccessibleEditableText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleEditableText.class,unoAccessibleComponent); if (unoAccessibleText != null) { return new AccessibleEditableTextImpl(unoAccessibleText); } else { @@ -116,8 +114,7 @@ public class TextComponent extends Component implements javax.accessibility.Acce /** Gets the AccessibleAction associated with this object that has a graphical representation */ public javax.accessibility.AccessibleAction getAccessibleAction() { try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent); + XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent); return (unoAccessibleAction != null) ? new AccessibleActionImpl(unoAccessibleAction) : null; } catch (com.sun.star.uno.RuntimeException e) { diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java b/accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java index 5322e9be2e1d..c433315665ff 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java @@ -40,7 +40,7 @@ class ToggleButton extends AbstractButton implements javax.accessibility.Accessi /** Gets the AccessibleValue associated with this object that has a graphical representation */ public javax.accessibility.AccessibleValue getAccessibleValue() { try { - XAccessibleValue unoAccessibleValue = (XAccessibleValue) UnoRuntime.queryInterface(XAccessibleValue.class, + XAccessibleValue unoAccessibleValue = UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); return (unoAccessibleValue != null) diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java b/accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java index 10ad1d1cfe2c..d3a6b7918a8a 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java @@ -54,7 +54,7 @@ public class ToolTip extends Component implements javax.accessibility.Accessible return null; try { - XAccessibleText unoAccessibleText = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, + XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleComponent); if (unoAccessibleText != null) { diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Tree.java b/accessibility/bridge/org/openoffice/java/accessibility/Tree.java index 477c20b980a6..1291f555854d 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Tree.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Tree.java @@ -136,7 +136,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces protected XAccessibleTable unoAccessibleTable; public AccessibleTree() { - unoAccessibleTable = (XAccessibleTable) UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext); + unoAccessibleTable = UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext); } /* @@ -467,9 +467,9 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces public Object[] create(Object[] targetSet) { try { - java.util.ArrayList list = new java.util.ArrayList(targetSet.length); + java.util.ArrayList<TreeItem> list = new java.util.ArrayList<TreeItem>(targetSet.length); for (int i=0; i < targetSet.length; i++) { - XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface( + XAccessible xAccessible = UnoRuntime.queryInterface( XAccessible.class, targetSet[i]); if (xAccessible != null) { list.add(new TreeItem(xAccessible)); @@ -510,8 +510,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces public AccessibleTreeItem(XAccessibleContext xAccessibleContext) { unoAccessibleContext = xAccessibleContext; - unoAccessibleSelection = (XAccessibleSelection) - UnoRuntime.queryInterface(XAccessibleSelection.class, xAccessibleContext); + unoAccessibleSelection = UnoRuntime.queryInterface(XAccessibleSelection.class, xAccessibleContext); } /** Returns the accessible name of this object */ @@ -614,8 +613,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces /** Gets the AccessibleComponent associated with this object that has a graphical representation */ public javax.accessibility.AccessibleComponent getAccessibleComponent() { try { - XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext); + XAccessibleComponent unoAccessibleComponent = UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext); return (unoAccessibleComponent != null) ? new AccessibleComponentImpl(unoAccessibleComponent) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -631,8 +629,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces /** Gets the AccessibleAction associated with this object that has a graphical representation */ public javax.accessibility.AccessibleAction getAccessibleAction() { try { - XAccessibleAction unoAccessibleAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext); + XAccessibleAction unoAccessibleAction = UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext); return (unoAccessibleAction != null) ? new AccessibleActionImpl(unoAccessibleAction) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -647,8 +644,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces return null; try { - XAccessibleText unoAccessibleText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext); + XAccessibleText unoAccessibleText = UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext); return (unoAccessibleText != null) ? new AccessibleTextImpl(unoAccessibleText) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -659,8 +655,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces /** Gets the AccessibleValue associated with this object that has a graphical representation */ public javax.accessibility.AccessibleValue getAccessibleValue() { try { - XAccessibleValue unoAccessibleValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); + XAccessibleValue unoAccessibleValue = UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext); return (unoAccessibleValue != null) ? new AccessibleValueImpl(unoAccessibleValue) : null; } catch (com.sun.star.uno.RuntimeException e) { @@ -671,8 +666,7 @@ public class Tree extends DescendantManager implements javax.accessibility.Acces /** Gets the AccessibleText associated with this object presenting text on the display */ public javax.accessibility.AccessibleIcon[] getAccessibleIcon() { try { - XAccessibleImage unoAccessibleImage = (XAccessibleImage) - UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext); + XAccessibleImage unoAccessibleImage = UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext); if (unoAccessibleImage != null) { javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) }; return icons; diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Window.java b/accessibility/bridge/org/openoffice/java/accessibility/Window.java index 216b51192330..00300d678256 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/Window.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/Window.java @@ -37,9 +37,8 @@ public class Window extends java.awt.Window implements javax.accessibility.Acces private void initialize(XAccessibleComponent xAccessibleComponent) { unoAccessibleComponent = xAccessibleComponent; eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue(); - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, - unoAccessibleComponent); + XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, + unoAccessibleComponent); if (broadcaster != null) { broadcaster.addEventListener(new AccessibleWindowListener()); } diff --git a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java index 6e89fedd8858..e601a1cae4fc 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java @@ -18,6 +18,8 @@ package org.openoffice.java.accessibility.logging; +import java.awt.Component; + import com.sun.star.accessibility.*; import com.sun.star.uno.*; @@ -28,7 +30,7 @@ public class XAccessibleEventLog implements XAccessibleEventListener { private static XAccessibleEventLog theEventListener = null; - private static java.util.Hashtable proxyList = new java.util.Hashtable(); + private static java.util.Hashtable<String, Component> proxyList = new java.util.Hashtable<String, Component>(); /** Creates a new instance of UNOAccessibleEventListener */ public XAccessibleEventLog() { @@ -42,8 +44,7 @@ public class XAccessibleEventLog implements XAccessibleEventListener { } public static void addEventListener(XAccessibleContext xac, java.awt.Component c) { - XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster) - UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, xac); + XAccessibleEventBroadcaster broadcaster = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, xac); if (broadcaster != null) { broadcaster.addEventListener(XAccessibleEventLog.get()); @@ -137,7 +138,7 @@ public class XAccessibleEventLog implements XAccessibleEventListener { } protected static void logMessage(Object o, String s) { - XAccessibleContext xac = (XAccessibleContext) UnoRuntime.queryInterface(XAccessibleContext.class, o); + XAccessibleContext xac = UnoRuntime.queryInterface(XAccessibleContext.class, o); if( xac != null ) { String oid = UnoRuntime.generateOid(xac); synchronized (proxyList) { diff --git a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java index 10c4fb6b0a22..7b3527bd278a 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java @@ -38,7 +38,7 @@ public class XAccessibleTextLog private void setName( com.sun.star.accessibility.XAccessibleText xAccessibleText) { try { - com.sun.star.accessibility.XAccessibleContext unoAccessibleContext = (com.sun.star.accessibility.XAccessibleContext) com.sun.star.uno.UnoRuntime.queryInterface(com.sun.star.accessibility.XAccessibleContext.class, + com.sun.star.accessibility.XAccessibleContext unoAccessibleContext = com.sun.star.uno.UnoRuntime.queryInterface(com.sun.star.accessibility.XAccessibleContext.class, xAccessibleText); if (unoAccessibleContext != null) { |