diff options
author | Noel Grandin <noel@peralex.com> | 2013-04-17 14:59:35 +0200 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-04-19 07:52:08 +0000 |
commit | 8d87758d65e4a03271f76e354dfc84c1fcd5fe21 (patch) | |
tree | bc8f4f0df6981ad10fe1333db1a2b015ea079709 /scripting/workben/ifc | |
parent | d62425cc27e04a3237cfec2ea2663b8b11284ec8 (diff) |
Java cleanup, remove the rest of the unnecessary casts
Change-Id: Ia61d250f6b3711abc29569c5ece38a6f87e38daa
Reviewed-on: https://gerrit.libreoffice.org/3432
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'scripting/workben/ifc')
7 files changed, 36 insertions, 52 deletions
diff --git a/scripting/workben/ifc/scripting/ScriptingUtils.java b/scripting/workben/ifc/scripting/ScriptingUtils.java index 45ff3f96e10a..f10cf53f15b5 100644 --- a/scripting/workben/ifc/scripting/ScriptingUtils.java +++ b/scripting/workben/ifc/scripting/ScriptingUtils.java @@ -68,19 +68,17 @@ public class ScriptingUtils { if (storageManager == null) { try { - XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xProp = UnoRuntime.queryInterface( XPropertySet.class, xMSF); - XComponentContext xContext = (XComponentContext) - UnoRuntime.queryInterface(XComponentContext.class, - xProp.getPropertyValue("DefaultContext")); + XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, + xProp.getPropertyValue("DefaultContext")); XInterface ifc = (XInterface) xContext.getValueByName("/singletons/drafts.com.sun.star." + "script.framework.storage.theScriptStorageManager"); - storageManager = (XScriptStorageManager) - UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); + storageManager = UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); } catch( Exception e ) { return -1; @@ -103,8 +101,7 @@ public class ScriptingUtils { Object fa = xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - access = (XSimpleFileAccess) - UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); + access = UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); } catch (com.sun.star.uno.Exception e) { return null; diff --git a/scripting/workben/ifc/scripting/SecurityDialogUtil.java b/scripting/workben/ifc/scripting/SecurityDialogUtil.java index 0dec7c3339c0..bbd2ee33aa4d 100644 --- a/scripting/workben/ifc/scripting/SecurityDialogUtil.java +++ b/scripting/workben/ifc/scripting/SecurityDialogUtil.java @@ -95,10 +95,10 @@ public void run() XInterface x = (XInterface) xMSF.createInstance( "com.sun.star.awt.Toolkit") ; XExtendedToolkit tk = - (XExtendedToolkit)UnoRuntime.queryInterface( - XExtendedToolkit.class,x); + UnoRuntime.queryInterface( + XExtendedToolkit.class,x); AccessibilityTools at = new AccessibilityTools(); - XWindow xWindow = (XWindow)UnoRuntime.queryInterface( + XWindow xWindow = UnoRuntime.queryInterface( XWindow.class,tk.getActiveTopWindow()); XAccessible xRoot = at.getAccessibleObject(xWindow); xCon = xRoot.getAccessibleContext(); @@ -135,8 +135,8 @@ public void run() // want to do this action now // probably equates to toggle cb XAccessibleAction xAction = - (XAccessibleAction)UnoRuntime.queryInterface( - XAccessibleAction.class, xAcc.getAccessibleContext()); + UnoRuntime.queryInterface( + XAccessibleAction.class, xAcc.getAccessibleContext()); xAction.doAccessibleAction(0); // might be worth using oObj2 to double check the new state?? @@ -149,8 +149,8 @@ public void run() } // press button XAccessibleAction xAction = - (XAccessibleAction)UnoRuntime.queryInterface( - XAccessibleAction.class, oObj); + UnoRuntime.queryInterface( + XAccessibleAction.class, oObj); xAction.doAccessibleAction(0); } catch(com.sun.star.lang.IndexOutOfBoundsException e) { diff --git a/scripting/workben/ifc/scripting/_XScriptInfoAccess.java b/scripting/workben/ifc/scripting/_XScriptInfoAccess.java index f5ad117f0306..765936a72584 100644 --- a/scripting/workben/ifc/scripting/_XScriptInfoAccess.java +++ b/scripting/workben/ifc/scripting/_XScriptInfoAccess.java @@ -188,8 +188,7 @@ public class _XScriptInfoAccess extends MultiMethodTest { Object obj = ScriptingUtils.getDefault().getScriptStorage( (XMultiServiceFactory) tParam.getMSF(), location); - XScriptInfoAccess access = (XScriptInfoAccess) - UnoRuntime.queryInterface(XScriptInfoAccess.class, obj); + XScriptInfoAccess access = UnoRuntime.queryInterface(XScriptInfoAccess.class, obj); XScriptInfo[] impls = access.getAllImplementations(); diff --git a/scripting/workben/ifc/scripting/_XScriptInvocation.java b/scripting/workben/ifc/scripting/_XScriptInvocation.java index ec13d4d139db..a9b9b72c8255 100644 --- a/scripting/workben/ifc/scripting/_XScriptInvocation.java +++ b/scripting/workben/ifc/scripting/_XScriptInvocation.java @@ -151,19 +151,17 @@ public class _XScriptInvocation extends MultiMethodTest { if (storageManager == null) { try { - XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xProp = UnoRuntime.queryInterface( XPropertySet.class, tParam.getMSF()); - XComponentContext xContext = (XComponentContext) - UnoRuntime.queryInterface(XComponentContext.class, - xProp.getPropertyValue("DefaultContext")); + XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, + xProp.getPropertyValue("DefaultContext")); XInterface ifc = (XInterface) xContext.getValueByName("/singletons/drafts.com.sun.star." + "script.framework.storage.theScriptStorageManager"); - storageManager = (XScriptStorageManager) - UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); + storageManager = UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); } catch( Exception e ) { return -1; @@ -186,8 +184,7 @@ public class _XScriptInvocation extends MultiMethodTest { Object fa = ((XMultiServiceFactory) tParam.getMSF()).createInstance( "com.sun.star.ucb.SimpleFileAccess"); - access = (XSimpleFileAccess) - UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); + access = UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); } catch (com.sun.star.uno.Exception e) { return null; @@ -203,7 +200,7 @@ public class _XScriptInvocation extends MultiMethodTest { try { Object obj = factory.loadDocument(fullname); - model = (XModel) UnoRuntime.queryInterface(XModel.class, obj); + model = UnoRuntime.queryInterface(XModel.class, obj); } catch (com.sun.star.lang.IllegalArgumentException iae) { return null; diff --git a/scripting/workben/ifc/scripting/_XScriptNameResolver.java b/scripting/workben/ifc/scripting/_XScriptNameResolver.java index 0a77a3f74608..95601ca95666 100644 --- a/scripting/workben/ifc/scripting/_XScriptNameResolver.java +++ b/scripting/workben/ifc/scripting/_XScriptNameResolver.java @@ -131,19 +131,17 @@ public class _XScriptNameResolver extends MultiMethodTest { if (storageManager == null) { try { - XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xProp = UnoRuntime.queryInterface( XPropertySet.class, tParam.getMSF()); - XComponentContext xContext = (XComponentContext) - UnoRuntime.queryInterface(XComponentContext.class, - xProp.getPropertyValue("DefaultContext")); + XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, + xProp.getPropertyValue("DefaultContext")); XInterface ifc = (XInterface) xContext.getValueByName("/singletons/drafts.com.sun.star." + "script.framework.storage.theScriptStorageManager"); - storageManager = (XScriptStorageManager) - UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); + storageManager = UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); } catch( Exception e ) { return -1; @@ -166,8 +164,7 @@ public class _XScriptNameResolver extends MultiMethodTest { Object fa = ((XMultiServiceFactory) tParam.getMSF()).createInstance( "com.sun.star.ucb.SimpleFileAccess"); - access = (XSimpleFileAccess) - UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); + access = UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); } catch (com.sun.star.uno.Exception e) { return null; diff --git a/scripting/workben/ifc/scripting/_XScriptSecurity.java b/scripting/workben/ifc/scripting/_XScriptSecurity.java index 69bb8f1ddf9a..de4ca0b693cf 100644 --- a/scripting/workben/ifc/scripting/_XScriptSecurity.java +++ b/scripting/workben/ifc/scripting/_XScriptSecurity.java @@ -203,8 +203,7 @@ public class _XScriptSecurity extends MultiMethodTest { Object oProv = ((XMultiServiceFactory) tParam.getMSF()).createInstance( "com.sun.star.configuration.ConfigurationProvider" ); - XMultiServiceFactory xProv = (XMultiServiceFactory) - UnoRuntime.queryInterface(XMultiServiceFactory.class, oProv); + XMultiServiceFactory xProv = UnoRuntime.queryInterface(XMultiServiceFactory.class, oProv); //the path to the security settings in the registry PropertyValue aPathArg = new PropertyValue(); @@ -221,7 +220,7 @@ public class _XScriptSecurity extends MultiMethodTest { Object oConfigUpdate = xProv.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aArgs ); - XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, oConfigUpdate ); String[] paths = (String[])xPropertySet.getPropertyValue("SecureURL"); @@ -245,8 +244,7 @@ public class _XScriptSecurity extends MultiMethodTest { Object oProv = ((XMultiServiceFactory) tParam.getMSF()).createInstance( "com.sun.star.configuration.ConfigurationProvider" ); - XMultiServiceFactory xProv = (XMultiServiceFactory) - UnoRuntime.queryInterface(XMultiServiceFactory.class, oProv); + XMultiServiceFactory xProv = UnoRuntime.queryInterface(XMultiServiceFactory.class, oProv); //the path to the security settings in the registry PropertyValue aPathArg = new PropertyValue(); @@ -263,9 +261,9 @@ public class _XScriptSecurity extends MultiMethodTest { Object oConfigUpdate = xProv.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", aArgs ); - XNameReplace xNameReplace = (XNameReplace)UnoRuntime.queryInterface( + XNameReplace xNameReplace = UnoRuntime.queryInterface( XNameReplace.class, oConfigUpdate ); - XChangesBatch xChangesBatch = (XChangesBatch)UnoRuntime.queryInterface( + XChangesBatch xChangesBatch = UnoRuntime.queryInterface( XChangesBatch.class, oConfigUpdate ); Object[] aSecureURLs; @@ -323,19 +321,17 @@ public class _XScriptSecurity extends MultiMethodTest { if (storageManager == null) { try { - XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xProp = UnoRuntime.queryInterface( XPropertySet.class, tParam.getMSF()); - XComponentContext xContext = (XComponentContext) - UnoRuntime.queryInterface(XComponentContext.class, - xProp.getPropertyValue("DefaultContext")); + XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, + xProp.getPropertyValue("DefaultContext")); XInterface ifc = (XInterface) xContext.getValueByName("/singletons/drafts.com.sun.star." + "script.framework.storage.theScriptStorageManager"); - storageManager = (XScriptStorageManager) - UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); + storageManager = UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); } catch( Exception e ) { return -1; @@ -358,8 +354,7 @@ public class _XScriptSecurity extends MultiMethodTest { Object fa = ((XMultiServiceFactory)tParam.getMSF()).createInstance( "com.sun.star.ucb.SimpleFileAccess"); - access = (XSimpleFileAccess) - UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); + access = UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); } catch (com.sun.star.uno.Exception e) { return null; @@ -375,7 +370,7 @@ public class _XScriptSecurity extends MultiMethodTest { try { Object obj = factory.loadDocument(fullname); - model = (XModel) UnoRuntime.queryInterface(XModel.class, obj); + model = UnoRuntime.queryInterface(XModel.class, obj); } catch (com.sun.star.lang.IllegalArgumentException iae) { return null; diff --git a/scripting/workben/ifc/scripting/_XScriptStorageManager.java b/scripting/workben/ifc/scripting/_XScriptStorageManager.java index 81c82fabed70..ea2b483010bd 100644 --- a/scripting/workben/ifc/scripting/_XScriptStorageManager.java +++ b/scripting/workben/ifc/scripting/_XScriptStorageManager.java @@ -244,8 +244,7 @@ public class _XScriptStorageManager extends MultiMethodTest { Object fa = ((XMultiServiceFactory) tParam.getMSF()).createInstance( "com.sun.star.ucb.SimpleFileAccess"); - access = (XSimpleFileAccess) - UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); + access = UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); } catch (com.sun.star.uno.Exception e) { return null; |