summaryrefslogtreecommitdiff
path: root/odk
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-09-07 09:42:15 +0200
committerMichael Stahl <mstahl@redhat.com>2012-09-10 23:43:37 +0200
commita5ff5aad59bbe70cfaa0b18ec9df6f787a7160ca (patch)
tree6313b316dc96b82e5cafec866631d15b01a04e52 /odk
parente3d9ff3fd0b753a6712e86703e5f69392d241508 (diff)
Java5 update, Convert ArrayList and Vector code to use generics
Change-Id: I6cf6fa8e55005ffdc1d173aeee1e374efbb214fd
Diffstat (limited to 'odk')
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java6
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java12
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java8
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java4
-rw-r--r--odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java8
-rw-r--r--odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java36
-rw-r--r--odk/examples/DevelopersGuide/UCB/PropertiesComposer.java20
-rw-r--r--odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java26
-rw-r--r--odk/examples/java/Inspector/HideableTreeModel.java20
-rw-r--r--odk/examples/java/Inspector/Inspector.java48
-rw-r--r--odk/examples/java/Inspector/Introspector.java40
-rw-r--r--odk/examples/java/Inspector/MethodParametersDialog.java4
-rw-r--r--odk/examples/java/Inspector/SourceCodeGenerator.java38
-rw-r--r--odk/examples/java/Inspector/SwingUnoMethodNode.java2
-rw-r--r--odk/examples/java/Inspector/UnoMethodNode.java2
-rw-r--r--odk/examples/java/Inspector/UnoNode.java4
-rw-r--r--odk/examples/java/Inspector/XUnoMethodNode.java2
22 files changed, 147 insertions, 149 deletions
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java
index 7127cd8043a8..99c26e7c9f40 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java
@@ -65,5 +65,5 @@ public interface IOnewayLink
* Note: Atomic types (e.g. int, long) will be transported as objects
* too (Integer, Long)!
*/
- public abstract void execOneway( int nRequest, Vector lParams );
+ public abstract void execOneway( int nRequest, Vector<?> lParams );
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
index 66ab24d41512..42d01cf1e679 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
@@ -161,7 +161,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
* @param lParams
* the vector with all packed parameters of the original request
*/
- public void execOneway(/*IN*/ int nRequest,/*IN*/ Vector lParams )
+ public void execOneway(/*IN*/ int nRequest,/*IN*/ Vector<?> lParams )
{
synchronized(this)
{
@@ -338,7 +338,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
xFrame = m_xFrame;
}
- com.sun.star.frame.XDispatchProviderInterception xRegistration = (com.sun.star.frame.XDispatchProviderInterception)UnoRuntime.queryInterface(
+ com.sun.star.frame.XDispatchProviderInterception xRegistration = UnoRuntime.queryInterface(
com.sun.star.frame.XDispatchProviderInterception.class,
xFrame);
@@ -650,7 +650,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
if (bIsRegistered)
{
- com.sun.star.frame.XDispatchProviderInterception xRegistration = (com.sun.star.frame.XDispatchProviderInterception)UnoRuntime.queryInterface(
+ com.sun.star.frame.XDispatchProviderInterception xRegistration = UnoRuntime.queryInterface(
com.sun.star.frame.XDispatchProviderInterception.class,
xFrame);
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java
index 132ee897e2be..c549c4883a73 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java
@@ -77,7 +77,7 @@ class OnewayExecutor extends Thread
*/
private IOnewayLink m_rLink ;
private int m_nRequest ;
- private Vector m_lParams ;
+ private Vector<?> m_lParams ;
// _______________________________
@@ -103,7 +103,7 @@ class OnewayExecutor extends Thread
*/
public OnewayExecutor( IOnewayLink rLink ,
int nRequest ,
- Vector lParams )
+ Vector<?> lParams )
{
m_rLink = rLink ;
m_nRequest = nRequest;
@@ -148,7 +148,7 @@ class OnewayExecutor extends Thread
{
if (bEncode)
{
- lParams[0] = new Vector(1);
+ lParams[0] = new Vector<Object>(1);
lParams[0].add( (Object)(aAction[0]) );
}
else
@@ -166,7 +166,7 @@ class OnewayExecutor extends Thread
{
if (bEncode)
{
- lParams[0] = new Vector(1);
+ lParams[0] = new Vector<Object>(1);
lParams[0].add( (Object)aStatus[0] );
}
else
@@ -185,7 +185,7 @@ class OnewayExecutor extends Thread
{
if (bEncode)
{
- lParams[0] = new Vector(2);
+ lParams[0] = new Vector<Object>(2);
lParams[0].add( (Object)xListener[0] );
lParams[0].add( (Object)aURL[0] );
}
@@ -208,7 +208,7 @@ class OnewayExecutor extends Thread
{
int nLength = lArgs.length+1;
int nPos = 0;
- lParams[0] = new Vector(nLength);
+ lParams[0] = new Vector<Object>(nLength);
lParams[0].add( (Object)aURL[0] );
--nLength;
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
index 5bb20d3fe149..ac5d429ba08a 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
@@ -166,7 +166,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener,
* @param lParams
* the vector with all packed parameters of the original request
*/
- public void execOneway(/*IN*/ int nRequest,/*IN*/ Vector lParams )
+ public void execOneway(/*IN*/ int nRequest,/*IN*/ Vector<?> lParams )
{
synchronized(this)
{
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
index 451593f9a634..fb3e675820ae 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
@@ -75,8 +75,8 @@ public class ViewContainer extends Thread
*/
private ViewContainer()
{
- mlViews = new Vector();
- mlListener = new Vector();
+ mlViews = new Vector<Object>();
+ mlListener = new Vector<IShutdownListener>();
mbShutdownActive = false ;
Runtime.getRuntime().addShutdownHook(this);
}
@@ -259,7 +259,7 @@ public class ViewContainer extends Thread
*/
public static boolean mbInplace = false ;
private static ViewContainer maSingleton = null ;
- private Vector mlViews ;
- private Vector mlListener ;
+ private Vector<Object> mlViews ;
+ private Vector<IShutdownListener> mlListener ;
private boolean mbShutdownActive ;
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java
index 87b1ea3b5b3b..498a8919b20c 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java
@@ -50,7 +50,7 @@ public class PropChgHelper implements
XInterface xEvtSource;
String[] aPropNames;
XPropertySet xPropSet;
- ArrayList aLngSvcEvtListeners;
+ ArrayList<XLinguServiceEventListener> aLngSvcEvtListeners;
public PropChgHelper(
XInterface xEvtSource,
@@ -59,7 +59,7 @@ public class PropChgHelper implements
this.xEvtSource = xEvtSource;
this.aPropNames = aPropNames;
xPropSet = null;
- aLngSvcEvtListeners = new ArrayList();
+ aLngSvcEvtListeners = new ArrayList<XLinguServiceEventListener>();
}
public XInterface GetEvtSource()
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java
index 8008fcd5affd..e28fe57a8dd7 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java
@@ -77,7 +77,7 @@ public class SampleHyphenator extends ComponentBase implements
XServiceInfo
{
PropChgHelper_Hyph aPropChgHelper;
- ArrayList aEvtListeners;
+ ArrayList<?> aEvtListeners;
boolean bDisposing;
public SampleHyphenator()
@@ -93,7 +93,7 @@ public class SampleHyphenator extends ComponentBase implements
"HyphMinWordLength"
};
aPropChgHelper = new PropChgHelper_Hyph( (XHyphenator) this, aProps );
- aEvtListeners = new ArrayList();;
+ aEvtListeners = new ArrayList<Object>();;
bDisposing = false;
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java
index 6d28867a3e1d..e7dd243c6dc2 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java
@@ -77,7 +77,7 @@ public class SampleSpellChecker extends ComponentBase implements
XServiceInfo
{
PropChgHelper_Spell aPropChgHelper;
- ArrayList aEvtListeners;
+ ArrayList<?> aEvtListeners;
boolean bDisposing;
public SampleSpellChecker()
@@ -93,7 +93,7 @@ public class SampleSpellChecker extends ComponentBase implements
"IsSpellCapitalization"
};
aPropChgHelper = new PropChgHelper_Spell( (XSpellChecker) this, aProps );
- aEvtListeners = new ArrayList();
+ aEvtListeners = new ArrayList<Object>();
bDisposing = false;
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java
index fd56a5683882..824ed09a0562 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java
@@ -72,7 +72,7 @@ public class SampleThesaurus extends ComponentBase implements
XServiceInfo
{
PropChgHelper aPropChgHelper;
- ArrayList aEvtListeners;
+ ArrayList<?> aEvtListeners;
boolean bDisposing;
public SampleThesaurus()
@@ -91,7 +91,7 @@ public class SampleThesaurus extends ComponentBase implements
// 'GetValueToUse' function
aPropChgHelper = new PropChgHelper( (XThesaurus) this, aProps );
- aEvtListeners = new ArrayList();
+ aEvtListeners = new ArrayList<Object>();
bDisposing = false;
}
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java b/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java
index 8c827d0cc2f8..b7299d16595b 100644
--- a/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java
+++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java
@@ -50,8 +50,8 @@ class ExampleSettings
}
public int nMemberCount = 3;
- public java.util.List aColDimensions = new java.util.ArrayList();
- public java.util.List aRowDimensions = new java.util.ArrayList();
+ public java.util.List<Integer> aColDimensions = new java.util.ArrayList<Integer>();
+ public java.util.List<Integer> aRowDimensions = new java.util.ArrayList<Integer>();
}
// XPropertySetInfo implementation for getPropertySetInfo
@@ -839,7 +839,7 @@ public class ExampleDataPilotSource
int nRowResult = 0;
for (int nRowDim=0; nRowDim<nRowDimCount; nRowDim++)
{
- int nDim = ((Integer)aSettings.aRowDimensions.get(nRowDimCount-nRowDim-1)).intValue();
+ int nDim = aSettings.aRowDimensions.get(nRowDimCount-nRowDim-1).intValue();
nRowResult += ( nRowVal % nMemberCount ) * nDigits[nDim];
nRowVal /= nMemberCount;
}
@@ -851,7 +851,7 @@ public class ExampleDataPilotSource
int nResult = nRowResult;
for (int nColDim=0; nColDim<nColDimCount; nColDim++)
{
- int nDim = ((Integer)aSettings.aColDimensions.get(nColDimCount-nColDim-1)).intValue();
+ int nDim = aSettings.aColDimensions.get(nColDimCount-nColDim-1).intValue();
nResult += ( nColVal % nMemberCount ) * nDigits[nDim];
nColVal /= nMemberCount;
}
diff --git a/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java b/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java
index 24d627111f38..f33e71d4cfd5 100644
--- a/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java
+++ b/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java
@@ -57,7 +57,7 @@ public class ChildrenRetriever {
private Helper m_helper;
private XContent m_content;
private String m_contenturl = "";
- private Vector m_propnames = new Vector();
+ private Vector<String> m_propnames = new Vector<String>();
/**
* Constructor. Create a new connection with the specific args to a running office
@@ -92,9 +92,9 @@ public class ChildrenRetriever {
*@exception com.sun.star.ucb.CommandAbortedException
*@exception com.sun.star.uno.Exception
*/
- public Vector getChildren()
+ public Vector<Vector<Object>> getChildren()
throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception {
- Vector properties = getProperties();
+ Vector<String> properties = getProperties();
return getChildren ( properties );
}
@@ -107,10 +107,10 @@ public class ChildrenRetriever {
*@exception com.sun.star.ucb.CommandAbortedException
*@exception com.sun.star.uno.Exception
*/
- public Vector getChildren( Vector properties )
+ public Vector<Vector<Object>> getChildren( Vector<String> properties )
throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception {
- Vector result = null;
+ Vector<Vector<Object>> result = null;
if ( m_content != null ) {
int size = 0;
if ( properties != null && !properties.isEmpty()) {
@@ -122,7 +122,7 @@ public class ChildrenRetriever {
// Define property sequence.
Property prop = new Property();
- prop.Name = ( String )properties.get( index );
+ prop.Name = properties.get( index );
prop.Handle = -1; // n/a
props[ index ] = prop;
}
@@ -136,11 +136,11 @@ public class ChildrenRetriever {
XDynamicResultSet set;
// Execute command "open".
- set = ( XDynamicResultSet )UnoRuntime.queryInterface(
+ set = UnoRuntime.queryInterface(
XDynamicResultSet.class, m_helper.executeCommand( m_content, "open", arg ));
XResultSet resultSet = ( XResultSet )set.getStaticResultSet();
- result = new Vector();
+ result = new Vector<Vector<Object>>();
/////////////////////////////////////////////////////////////////////
// Iterate over children, access children and property values...
@@ -148,12 +148,12 @@ public class ChildrenRetriever {
// Move to begin.
if ( resultSet.first() ) {
- XContentAccess contentAccess = ( XContentAccess )UnoRuntime.queryInterface(
+ XContentAccess contentAccess = UnoRuntime.queryInterface(
XContentAccess.class, resultSet );
- XRow row = ( XRow )UnoRuntime.queryInterface( XRow.class, resultSet );
+ XRow row = UnoRuntime.queryInterface( XRow.class, resultSet );
do {
- Vector propsValues = new Vector();
+ Vector<Object> propsValues = new Vector<Object>();
// Obtain URL of child.
String id = contentAccess.queryContentIdentifierString();
@@ -187,7 +187,7 @@ public class ChildrenRetriever {
*
*@return String That contains the properties
*/
- public Vector getProperties() {
+ public Vector<String> getProperties() {
return m_propnames;
}
@@ -243,7 +243,7 @@ public class ChildrenRetriever {
*
*@param Vector
*/
- public void printLine( Vector props ) {
+ public void printLine( Vector<Object> props ) {
int limit;
while ( !props.isEmpty() ) {
String print = "";
@@ -305,7 +305,7 @@ public class ChildrenRetriever {
ChildrenRetriever access = new ChildrenRetriever( args );
// Get the properties Title and IsFolder for the children.
- Vector result = access.getChildren();
+ Vector<Vector<Object>> result = access.getChildren();
String tempPrint = "\nChildren of resource " + access.getContentURL();
int size = tempPrint.length();
@@ -318,9 +318,9 @@ public class ChildrenRetriever {
if ( result != null && !result.isEmpty() ) {
- Vector cont = new Vector();
+ Vector<Object> cont = new Vector<Object>();
cont.add("URL:");
- Vector props = access.getProperties();
+ Vector<String> props = access.getProperties();
size = props.size();
for ( int i = 0; i < size; i++ ) {
Object obj = props.get( i );
@@ -329,8 +329,8 @@ public class ChildrenRetriever {
}
access.printLine(cont);
System.out.println( "\n" );
- for ( Enumeration e = result.elements(); e.hasMoreElements(); ) {
- Vector propsV = ( Vector )e.nextElement();
+ for ( Enumeration<Vector<Object>> e = result.elements(); e.hasMoreElements(); ) {
+ Vector<Object> propsV = e.nextElement();
access.printLine( propsV );
}
}
diff --git a/odk/examples/DevelopersGuide/UCB/PropertiesComposer.java b/odk/examples/DevelopersGuide/UCB/PropertiesComposer.java
index 739ba7b2e687..794502262ff2 100644
--- a/odk/examples/DevelopersGuide/UCB/PropertiesComposer.java
+++ b/odk/examples/DevelopersGuide/UCB/PropertiesComposer.java
@@ -49,8 +49,8 @@ public class PropertiesComposer {
private Helper m_helper;
private XContent m_content;
private String m_contenturl = "";
- private Vector m_propNames = new Vector();
- private Vector m_propValues = new Vector();
+ private Vector<String> m_propNames = new Vector<String>();
+ private Vector<String> m_propValues = new Vector<String>();
/**
* Constructor.
@@ -89,8 +89,8 @@ public class PropertiesComposer {
*/
public Object[] setProperties()
throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception {
- Vector properties = getProperties();
- Vector propertyValues = getPropertyValues();
+ Vector<String> properties = getProperties();
+ Vector<String> propertyValues = getPropertyValues();
return setProperties( properties, propertyValues );
}
@@ -104,7 +104,7 @@ public class PropertiesComposer {
*@exception com.sun.star.ucb.CommandAbortedException
*@exception com.sun.star.uno.Exception
*/
- public Object[] setProperties( Vector properties, Vector propertiesValues )
+ public Object[] setProperties( Vector<String> properties, Vector<String> propertiesValues )
throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception {
Object[] result = null;
@@ -127,7 +127,7 @@ public class PropertiesComposer {
int size = properties.size();
PropertyValue[] props = new PropertyValue[ size ];
for ( int index = 0 ; index < size; index++ ) {
- String propName = ( String )properties.get( index );
+ String propName = properties.get( index );
Object propValue = propertiesValues.get( index );
/*
@@ -161,7 +161,7 @@ public class PropertiesComposer {
*
*@return Vector That contains the properties names
*/
- public Vector getProperties() {
+ public Vector<String> getProperties() {
return m_propNames;
}
@@ -170,7 +170,7 @@ public class PropertiesComposer {
*
*@return Vector That contains the properties values
*/
- public Vector getPropertyValues() {
+ public Vector<String> getPropertyValues() {
return m_propValues;
}
@@ -263,8 +263,8 @@ public class PropertiesComposer {
try {
PropertiesComposer setProp = new PropertiesComposer( args );
- Vector properties = setProp.getProperties();
- Vector propertiesValues = setProp.getPropertyValues();
+ Vector<String> properties = setProp.getProperties();
+ Vector<String> propertiesValues = setProp.getPropertyValues();
Object[] result = setProp.setProperties( properties, propertiesValues );
String tempPrint = "\nSetting properties of resource " + setProp.getContentURL();
diff --git a/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java b/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java
index 2d000c1a3b90..49f0fa2a3604 100644
--- a/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java
+++ b/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java
@@ -52,7 +52,7 @@ public class PropertiesRetriever {
private Helper m_helper;
private XContent m_content;
private String m_contenturl = "";
- private Vector m_propNames = new Vector();
+ private Vector<String> m_propNames = new Vector<String>();
/**
* Constructor.
@@ -87,9 +87,9 @@ public class PropertiesRetriever {
*@exception com.sun.star.ucb.CommandAbortedException
*@exception com.sun.star.uno.Exception
*/
- public Vector getPropertyValues()
+ public Vector<Object> getPropertyValues()
throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception {
- Vector properties = getProperties();
+ Vector<String> properties = getProperties();
return getPropertyValues ( properties );
}
@@ -101,9 +101,9 @@ public class PropertiesRetriever {
*@exception com.sun.star.ucb.CommandAbortedException
*@exception com.sun.star.uno.Exception
*/
- public Vector getPropertyValues( Vector properties )
+ public Vector<Object> getPropertyValues( Vector<String> properties )
throws com.sun.star.ucb.CommandAbortedException, com.sun.star.uno.Exception {
- Vector m_propValues = null;
+ Vector<Object> m_propValues = null;
if ( m_content != null && properties != null && !properties.isEmpty() ) {
int size = properties.size();
@@ -114,17 +114,17 @@ public class PropertiesRetriever {
// Define property sequence.
Property prop = new Property();
- prop.Name = ( String )properties.get( index );
+ prop.Name = properties.get( index );
prop.Handle = -1; // n/a
props[ index ] = prop;
}
// Execute command "getPropertyValues".
XRow values =
- ( XRow )UnoRuntime.queryInterface(
- XRow.class, m_helper.executeCommand( m_content,"getPropertyValues", props ));
+ UnoRuntime.queryInterface(
+ XRow.class, m_helper.executeCommand( m_content,"getPropertyValues", props ));
- m_propValues = new Vector();
+ m_propValues = new Vector<Object>();
/*
Extract values from row object. Note that the
@@ -155,7 +155,7 @@ public class PropertiesRetriever {
*
*@return Vector That contains the properties
*/
- public Vector getProperties() {
+ public Vector<String> getProperties() {
return m_propNames;
}
@@ -222,8 +222,8 @@ public class PropertiesRetriever {
"--------------------------------------------------------------" );
try {
PropertiesRetriever obtProperty = new PropertiesRetriever( args );
- Vector properties = obtProperty.getProperties();
- Vector propertiesValues = obtProperty.getPropertyValues( properties );
+ Vector<String> properties = obtProperty.getProperties();
+ Vector<Object> propertiesValues = obtProperty.getPropertyValues( properties );
String tempPrint = "\nProperties of resource " + obtProperty.getContentURL();
int size = tempPrint.length();
@@ -237,7 +237,7 @@ public class PropertiesRetriever {
if ( properties != null && propertiesValues != null ) {
size = properties.size();
for (int index = 0; index < size ; index++ ) {
- String property = ( String )properties.get( index );
+ String property = properties.get( index );
Object propValue = propertiesValues.get( index );
System.out.println( property + " : " + propValue );
}
diff --git a/odk/examples/java/Inspector/HideableTreeModel.java b/odk/examples/java/Inspector/HideableTreeModel.java
index df5b0e26acba..21732e6776fe 100644
--- a/odk/examples/java/Inspector/HideableTreeModel.java
+++ b/odk/examples/java/Inspector/HideableTreeModel.java
@@ -26,7 +26,7 @@ import javax.swing.tree.*;
public class HideableTreeModel implements TreeModel {
- private Vector modelListeners = new Vector();
+ private Vector<TreeModelListener> modelListeners = new Vector<TreeModelListener>();
private Object root = null;
@@ -136,39 +136,39 @@ public class HideableTreeModel implements TreeModel {
protected void fireTreeNodesChanged(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
- ((TreeModelListener)modelListeners.elementAt(i)).treeNodesChanged(event);
+ modelListeners.elementAt(i).treeNodesChanged(event);
}
}
protected void fireTreeNodesInserted(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
- ((TreeModelListener)modelListeners.elementAt(i)).treeNodesInserted(event);
+ modelListeners.elementAt(i).treeNodesInserted(event);
}
}
protected void fireTreeNodesRemoved(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
- ((TreeModelListener)modelListeners.elementAt(i)).treeNodesRemoved(event);
+ modelListeners.elementAt(i).treeNodesRemoved(event);
}
}
protected void fireTreeStructureChanged(TreeModelEvent event) {
for(int i = 0; i < modelListeners.size(); i++) {
- ((TreeModelListener)modelListeners.elementAt(i)).treeStructureChanged(event);
+ modelListeners.elementAt(i).treeStructureChanged(event);
}
}
- public ArrayList getExpandedPaths(JTree tree) {
- ArrayList expandedPaths = new ArrayList();
+ public ArrayList<TreePath> getExpandedPaths(JTree tree) {
+ ArrayList<TreePath> expandedPaths = new ArrayList<TreePath>();
addExpandedPaths(tree, tree.getPathForRow(0), expandedPaths);
return expandedPaths;
}
- private void addExpandedPaths(JTree tree, TreePath path, ArrayList pathlist) {
+ private void addExpandedPaths(JTree tree, TreePath path, ArrayList<TreePath> pathlist) {
Enumeration aEnum = tree.getExpandedDescendants(path);
while(aEnum.hasMoreElements()) {
TreePath tp = (TreePath) aEnum.nextElement();
@@ -178,9 +178,9 @@ public class HideableTreeModel implements TreeModel {
}
- public void expandPaths(JTree tree, ArrayList pathlist) {
+ public void expandPaths(JTree tree, ArrayList<TreePath> pathlist) {
for(int i = 0; i < pathlist.size(); i++) {
- tree.expandPath((TreePath)pathlist.get(i));
+ tree.expandPath(pathlist.get(i));
}
}
diff --git a/odk/examples/java/Inspector/Inspector.java b/odk/examples/java/Inspector/Inspector.java
index f83f5a76b56a..a2f85758c196 100644
--- a/odk/examples/java/Inspector/Inspector.java
+++ b/odk/examples/java/Inspector/Inspector.java
@@ -77,13 +77,13 @@ public class Inspector{
static public class _Inspector extends WeakBase implements XInstanceInspector, XServiceInfo{
static private final String __serviceName = "org.openoffice.InstanceInspector";
- private HashMap aApplicationHashMap = new HashMap();
+ private HashMap<String, String> aApplicationHashMap = new HashMap<String, String>();
private String sTitle = "Object Inspector";
- private Vector aHiddenDocuments = new Vector();
+ private Vector<XComponent> aHiddenDocuments = new Vector<XComponent>();
// private String[] sApplicationDocUrls = new String[]{"private:factory/swriter", "private:factory/scalc", "private:factory/simpress", "private:factory/sdraw", "private:factory/sbase"};
// private String[] sApplicationDocNames = new String[]{"Text Document", "Spreadsheet", "Presentation", "Drawing", "Database"};
private XComponentContext m_xComponentContext;
- private HashMap aInspectorPanes = new HashMap();
+ private HashMap<String, InspectorPane> aInspectorPanes = new HashMap<String, InspectorPane>();
private XDialogProvider m_oSwingDialogProvider;
private TDocSupplier oTDocSupplier;
private Introspector m_oIntrospector = null;
@@ -108,7 +108,7 @@ public class Inspector{
}
- public HashMap getInspectorPages(){
+ public HashMap<String, InspectorPane> getInspectorPages(){
return aInspectorPanes;
}
@@ -117,7 +117,7 @@ public class Inspector{
String sRetPath = "";
try{
XNameAccess xNameAccess = getConfigurationAccess("org.openoffice.inspector.ObjectInspector", true);
- XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xNameAccess);
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xNameAccess);
sRetPath = (String) xPropertySet.getPropertyValue("SDKPath");
}catch( Exception exception ) {
exception.printStackTrace(System.err);
@@ -154,9 +154,9 @@ public class Inspector{
try {
String sInstallationFolder = "";
Object oFolderPicker = m_xComponentContext.getServiceManager().createInstanceWithContext("com.sun.star.ui.dialogs.FolderPicker", m_xComponentContext);
- XFolderPicker xFolderPicker = (XFolderPicker) UnoRuntime.queryInterface(XFolderPicker.class, oFolderPicker);
- XExecutableDialog xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, oFolderPicker);
- XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, oFolderPicker);
+ XFolderPicker xFolderPicker = UnoRuntime.queryInterface(XFolderPicker.class, oFolderPicker);
+ XExecutableDialog xExecutable = UnoRuntime.queryInterface(XExecutableDialog.class, oFolderPicker);
+ XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, oFolderPicker);
String sPath = getSDKPath();
if (!sPath.equals("")){
xFolderPicker.setDisplayDirectory(sPath);
@@ -167,15 +167,15 @@ public class Inspector{
sInstallationFolder = xFolderPicker.getDirectory();
if (m_oIntrospector.isValidSDKInstallationPath(sInstallationFolder)){
XNameAccess xNameAccess = getConfigurationAccess(true);
- XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xNameAccess);
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xNameAccess);
xPropertySet.setPropertyValue("SDKPath", sInstallationFolder);
- XChangesBatch xBatch = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, xNameAccess);
+ XChangesBatch xBatch = UnoRuntime.queryInterface(XChangesBatch.class, xNameAccess);
xBatch.commitChanges();
}
else{
- XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xFolderPicker);
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xFolderPicker);
Object oWindow = xPropertySet.getPropertyValue("Window");
- XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, oWindow);
+ XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, oWindow);
showErrorMessageBox(xWindowPeer, sTitle, sWRONGINSTALLATIONPATH);
assignSDKPath();
}
@@ -189,10 +189,10 @@ public class Inspector{
public void showErrorMessageBox(XWindowPeer _xWindowPeer, String _sTitle, String _sMessage){
try {
Object oToolkit = m_xComponentContext.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit", m_xComponentContext);
- XMessageBoxFactory xMessageBoxFactory = (XMessageBoxFactory) UnoRuntime.queryInterface(XMessageBoxFactory.class, oToolkit);
+ XMessageBoxFactory xMessageBoxFactory = UnoRuntime.queryInterface(XMessageBoxFactory.class, oToolkit);
Rectangle aRectangle = new Rectangle();
XMessageBox xMessageBox = xMessageBoxFactory.createMessageBox(_xWindowPeer, aRectangle, "errorbox", com.sun.star.awt.MessageBoxButtons.BUTTONS_OK, _sTitle, _sMessage);
- XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xMessageBox);
+ XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, xMessageBox);
if (xMessageBox != null){
short nResult = xMessageBox.execute();
xComponent.dispose();
@@ -217,7 +217,7 @@ public class Inspector{
public void inspectOpenEmptyDocument(String _sApplicationDocUrl){
XComponent xComponent = getTDocSupplier().openEmptyDocument(_sApplicationDocUrl);
- String sRootTitle = (String) aApplicationHashMap.get(_sApplicationDocUrl);
+ String sRootTitle = aApplicationHashMap.get(_sApplicationDocUrl);
inspect(xComponent, sRootTitle);
aHiddenDocuments.add(xComponent);
}
@@ -263,7 +263,7 @@ public class Inspector{
try{
String sLanguage = "Java";
XNameAccess xNameAccess = getConfigurationAccess("org.openoffice.inspector.ObjectInspector", true);
- XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xNameAccess);
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xNameAccess);
switch (_nLanguage){
case XLanguageSourceCodeGenerator.nJAVA:
sLanguage = "Java";
@@ -278,7 +278,7 @@ public class Inspector{
System.out.println("Warning: Sourcecode language is not defined!");
}
xPropertySet.setPropertyValue("Language", sLanguage);
- XChangesBatch xBatch = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, xNameAccess);
+ XChangesBatch xBatch = UnoRuntime.queryInterface(XChangesBatch.class, xNameAccess);
xBatch.commitChanges();
for (int i = 0; i < m_oSwingDialogProvider.getInspectorPageCount(); i++){
m_oSwingDialogProvider.getInspectorPage(i).convertCompleteSourceCode(_nLanguage);
@@ -306,14 +306,14 @@ public class Inspector{
public String[][] getApplicationUrls(){
- Set aSet = aApplicationHashMap.keySet();
+ Set<String> aSet = aApplicationHashMap.keySet();
String[][] sReturnList = new String[aSet.size()][];
int n= 0;
- for ( Iterator i = aSet.iterator(); i.hasNext(); ){
+ for ( Iterator<String> i = aSet.iterator(); i.hasNext(); ){
String[] sSingleApplication = new String[2];
- sSingleApplication[0] = (String) i.next();
+ sSingleApplication[0] = i.next();
// assign the title in the second index
- sSingleApplication[1] = (String) aApplicationHashMap.get(sSingleApplication[0]);
+ sSingleApplication[1] = aApplicationHashMap.get(sSingleApplication[0]);
sReturnList[n++] = sSingleApplication;
}
return sReturnList;
@@ -324,10 +324,10 @@ public class Inspector{
int nHiddenCount = aHiddenDocuments.size();
if (nHiddenCount > 0){
for (int i = nHiddenCount - 1; i >= 0; i--){
- XComponent xComponent = (XComponent) aHiddenDocuments.get(i);
+ XComponent xComponent = aHiddenDocuments.get(i);
if (xComponent != null){
try {
- XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, xComponent);
+ XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, xComponent);
xCloseable.close(true);
aHiddenDocuments.remove(i);
} catch (CloseVetoException ex) {
@@ -413,7 +413,7 @@ public class Inspector{
XMultiComponentFactory xMCF = m_xComponentContext.getServiceManager();
XMultiServiceFactory xMSFCfg = theDefaultProvider.get(this.getXComponentContext());
Object oAccess = xMSFCfg.createInstanceWithArguments(sAccess, new Object[]{new NamedValue("nodepath", _sNodePath)});
- xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oAccess);
+ xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oAccess);
} catch (com.sun.star.uno.Exception e) {
}
return xNameAccess;
diff --git a/odk/examples/java/Inspector/Introspector.java b/odk/examples/java/Inspector/Introspector.java
index 1ea2eb382a3c..e8c80cf5c82d 100644
--- a/odk/examples/java/Inspector/Introspector.java
+++ b/odk/examples/java/Inspector/Introspector.java
@@ -106,9 +106,9 @@ public class Introspector extends WeakBase{
m_xComponentContext = _xComponentContext;
m_xMultiComponentFactory = m_xComponentContext.getServiceManager();
Object o = m_xMultiComponentFactory.createInstanceWithContext("com.sun.star.beans.Introspection", m_xComponentContext);
- m_xIntrospection = ( XIntrospection ) UnoRuntime.queryInterface(XIntrospection.class, o );
+ m_xIntrospection = UnoRuntime.queryInterface(XIntrospection.class, o );
Object oCoreReflection = getXMultiComponentFactory().createInstanceWithContext("com.sun.star.reflection.CoreReflection", getXComponentContext());
- mxIdlReflection = (XIdlReflection) UnoRuntime.queryInterface(XIdlReflection.class, oCoreReflection);
+ mxIdlReflection = UnoRuntime.queryInterface(XIdlReflection.class, oCoreReflection);
initTypeDescriptionManager();
}
catch( Exception exception ) {
@@ -136,13 +136,13 @@ public class Introspector extends WeakBase{
try {
XIntrospectionAccess xIntrospectionAccessObject = getXIntrospectionAccess(_oUnoObject);
if (xIntrospectionAccessObject != null){
- XEnumerationAccess xEnumerationAccess = (XEnumerationAccess) UnoRuntime.queryInterface(XEnumerationAccess.class, xIntrospectionAccessObject.queryAdapter( new Type( XEnumerationAccess.class ) ) );
+ XEnumerationAccess xEnumerationAccess = UnoRuntime.queryInterface(XEnumerationAccess.class, xIntrospectionAccessObject.queryAdapter( new Type( XEnumerationAccess.class ) ) );
if (xEnumerationAccess != null){
XEnumeration xEnumeration = xEnumerationAccess.createEnumeration();
bIsContainer = xEnumeration.hasMoreElements();
}
if (!bIsContainer){
- XIndexAccess xIndexAccess = (XIndexAccess) UnoRuntime.queryInterface( XIndexAccess.class, xIntrospectionAccessObject.queryAdapter(new Type( XIndexAccess.class )));
+ XIndexAccess xIndexAccess = UnoRuntime.queryInterface( XIndexAccess.class, xIntrospectionAccessObject.queryAdapter(new Type( XIndexAccess.class )));
if (xIndexAccess != null){
bIsContainer = (xIndexAccess.getCount() > 0);
}
@@ -160,17 +160,17 @@ public class Introspector extends WeakBase{
public Object[] getUnoObjectsOfContainer(Object _oUnoParentObject) {
Object[] oRetComponents = null;
try {
- Vector oRetComponentsVector = new Vector();
+ Vector<Object> oRetComponentsVector = new Vector<Object>();
XIntrospectionAccess xIntrospectionAccessObject = getXIntrospectionAccess(_oUnoParentObject);
if ( xIntrospectionAccessObject != null ) {
- XEnumerationAccess xEnumerationAccess = (XEnumerationAccess) UnoRuntime.queryInterface(XEnumerationAccess.class, xIntrospectionAccessObject.queryAdapter( new Type( XEnumerationAccess.class ) ) );
+ XEnumerationAccess xEnumerationAccess = UnoRuntime.queryInterface(XEnumerationAccess.class, xIntrospectionAccessObject.queryAdapter( new Type( XEnumerationAccess.class ) ) );
if ( xEnumerationAccess != null ) {
XEnumeration xEnumeration = xEnumerationAccess.createEnumeration();
while ( xEnumeration.hasMoreElements() ) {
oRetComponentsVector.add(xEnumeration.nextElement());
}
}
- XIndexAccess xIndexAccess = (XIndexAccess) UnoRuntime.queryInterface( XIndexAccess.class, xIntrospectionAccessObject.queryAdapter(new Type( XIndexAccess.class )));
+ XIndexAccess xIndexAccess = UnoRuntime.queryInterface( XIndexAccess.class, xIntrospectionAccessObject.queryAdapter(new Type( XIndexAccess.class )));
if ( xIndexAccess != null ) {
XIdlMethod mMethod = xIntrospectionAccessObject.getMethod("getByIndex", com.sun.star.beans.MethodConcept.INDEXCONTAINER);
for ( int i = 0; i < xIndexAccess.getCount(); i++ ) {
@@ -259,8 +259,8 @@ public class Introspector extends WeakBase{
protected Property[] getProperties(Object _oUnoObject, String _sServiceName){
Property[] aProperties = getProperties(_oUnoObject);
- List aListOfProperties = java.util.Arrays.asList(aProperties);
- Vector aPropertiesVector = new Vector(aListOfProperties);
+ List<Property> aListOfProperties = java.util.Arrays.asList(aProperties);
+ Vector<Property> aPropertiesVector = new Vector<Property>(aListOfProperties);
if (aProperties != null){
XPropertyTypeDescription[] xPropertyTypeDescriptions = getPropertyDescriptionsOfService(_sServiceName);
for (int i = aProperties.length - 1; i >= 0; i--){
@@ -277,8 +277,8 @@ public class Introspector extends WeakBase{
protected Type[] getInterfaces(Object _oUnoObject, String _sServiceName){
Type[] aTypes = getInterfaces(_oUnoObject);
- List aListOfTypes = java.util.Arrays.asList(aTypes);
- Vector aTypesVector = new Vector(aListOfTypes);
+ List<Type> aListOfTypes = java.util.Arrays.asList(aTypes);
+ Vector<Type> aTypesVector = new Vector<Type>(aListOfTypes);
if (aTypes != null){
XInterfaceTypeDescription[] xInterfaceTypeDescriptions = getInterfaceDescriptionsOfService(_sServiceName);
for (int i = aTypes.length - 1; i >= 0; i--){
@@ -300,7 +300,7 @@ public class Introspector extends WeakBase{
protected Type[] getInterfaces(Object _oUnoParentObject){
Type[] aTypes = new Type[]{};
- XTypeProvider xTypeProvider = ( XTypeProvider ) UnoRuntime.queryInterface( XTypeProvider.class, _oUnoParentObject);
+ XTypeProvider xTypeProvider = UnoRuntime.queryInterface( XTypeProvider.class, _oUnoParentObject);
if ( xTypeProvider != null ) {
aTypes = xTypeProvider.getTypes();
}
@@ -341,7 +341,7 @@ public class Introspector extends WeakBase{
|| ( _typeClass == TypeClass.UNSIGNED_SHORT ));
}
- public static boolean isObjectPrimitive(Class _oUnoClass, TypeClass _typeClass){
+ public static boolean isObjectPrimitive(Class<? extends Object> _oUnoClass, TypeClass _typeClass){
return !( ( !_oUnoClass.isPrimitive() ) && ( _typeClass != TypeClass.ARRAY )
&& ( _typeClass != TypeClass.BOOLEAN )
&& ( _typeClass != TypeClass.BYTE )
@@ -362,7 +362,7 @@ public class Introspector extends WeakBase{
protected void initTypeDescriptionManager() {
try {
Object oTypeDescriptionManager = getXComponentContext().getValueByName("/singletons/com.sun.star.reflection.theTypeDescriptionManager");
- m_xTDEnumerationAccess = (XTypeDescriptionEnumerationAccess) UnoRuntime.queryInterface(XTypeDescriptionEnumerationAccess.class, oTypeDescriptionManager);
+ m_xTDEnumerationAccess = UnoRuntime.queryInterface(XTypeDescriptionEnumerationAccess.class, oTypeDescriptionManager);
} catch ( java.lang.Exception e) {
System.out.println(System.out);
}}
@@ -382,7 +382,7 @@ public class Introspector extends WeakBase{
while (xTDEnumeration.hasMoreElements()) {
XTypeDescription xTD = xTDEnumeration.nextTypeDescription();
if (xTD.getName().equals(_sTypeClass)){
- XConstantsTypeDescription xConstantsTypeDescription = (XConstantsTypeDescription) UnoRuntime.queryInterface(XConstantsTypeDescription.class, xTD);
+ XConstantsTypeDescription xConstantsTypeDescription = UnoRuntime.queryInterface(XConstantsTypeDescription.class, xTD);
xConstantTypeDescriptions = xConstantsTypeDescription.getConstants();
}
String sName = xTD.getName();
@@ -404,7 +404,7 @@ public class Introspector extends WeakBase{
while (xTDEnumeration.hasMoreElements()) {
XTypeDescription xTD = xTDEnumeration.nextTypeDescription();
if (xTD.getName().equals(_sServiceName)){
- XServiceTypeDescription xServiceTypeDescription = (XServiceTypeDescription) UnoRuntime.queryInterface(XServiceTypeDescription.class, xTD);
+ XServiceTypeDescription xServiceTypeDescription = UnoRuntime.queryInterface(XServiceTypeDescription.class, xTD);
return xServiceTypeDescription;
}
}
@@ -433,10 +433,10 @@ public class Introspector extends WeakBase{
public XTypeDescription getReferencedType(String _sTypeName){
XTypeDescription xTypeDescription = null;
try{
- XHierarchicalNameAccess xHierarchicalNameAccess = (XHierarchicalNameAccess) UnoRuntime.queryInterface(XHierarchicalNameAccess.class, m_xTDEnumerationAccess);
+ XHierarchicalNameAccess xHierarchicalNameAccess = UnoRuntime.queryInterface(XHierarchicalNameAccess.class, m_xTDEnumerationAccess);
if (xHierarchicalNameAccess != null){
if (xHierarchicalNameAccess.hasByHierarchicalName(_sTypeName)){
- XIndirectTypeDescription xIndirectTypeDescription = (XIndirectTypeDescription) UnoRuntime.queryInterface(XIndirectTypeDescription.class, xHierarchicalNameAccess.getByHierarchicalName(_sTypeName));
+ XIndirectTypeDescription xIndirectTypeDescription = UnoRuntime.queryInterface(XIndirectTypeDescription.class, xHierarchicalNameAccess.getByHierarchicalName(_sTypeName));
if (xIndirectTypeDescription != null){
xTypeDescription = xIndirectTypeDescription.getReferencedType();
}
@@ -569,7 +569,7 @@ public class Introspector extends WeakBase{
public boolean hasSupportedServices(Object _oUnoObject){
boolean bHasSupportedServices = false;
- XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject);
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _oUnoObject);
if ( xServiceInfo != null ){
String[] sSupportedServiceNames = xServiceInfo.getSupportedServiceNames();
bHasSupportedServices = sSupportedServiceNames.length > 0;
@@ -622,7 +622,7 @@ public class Introspector extends WeakBase{
try {
if (xSimpleFileAccess == null){
Object oSimpleFileAccess = m_xComponentContext.getServiceManager().createInstanceWithContext("com.sun.star.ucb.SimpleFileAccess", m_xComponentContext);
- xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess);
+ xSimpleFileAccess = com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess);
}
return xSimpleFileAccess;
} catch (com.sun.star.uno.Exception ex) {
diff --git a/odk/examples/java/Inspector/MethodParametersDialog.java b/odk/examples/java/Inspector/MethodParametersDialog.java
index 963fcaeed265..2f7c63ef8b1d 100644
--- a/odk/examples/java/Inspector/MethodParametersDialog.java
+++ b/odk/examples/java/Inspector/MethodParametersDialog.java
@@ -79,7 +79,7 @@ public class MethodParametersDialog extends JDialog{
}
- public Vector getMethodObjects() {
+ public Vector<Object> getMethodObjects() {
super.setModal(true);
addBorderPanel(getContentPane(), BorderLayout.NORTH);
addBorderPanel(getContentPane(), BorderLayout.WEST);
@@ -108,7 +108,7 @@ public class MethodParametersDialog extends JDialog{
m_aParameterPanels[0].getInputComponent().requestFocusInWindow();
setVisible(true);
if (!bisdiposed){
- Vector aMethodObjects = new Vector();
+ Vector<Object> aMethodObjects = new Vector<Object>();
for (int i = 0; i < m_aParameterPanels.length; i++){
aMethodObjects.add(m_aParameterPanels[i].getValue());
}
diff --git a/odk/examples/java/Inspector/SourceCodeGenerator.java b/odk/examples/java/Inspector/SourceCodeGenerator.java
index 59092c76a5c1..279cfeb8ad0c 100644
--- a/odk/examples/java/Inspector/SourceCodeGenerator.java
+++ b/odk/examples/java/Inspector/SourceCodeGenerator.java
@@ -47,21 +47,21 @@ import java.util.Vector;
public class SourceCodeGenerator {
- private Vector sExceptions = new Vector();
- Vector sHeaderStatements = new HeaderStatements();
+ private Vector<String> sExceptions = new Vector<String>();
+ Vector<String> sHeaderStatements = new HeaderStatements();
private XLanguageSourceCodeGenerator m_xLanguageSourceCodeGenerator;
private String sHeaderCode = "";
private String sStatementCode = "";
private String sMainMethodSignature = "";
- private Hashtable aVariables = new Hashtable();
+ private Hashtable<String, UnoObjectDefinition> aVariables = new Hashtable<String, UnoObjectDefinition>();
private final String SSUFFIXSEPARATOR = "_";
private final String SVARIABLENAME = "VariableName";
private final String SARRAYVARIABLENAME = "VariableNameList";
private final String SUNOOBJECTNAME = "oUnobject";
private final String SUNOSTRUCTNAME = "aUnoStruct";
private Introspector m_oIntrospector;
- private Vector aTreepathProviders = new Vector();
+ private Vector<XTreePathProvider> aTreepathProviders = new Vector<XTreePathProvider>();
private XTreePathProvider xTreepathProvider = null;
private boolean baddExceptionHandling = false;
private boolean bXPropertySetExceptionsAreAdded = false;
@@ -207,7 +207,7 @@ public class SourceCodeGenerator {
resetSourceCodeGeneration(_nLanguage);
int ncount = aTreepathProviders.size();
for (int i=0; i< ncount; i++){
- sSourceCode = addSourceCodeOfUnoObject((XTreePathProvider) aTreepathProviders.get(i), false, (i==0), (i == (ncount-1)));
+ sSourceCode = addSourceCodeOfUnoObject(aTreepathProviders.get(i), false, (i==0), (i == (ncount-1)));
}
return sSourceCode;
}
@@ -345,9 +345,9 @@ public class SourceCodeGenerator {
private String getHeaderSourceCode(){
- Enumeration aEnumeration = aVariables.elements();
+ Enumeration<UnoObjectDefinition> aEnumeration = aVariables.elements();
while(aEnumeration.hasMoreElements()){
- UnoObjectDefinition oUnoObjectDefinition = (UnoObjectDefinition) aEnumeration.nextElement();
+ UnoObjectDefinition oUnoObjectDefinition = aEnumeration.nextElement();
String sCurHeaderStatement = m_xLanguageSourceCodeGenerator.getHeaderSourceCode(oUnoObjectDefinition.getUnoObject(), oUnoObjectDefinition.getTypeName(), oUnoObjectDefinition.getTypeClass());
sHeaderStatements.add(sCurHeaderStatement);
}
@@ -363,9 +363,9 @@ public class SourceCodeGenerator {
}
- private class HeaderStatements extends Vector{
+ private class HeaderStatements extends Vector<String> {
- public boolean contains(Object _oElement){
+ public boolean contains(String _oElement){
String sCompName = (String) _oElement;
for (int i = 0; i < this.size(); i++){
String sElement = (String) this.get(i);
@@ -377,13 +377,11 @@ public class SourceCodeGenerator {
}
- public boolean add(Object _oElement){
- if (_oElement instanceof String){
- if (!contains(_oElement)){
- super.add(_oElement);
- return true;
- }
- }
+ public boolean add(String _oElement){
+ if (!contains(_oElement)){
+ super.add(_oElement);
+ return true;
+ }
return false;
}
}
@@ -411,7 +409,7 @@ public class SourceCodeGenerator {
int a = 2;
while (!bleaveloop){
if (aVariables.containsKey(sCompVariableName)){
- Object oUnoCompObject = ((UnoObjectDefinition) aVariables.get(sCompVariableName)).getUnoObject();
+ Object oUnoCompObject = aVariables.get(sCompVariableName).getUnoObject();
String sUnoCompObjectIdentity = oUnoCompObject.toString();
bleaveloop = sUnoCompObjectIdentity.equals(sUnoObjectIdentity);
bisDeclared = bleaveloop;
@@ -758,7 +756,7 @@ class UnoObjectDefinition{
boolean bleaveloop = false;
while (!bleaveloop){
if (aVariables.containsKey(sVariableName)){
- String sUnoObjectIdentity = ((UnoObjectDefinition) aVariables.get(sVariableName)).getUnoObject().toString();
+ String sUnoObjectIdentity = aVariables.get(sVariableName).getUnoObject().toString();
if (m_oUnoObject != null){
if ((sUnoObjectIdentity.equals(m_oUnoObject.toString()) && (!m_oIntrospector.isPrimitive(this.getTypeClass())) &&
(! m_oIntrospector.isObjectSequence(m_oUnoObject)))){
@@ -1037,7 +1035,7 @@ class UnoObjectDefinition{
String sExceptionName = "e";
if (baddExceptionHandling){
for (int i = 0; i < sExceptions.size(); i++){
- String sCurException = (String) sExceptions.get(i);
+ String sCurException = sExceptions.get(i);
if (sReturn.indexOf(sCurException) == -1){
if (nIndex > 1){
sExceptionName = "e"+ nIndex;
@@ -1500,7 +1498,7 @@ class UnoObjectDefinition{
if (baddExceptionHandling){
sReturn += "\n//throw ";
for (int i = 0; i < sExceptions.size(); i++){
- String sCurException = (String) sExceptions.get(i);
+ String sCurException = sExceptions.get(i);
if (sReturn.indexOf(sCurException) == -1){
if (a++ > 0){
sReturn += ", ";
diff --git a/odk/examples/java/Inspector/SwingUnoMethodNode.java b/odk/examples/java/Inspector/SwingUnoMethodNode.java
index c01c6074b795..3f67de3a2096 100644
--- a/odk/examples/java/Inspector/SwingUnoMethodNode.java
+++ b/odk/examples/java/Inspector/SwingUnoMethodNode.java
@@ -120,7 +120,7 @@ public class SwingUnoMethodNode extends SwingUnoNode implements ActionListener,
openIdlDescription(m_xDialogProvider.getIDLPath());
}
- public Vector getMethodObjects(){
+ public Vector<Object> getMethodObjects(){
MethodParametersDialog oMethodParametersDialog = new MethodParametersDialog(this);
oMethodParametersDialog.addActionListener(this);
return oMethodParametersDialog.getMethodObjects();
diff --git a/odk/examples/java/Inspector/UnoMethodNode.java b/odk/examples/java/Inspector/UnoMethodNode.java
index cb2cb46769f7..c02261f5efe3 100644
--- a/odk/examples/java/Inspector/UnoMethodNode.java
+++ b/odk/examples/java/Inspector/UnoMethodNode.java
@@ -93,7 +93,7 @@ public class UnoMethodNode extends UnoNode{
m_bisInvoked = true;
}
else{
- Vector oUnoMethodObjects = m_xUnoMethodNode.getMethodObjects();
+ Vector<Object> oUnoMethodObjects = m_xUnoMethodNode.getMethodObjects();
if (oUnoMethodObjects != null){
for (int i = 0; i < getXIdlMethod().getParameterInfos().length; i++){
this.m_oParamObjects[i] = oUnoMethodObjects.get(i);
diff --git a/odk/examples/java/Inspector/UnoNode.java b/odk/examples/java/Inspector/UnoNode.java
index 152785407d1e..9ba110c06c3a 100644
--- a/odk/examples/java/Inspector/UnoNode.java
+++ b/odk/examples/java/Inspector/UnoNode.java
@@ -269,8 +269,8 @@ public class UnoNode{
private static String[] removeMandatoryServiceNames(String[] _sServiceNames){
try{
- List aList = java.util.Arrays.asList(_sServiceNames);
- Vector aVector = new Vector(aList);
+ List<String> aList = java.util.Arrays.asList(_sServiceNames);
+ Vector<String> aVector = new Vector<String>(aList);
for (int n = 0; n < _sServiceNames.length; n++){
String[] sDelServiceNames = getMandatoryServiceNames(_sServiceNames[n]);
for (int m = 0; m < sDelServiceNames.length; m++){
diff --git a/odk/examples/java/Inspector/XUnoMethodNode.java b/odk/examples/java/Inspector/XUnoMethodNode.java
index 074c2fe913ba..eee0cb023a18 100644
--- a/odk/examples/java/Inspector/XUnoMethodNode.java
+++ b/odk/examples/java/Inspector/XUnoMethodNode.java
@@ -59,7 +59,7 @@ public interface XUnoMethodNode extends XUnoNode {
public boolean isPrimitive();
- public Vector getMethodObjects();
+ public Vector<Object> getMethodObjects();
public boolean isFoldable();