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 /scripting | |
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 'scripting')
22 files changed, 144 insertions, 173 deletions
diff --git a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java index 7337a71ae33b..238d35f36625 100644 --- a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java +++ b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java @@ -236,7 +236,7 @@ XInitialization { // create the dialog model and set the properties Object dialogModel = xMultiComponentFactory.createInstanceWithContext( "com.sun.star.awt.UnoControlDialogModel", _xComponentContext ); - XPropertySet xPSetDialog = ( XPropertySet )UnoRuntime.queryInterface( + XPropertySet xPSetDialog = UnoRuntime.queryInterface( XPropertySet.class, dialogModel ); xPSetDialog.setPropertyValue( "PositionX", new Integer( dialogX) ); xPSetDialog.setPropertyValue( "PositionY", new Integer( dialogY)); @@ -245,13 +245,13 @@ XInitialization { xPSetDialog.setPropertyValue( "Title", _title ); // get the service manager from the dialog model - XMultiServiceFactory xMultiServiceFactory = ( XMultiServiceFactory )UnoRuntime.queryInterface( + XMultiServiceFactory xMultiServiceFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class, dialogModel ); // create the Run Macro button model and set the properties Object runButtonModel = xMultiServiceFactory.createInstance( "com.sun.star.awt.UnoControlButtonModel" ); - XPropertySet xPSetButton = ( XPropertySet )UnoRuntime.queryInterface( + XPropertySet xPSetButton = UnoRuntime.queryInterface( XPropertySet.class, runButtonModel ); LogUtils.DEBUG("run: x="+(((dialogW+cbIncrW)/2)-runButtonW -1) ); LogUtils.DEBUG("run: y="+(dialogH+cbIncrH-runButtonH-1)); @@ -266,7 +266,7 @@ XInitialization { // create the Dont Run Macro button model and set the properties Object doNotRunButtonModel = xMultiServiceFactory.createInstance( "com.sun.star.awt.UnoControlButtonModel" ); - xPSetButton = ( XPropertySet )UnoRuntime.queryInterface( + xPSetButton = UnoRuntime.queryInterface( XPropertySet.class, doNotRunButtonModel ); LogUtils.DEBUG("dontrun: x="+(((dialogW+cbIncrW)/2)-1) ); LogUtils.DEBUG("dontrun: y="+(dialogH+cbIncrH-doNotRunButtonH-1 )); @@ -279,7 +279,7 @@ XInitialization { xPSetButton.setPropertyValue( "Label", _doNotRunMacro ); // insert the control models into the dialog model - XNameContainer xNameCont = ( XNameContainer )UnoRuntime.queryInterface( + XNameContainer xNameCont = UnoRuntime.queryInterface( XNameContainer.class, dialogModel ); xNameCont.insertByName( _runButtonName, runButtonModel ); xNameCont.insertByName( _doNotRunButtonName, doNotRunButtonModel ); @@ -290,7 +290,7 @@ XInitialization { // create the label model and set the properties Object label2Model = xMultiServiceFactory.createInstance( "com.sun.star.awt.UnoControlFixedTextModel" ); - XPropertySet xPSetLabel = ( XPropertySet )UnoRuntime.queryInterface( + XPropertySet xPSetLabel = UnoRuntime.queryInterface( XPropertySet.class, label2Model ); xPSetLabel.setPropertyValue( "PositionX", new Integer( label2X )); xPSetLabel.setPropertyValue( "PositionY", new Integer( label2Y )); @@ -303,7 +303,7 @@ XInitialization { // create the label model and set the properties Object label3Model = xMultiServiceFactory.createInstance( "com.sun.star.awt.UnoControlFixedTextModel" ); - XPropertySet xPSetLabel3 = ( XPropertySet )UnoRuntime.queryInterface( + XPropertySet xPSetLabel3 = UnoRuntime.queryInterface( XPropertySet.class, label3Model ); xPSetLabel3.setPropertyValue( "PositionX", new Integer( label3X )); xPSetLabel3.setPropertyValue( "PositionY", new Integer( label3Y )); @@ -316,7 +316,7 @@ XInitialization { // create the label model and set the properties Object label4Model = xMultiServiceFactory.createInstance( "com.sun.star.awt.UnoControlFixedTextModel" ); - XPropertySet xPSetLabel4 = ( XPropertySet )UnoRuntime.queryInterface( + XPropertySet xPSetLabel4 = UnoRuntime.queryInterface( XPropertySet.class, label4Model ); xPSetLabel4.setPropertyValue( "PositionX", new Integer( label4X )); xPSetLabel4.setPropertyValue( "PositionY", new Integer( label4Y )); @@ -329,7 +329,7 @@ XInitialization { // create the checkbox model and set the properties Object checkBoxModel = xMultiServiceFactory.createInstance( "com.sun.star.awt.UnoControlCheckBoxModel" ); - XPropertySet xPSetCheckBox = ( XPropertySet )UnoRuntime.queryInterface( + XPropertySet xPSetCheckBox = UnoRuntime.queryInterface( XPropertySet.class, checkBoxModel ); xPSetCheckBox.setPropertyValue( "PositionX", new Integer( checkBoxX )); xPSetCheckBox.setPropertyValue( "PositionY", new Integer( checkBoxY )); @@ -351,7 +351,7 @@ XInitialization { // create the label model and set the properties Object label5Model = xMultiServiceFactory.createInstance( "com.sun.star.awt.UnoControlFixedTextModel" ); - XPropertySet xPSetLabel5 = ( XPropertySet )UnoRuntime.queryInterface( + XPropertySet xPSetLabel5 = UnoRuntime.queryInterface( XPropertySet.class, label5Model ); xPSetLabel5.setPropertyValue( "PositionX", new Integer( label5X )); xPSetLabel5.setPropertyValue( "PositionY", new Integer( label5Y )); @@ -368,7 +368,7 @@ XInitialization { // create the label model and set the properties Object labelModel = xMultiServiceFactory.createInstance( "com.sun.star.awt.UnoControlFixedTextModel" ); - XPropertySet xPSetLabel = ( XPropertySet )UnoRuntime.queryInterface( + XPropertySet xPSetLabel = UnoRuntime.queryInterface( XPropertySet.class, labelModel ); xPSetLabel.setPropertyValue( "PositionX", new Integer( label1X )); xPSetLabel.setPropertyValue( "PositionY", new Integer( label1Y )); @@ -385,25 +385,25 @@ XInitialization { // create the dialog control and set the model Object dialog = xMultiComponentFactory.createInstanceWithContext( "com.sun.star.awt.UnoControlDialog", _xComponentContext ); - XControl xControl = ( XControl )UnoRuntime.queryInterface( + XControl xControl = UnoRuntime.queryInterface( XControl.class, dialog ); - XControlModel xControlModel = ( XControlModel )UnoRuntime.queryInterface( + XControlModel xControlModel = UnoRuntime.queryInterface( XControlModel.class, dialogModel ); xControl.setModel( xControlModel ); // add an action listener to the button control - XControlContainer xControlCont = ( XControlContainer )UnoRuntime.queryInterface( + XControlContainer xControlCont = UnoRuntime.queryInterface( XControlContainer.class, dialog ); // Add to yes button Object objectButton = xControlCont.getControl( _runButtonName ); - XButton xButton = ( XButton )UnoRuntime.queryInterface( + XButton xButton = UnoRuntime.queryInterface( XButton.class, objectButton ); xButton.addActionListener( new ActionListenerImpl( xControlCont, _runButtonName ) ); // add to no button objectButton = xControlCont.getControl( _doNotRunButtonName ); - xButton = ( XButton )UnoRuntime.queryInterface( + xButton = UnoRuntime.queryInterface( XButton.class, objectButton ); xButton.addActionListener( new ActionListenerImpl( xControlCont, _doNotRunButtonName ) ); @@ -411,23 +411,23 @@ XInitialization { { // add to checkbox Object objectCheckBox = xControlCont.getControl( _checkBoxName ); - XCheckBox xCheckBox = ( XCheckBox )UnoRuntime.queryInterface( + XCheckBox xCheckBox = UnoRuntime.queryInterface( XCheckBox.class, objectCheckBox ); - xCheckBox.addItemListener((XItemListener) new ItemListenerImpl( xControlCont ) ); + xCheckBox.addItemListener(new ItemListenerImpl( xControlCont ) ); } // create a peer Object toolkit = xMultiComponentFactory.createInstanceWithContext( "com.sun.star.awt.ExtToolkit", _xComponentContext ); - XToolkit xToolkit = ( XToolkit )UnoRuntime.queryInterface( + XToolkit xToolkit = UnoRuntime.queryInterface( XToolkit.class, toolkit ); - XWindow xWindow = ( XWindow )UnoRuntime.queryInterface( + XWindow xWindow = UnoRuntime.queryInterface( XWindow.class, xControl ); xWindow.setVisible( false ); xControl.createPeer( xToolkit, null ); // return the dialog - XDialog xDialog = ( XDialog )UnoRuntime.queryInterface( + XDialog xDialog = UnoRuntime.queryInterface( XDialog.class, dialog ); return xDialog; } @@ -468,14 +468,14 @@ XInitialization { public void dispose () { - XComponent xComponent = ( XComponent )UnoRuntime.queryInterface( + XComponent xComponent = UnoRuntime.queryInterface( XComponent.class, _xDialog ); xComponent.dispose(); } public void addEventListener ( com.sun.star.lang.XEventListener xListener ) { - XComponent xComponent = ( XComponent )UnoRuntime.queryInterface( + XComponent xComponent = UnoRuntime.queryInterface( XComponent.class, _xDialog ); xComponent.addEventListener( xListener ); } @@ -483,7 +483,7 @@ XInitialization { public void removeEventListener ( com.sun.star.lang.XEventListener aListener ) { - XComponent xComponent = ( XComponent )UnoRuntime.queryInterface( + XComponent xComponent = UnoRuntime.queryInterface( XComponent.class, _xDialog ); xComponent.removeEventListener( aListener ); } @@ -514,7 +514,7 @@ XInitialization { private XCheckBox _xCheckBox; public ItemListenerImpl( XControlContainer xControlCont ) { Object objectCheckBox = xControlCont.getControl( _checkBoxName ); - _xCheckBox = ( XCheckBox )UnoRuntime.queryInterface( + _xCheckBox = UnoRuntime.queryInterface( XCheckBox.class, objectCheckBox ); } diff --git a/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java b/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java index 1481056d8bfb..68cf617a5179 100644 --- a/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java +++ b/scripting/java/com/sun/star/script/framework/browse/DialogFactory.java @@ -80,14 +80,13 @@ public class DialogFactory } // add an action listener to the button controls - XControlContainer controls = (XControlContainer) - UnoRuntime.queryInterface(XControlContainer.class, xDialog); + XControlContainer controls = UnoRuntime.queryInterface(XControlContainer.class, xDialog); - XButton okButton = (XButton) UnoRuntime.queryInterface( + XButton okButton = UnoRuntime.queryInterface( XButton.class, controls.getControl("Ok")); okButton.setActionCommand("Ok"); - XButton cancelButton = (XButton) UnoRuntime.queryInterface( + XButton cancelButton = UnoRuntime.queryInterface( XButton.class, controls.getControl("Cancel")); cancelButton.setActionCommand("Cancel"); @@ -137,20 +136,18 @@ public class DialogFactory } // add an action listener to the button controls - XControlContainer controls = (XControlContainer) - UnoRuntime.queryInterface(XControlContainer.class, xDialog); + XControlContainer controls = UnoRuntime.queryInterface(XControlContainer.class, xDialog); - XButton okButton = (XButton) UnoRuntime.queryInterface( + XButton okButton = UnoRuntime.queryInterface( XButton.class, controls.getControl("Ok")); okButton.setActionCommand("Ok"); - XButton cancelButton = (XButton) UnoRuntime.queryInterface( + XButton cancelButton = UnoRuntime.queryInterface( XButton.class, controls.getControl("Cancel")); cancelButton.setActionCommand("Cancel"); - final XTextComponent textField = (XTextComponent) - UnoRuntime.queryInterface( - XTextComponent.class, controls.getControl("NameField")); + final XTextComponent textField = UnoRuntime.queryInterface( + XTextComponent.class, controls.getControl("NameField")); final ResultHolder resultHolder = new ResultHolder(); @@ -204,7 +201,7 @@ public class DialogFactory Object dialogModel = xMultiComponentFactory.createInstanceWithContext( "com.sun.star.awt.UnoControlDialogModel", xComponentContext); - XPropertySet props = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet props = UnoRuntime.queryInterface( XPropertySet.class, dialogModel); props.setPropertyValue("Title", title); @@ -212,8 +209,8 @@ public class DialogFactory // get the service manager from the dialog model XMultiServiceFactory xMultiServiceFactory = - (XMultiServiceFactory) UnoRuntime.queryInterface( - XMultiServiceFactory.class, dialogModel); + UnoRuntime.queryInterface( + XMultiServiceFactory.class, dialogModel); // create the label model and set the properties Object label = xMultiServiceFactory.createInstance( @@ -221,7 +218,7 @@ public class DialogFactory setDimensions(label, 15, 5, 134, 12); - XPropertySet labelProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet labelProps = UnoRuntime.queryInterface( XPropertySet.class, label); labelProps.setPropertyValue("Name", "PromptLabel"); labelProps.setPropertyValue("Label", prompt); @@ -232,7 +229,7 @@ public class DialogFactory setDimensions(okButtonModel, 40, 18, 38, 15); - XPropertySet buttonProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet buttonProps = UnoRuntime.queryInterface( XPropertySet.class, okButtonModel); buttonProps.setPropertyValue("Name", "Ok"); buttonProps.setPropertyValue("Label", "Ok"); @@ -243,13 +240,13 @@ public class DialogFactory setDimensions(cancelButtonModel, 83, 18, 38, 15); - buttonProps = (XPropertySet) UnoRuntime.queryInterface( + buttonProps = UnoRuntime.queryInterface( XPropertySet.class, cancelButtonModel); buttonProps.setPropertyValue("Name", "Cancel"); buttonProps.setPropertyValue("Label", "Cancel"); // insert the control models into the dialog model - XNameContainer xNameCont = (XNameContainer) UnoRuntime.queryInterface( + XNameContainer xNameCont = UnoRuntime.queryInterface( XNameContainer.class, dialogModel); xNameCont.insertByName("PromptLabel", label); @@ -259,31 +256,29 @@ public class DialogFactory // create the dialog control and set the model Object dialog = xMultiComponentFactory.createInstanceWithContext( "com.sun.star.awt.UnoControlDialog", xComponentContext); - XControl xControl = (XControl) UnoRuntime.queryInterface( + XControl xControl = UnoRuntime.queryInterface( XControl.class, dialog); - XControlModel xControlModel = (XControlModel) - UnoRuntime.queryInterface(XControlModel.class, dialogModel); + XControlModel xControlModel = UnoRuntime.queryInterface(XControlModel.class, dialogModel); xControl.setModel(xControlModel); // create a peer Object toolkit = xMultiComponentFactory.createInstanceWithContext( "com.sun.star.awt.ExtToolkit", xComponentContext); - XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface( + XToolkit xToolkit = UnoRuntime.queryInterface( XToolkit.class, toolkit); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface( + XWindow xWindow = UnoRuntime.queryInterface( XWindow.class, xControl); xWindow.setVisible(false); xControl.createPeer(xToolkit, null); - return (XDialog) UnoRuntime.queryInterface(XDialog.class, dialog); + return UnoRuntime.queryInterface(XDialog.class, dialog); } private void setDimensions(Object o, int x, int y, int width, int height) throws com.sun.star.uno.Exception { - XPropertySet props = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class, o); + XPropertySet props = UnoRuntime.queryInterface(XPropertySet.class, o); props.setPropertyValue("PositionX", new Integer(x)); props.setPropertyValue("PositionY", new Integer(y)); @@ -314,14 +309,14 @@ public class DialogFactory setDimensions(dialogModel, 100, 100, 157, 58); - XPropertySet props = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet props = UnoRuntime.queryInterface( XPropertySet.class, dialogModel); props.setPropertyValue("Title", title); // get the service manager from the dialog model XMultiServiceFactory xMultiServiceFactory = - (XMultiServiceFactory) UnoRuntime.queryInterface( - XMultiServiceFactory.class, dialogModel); + UnoRuntime.queryInterface( + XMultiServiceFactory.class, dialogModel); // create the label model and set the properties Object label = xMultiServiceFactory.createInstance( @@ -329,7 +324,7 @@ public class DialogFactory setDimensions(label, 15, 5, 134, 12); - XPropertySet labelProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet labelProps = UnoRuntime.queryInterface( XPropertySet.class, label); labelProps.setPropertyValue("Name", "PromptLabel"); labelProps.setPropertyValue("Label", prompt); @@ -340,7 +335,7 @@ public class DialogFactory setDimensions(edit, 15, 18, 134, 12); - XPropertySet editProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet editProps = UnoRuntime.queryInterface( XPropertySet.class, edit); editProps.setPropertyValue("Name", "NameField"); @@ -350,7 +345,7 @@ public class DialogFactory setDimensions(okButtonModel, 40, 39, 38, 15); - XPropertySet buttonProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet buttonProps = UnoRuntime.queryInterface( XPropertySet.class, okButtonModel); buttonProps.setPropertyValue("Name", "Ok"); buttonProps.setPropertyValue("Label", "Ok"); @@ -361,14 +356,13 @@ public class DialogFactory setDimensions(cancelButtonModel, 83, 39, 38, 15); - buttonProps = (XPropertySet) UnoRuntime.queryInterface( + buttonProps = UnoRuntime.queryInterface( XPropertySet.class, cancelButtonModel); buttonProps.setPropertyValue("Name", "Cancel"); buttonProps.setPropertyValue("Label", "Cancel"); // insert the control models into the dialog model - XNameContainer xNameCont = (XNameContainer) - UnoRuntime.queryInterface(XNameContainer.class, dialogModel); + XNameContainer xNameCont = UnoRuntime.queryInterface(XNameContainer.class, dialogModel); xNameCont.insertByName("PromptLabel", label); xNameCont.insertByName("NameField", edit); @@ -378,24 +372,23 @@ public class DialogFactory // create the dialog control and set the model Object dialog = xMultiComponentFactory.createInstanceWithContext( "com.sun.star.awt.UnoControlDialog", xComponentContext); - XControl xControl = (XControl) UnoRuntime.queryInterface( + XControl xControl = UnoRuntime.queryInterface( XControl.class, dialog); - XControlModel xControlModel = (XControlModel) - UnoRuntime.queryInterface(XControlModel.class, dialogModel); + XControlModel xControlModel = UnoRuntime.queryInterface(XControlModel.class, dialogModel); xControl.setModel(xControlModel); // create a peer Object toolkit = xMultiComponentFactory.createInstanceWithContext( "com.sun.star.awt.ExtToolkit", xComponentContext); - XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface( + XToolkit xToolkit = UnoRuntime.queryInterface( XToolkit.class, toolkit); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface( + XWindow xWindow = UnoRuntime.queryInterface( XWindow.class, xControl); xWindow.setVisible(false); xControl.createPeer(xToolkit, null); - return (XDialog) UnoRuntime.queryInterface(XDialog.class, dialog); + return UnoRuntime.queryInterface(XDialog.class, dialog); } private static class ResultHolder { diff --git a/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java b/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java index cb87c0b24731..ceed8b6d4b24 100644 --- a/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java +++ b/scripting/java/com/sun/star/script/framework/browse/ParcelBrowseNode.java @@ -99,11 +99,10 @@ public class ParcelBrowseNode extends PropertySet XMultiComponentFactory xFac = xCtx.getServiceManager(); try { - XSimpleFileAccess xSFA = ( XSimpleFileAccess) - UnoRuntime.queryInterface( XSimpleFileAccess.class, - xFac.createInstanceWithContext( - "com.sun.star.ucb.SimpleFileAccess", - xCtx ) ); + XSimpleFileAccess xSFA = UnoRuntime.queryInterface( XSimpleFileAccess.class, + xFac.createInstanceWithContext( + "com.sun.star.ucb.SimpleFileAccess", + xCtx ) ); if ( xSFA != null && ( xSFA.isReadOnly( parcelDirUrl ) || container.isUnoPkg() ) ) { @@ -221,7 +220,7 @@ public class ParcelBrowseNode extends PropertySet } } else { - newName = (String) AnyConverter.toString(aParams[0]); + newName = AnyConverter.toString(aParams[0]); } if ( newName == null || newName.equals("")) @@ -234,7 +233,7 @@ public class ParcelBrowseNode extends PropertySet String languageName = newName + "." + provider.getScriptEditor().getExtension(); String language = container.getLanguage(); - ScriptEntry entry = new ScriptEntry( language, languageName, languageName, "", new HashMap() ); + ScriptEntry entry = new ScriptEntry( language, languageName, languageName, "", new HashMap<String,String>() ); Parcel parcel = (Parcel)container.getByName( getName() ); ScriptMetaData data = new ScriptMetaData( parcel, entry, source ); @@ -311,7 +310,7 @@ public class ParcelBrowseNode extends PropertySet } } else { - newName = (String) AnyConverter.toString(aParams[0]); + newName = AnyConverter.toString(aParams[0]); } container.renameParcel( getName(), newName ); Parcel p = (Parcel)container.getByName( newName ); diff --git a/scripting/java/com/sun/star/script/framework/browse/ProviderBrowseNode.java b/scripting/java/com/sun/star/script/framework/browse/ProviderBrowseNode.java index 881496dd7b0c..63a2d8d0ddc4 100644 --- a/scripting/java/com/sun/star/script/framework/browse/ProviderBrowseNode.java +++ b/scripting/java/com/sun/star/script/framework/browse/ProviderBrowseNode.java @@ -74,11 +74,10 @@ public class ProviderBrowseNode extends PropertySet XMultiComponentFactory xFac = m_xCtx.getServiceManager(); try { - xSFA = ( XSimpleFileAccess) - UnoRuntime.queryInterface( XSimpleFileAccess.class, - xFac.createInstanceWithContext( - "com.sun.star.ucb.SimpleFileAccess", - xCtx ) ); + xSFA = UnoRuntime.queryInterface( XSimpleFileAccess.class, + xFac.createInstanceWithContext( + "com.sun.star.ucb.SimpleFileAccess", + xCtx ) ); if ( container.isUnoPkg() || xSFA.isReadOnly( container.getParcelContainerDir() ) ) { deletable = false; @@ -209,7 +208,7 @@ public class ProviderBrowseNode extends PropertySet } } else { - name = (String) AnyConverter.toString(aParams[0]); + name = AnyConverter.toString(aParams[0]); } if (name == null || name.equals("")) diff --git a/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java b/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java index 8462dc57d4c8..6760133595a6 100644 --- a/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java +++ b/scripting/java/com/sun/star/script/framework/browse/ScriptBrowseNode.java @@ -71,11 +71,10 @@ public class ScriptBrowseNode extends PropertySet try { data = (ScriptMetaData)parent.getByName( name ); - xSFA = ( XSimpleFileAccess) - UnoRuntime.queryInterface( XSimpleFileAccess.class, - xFac.createInstanceWithContext( - "com.sun.star.ucb.SimpleFileAccess", - xCtx ) ); + xSFA = UnoRuntime.queryInterface( XSimpleFileAccess.class, + xFac.createInstanceWithContext( + "com.sun.star.ucb.SimpleFileAccess", + xCtx ) ); } // TODO fix exception types to be caught here, should we rethrow? @@ -250,7 +249,7 @@ public class ScriptBrowseNode extends PropertySet try { - String newName = (String) AnyConverter.toString(aParams[0]); + String newName = AnyConverter.toString(aParams[0]); ScriptMetaData oldData = (ScriptMetaData)parent.getByName( name ); oldData.loadSource(); String oldSource = oldData.getSource(); @@ -261,7 +260,7 @@ public class ScriptBrowseNode extends PropertySet String language = provider.getName(); ScriptEntry entry = new ScriptEntry( - language, languageName, languageName, "", new HashMap() ); + language, languageName, languageName, "", new HashMap<String,String>() ); ScriptMetaData data = new ScriptMetaData( parent, entry, oldSource ); diff --git a/scripting/java/com/sun/star/script/framework/container/Parcel.java b/scripting/java/com/sun/star/script/framework/container/Parcel.java index 5a07f8438c99..4fbc1623b27d 100644 --- a/scripting/java/com/sun/star/script/framework/container/Parcel.java +++ b/scripting/java/com/sun/star/script/framework/container/Parcel.java @@ -218,8 +218,7 @@ public class Parcel implements XNameContainer String pathToDescriptor = PathUtils.make_url( getPathToParcel(), ParcelDescriptor.PARCEL_DESCRIPTOR_NAME ); - XSimpleFileAccess2 xSFA2 = ( XSimpleFileAccess2 ) - UnoRuntime.queryInterface( XSimpleFileAccess2.class, m_xSFA ); + XSimpleFileAccess2 xSFA2 = UnoRuntime.queryInterface( XSimpleFileAccess2.class, m_xSFA ); if ( xSFA2 != null ) { diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java b/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java index 367186ee44a2..be9af1c16a03 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelContainer.java @@ -290,7 +290,7 @@ public class ParcelContainer implements XNameAccess } try { - m_xSFA = ( XSimpleFileAccess )UnoRuntime.queryInterface( + m_xSFA = UnoRuntime.queryInterface( XSimpleFileAccess.class, m_xCtx.getServiceManager().createInstanceWithContext( "com.sun.star.ucb.SimpleFileAccess", m_xCtx ) ); @@ -454,8 +454,7 @@ public class ParcelContainer implements XNameAccess ParcelDescriptor pd = new ParcelDescriptor(); pd.setLanguage( language ); String parcelDesc = PathUtils.make_url( pathToParcel, ParcelDescriptor.PARCEL_DESCRIPTOR_NAME ); - XSimpleFileAccess2 xSFA2 = ( XSimpleFileAccess2 ) - UnoRuntime.queryInterface( XSimpleFileAccess2.class, m_xSFA ); + XSimpleFileAccess2 xSFA2 = UnoRuntime.queryInterface( XSimpleFileAccess2.class, m_xSFA ); if ( xSFA2 != null ) { LogUtils.DEBUG("createParcel() Using XSIMPLEFILEACCESS2 " + parcelDesc ); @@ -667,10 +666,9 @@ public ParsedScriptUri parseScriptUri( String scriptURI ) throws com.sun.star.l try { xMcFac = m_xCtx.getServiceManager(); - xFac = ( XUriReferenceFactory ) - UnoRuntime.queryInterface( XUriReferenceFactory.class, - xMcFac.createInstanceWithContext( - "com.sun.star.uri.UriReferenceFactory", m_xCtx ) ); + xFac = UnoRuntime.queryInterface( XUriReferenceFactory.class, + xMcFac.createInstanceWithContext( + "com.sun.star.uri.UriReferenceFactory", m_xCtx ) ); } catch( com.sun.star.uno.Exception e ) { @@ -684,8 +682,7 @@ public ParsedScriptUri parseScriptUri( String scriptURI ) throws com.sun.star.l } XUriReference uriRef = xFac.parse( scriptURI ); - XVndSunStarScriptUrl sfUri = ( XVndSunStarScriptUrl ) - UnoRuntime.queryInterface( XVndSunStarScriptUrl.class, uriRef ); + XVndSunStarScriptUrl sfUri = UnoRuntime.queryInterface( XVndSunStarScriptUrl.class, uriRef ); if ( sfUri == null ) { diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java index 55c5c2fdd3a1..20ac568827eb 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java @@ -294,10 +294,10 @@ public class ParcelDescriptor { addScriptEntry(scripts[i]); } - public void setScriptEntries(Enumeration scripts) { + public void setScriptEntries(Enumeration<ScriptEntry> scripts) { clearEntries(); while (scripts.hasMoreElements()) - addScriptEntry((ScriptEntry) scripts.nextElement()); + addScriptEntry(scripts.nextElement()); } public String getLanguageProperty(String name) { @@ -427,7 +427,7 @@ public class ParcelDescriptor { Iterator<String> iter = languagedepprops.keySet().iterator(); while (iter.hasNext()) { tempitem = document.createElement("prop"); - key = (String)iter.next(); + key = iter.next(); tempitem.setAttribute("name", key); tempitem.setAttribute("value", languagedepprops.get(key)); item.appendChild(tempitem); diff --git a/scripting/java/com/sun/star/script/framework/container/ScriptEntry.java b/scripting/java/com/sun/star/script/framework/container/ScriptEntry.java index 3cc2080bd611..a5eadbe74898 100644 --- a/scripting/java/com/sun/star/script/framework/container/ScriptEntry.java +++ b/scripting/java/com/sun/star/script/framework/container/ScriptEntry.java @@ -27,7 +27,7 @@ public class ScriptEntry implements Cloneable { private String logicalname = ""; private String description = ""; - private Map languagedepprops; + private Map<String,String> languagedepprops; public ScriptEntry(String language, String languagename, String logicalname, String location) { @@ -39,7 +39,7 @@ public class ScriptEntry implements Cloneable { // as logical name also this.logicalname = languagename; this.location = location; - this.languagedepprops = new HashMap(); + this.languagedepprops = new HashMap<String,String>(); } public ScriptEntry(ScriptEntry entry) @@ -53,14 +53,14 @@ public class ScriptEntry implements Cloneable { } public ScriptEntry(String language, String languagename, - String logicalname, String location, Map languagedepprops) { + String logicalname, String location, Map<String,String> languagedepprops) { this( language, languagename, logicalname, location ); this.languagedepprops = languagedepprops; } public ScriptEntry(String language, String languagename, String logicalname, String location, - Map languagedepprops, String description) { + Map<String,String> languagedepprops, String description) { this( language, languagename, logicalname, location ); this.languagedepprops = languagedepprops; this.description = description; @@ -84,7 +84,7 @@ public class ScriptEntry implements Cloneable { return false; } - public Map getLanguageProperties() + public Map<String,String> getLanguageProperties() { return languagedepprops; } diff --git a/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java b/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java index e0051aeaf87c..f39e8b92f6e8 100644 --- a/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java +++ b/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java @@ -249,8 +249,7 @@ public class ScriptMetaData extends ScriptEntry implements Cloneable { { try { - String classpath = (String)getLanguageProperties().get("classpath"); - ArrayList paths = null; + String classpath = getLanguageProperties().get("classpath"); if ( classpath == null ) { @@ -271,7 +270,7 @@ public class ScriptMetaData extends ScriptEntry implements Cloneable { StringTokenizer stk = new StringTokenizer(classpath, ":"); while ( stk.hasMoreElements() ) { - String relativeClasspath = (String)stk.nextElement(); + String relativeClasspath = stk.nextToken(); String pathToProcess = PathUtils.make_url( parcelPath, relativeClasspath); URL url = expandURL( context, pathToProcess ); if ( url != null ) @@ -388,9 +387,8 @@ public class ScriptMetaData extends ScriptEntry implements Cloneable { OutputStream os = null; try { - XSimpleFileAccess2 xSFA2 = ( XSimpleFileAccess2 ) - UnoRuntime.queryInterface( XSimpleFileAccess2.class, - parent.m_xSFA ); + XSimpleFileAccess2 xSFA2 = UnoRuntime.queryInterface( XSimpleFileAccess2.class, + parent.m_xSFA ); if ( xSFA2 != null ) { ByteArrayInputStream bis = new ByteArrayInputStream( getSourceBytes() ); diff --git a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java index b4389eec9b0d..1e157bd71f69 100644 --- a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java +++ b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java @@ -275,7 +275,7 @@ public class UnoPkgContainer extends ParcelContainer // String path = containerUrl.substring( 0, containerUrl.lastIndexOf("/") ); String packagesUrl = PathUtils.make_url( extensionDb, "/Scripts/" + extensionRepository + "-extension-desc.xml" ); xos = m_xSFA.openFileWrite( packagesUrl ); - XTruncate xTrc = (XTruncate) UnoRuntime.queryInterface( XTruncate.class, xos ); + XTruncate xTrc = UnoRuntime.queryInterface( XTruncate.class, xos ); if ( xTrc != null ) { LogUtils.DEBUG("In writeUnoPackageDB() Truncating...." ); diff --git a/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java b/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java index 78f74d40e215..24e7b8c27540 100644 --- a/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java +++ b/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java @@ -114,7 +114,7 @@ public class UCBStreamHandler extends URLStreamHandler { // we will only deal with simple file write XOutputStream xos = m_xSimpleFileAccess.openFileWrite( path ); - XTruncate xtrunc = ( XTruncate ) UnoRuntime.queryInterface( XTruncate.class, xos ); + XTruncate xtrunc = UnoRuntime.queryInterface( XTruncate.class, xos ); if ( xtrunc != null ) { xtrunc.truncate(); @@ -197,7 +197,7 @@ public class UCBStreamHandler extends URLStreamHandler { zis = new ZipInputStream(is); while (zis.available() != 0) { - entry = (ZipEntry)zis.getNextEntry(); + entry = zis.getNextEntry(); if (entry.getName().equals(file)) { return zis; diff --git a/scripting/java/com/sun/star/script/framework/io/XStorageHelper.java b/scripting/java/com/sun/star/script/framework/io/XStorageHelper.java index 3752f8a766ab..ba507afc6a6a 100644 --- a/scripting/java/com/sun/star/script/framework/io/XStorageHelper.java +++ b/scripting/java/com/sun/star/script/framework/io/XStorageHelper.java @@ -83,8 +83,8 @@ public class XStorageHelper implements XEventListener throw new IOException("Invalid path"); } XDocumentSubStorageSupplier xDocumentSubStorageSupplier = - (XDocumentSubStorageSupplier) UnoRuntime.queryInterface( - XDocumentSubStorageSupplier.class, xModel); + UnoRuntime.queryInterface( + XDocumentSubStorageSupplier.class, xModel); xStorages = new XStorage[tokens.countTokens() ]; LogUtils.DEBUG("XStorageHelper ctor, path chunks length: " + xStorages.length ); @@ -101,7 +101,7 @@ public class XStorageHelper implements XEventListener { LogUtils.DEBUG("** boo hoo Storage is null " ); } - XPropertySet xProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,storage ); + XPropertySet xProps = UnoRuntime.queryInterface(XPropertySet.class,storage ); if ( xProps != null ) { String mediaType = AnyConverter.toString( xProps.getPropertyValue( "MediaType" ) ); @@ -114,8 +114,7 @@ public class XStorageHelper implements XEventListener } else { - XNameAccess xNameAccess = (XNameAccess) - UnoRuntime.queryInterface(XNameAccess.class, xStorages[i-1]); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xStorages[i-1]); if (xNameAccess == null ) { disposeObject(); @@ -162,8 +161,7 @@ public class XStorageHelper implements XEventListener { // TODO needs to cater for model for untitled document modelMap.put( PathUtils.getOidForModel( model ), model ); - XComponent xComp = (XComponent) - UnoRuntime.queryInterface(XComponent.class, model); + XComponent xComp = UnoRuntime.queryInterface(XComponent.class, model); if ( xComp != null ) { @@ -181,8 +179,7 @@ public class XStorageHelper implements XEventListener public void disposing( EventObject Source ) { - XModel model = (XModel) - UnoRuntime.queryInterface(XModel.class,Source.Source ); + XModel model = UnoRuntime.queryInterface(XModel.class,Source.Source ); if ( model != null ) { @@ -234,8 +231,7 @@ public class XStorageHelper implements XEventListener return; } - XComponent xComponent = (XComponent) - UnoRuntime.queryInterface(XComponent.class, xInterface); + XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, xInterface); if (xComponent == null) { return; @@ -244,8 +240,7 @@ public class XStorageHelper implements XEventListener } static public void commit( XInterface xInterface ) { - XTransactedObject xTrans = (XTransactedObject) - UnoRuntime.queryInterface(XTransactedObject.class, xInterface); + XTransactedObject xTrans = UnoRuntime.queryInterface(XTransactedObject.class, xInterface); if ( xTrans != null ) { try diff --git a/scripting/java/com/sun/star/script/framework/provider/EditorScriptContext.java b/scripting/java/com/sun/star/script/framework/provider/EditorScriptContext.java index 9b16d54524cb..ce519abc605e 100644 --- a/scripting/java/com/sun/star/script/framework/provider/EditorScriptContext.java +++ b/scripting/java/com/sun/star/script/framework/provider/EditorScriptContext.java @@ -52,7 +52,7 @@ public class EditorScriptContext implements XScriptContext */ public XModel getDocument() { - XModel xModel = ( XModel ) UnoRuntime.queryInterface( XModel.class, + XModel xModel = UnoRuntime.queryInterface( XModel.class, m_xDeskTop.getCurrentComponent() ); return xModel; @@ -60,7 +60,7 @@ public class EditorScriptContext implements XScriptContext public XScriptInvocationContext getInvocationContext() { - XScriptInvocationContext xContext = ( XScriptInvocationContext ) UnoRuntime.queryInterface( + XScriptInvocationContext xContext = UnoRuntime.queryInterface( XScriptInvocationContext.class, getDocument() ); return xContext; } diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java b/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java index d659ea5872ed..c0427dc90718 100644 --- a/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java +++ b/scripting/java/com/sun/star/script/framework/provider/ScriptContext.java @@ -94,8 +94,7 @@ public class ScriptContext extends PropertySet implements XScriptContext xInterface = xMCF.createInstanceWithContext( "com.sun.star.frame.Desktop", xCtxt); - xDesktop = (XDesktop) - UnoRuntime.queryInterface(XDesktop.class, xInterface); + xDesktop = UnoRuntime.queryInterface(XDesktop.class, xInterface); if ( xModel != null ) { sc = new ScriptContext(xCtxt, xDesktop, xModel, xInvocContext); diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java index 0acdbbc8eb78..0701f95d5c25 100644 --- a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java +++ b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java @@ -168,19 +168,19 @@ public abstract class ScriptProvider if ( AnyConverter.getType(aArguments[0]).getTypeClass().equals(TypeClass.INTERFACE) ) { // try whether it denotes a XScriptInvocationContext - m_xInvocContext = (XScriptInvocationContext)UnoRuntime.queryInterface( + m_xInvocContext = UnoRuntime.queryInterface( XScriptInvocationContext.class, aArguments[0]); if ( m_xInvocContext != null ) { // if so, obtain the document - by definition, this must be // the ScriptContainer - m_xModel = (XModel)UnoRuntime.queryInterface( XModel.class, + m_xModel = UnoRuntime.queryInterface( XModel.class, m_xInvocContext.getScriptContainer() ); } else { // otherwise, check whether it's an XModel - m_xModel = (XModel)UnoRuntime.queryInterface( XModel.class, + m_xModel = UnoRuntime.queryInterface( XModel.class, m_xInvocContext.getScriptContainer() ); } if ( m_xModel == null ) @@ -261,8 +261,8 @@ public abstract class ScriptProvider m_xBrowseNodeProxy = new ProviderBrowseNode( this, m_container, m_xContext ); - m_xInvocationProxy = (XInvocation)UnoRuntime.queryInterface(XInvocation.class, m_xBrowseNodeProxy); - m_xPropertySetProxy = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, m_xBrowseNodeProxy); + m_xInvocationProxy = UnoRuntime.queryInterface(XInvocation.class, m_xBrowseNodeProxy); + m_xPropertySetProxy = UnoRuntime.queryInterface(XPropertySet.class, m_xBrowseNodeProxy); } else { @@ -608,7 +608,7 @@ public abstract class ScriptProvider public void insertByName( String aName, java.lang.Object aElement ) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.container.ElementExistException, com.sun.star.lang.WrappedTargetException { LogUtils.DEBUG("Provider for " + language + " received register for package " + aName ); - XPackage newPackage = ( XPackage ) UnoRuntime.queryInterface( XPackage.class, aElement ); + XPackage newPackage = UnoRuntime.queryInterface( XPackage.class, aElement ); if ( aName.length() == 0 ) { throw new com.sun.star.lang.IllegalArgumentException( "Empty name" ); @@ -660,7 +660,7 @@ public abstract class ScriptProvider XTransientDocumentsDocumentContentFactory factory = null; try { - factory = (XTransientDocumentsDocumentContentFactory)UnoRuntime.queryInterface( + factory = UnoRuntime.queryInterface( XTransientDocumentsDocumentContentFactory.class, m_xMultiComponentFactory.createInstanceWithContext( "com.sun.star.frame.TransientDocumentsDocumentContentFactory", @@ -699,24 +699,21 @@ public abstract class ScriptProvider Object ucb = m_xMultiComponentFactory.createInstanceWithArgumentsAndContext( "com.sun.star.ucb.UniversalContentBroker", args, m_xContext ); - XContentIdentifierFactory xFac = ( XContentIdentifierFactory ) - UnoRuntime.queryInterface( XContentIdentifierFactory.class, - ucb ); + XContentIdentifierFactory xFac = UnoRuntime.queryInterface( XContentIdentifierFactory.class, + ucb ); XContentIdentifier xCntId = xFac.createContentIdentifier( docUrl ); - XContentProvider xCntAccess = ( XContentProvider ) - UnoRuntime.queryInterface( XContentProvider.class, - ucb ); + XContentProvider xCntAccess = UnoRuntime.queryInterface( XContentProvider.class, + ucb ); XContent xCnt = xCntAccess.queryContent( xCntId ); - XCommandProcessor xCmd = ( XCommandProcessor ) - UnoRuntime.queryInterface( XCommandProcessor.class, xCnt ); + XCommandProcessor xCmd = UnoRuntime.queryInterface( XCommandProcessor.class, xCnt ); Property[] pArgs = new Property[ ] { new Property() }; @@ -732,10 +729,10 @@ public abstract class ScriptProvider com.sun.star.ucb.XCommandEnvironment env = null ; Object result = xCmd.execute( command, 0, env ) ; - XRow values = ( XRow ) UnoRuntime.queryInterface( XRow.class, + XRow values = UnoRuntime.queryInterface( XRow.class, result ); - xModel = ( XModel ) UnoRuntime.queryInterface( XModel.class, + xModel = UnoRuntime.queryInterface( XModel.class, values.getObject( 1, null ) ); } catch ( Exception ignore ) diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java index a679d695742b..4fd6a9400c13 100644 --- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java +++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java @@ -59,7 +59,7 @@ public class ScriptEditorForBeanShell private static ScriptEditorForBeanShell theScriptEditorForBeanShell; // global list of ScriptEditors, key is URL of file being edited - private static Map BEING_EDITED = new HashMap(); + private static Map<URL,ScriptEditorForBeanShell> BEING_EDITED = new HashMap<URL,ScriptEditorForBeanShell>(); // template for new BeanShell scripts private static String BSHTEMPLATE; @@ -121,7 +121,7 @@ public class ScriptEditorForBeanShell public static ScriptEditorForBeanShell getEditor(URL url) { synchronized (BEING_EDITED) { - return (ScriptEditorForBeanShell)BEING_EDITED.get(url); + return BEING_EDITED.get(url); } } @@ -211,8 +211,7 @@ public class ScriptEditorForBeanShell public void run() { ScriptEditorForBeanShell editor; synchronized (BEING_EDITED) { - editor = (ScriptEditorForBeanShell) - BEING_EDITED.get(url); + editor = BEING_EDITED.get(url); if (editor == null) { editor = new ScriptEditorForBeanShell( context, theCl, url); @@ -241,12 +240,12 @@ public class ScriptEditorForBeanShell this.filename = url.getFile(); this.cl = cl; try { - Class c = Class.forName( + Class<?> c = Class.forName( "org.openoffice.netbeans.editor.NetBeansSourceView"); - Class[] types = new Class[] { ScriptSourceModel.class }; + Class<?>[] types = new Class[] { ScriptSourceModel.class }; - java.lang.reflect.Constructor ctor = c.getConstructor(types); + java.lang.reflect.Constructor<?> ctor = c.getConstructor(types); if (ctor != null) { Object[] args = new Object[] { this.model }; diff --git a/scripting/java/com/sun/star/script/framework/provider/java/Resolver.java b/scripting/java/com/sun/star/script/framework/provider/java/Resolver.java index b810ec6db3c0..34a15f0995b5 100644 --- a/scripting/java/com/sun/star/script/framework/provider/java/Resolver.java +++ b/scripting/java/com/sun/star/script/framework/provider/java/Resolver.java @@ -34,7 +34,7 @@ public interface Resolver { * @param c A Class * @return The ScriptProxy value */ - public ScriptProxy getProxy( ScriptDescriptor sd, Class c ) + public ScriptProxy getProxy( ScriptDescriptor sd, Class<?> c ) throws NoSuchMethodException; } diff --git a/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java b/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java index cdd4916d531c..9b8375dd2070 100644 --- a/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java +++ b/scripting/java/com/sun/star/script/framework/provider/java/ScriptDescriptor.java @@ -145,7 +145,7 @@ public class ScriptDescriptor * * @param classes The feature to be added to the ArgumentTypes attribute */ - public synchronized void addArgumentTypes( Class[] classes ) + public synchronized void addArgumentTypes( Class<?>[] classes ) { for ( int i = 0; i < classes.length; i++ ) { @@ -181,7 +181,7 @@ public class ScriptDescriptor public String toString() { StringBuffer description = new StringBuffer( m_name ); - Class[] types = getArgumentTypes(); + Class<?>[] types = getArgumentTypes(); description.append( " (" ); diff --git a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java index c98a1ed59f95..800c084f0eba 100644 --- a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java +++ b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java @@ -190,8 +190,7 @@ class ScriptImpl implements XScript aOutParamIndex[0] = new short[0]; aOutParam[0] = new Object[0]; - - Map languageProps = metaData.getLanguageProperties(); + Map<String,String> languageProps = metaData.getLanguageProperties(); ScriptDescriptor scriptDesc = new ScriptDescriptor( metaData.getLanguageName() ); @@ -271,7 +270,7 @@ class ScriptImpl implements XScript LogUtils.DEBUG( "About to load Class " + className + " starting... " ); long start = new java.util.Date().getTime(); - Class c = scriptLoader.loadClass( className ); + Class<?> c = scriptLoader.loadClass( className ); long end = new java.util.Date().getTime(); LogUtils.DEBUG("loadClass took: " + String.valueOf(end - start) + diff --git a/scripting/java/com/sun/star/script/framework/provider/java/StrictResolver.java b/scripting/java/com/sun/star/script/framework/provider/java/StrictResolver.java index 6889e607f156..2dfc6be7b2fa 100644 --- a/scripting/java/com/sun/star/script/framework/provider/java/StrictResolver.java +++ b/scripting/java/com/sun/star/script/framework/provider/java/StrictResolver.java @@ -50,7 +50,7 @@ public class StrictResolver implements Resolver * @param c the Class file in which to search for the method * @return the ScriptProxy matching the criteria, or null if no match is found */ - public ScriptProxy getProxy( ScriptDescriptor sd, Class c ) + public ScriptProxy getProxy( ScriptDescriptor sd, Class<?> c ) throws NoSuchMethodException { Method m = null; diff --git a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java index d234a0019acf..c359ba39660b 100644 --- a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java +++ b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptEditorForJavaScript.java @@ -51,7 +51,7 @@ public class ScriptEditorForJavaScript implements ScriptEditor static private Main rhinoWindow; private URL scriptURL; // global list of ScriptEditors, key is URL of file being edited - private static Map BEING_EDITED = new HashMap(); + private static Map<URL,ScriptEditorForJavaScript> BEING_EDITED = new HashMap<URL,ScriptEditorForJavaScript>(); static { try { @@ -109,7 +109,7 @@ public class ScriptEditorForJavaScript implements ScriptEditor public static ScriptEditorForJavaScript getEditor(URL url) { synchronized (BEING_EDITED) { - return (ScriptEditorForJavaScript)BEING_EDITED.get(url); + return BEING_EDITED.get(url); } } @@ -185,8 +185,7 @@ public class ScriptEditorForJavaScript implements ScriptEditor public void run() { synchronized (BEING_EDITED) { ScriptEditorForJavaScript editor = - (ScriptEditorForJavaScript) BEING_EDITED.get( - url); + BEING_EDITED.get(url); if (editor == null) { editor = new ScriptEditorForJavaScript( context, url); @@ -291,17 +290,16 @@ public class ScriptEditorForJavaScript implements ScriptEditor // remove all scripts from BEING_EDITED synchronized( BEING_EDITED ) { - java.util.Iterator iter = BEING_EDITED.keySet().iterator(); - java.util.Vector keysToRemove = new java.util.Vector(); + java.util.Iterator<URL> iter = BEING_EDITED.keySet().iterator(); + java.util.ArrayList<URL> keysToRemove = new java.util.ArrayList<URL>(); while ( iter.hasNext() ) { - - URL key = (URL)iter.next(); + URL key = iter.next(); keysToRemove.add( key ); } for ( int i=0; i<keysToRemove.size(); i++ ) { - BEING_EDITED.remove( keysToRemove.elementAt( i ) ); + BEING_EDITED.remove( keysToRemove.get( i ) ); } keysToRemove = null; } @@ -334,7 +332,7 @@ public class ScriptEditorForJavaScript implements ScriptEditor { synchronized( BEING_EDITED ) { - Object o = BEING_EDITED.remove( this.url ); + BEING_EDITED.remove( this.url ); } } } |