Kaydet (Commit) 4c9e62c6 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

Java cleanup, convert ArrayList and Vector to use generics

Change-Id: Ic668b46872ee0bfd259ca335aed9d68fb545c3a4
üst 6bf09ecf
...@@ -73,7 +73,7 @@ public class OOoViewer extends Applet { ...@@ -73,7 +73,7 @@ public class OOoViewer extends Applet {
// Class arPropValClass = m_loader.loadClass("[Lcom.sun.star.beans.PropertyValue;"); // Class arPropValClass = m_loader.loadClass("[Lcom.sun.star.beans.PropertyValue;");
Object arProp = Array.newInstance( Object arProp = Array.newInstance(
m_loader.loadClass("com.sun.star.beans.PropertyValue"), 1); m_loader.loadClass("com.sun.star.beans.PropertyValue"), 1);
Class clazz = arProp.getClass(); Class<? extends Object> clazz = arProp.getClass();
Method methLoad = beanClass.getMethod( Method methLoad = beanClass.getMethod(
"loadFromURL", new Class[] { "loadFromURL", new Class[] {
...@@ -124,7 +124,7 @@ public class OOoViewer extends Applet { ...@@ -124,7 +124,7 @@ public class OOoViewer extends Applet {
final class CustomURLClassLoader extends URLClassLoader { final class CustomURLClassLoader extends URLClassLoader {
private Vector resourcePaths; private Vector<URL> resourcePaths;
public CustomURLClassLoader( URL[] urls ) { public CustomURLClassLoader( URL[] urls ) {
super( urls ); super( urls );
...@@ -163,7 +163,7 @@ final class CustomURLClassLoader extends URLClassLoader { ...@@ -163,7 +163,7 @@ final class CustomURLClassLoader extends URLClassLoader {
} }
public void addResourcePath(URL rurl) { public void addResourcePath(URL rurl) {
if (resourcePaths == null) resourcePaths = new Vector(); if (resourcePaths == null) resourcePaths = new Vector<URL>();
resourcePaths.add(rurl); resourcePaths.add(rurl);
} }
...@@ -177,8 +177,8 @@ final class CustomURLClassLoader extends URLClassLoader { ...@@ -177,8 +177,8 @@ final class CustomURLClassLoader extends URLClassLoader {
URL u = null; URL u = null;
URI uri = null; URI uri = null;
for (Enumeration e = resourcePaths.elements(); e.hasMoreElements();) { for (Enumeration<URL> e = resourcePaths.elements(); e.hasMoreElements();) {
u = (URL)e.nextElement(); u = e.nextElement();
if (u.getProtocol().startsWith("file")){ if (u.getProtocol().startsWith("file")){
try { try {
File f1 = new File(u.getPath()); File f1 = new File(u.getPath());
......
import com.sun.star.sheet.XResultListener;
/************************************************************************* /*************************************************************************
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
...@@ -36,7 +38,7 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult ...@@ -36,7 +38,7 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult
{ {
private String aName; private String aName;
private int nValue; private int nValue;
private java.util.Vector aListeners = new java.util.Vector(); private java.util.Vector<XResultListener> aListeners = new java.util.Vector<XResultListener>();
public ExampleAddInResult( String aNewName ) public ExampleAddInResult( String aNewName )
{ {
...@@ -70,18 +72,18 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult ...@@ -70,18 +72,18 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult
++nValue; ++nValue;
com.sun.star.sheet.ResultEvent aEvent = getResult(); com.sun.star.sheet.ResultEvent aEvent = getResult();
java.util.Enumeration aEnum = aListeners.elements(); java.util.Enumeration<XResultListener> aEnum = aListeners.elements();
while (aEnum.hasMoreElements()) while (aEnum.hasMoreElements())
((com.sun.star.sheet.XResultListener)aEnum.nextElement()).modified( aEnum.nextElement().modified(
aEvent); aEvent);
} }
} }
class ExampleAddInThread extends Thread class ExampleAddInThread extends Thread
{ {
private java.util.Hashtable aCounters; private java.util.Hashtable<String, ExampleAddInResult> aCounters;
public ExampleAddInThread( java.util.Hashtable aResults ) public ExampleAddInThread( java.util.Hashtable<String, ExampleAddInResult> aResults )
{ {
aCounters = aResults; aCounters = aResults;
} }
...@@ -99,9 +101,9 @@ class ExampleAddInThread extends Thread ...@@ -99,9 +101,9 @@ class ExampleAddInThread extends Thread
} }
// increment all counters // increment all counters
java.util.Enumeration aEnum = aCounters.elements(); java.util.Enumeration<ExampleAddInResult> aEnum = aCounters.elements();
while (aEnum.hasMoreElements()) while (aEnum.hasMoreElements())
((ExampleAddInResult)aEnum.nextElement()).incrementValue(); aEnum.nextElement().incrementValue();
} }
} }
} }
...@@ -149,7 +151,7 @@ public class ExampleAddIn ...@@ -149,7 +151,7 @@ public class ExampleAddIn
}; };
private com.sun.star.lang.Locale aFuncLocale; private com.sun.star.lang.Locale aFuncLocale;
private java.util.Hashtable aResults; private java.util.Hashtable<String, ExampleAddInResult> aResults;
public _ExampleAddIn( com.sun.star.lang.XMultiServiceFactory xFactory ) public _ExampleAddIn( com.sun.star.lang.XMultiServiceFactory xFactory )
{ {
...@@ -176,12 +178,12 @@ public class ExampleAddIn ...@@ -176,12 +178,12 @@ public class ExampleAddIn
{ {
// create the table of results, and start a thread to increment // create the table of results, and start a thread to increment
// all counters // all counters
aResults = new java.util.Hashtable(); aResults = new java.util.Hashtable<String, ExampleAddInResult>();
ExampleAddInThread aThread = new ExampleAddInThread( aResults ); ExampleAddInThread aThread = new ExampleAddInThread( aResults );
aThread.start(); aThread.start();
} }
ExampleAddInResult aResult = (ExampleAddInResult) aResults.get(aName); ExampleAddInResult aResult = aResults.get(aName);
if ( aResult == null ) if ( aResult == null )
{ {
aResult = new ExampleAddInResult(aName); aResult = new ExampleAddInResult(aName);
......
...@@ -59,7 +59,7 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -59,7 +59,7 @@ public final class OwnEmbeddedObject extends WeakBase
protected EditorFrame m_aEditorFrame; protected EditorFrame m_aEditorFrame;
protected Vector m_aListeners; protected Vector<Object> m_aListeners;
com.sun.star.embed.VerbDescriptor[] m_pOwnVerbs; com.sun.star.embed.VerbDescriptor[] m_pOwnVerbs;
...@@ -68,7 +68,7 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -68,7 +68,7 @@ public final class OwnEmbeddedObject extends WeakBase
Dimension m_aObjSize; Dimension m_aObjSize;
// ------------------------------------------------------------- // -------------------------------------------------------------
protected Vector GetListeners() protected Vector<Object> GetListeners()
{ {
if ( m_aListeners == null ) if ( m_aListeners == null )
m_aListeners = new Vector<Object>( 10, 10 ); m_aListeners = new Vector<Object>( 10, 10 );
...@@ -133,12 +133,12 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -133,12 +133,12 @@ public final class OwnEmbeddedObject extends WeakBase
{ {
// save the text // save the text
XStream xStream = xStorage.openStreamElement( "content.txt", com.sun.star.embed.ElementModes.READWRITE ); XStream xStream = xStorage.openStreamElement( "content.txt", com.sun.star.embed.ElementModes.READWRITE );
XComponent xStreamComp = ( XComponent ) UnoRuntime.queryInterface( XComponent.class, xStream ); XComponent xStreamComp = UnoRuntime.queryInterface( XComponent.class, xStream );
if ( xStreamComp == null ) if ( xStreamComp == null )
throw new com.sun.star.uno.RuntimeException(); throw new com.sun.star.uno.RuntimeException();
XOutputStream xOutStream = xStream.getOutputStream(); XOutputStream xOutStream = xStream.getOutputStream();
XTruncate xTruncate = ( XTruncate ) UnoRuntime.queryInterface( XTruncate.class, xOutStream ); XTruncate xTruncate = UnoRuntime.queryInterface( XTruncate.class, xOutStream );
if ( xTruncate == null ) if ( xTruncate == null )
throw new com.sun.star.io.IOException(); throw new com.sun.star.io.IOException();
...@@ -147,12 +147,12 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -147,12 +147,12 @@ public final class OwnEmbeddedObject extends WeakBase
// save the size // save the size
xStream = xStorage.openStreamElement( "properties.txt", com.sun.star.embed.ElementModes.READWRITE ); xStream = xStorage.openStreamElement( "properties.txt", com.sun.star.embed.ElementModes.READWRITE );
xStreamComp = ( XComponent ) UnoRuntime.queryInterface( XComponent.class, xStream ); xStreamComp = UnoRuntime.queryInterface( XComponent.class, xStream );
if ( xStreamComp == null ) if ( xStreamComp == null )
throw new com.sun.star.uno.RuntimeException(); throw new com.sun.star.uno.RuntimeException();
xOutStream = xStream.getOutputStream(); xOutStream = xStream.getOutputStream();
xTruncate = ( XTruncate ) UnoRuntime.queryInterface( XTruncate.class, xOutStream ); xTruncate = UnoRuntime.queryInterface( XTruncate.class, xOutStream );
if ( xTruncate == null ) if ( xTruncate == null )
throw new com.sun.star.io.IOException(); throw new com.sun.star.io.IOException();
...@@ -161,12 +161,12 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -161,12 +161,12 @@ public final class OwnEmbeddedObject extends WeakBase
xOutStream.writeBytes( aProps.getBytes() ); xOutStream.writeBytes( aProps.getBytes() );
// set the media type // set the media type
XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xStorage ); XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, xStorage );
if ( xPropSet == null ) if ( xPropSet == null )
throw new com.sun.star.uno.RuntimeException(); throw new com.sun.star.uno.RuntimeException();
xPropSet.setPropertyValue( "MediaType", "application/x-openoffice-embedded-69474366-FD6F-4806-8374-8EDD1B6E771D" ); xPropSet.setPropertyValue( "MediaType", "application/x-openoffice-embedded-69474366-FD6F-4806-8374-8EDD1B6E771D" );
XTransactedObject xTransact = ( XTransactedObject ) UnoRuntime.queryInterface( XTransactedObject.class, xStorage ); XTransactedObject xTransact = UnoRuntime.queryInterface( XTransactedObject.class, xStorage );
if ( xTransact != null ) if ( xTransact != null )
xTransact.commit(); xTransact.commit();
...@@ -196,8 +196,7 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -196,8 +196,7 @@ public final class OwnEmbeddedObject extends WeakBase
{ {
try try
{ {
com.sun.star.document.XEventListener xListener = ( com.sun.star.document.XEventListener ) com.sun.star.document.XEventListener xListener = UnoRuntime.queryInterface( com.sun.star.document.XEventListener.class, m_aListeners.get( nInd ) );
UnoRuntime.queryInterface( com.sun.star.document.XEventListener.class, m_aListeners.get( nInd ) );
if ( xListener != null ) if ( xListener != null )
xListener.notifyEvent( aEventObject ); xListener.notifyEvent( aEventObject );
...@@ -220,8 +219,7 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -220,8 +219,7 @@ public final class OwnEmbeddedObject extends WeakBase
{ {
try try
{ {
com.sun.star.embed.XStateChangeListener xListener = ( com.sun.star.embed.XStateChangeListener ) com.sun.star.embed.XStateChangeListener xListener = UnoRuntime.queryInterface( com.sun.star.embed.XStateChangeListener.class, m_aListeners.get( nInd ) );
UnoRuntime.queryInterface( com.sun.star.embed.XStateChangeListener.class, m_aListeners.get( nInd ) );
if ( xListener != null ) if ( xListener != null )
{ {
...@@ -248,7 +246,7 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -248,7 +246,7 @@ public final class OwnEmbeddedObject extends WeakBase
try try
{ {
XStream xStream = xStorage.openStreamElement( aStreamName, com.sun.star.embed.ElementModes.READWRITE ); XStream xStream = xStorage.openStreamElement( aStreamName, com.sun.star.embed.ElementModes.READWRITE );
XComponent xStreamComp = ( XComponent ) UnoRuntime.queryInterface( XComponent.class, xStream ); XComponent xStreamComp = UnoRuntime.queryInterface( XComponent.class, xStream );
if ( xStreamComp == null ) if ( xStreamComp == null )
throw new com.sun.star.uno.RuntimeException(); throw new com.sun.star.uno.RuntimeException();
...@@ -415,7 +413,7 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -415,7 +413,7 @@ public final class OwnEmbeddedObject extends WeakBase
SwitchOwnPersistence( xStorage, aEntryName ); SwitchOwnPersistence( xStorage, aEntryName );
if ( bElExists ) if ( bElExists )
{ {
XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_xOwnStorage ); XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, m_xOwnStorage );
if ( xPropSet == null ) if ( xPropSet == null )
throw new com.sun.star.uno.RuntimeException(); throw new com.sun.star.uno.RuntimeException();
...@@ -993,19 +991,19 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -993,19 +991,19 @@ public final class OwnEmbeddedObject extends WeakBase
{ {
XMultiComponentFactory xFactory = m_xContext.getServiceManager(); XMultiComponentFactory xFactory = m_xContext.getServiceManager();
Object obj = xFactory.createInstanceWithContext( "com.sun.star.configuration.ConfigurationProvider", m_xContext ); Object obj = xFactory.createInstanceWithContext( "com.sun.star.configuration.ConfigurationProvider", m_xContext );
XMultiServiceFactory xConfProvider = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, obj ); XMultiServiceFactory xConfProvider = UnoRuntime.queryInterface( XMultiServiceFactory.class, obj );
if ( xConfProvider == null ) if ( xConfProvider == null )
throw new com.sun.star.uno.RuntimeException(); throw new com.sun.star.uno.RuntimeException();
Object[] aArgs = new Object[1]; Object[] aArgs = new Object[1];
aArgs[0] = "/org.openoffice.Office.Embedding/Objects"; aArgs[0] = "/org.openoffice.Office.Embedding/Objects";
Object oSettings = xConfProvider.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aArgs ); Object oSettings = xConfProvider.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aArgs );
XNameAccess xObjConfNA = ( XNameAccess ) UnoRuntime.queryInterface( XNameAccess.class, oSettings ); XNameAccess xObjConfNA = UnoRuntime.queryInterface( XNameAccess.class, oSettings );
if ( xObjConfNA == null ) if ( xObjConfNA == null )
throw new com.sun.star.uno.RuntimeException(); throw new com.sun.star.uno.RuntimeException();
Object oEmbObj = xObjConfNA.getByName( "69474366-FD6F-4806-8374-8EDD1B6E771D" ); Object oEmbObj = xObjConfNA.getByName( "69474366-FD6F-4806-8374-8EDD1B6E771D" );
XNameAccess xEmbObjNA = (XNameAccess) UnoRuntime.queryInterface( XNameAccess.class, oEmbObj ); XNameAccess xEmbObjNA = UnoRuntime.queryInterface( XNameAccess.class, oEmbObj );
if ( xEmbObjNA == null ) if ( xEmbObjNA == null )
throw new com.sun.star.uno.RuntimeException(); throw new com.sun.star.uno.RuntimeException();
...@@ -1015,7 +1013,7 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -1015,7 +1013,7 @@ public final class OwnEmbeddedObject extends WeakBase
com.sun.star.embed.VerbDescriptor[] pVerbs = new com.sun.star.embed.VerbDescriptor[pVerbShortcuts.length]; com.sun.star.embed.VerbDescriptor[] pVerbs = new com.sun.star.embed.VerbDescriptor[pVerbShortcuts.length];
aArgs[0] = "/org.openoffice.Office.Embedding/Verbs"; aArgs[0] = "/org.openoffice.Office.Embedding/Verbs";
Object oVerbs = xConfProvider.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aArgs ); Object oVerbs = xConfProvider.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", aArgs );
XNameAccess xVerbsConfNA = ( XNameAccess ) UnoRuntime.queryInterface( XNameAccess.class, oVerbs ); XNameAccess xVerbsConfNA = UnoRuntime.queryInterface( XNameAccess.class, oVerbs );
if ( xVerbsConfNA == null ) if ( xVerbsConfNA == null )
throw new com.sun.star.uno.RuntimeException(); throw new com.sun.star.uno.RuntimeException();
...@@ -1023,7 +1021,7 @@ public final class OwnEmbeddedObject extends WeakBase ...@@ -1023,7 +1021,7 @@ public final class OwnEmbeddedObject extends WeakBase
{ {
try try
{ {
XNameAccess xVerbNA = (XNameAccess) UnoRuntime.queryInterface( XNameAccess xVerbNA = UnoRuntime.queryInterface(
XNameAccess.class, XNameAccess.class,
xVerbsConfNA.getByName( pVerbShortcuts[nInd] ) ); xVerbsConfNA.getByName( pVerbShortcuts[nInd] ) );
if ( xVerbNA != null ) if ( xVerbNA != null )
......
...@@ -171,21 +171,19 @@ public class ToDo { ...@@ -171,21 +171,19 @@ public class ToDo {
try { try {
// Querying for the interface XSpreadsheetDocument // Querying for the interface XSpreadsheetDocument
XSpreadsheetDocument xspreadsheetdocument = XSpreadsheetDocument xspreadsheetdocument =
( XSpreadsheetDocument ) UnoRuntime.queryInterface( UnoRuntime.queryInterface(
XSpreadsheetDocument.class, aInstance ); XSpreadsheetDocument.class, aInstance );
// Querying for the interface XIndexAccess // Querying for the interface XIndexAccess
XIndexAccess xindexaccess = ( XIndexAccess ) XIndexAccess xindexaccess = UnoRuntime.queryInterface( XIndexAccess.class,
UnoRuntime.queryInterface( XIndexAccess.class, xspreadsheetdocument.getSheets() );
xspreadsheetdocument.getSheets() );
// Getting the first XSpreadsheet // Getting the first XSpreadsheet
XSpreadsheet xspreadsheet = (XSpreadsheet)UnoRuntime.queryInterface( XSpreadsheet xspreadsheet = UnoRuntime.queryInterface(
XSpreadsheet.class, xindexaccess.getByIndex( 0 )); XSpreadsheet.class, xindexaccess.getByIndex( 0 ));
// Querying for the interface XCellRange on the XSpeadsheet // Querying for the interface XCellRange on the XSpeadsheet
XCellRange xcellrange = ( XCellRange ) XCellRange xcellrange = UnoRuntime.queryInterface( XCellRange.class, xspreadsheet );
UnoRuntime.queryInterface( XCellRange.class, xspreadsheet );
/* Getting the gregorian calendar with the date on which to start /* Getting the gregorian calendar with the date on which to start
the calculation */ the calculation */
...@@ -206,12 +204,11 @@ public class ToDo { ...@@ -206,12 +204,11 @@ public class ToDo {
// Querying for the interface XFunctionAccess on service // Querying for the interface XFunctionAccess on service
// FunctionAccess // FunctionAccess
XFunctionAccess xfunctionaccess = (XFunctionAccess) XFunctionAccess xfunctionaccess = UnoRuntime.queryInterface(XFunctionAccess.class,
UnoRuntime.queryInterface(XFunctionAccess.class, objectFunctionAccess );
objectFunctionAccess );
// Creating vector for holidays // Creating vector for holidays
Vector vectorHolidays = new Vector(); Vector<Object> vectorHolidays = new Vector<Object>();
// Get the Official Holidays // Get the Official Holidays
this.getOfficialHolidays( vectorHolidays, xcellrange, this.getOfficialHolidays( vectorHolidays, xcellrange,
...@@ -268,11 +265,10 @@ public class ToDo { ...@@ -268,11 +265,10 @@ public class ToDo {
{ {
// Querying for the interface XPropertySet for the cell // Querying for the interface XPropertySet for the cell
// providing the due date // providing the due date
XPropertySet xpropertyset = ( XPropertySet ) XPropertySet xpropertyset = UnoRuntime.queryInterface(XPropertySet.class,
UnoRuntime.queryInterface(XPropertySet.class,
xcellrange.getCellByPosition( xcellrange.getCellByPosition(
this.INT_COLUMN_DUEDATE, this.INT_COLUMN_DUEDATE,
intRow )); intRow ));
// Changing the background color of the cell to white // Changing the background color of the cell to white
xpropertyset.setPropertyValue( "CellBackColor", xpropertyset.setPropertyValue( "CellBackColor",
...@@ -283,15 +279,13 @@ public class ToDo { ...@@ -283,15 +279,13 @@ public class ToDo {
this.INT_COLUMN_FEATURE, intRow ); this.INT_COLUMN_FEATURE, intRow );
// Querying for the interface XSimpleText // Querying for the interface XSimpleText
XSimpleText xsimpletext = ( XSimpleText ) XSimpleText xsimpletext = UnoRuntime.queryInterface( XSimpleText.class, xcell );
UnoRuntime.queryInterface( XSimpleText.class, xcell );
// Getting the text cursor // Getting the text cursor
XTextCursor xtextcursor = xsimpletext.createTextCursor(); XTextCursor xtextcursor = xsimpletext.createTextCursor();
// Querying for the interface XTextRange // Querying for the interface XTextRange
XTextRange xtextrange = ( XTextRange ) XTextRange xtextrange = UnoRuntime.queryInterface( XTextRange.class, xtextcursor );
UnoRuntime.queryInterface( XTextRange.class, xtextcursor );
// Getting the bug ID from the cell // Getting the bug ID from the cell
String sBugID = xtextrange.getString(); String sBugID = xtextrange.getString();
...@@ -302,8 +296,8 @@ public class ToDo { ...@@ -302,8 +296,8 @@ public class ToDo {
// Querying for the interface XMultiServiceFactory // Querying for the interface XMultiServiceFactory
XMultiServiceFactory xMSFTextField = XMultiServiceFactory xMSFTextField =
(XMultiServiceFactory)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
XMultiServiceFactory.class, aInstance ); XMultiServiceFactory.class, aInstance );
// Creating an instance of the text field URL // Creating an instance of the text field URL
Object objectTextField = Object objectTextField =
...@@ -311,14 +305,12 @@ public class ToDo { ...@@ -311,14 +305,12 @@ public class ToDo {
"com.sun.star.text.TextField.URL" ); "com.sun.star.text.TextField.URL" );
// Querying for the interface XTextField // Querying for the interface XTextField
XTextField xtextfield = ( XTextField ) XTextField xtextfield = UnoRuntime.queryInterface( XTextField.class,
UnoRuntime.queryInterface( XTextField.class, objectTextField );
objectTextField );
// Querying for the interface XPropertySet // Querying for the interface XPropertySet
XPropertySet xpropertysetTextField = ( XPropertySet ) XPropertySet xpropertysetTextField = UnoRuntime.queryInterface( XPropertySet.class,
UnoRuntime.queryInterface( XPropertySet.class, xtextfield );
xtextfield );
// Setting the URL // Setting the URL
xpropertysetTextField.setPropertyValue( "URL", xpropertysetTextField.setPropertyValue( "URL",
...@@ -329,7 +321,7 @@ public class ToDo { ...@@ -329,7 +321,7 @@ public class ToDo {
sBugID ); sBugID );
// Querying for the interface XText // Querying for the interface XText
XText xtext = ( XText )UnoRuntime.queryInterface( XText xtext = UnoRuntime.queryInterface(
XText.class, xcell ); XText.class, xcell );
// Delete cell content // Delete cell content
...@@ -504,12 +496,11 @@ public class ToDo { ...@@ -504,12 +496,11 @@ public class ToDo {
gregCalPreviousDueDate ) ) ) { gregCalPreviousDueDate ) ) ) {
// Querying for the interface XPropertySet for // Querying for the interface XPropertySet for
// the cell providing the due date // the cell providing the due date
XPropertySet xpropertyset = ( XPropertySet ) XPropertySet xpropertyset = UnoRuntime.queryInterface(
UnoRuntime.queryInterface(
XPropertySet.class, XPropertySet.class,
xcellrange.getCellByPosition( xcellrange.getCellByPosition(
this.INT_COLUMN_DUEDATE, this.INT_COLUMN_DUEDATE,
intRow ) ); intRow ) );
// Changing the background color of the cell // Changing the background color of the cell
// to red // to red
...@@ -519,8 +510,8 @@ public class ToDo { ...@@ -519,8 +510,8 @@ public class ToDo {
// Querying for the interface XColumnRowRange // Querying for the interface XColumnRowRange
// on the XCellRange // on the XCellRange
XColumnRowRange xcolumnrowrange = XColumnRowRange xcolumnrowrange =
( XColumnRowRange)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
XColumnRowRange.class, xcellrange ); XColumnRowRange.class, xcellrange );
// Inserting one row to the table // Inserting one row to the table
XTableRows xTableRows = XTableRows xTableRows =
xcolumnrowrange.getRows(); xcolumnrowrange.getRows();
...@@ -529,7 +520,7 @@ public class ToDo { ...@@ -529,7 +520,7 @@ public class ToDo {
// Querying for the interface // Querying for the interface
// XCellRangeMovement on XCellRange // XCellRangeMovement on XCellRange
XCellRangeMovement xcellrangemovement = XCellRangeMovement xcellrangemovement =
(XCellRangeMovement)UnoRuntime.queryInterface( UnoRuntime.queryInterface(
XCellRangeMovement.class, xcellrange ); XCellRangeMovement.class, xcellrange );
// Creating the cell address of the destination // Creating the cell address of the destination
...@@ -648,8 +639,7 @@ public class ToDo { ...@@ -648,8 +639,7 @@ public class ToDo {
XCell xcellStartDate = xcellrange.getCellByPosition(intColumn, XCell xcellStartDate = xcellrange.getCellByPosition(intColumn,
intRow); intRow);
// Querying for the interface XTextRange on the XCell // Querying for the interface XTextRange on the XCell
xtextrangeStartDate = (XTextRange) xtextrangeStartDate = UnoRuntime.queryInterface(XTextRange.class, xcellStartDate);
UnoRuntime.queryInterface(XTextRange.class, xcellStartDate);
} }
catch( Exception exception ) { catch( Exception exception ) {
this.showExceptionMessage( exception ); this.showExceptionMessage( exception );
...@@ -672,8 +662,7 @@ public class ToDo { ...@@ -672,8 +662,7 @@ public class ToDo {
XCell xcellStartDate = xcellrange.getCellByPosition(intColumn, XCell xcellStartDate = xcellrange.getCellByPosition(intColumn,
intRow); intRow);
// Querying for the interface XTextRange on the XCell // Querying for the interface XTextRange on the XCell
XTextRange xtextrange = (XTextRange) XTextRange xtextrange = UnoRuntime.queryInterface(XTextRange.class, xcellStartDate);
UnoRuntime.queryInterface(XTextRange.class, xcellStartDate);
// Setting the new start date // Setting the new start date
xtextrange.setString( sDate ); xtextrange.setString( sDate );
} }
...@@ -717,7 +706,7 @@ public class ToDo { ...@@ -717,7 +706,7 @@ public class ToDo {
* @param intYear Year to calculate the official holidays. * @param intYear Year to calculate the official holidays.
*/ */
public void getOfficialHolidays( public void getOfficialHolidays(
Vector vectorHolidays, Vector<Object> vectorHolidays,
XCellRange xcellrange, XCellRange xcellrange,
XFunctionAccess xfunctionaccess, XFunctionAccess xfunctionaccess,
int intYear ) { int intYear ) {
...@@ -852,7 +841,7 @@ public class ToDo { ...@@ -852,7 +841,7 @@ public class ToDo {
* @param xcellrange Providing the cells. * @param xcellrange Providing the cells.
* @param xfunctionaccess Provides the access to functions of the Calc. * @param xfunctionaccess Provides the access to functions of the Calc.
*/ */
public void getPrivateHolidays( Vector vectorHolidays, public void getPrivateHolidays( Vector<Object> vectorHolidays,
XCellRange xcellrange, XCellRange xcellrange,
XFunctionAccess xfunctionaccess ) { XFunctionAccess xfunctionaccess ) {
try { try {
......
...@@ -41,11 +41,11 @@ public class JavaFinder implements MethodFinder { ...@@ -41,11 +41,11 @@ public class JavaFinder implements MethodFinder {
private static final String FIRST_PARAM = private static final String FIRST_PARAM =
"drafts.com.sun.star.script.framework.runtime.XScriptContext"; "drafts.com.sun.star.script.framework.runtime.XScriptContext";
private Vector classpath = null; private Vector<String> classpath = null;
private JavaFinder() {} private JavaFinder() {}
private JavaFinder(Vector classpath) { private JavaFinder(Vector<String> classpath) {
this.classpath = classpath; this.classpath = classpath;
} }
...@@ -59,7 +59,7 @@ public class JavaFinder implements MethodFinder { ...@@ -59,7 +59,7 @@ public class JavaFinder implements MethodFinder {
return finder; return finder;
} }
public static JavaFinder getInstance(Vector classpath) { public static JavaFinder getInstance(Vector<String> classpath) {
return new JavaFinder(classpath); return new JavaFinder(classpath);
} }
...@@ -126,7 +126,7 @@ public class JavaFinder implements MethodFinder { ...@@ -126,7 +126,7 @@ public class JavaFinder implements MethodFinder {
} }
if (result.size() != 0) if (result.size() != 0)
return (ScriptEntry[])result.toArray(empty); return result.toArray(empty);
return empty; return empty;
} }
...@@ -136,7 +136,7 @@ public class JavaFinder implements MethodFinder { ...@@ -136,7 +136,7 @@ public class JavaFinder implements MethodFinder {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
try { try {
String s = (String)classpath.elementAt(i); String s = classpath.elementAt(i);
s = SVersionRCFile.toFileURL(s); s = SVersionRCFile.toFileURL(s);
if (s != null) if (s != null)
...@@ -146,7 +146,7 @@ public class JavaFinder implements MethodFinder { ...@@ -146,7 +146,7 @@ public class JavaFinder implements MethodFinder {
} }
} }
return new URLClassLoader((URL[])urls.toArray(new URL[0])); return new URLClassLoader(urls.toArray(new URL[0]));
} }
private ClassLoader getClassLoader(File basedir) { private ClassLoader getClassLoader(File basedir) {
...@@ -175,7 +175,7 @@ public class JavaFinder implements MethodFinder { ...@@ -175,7 +175,7 @@ public class JavaFinder implements MethodFinder {
File f; File f;
for (int i = 0; i < urls.length; i++) { for (int i = 0; i < urls.length; i++) {
try { try {
f = (File)files.get(i); f = files.get(i);
urlpath = SVersionRCFile.toFileURL(f.getAbsolutePath()); urlpath = SVersionRCFile.toFileURL(f.getAbsolutePath());
if (urlpath != null) if (urlpath != null)
...@@ -215,7 +215,7 @@ public class JavaFinder implements MethodFinder { ...@@ -215,7 +215,7 @@ public class JavaFinder implements MethodFinder {
ArrayList<String> result = new ArrayList<String>(); ArrayList<String> result = new ArrayList<String>();
for (int i = 0; i < classFiles.size(); i++) for (int i = 0; i < classFiles.size(); i++)
{ {
File classFile = (File)classFiles.get(i); File classFile = classFiles.get(i);
String className = classFile.getName(); String className = classFile.getName();
className = className.substring(0, className.lastIndexOf(CLASS_SUFFIX)); className = className.substring(0, className.lastIndexOf(CLASS_SUFFIX));
boolean finished = false; boolean finished = false;
...@@ -223,7 +223,7 @@ public class JavaFinder implements MethodFinder { ...@@ -223,7 +223,7 @@ public class JavaFinder implements MethodFinder {
for (int j = 0; j < javaFiles.size() && finished == false; j++) for (int j = 0; j < javaFiles.size() && finished == false; j++)
{ {
File javaFile = (File)javaFiles.get(j); File javaFile = javaFiles.get(j);
String javaName = javaFile.getName(); String javaName = javaFile.getName();
javaName = javaName.substring(0, javaName.lastIndexOf(JAVA_SUFFIX)); javaName = javaName.substring(0, javaName.lastIndexOf(JAVA_SUFFIX));
...@@ -240,6 +240,6 @@ public class JavaFinder implements MethodFinder { ...@@ -240,6 +240,6 @@ public class JavaFinder implements MethodFinder {
} }
} }
} }
return (String[])result.toArray(new String[0]); return result.toArray(new String[0]);
} }
} }
...@@ -43,7 +43,7 @@ public class LocalOffice ...@@ -43,7 +43,7 @@ public class LocalOffice
public static final LocalOffice create( public static final LocalOffice create(
ClassLoader parent, String officePath, int port) ClassLoader parent, String officePath, int port)
{ {
Vector path = new Vector(); Vector<String> path = new Vector<String>();
path.addElement(officePath + "/program/classes/ridl.jar"); path.addElement(officePath + "/program/classes/ridl.jar");
path.addElement(officePath + "/program/classes/jurt.jar"); path.addElement(officePath + "/program/classes/jurt.jar");
path.addElement(officePath + "/program/classes/unoil.jar"); path.addElement(officePath + "/program/classes/unoil.jar");
......
...@@ -51,9 +51,9 @@ public class OfficeDocument ...@@ -51,9 +51,9 @@ public class OfficeDocument
return false; return false;
} }
public Enumeration getParcels() { public Enumeration<String> getParcels() {
Vector parcels = new Vector(); Vector<String> parcels = new Vector<String>();
ZipFile zp = null; ZipFile zp = null;
try try
......
...@@ -57,11 +57,11 @@ public class SVersionRCFile { ...@@ -57,11 +57,11 @@ public class SVersionRCFile {
/* Make sure this is in LowerCase !!!!! */ /* Make sure this is in LowerCase !!!!! */
private static final String SCRIPTF = "scriptf"; private static final String SCRIPTF = "scriptf";
private static final HashMap files = new HashMap(3); private static final HashMap<String, SVersionRCFile> files = new HashMap<String, SVersionRCFile>(3);
private File sversionrc = null; private File sversionrc = null;
private OfficeInstallation defaultversion = null; private OfficeInstallation defaultversion = null;
private Vector versions = null; private Vector<OfficeInstallation> versions = null;
private long lastModified = 0; private long lastModified = 0;
public SVersionRCFile() { public SVersionRCFile() {
...@@ -70,7 +70,7 @@ public class SVersionRCFile { ...@@ -70,7 +70,7 @@ public class SVersionRCFile {
public SVersionRCFile(String name) { public SVersionRCFile(String name) {
sversionrc = new File(name); sversionrc = new File(name);
versions = new Vector(5); versions = new Vector<OfficeInstallation>(5);
} }
public static SVersionRCFile createInstance() { public static SVersionRCFile createInstance() {
...@@ -81,7 +81,7 @@ public class SVersionRCFile { ...@@ -81,7 +81,7 @@ public class SVersionRCFile {
SVersionRCFile result = null; SVersionRCFile result = null;
synchronized(SVersionRCFile.class) { synchronized(SVersionRCFile.class) {
result = (SVersionRCFile)files.get(name); result = files.get(name);
if (result == null) { if (result == null) {
result = new SVersionRCFile(name); result = new SVersionRCFile(name);
...@@ -99,7 +99,7 @@ public class SVersionRCFile { ...@@ -99,7 +99,7 @@ public class SVersionRCFile {
return defaultversion; return defaultversion;
} }
public Enumeration getVersions() throws IOException { public Enumeration<OfficeInstallation> getVersions() throws IOException {
long l = sversionrc.lastModified(); long l = sversionrc.lastModified();
...@@ -209,7 +209,7 @@ public class SVersionRCFile { ...@@ -209,7 +209,7 @@ public class SVersionRCFile {
else else
ov = new SVersionRCFile(args[0]); ov = new SVersionRCFile(args[0]);
Enumeration enumer; Enumeration<OfficeInstallation> enumer;
try { try {
enumer = ov.getVersions(); enumer = ov.getVersions();
...@@ -220,7 +220,7 @@ public class SVersionRCFile { ...@@ -220,7 +220,7 @@ public class SVersionRCFile {
} }
while (enumer.hasMoreElements()) { while (enumer.hasMoreElements()) {
OfficeInstallation oi = (OfficeInstallation)enumer.nextElement(); OfficeInstallation oi = enumer.nextElement();
System.out.println("Name: " + oi.getName() + ", Path: " + oi.getPath() + System.out.println("Name: " + oi.getName() + ", Path: " + oi.getPath() +
", URL: " + oi.getURL()); ", URL: " + oi.getURL());
} }
......
...@@ -38,13 +38,14 @@ import java.awt.event.ActionEvent; ...@@ -38,13 +38,14 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import com.sun.star.script.framework.container.ParcelDescriptor; import com.sun.star.script.framework.container.ParcelDescriptor;
import com.sun.star.script.framework.container.ScriptEntry;
import org.openoffice.idesupport.zip.ParcelZipper; import org.openoffice.idesupport.zip.ParcelZipper;
public class ConfigurePanel extends JPanel { public class ConfigurePanel extends JPanel {
private File basedir; private File basedir;
private Vector classpath; private Vector<String> classpath;
private ParcelDescriptor descriptor; private ParcelDescriptor descriptor;
private MethodPanel methodPanel; private MethodPanel methodPanel;
...@@ -53,7 +54,7 @@ public class ConfigurePanel extends JPanel { ...@@ -53,7 +54,7 @@ public class ConfigurePanel extends JPanel {
public static final String DIALOG_TITLE = public static final String DIALOG_TITLE =
"Choose What to Export as Scripts"; "Choose What to Export as Scripts";
public ConfigurePanel(String basedir, Vector classpath, public ConfigurePanel(String basedir, Vector<String> classpath,
ParcelDescriptor descriptor) { ParcelDescriptor descriptor) {
this.basedir = new File(basedir); this.basedir = new File(basedir);
...@@ -62,7 +63,7 @@ public class ConfigurePanel extends JPanel { ...@@ -62,7 +63,7 @@ public class ConfigurePanel extends JPanel {
initUI(); initUI();
} }
public ConfigurePanel(String basedir, Vector classpath) public ConfigurePanel(String basedir, Vector<String> classpath)
throws IOException { throws IOException {
this.basedir = new File(basedir); this.basedir = new File(basedir);
...@@ -72,7 +73,7 @@ public class ConfigurePanel extends JPanel { ...@@ -72,7 +73,7 @@ public class ConfigurePanel extends JPanel {
initUI(); initUI();
} }
public void reload(String basedir, Vector classpath, public void reload(String basedir, Vector<String> classpath,
ParcelDescriptor descriptor) { ParcelDescriptor descriptor) {
if (basedir != null) if (basedir != null)
...@@ -90,7 +91,7 @@ public class ConfigurePanel extends JPanel { ...@@ -90,7 +91,7 @@ public class ConfigurePanel extends JPanel {
scriptPanel.reload(descriptor.getScriptEntries()); scriptPanel.reload(descriptor.getScriptEntries());
} }
public void reload(String basedir, Vector classpath) public void reload(String basedir, Vector<String> classpath)
throws IOException { throws IOException {
if (basedir != null) if (basedir != null)
...@@ -108,7 +109,7 @@ public class ConfigurePanel extends JPanel { ...@@ -108,7 +109,7 @@ public class ConfigurePanel extends JPanel {
} }
public ParcelDescriptor getConfiguration() throws Exception { public ParcelDescriptor getConfiguration() throws Exception {
Enumeration scripts = scriptPanel.getScriptEntries(); Enumeration<ScriptEntry> scripts = scriptPanel.getScriptEntries();
descriptor.setScriptEntries(scripts); descriptor.setScriptEntries(scripts);
return descriptor; return descriptor;
} }
......
...@@ -33,7 +33,7 @@ import org.openoffice.idesupport.JavaFinder; ...@@ -33,7 +33,7 @@ import org.openoffice.idesupport.JavaFinder;
public class MethodPanel extends JPanel { public class MethodPanel extends JPanel {
private File basedir; private File basedir;
private Vector classpath; private Vector<String> classpath;
private final static String FIRST_PARAM = private final static String FIRST_PARAM =
"drafts.com.sun.star.script.framework.runtime.XScriptContext"; "drafts.com.sun.star.script.framework.runtime.XScriptContext";
...@@ -42,7 +42,7 @@ public class MethodPanel extends JPanel { ...@@ -42,7 +42,7 @@ public class MethodPanel extends JPanel {
private JList list; private JList list;
private ScriptEntry[] values; private ScriptEntry[] values;
public MethodPanel(File basedir, Vector classpath, String language) { public MethodPanel(File basedir, Vector<String> classpath, String language) {
this.basedir = basedir; this.basedir = basedir;
this.classpath = classpath; this.classpath = classpath;
...@@ -50,7 +50,7 @@ public class MethodPanel extends JPanel { ...@@ -50,7 +50,7 @@ public class MethodPanel extends JPanel {
initUI(); initUI();
} }
public void reload(File basedir, Vector classpath, String language) { public void reload(File basedir, Vector<String> classpath, String language) {
this.basedir = basedir; this.basedir = basedir;
this.classpath = classpath; this.classpath = classpath;
......
...@@ -81,7 +81,7 @@ public class ScriptPanel extends JPanel { ...@@ -81,7 +81,7 @@ public class ScriptPanel extends JPanel {
model.removeAll(); model.removeAll();
} }
public Enumeration getScriptEntries() { public Enumeration<ScriptEntry> getScriptEntries() {
return model.getScriptEntries(); return model.getScriptEntries();
} }
...@@ -121,11 +121,11 @@ public class ScriptPanel extends JPanel { ...@@ -121,11 +121,11 @@ public class ScriptPanel extends JPanel {
final String[] columnNames = {"Exported Method", final String[] columnNames = {"Exported Method",
"Script Name"}; "Script Name"};
private Vector scripts; private Vector<ScriptEntry> scripts;
private int nextRow; private int nextRow;
public ScriptTableModel(ScriptEntry[] entries) { public ScriptTableModel(ScriptEntry[] entries) {
scripts = new Vector(entries.length + 11); scripts = new Vector<ScriptEntry>(entries.length + 11);
for (int i = 0; i < entries.length; i++) { for (int i = 0; i < entries.length; i++) {
scripts.addElement(entries[i]); scripts.addElement(entries[i]);
} }
...@@ -162,7 +162,7 @@ public class ScriptPanel extends JPanel { ...@@ -162,7 +162,7 @@ public class ScriptPanel extends JPanel {
nextRow = 0; nextRow = 0;
} }
public Enumeration getScriptEntries() { public Enumeration<ScriptEntry> getScriptEntries() {
return scripts.elements(); return scripts.elements();
} }
...@@ -170,7 +170,7 @@ public class ScriptPanel extends JPanel { ...@@ -170,7 +170,7 @@ public class ScriptPanel extends JPanel {
String result = ""; String result = "";
ScriptEntry entry; ScriptEntry entry;
entry = (ScriptEntry)scripts.elementAt(row); entry = scripts.elementAt(row);
if (col == 0) if (col == 0)
result = entry.getLanguageName(); result = entry.getLanguageName();
...@@ -188,7 +188,7 @@ public class ScriptPanel extends JPanel { ...@@ -188,7 +188,7 @@ public class ScriptPanel extends JPanel {
} }
public void setValueAt(Object value, int row, int col) { public void setValueAt(Object value, int row, int col) {
ScriptEntry entry = (ScriptEntry)scripts.elementAt(row); ScriptEntry entry = scripts.elementAt(row);
entry.setLogicalName((String)value); entry.setLogicalName((String)value);
fireTableCellUpdated(row, col); fireTableCellUpdated(row, col);
} }
......
...@@ -39,7 +39,7 @@ public class IdeUpdater extends Thread { ...@@ -39,7 +39,7 @@ public class IdeUpdater extends Thread {
private JLabel statusLabel; private JLabel statusLabel;
private Vector listeners; private Vector<InstallListener> listeners;
private Thread internalThread; private Thread internalThread;
private boolean threadSuspended; private boolean threadSuspended;
private JProgressBar progressBar; private JProgressBar progressBar;
...@@ -69,7 +69,7 @@ public class IdeUpdater extends Thread { ...@@ -69,7 +69,7 @@ public class IdeUpdater extends Thread {
System.out.println( "IdeUpdater installPath is " + installPath + " isNetbeansPath is " + isNetbeansPath ); System.out.println( "IdeUpdater installPath is " + installPath + " isNetbeansPath is " + isNetbeansPath );
this.installPath = installPath; this.installPath = installPath;
this.statusLabel = statusLabel; this.statusLabel = statusLabel;
listeners = new Vector(); listeners = new Vector<InstallListener>();
threadSuspended = false; threadSuspended = false;
progressBar=pBar; progressBar=pBar;
progressBar.setStringPainted(true); progressBar.setStringPainted(true);
...@@ -173,10 +173,10 @@ public class IdeUpdater extends Thread { ...@@ -173,10 +173,10 @@ public class IdeUpdater extends Thread {
private void onInstallComplete() private void onInstallComplete()
{ {
Enumeration e = listeners.elements(); Enumeration<InstallListener> e = listeners.elements();
while (e.hasMoreElements()) while (e.hasMoreElements())
{ {
InstallListener listener = (InstallListener)e.nextElement(); InstallListener listener = e.nextElement();
listener.installationComplete(null); listener.installationComplete(null);
} }
}// onInstallComplete }// onInstallComplete
......
...@@ -331,7 +331,6 @@ public class InstUtil { ...@@ -331,7 +331,6 @@ public class InstUtil {
public static Properties getOfficeVersions(File sversionFile) throws IOException { public static Properties getOfficeVersions(File sversionFile) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(sversionFile)); BufferedReader reader = new BufferedReader(new FileReader(sversionFile));
Vector values;
String sectionName = null; String sectionName = null;
Properties results = new Properties(); Properties results = new Properties();
......
...@@ -38,7 +38,7 @@ public class XmlUpdater extends Thread { ...@@ -38,7 +38,7 @@ public class XmlUpdater extends Thread {
private JLabel statusLabel; private JLabel statusLabel;
private Vector listeners; private Vector<InstallListener> listeners;
private Thread internalThread; private Thread internalThread;
private boolean threadSuspended; private boolean threadSuspended;
private JProgressBar progressBar; private JProgressBar progressBar;
...@@ -107,7 +107,7 @@ public class XmlUpdater extends Thread { ...@@ -107,7 +107,7 @@ public class XmlUpdater extends Thread {
this.statusLabel = statusLabel; this.statusLabel = statusLabel;
this.netInstall = netInstall; this.netInstall = netInstall;
this.bindingsInstall = bindingsInstall; this.bindingsInstall = bindingsInstall;
listeners = new Vector(); listeners = new Vector<InstallListener>();
threadSuspended = false; threadSuspended = false;
progressBar=pBar; progressBar=pBar;
progressBar.setStringPainted(true); progressBar.setStringPainted(true);
...@@ -432,10 +432,10 @@ public class XmlUpdater extends Thread { ...@@ -432,10 +432,10 @@ public class XmlUpdater extends Thread {
private void onInstallComplete() private void onInstallComplete()
{ {
Enumeration e = listeners.elements(); Enumeration<InstallListener> e = listeners.elements();
while (e.hasMoreElements()) while (e.hasMoreElements())
{ {
InstallListener listener = (InstallListener)e.nextElement(); InstallListener listener = e.nextElement();
listener.installationComplete(null); listener.installationComplete(null);
} }
}// onInstallComplete }// onInstallComplete
......
...@@ -42,8 +42,8 @@ public class Settings ...@@ -42,8 +42,8 @@ public class Settings
private static Settings m_instance; private static Settings m_instance;
private Vector m_WikiConnections = new Vector(); private Vector<Hashtable<String, String>> m_WikiConnections = new Vector<Hashtable<String, String>>();
private Vector m_aWikiDocs = new Vector(); private Vector<Hashtable<String, Object>> m_aWikiDocs = new Vector<Hashtable<String, Object>>();
private Settings( XComponentContext ctx ) private Settings( XComponentContext ctx )
{ {
...@@ -61,13 +61,13 @@ public class Settings ...@@ -61,13 +61,13 @@ public class Settings
} }
public void addWikiCon ( Hashtable wikiCon ) public void addWikiCon ( Hashtable<String, String> wikiCon )
{ {
m_WikiConnections.add( wikiCon ); m_WikiConnections.add( wikiCon );
} }
public Vector getWikiCons() public Vector<Hashtable<String, String>> getWikiCons()
{ {
return m_WikiConnections; return m_WikiConnections;
} }
...@@ -77,14 +77,14 @@ public class Settings ...@@ -77,14 +77,14 @@ public class Settings
String url = ""; String url = "";
if ( num >=0 && num < m_WikiConnections.size() ) if ( num >=0 && num < m_WikiConnections.size() )
{ {
Hashtable ht = ( Hashtable ) m_WikiConnections.get( num ); Hashtable ht = m_WikiConnections.get( num );
url = ( String ) ht.get( "Url" ); url = ( String ) ht.get( "Url" );
} }
return url; return url;
} }
public void addWikiDoc ( Hashtable aWikiDoc ) public void addWikiDoc ( Hashtable<String, Object> aWikiDoc )
{ {
String sURL = ( String ) aWikiDoc.get( "CompleteUrl" ); String sURL = ( String ) aWikiDoc.get( "CompleteUrl" );
Hashtable aEntry = getDocByCompleteUrl( sURL ); Hashtable aEntry = getDocByCompleteUrl( sURL );
...@@ -104,7 +104,7 @@ public class Settings ...@@ -104,7 +104,7 @@ public class Settings
} }
public Vector getWikiDocs() public Vector<Hashtable<String, Object>> getWikiDocs()
{ {
return m_aWikiDocs; return m_aWikiDocs;
} }
...@@ -112,11 +112,11 @@ public class Settings ...@@ -112,11 +112,11 @@ public class Settings
public Object[] getWikiDocList( int serverid, int num ) public Object[] getWikiDocList( int serverid, int num )
{ {
String wikiserverurl = getWikiConUrlByNumber( serverid ); String wikiserverurl = getWikiConUrlByNumber( serverid );
Vector theDocs = new Vector(); Vector<String> theDocs = new Vector<String>();
String [] docs = new String[0]; String [] docs = new String[0];
for ( int i=0; i<m_aWikiDocs.size(); i++ ) for ( int i=0; i<m_aWikiDocs.size(); i++ )
{ {
Hashtable ht = ( Hashtable ) m_aWikiDocs.get( i ); Hashtable ht = m_aWikiDocs.get( i );
String docurl = ( String ) ht.get( "Url" ); String docurl = ( String ) ht.get( "Url" );
if ( docurl.equals( wikiserverurl ) ) if ( docurl.equals( wikiserverurl ) )
{ {
...@@ -141,27 +141,27 @@ public class Settings ...@@ -141,27 +141,27 @@ public class Settings
String [] WikiList = new String [m_WikiConnections.size()]; String [] WikiList = new String [m_WikiConnections.size()];
for ( int i=0; i<m_WikiConnections.size(); i++ ) for ( int i=0; i<m_WikiConnections.size(); i++ )
{ {
Hashtable ht = ( Hashtable ) m_WikiConnections.get( i ); Hashtable ht = m_WikiConnections.get( i );
WikiList[i] = ( String ) ht.get( "Url" ); WikiList[i] = ( String ) ht.get( "Url" );
} }
return WikiList; return WikiList;
} }
public Hashtable getSettingByUrl( String sUrl ) public Hashtable<String, String> getSettingByUrl( String sUrl )
{ {
Hashtable ht = null; Hashtable<String, String> ht = null;
for( int i=0;i<m_WikiConnections.size();i++ ) for( int i=0;i<m_WikiConnections.size();i++ )
{ {
Hashtable h1 = ( Hashtable ) m_WikiConnections.get( i ); Hashtable<String, String> h1 = m_WikiConnections.get( i );
String u1 = ( String ) h1.get( "Url" ); String u1 = h1.get( "Url" );
if ( u1.equals( sUrl ) ) if ( u1.equals( sUrl ) )
{ {
ht = h1; ht = h1;
try try
{ {
String sUserName = (String)ht.get( "Username" ); String sUserName = ht.get( "Username" );
String aPassword = (String)ht.get( "Password" ); String aPassword = ht.get( "Password" );
if ( sUserName != null && sUserName.length() > 0 && ( aPassword == null || aPassword.length() == 0 ) ) if ( sUserName != null && sUserName.length() > 0 && ( aPassword == null || aPassword.length() == 0 ) )
{ {
String[] pPasswords = Helper.GetPasswordsForURLAndUser( m_xContext, sUrl, sUserName ); String[] pPasswords = Helper.GetPasswordsForURLAndUser( m_xContext, sUrl, sUserName );
...@@ -185,7 +185,7 @@ public class Settings ...@@ -185,7 +185,7 @@ public class Settings
Hashtable ht = null; Hashtable ht = null;
for( int i=0;i<m_aWikiDocs.size();i++ ) for( int i=0;i<m_aWikiDocs.size();i++ )
{ {
Hashtable h1 = ( Hashtable ) m_aWikiDocs.get( i ); Hashtable h1 = m_aWikiDocs.get( i );
String u1 = ( String ) h1.get( "CompleteUrl" ); String u1 = ( String ) h1.get( "CompleteUrl" );
if ( u1.equals( curl ) ) if ( u1.equals( curl ) )
{ {
...@@ -201,7 +201,7 @@ public class Settings ...@@ -201,7 +201,7 @@ public class Settings
Hashtable ht = null; Hashtable ht = null;
for( int i=0;i<m_WikiConnections.size();i++ ) for( int i=0;i<m_WikiConnections.size();i++ )
{ {
Hashtable h1 = ( Hashtable ) m_WikiConnections.get( i ); Hashtable h1 = m_WikiConnections.get( i );
String u1 = ( String ) h1.get( "Url" ); String u1 = ( String ) h1.get( "Url" );
if ( u1.equals( sUrl ) ) if ( u1.equals( sUrl ) )
{ {
...@@ -224,12 +224,12 @@ public class Settings ...@@ -224,12 +224,12 @@ public class Settings
} }
// store all connections // store all connections
XSingleServiceFactory xConnectionFactory = ( XSingleServiceFactory ) UnoRuntime.queryInterface( XSingleServiceFactory.class, xContainer ); XSingleServiceFactory xConnectionFactory = UnoRuntime.queryInterface( XSingleServiceFactory.class, xContainer );
for ( int i=0; i< m_WikiConnections.size(); i++ ) for ( int i=0; i< m_WikiConnections.size(); i++ )
{ {
Object oNewConnection = xConnectionFactory.createInstance(); Object oNewConnection = xConnectionFactory.createInstance();
Hashtable ht = ( Hashtable ) m_WikiConnections.get( i ); Hashtable ht = m_WikiConnections.get( i );
XNameReplace xNewConn = ( XNameReplace ) UnoRuntime.queryInterface( XNameReplace.class, oNewConnection ); XNameReplace xNewConn = UnoRuntime.queryInterface( XNameReplace.class, oNewConnection );
if ( xNewConn != null ) if ( xNewConn != null )
xNewConn.replaceByName( "UserName", ht.get( "Username" ) ); xNewConn.replaceByName( "UserName", ht.get( "Username" ) );
...@@ -237,7 +237,7 @@ public class Settings ...@@ -237,7 +237,7 @@ public class Settings
xContainer.insertByName( (String)ht.get( "Url" ), xNewConn ); xContainer.insertByName( (String)ht.get( "Url" ), xNewConn );
} }
// commit changes // commit changes
XChangesBatch xBatch = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xContainer ); XChangesBatch xBatch = UnoRuntime.queryInterface( XChangesBatch.class, xContainer );
xBatch.commitChanges(); xBatch.commitChanges();
// remove stored connection information // remove stored connection information
...@@ -248,13 +248,13 @@ public class Settings ...@@ -248,13 +248,13 @@ public class Settings
xContainer2.removeByName( pNames2[i] ); xContainer2.removeByName( pNames2[i] );
} }
// store all Docs // store all Docs
XSingleServiceFactory xDocListFactory = ( XSingleServiceFactory ) UnoRuntime.queryInterface( XSingleServiceFactory.class, xContainer2 ); XSingleServiceFactory xDocListFactory = UnoRuntime.queryInterface( XSingleServiceFactory.class, xContainer2 );
for ( int i=0; i< m_aWikiDocs.size(); i++ ) for ( int i=0; i< m_aWikiDocs.size(); i++ )
{ {
Hashtable ht = ( Hashtable ) m_aWikiDocs.get( i ); Hashtable ht = m_aWikiDocs.get( i );
Object oNewDoc = xDocListFactory.createInstance(); Object oNewDoc = xDocListFactory.createInstance();
XNameReplace xNewDoc = ( XNameReplace ) UnoRuntime.queryInterface( XNameReplace.class, oNewDoc ); XNameReplace xNewDoc = UnoRuntime.queryInterface( XNameReplace.class, oNewDoc );
Enumeration e = ht.keys(); Enumeration e = ht.keys();
while ( e.hasMoreElements() ) while ( e.hasMoreElements() )
...@@ -266,7 +266,7 @@ public class Settings ...@@ -266,7 +266,7 @@ public class Settings
xContainer2.insertByName( "d" + i, xNewDoc ); xContainer2.insertByName( "d" + i, xNewDoc );
} }
// commit changes // commit changes
XChangesBatch xBatch2 = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xContainer2 ); XChangesBatch xBatch2 = UnoRuntime.queryInterface( XChangesBatch.class, xContainer2 );
xBatch2.commitChanges(); xBatch2.commitChanges();
} }
...@@ -288,18 +288,18 @@ public class Settings ...@@ -288,18 +288,18 @@ public class Settings
if ( xAccess != null ) if ( xAccess != null )
{ {
Object oList = xAccess.getByName( "ConnectionList" ); Object oList = xAccess.getByName( "ConnectionList" );
XNameAccess xConnectionList = ( XNameAccess ) UnoRuntime.queryInterface( XNameAccess.class, oList ); XNameAccess xConnectionList = UnoRuntime.queryInterface( XNameAccess.class, oList );
String [] allCons = xConnectionList.getElementNames(); String [] allCons = xConnectionList.getElementNames();
for ( int i=0; i<allCons.length; i++ ) for ( int i=0; i<allCons.length; i++ )
{ {
Hashtable ht = new Hashtable(); Hashtable<String, String> ht = new Hashtable<String, String>();
ht.put( "Url", allCons[i] ); ht.put( "Url", allCons[i] );
ht.put( "Username", "" ); ht.put( "Username", "" );
ht.put( "Password", "" ); ht.put( "Password", "" );
try try
{ {
XPropertySet xProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xConnectionList.getByName( allCons[i] ) ); XPropertySet xProps = UnoRuntime.queryInterface( XPropertySet.class, xConnectionList.getByName( allCons[i] ) );
if ( xProps != null ) if ( xProps != null )
{ {
String aUsername = AnyConverter.toString( xProps.getPropertyValue( "UserName" ) ); String aUsername = AnyConverter.toString( xProps.getPropertyValue( "UserName" ) );
...@@ -316,13 +316,13 @@ public class Settings ...@@ -316,13 +316,13 @@ public class Settings
} }
Object oDocs = xAccess.getByName( "RecentDocs" ); Object oDocs = xAccess.getByName( "RecentDocs" );
XNameAccess xRecentDocs = ( XNameAccess ) UnoRuntime.queryInterface( XNameAccess.class, oDocs ); XNameAccess xRecentDocs = UnoRuntime.queryInterface( XNameAccess.class, oDocs );
String [] allDocs = xRecentDocs.getElementNames(); String [] allDocs = xRecentDocs.getElementNames();
for ( int i=0; i<allDocs.length; i++ ) for ( int i=0; i<allDocs.length; i++ )
{ {
Object oDoc = xRecentDocs.getByName( allDocs[i] ); Object oDoc = xRecentDocs.getByName( allDocs[i] );
XNameAccess xDoc = ( XNameAccess ) UnoRuntime.queryInterface( XNameAccess.class, oDoc ); XNameAccess xDoc = UnoRuntime.queryInterface( XNameAccess.class, oDoc );
Hashtable ht = new Hashtable(); Hashtable<String, Object> ht = new Hashtable<String, Object>();
ht.put( "Url", xDoc.getByName( "Url" ) ); ht.put( "Url", xDoc.getByName( "Url" ) );
ht.put( "CompleteUrl", xDoc.getByName( "CompleteUrl" ) ); ht.put( "CompleteUrl", xDoc.getByName( "CompleteUrl" ) );
ht.put( "Doc", xDoc.getByName( "Doc" ) ); ht.put( "Doc", xDoc.getByName( "Doc" ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment