Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3430
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/30/3430/1
Java cleanup in mediawiki extension
- remove unnecessary casts
- convert Hashtable->Map and Vector->ArrayList
- remove dead fields
Change-Id: Id85abee74857325a113133bf61474b962256489c
---
M swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java
M swext/mediawiki/src/com/sun/star/wiki/Helper.java
M swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
M swext/mediawiki/src/com/sun/star/wiki/Settings.java
M swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java
M swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java
M swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java
M swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java
M swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java
M swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java
10 files changed, 168 insertions(+), 192 deletions(-)
diff --git a/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java
b/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java
index 3967710..7500be6 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java
@@ -29,7 +29,6 @@
protected String m_sLoginToken = "";
protected String m_sMainURL = "";
- private int m_nWikiArticleHash = 0;
private boolean m_bHTMLStartFound = false;
private boolean m_bInHead = false;
@@ -138,7 +137,6 @@
{
if ( sName.equalsIgnoreCase( "wpTextbox1" ) )
{
- m_nWikiArticleHash = t.hashCode();
m_nWikiArticleStart = pos;
}
}
diff --git a/swext/mediawiki/src/com/sun/star/wiki/Helper.java
b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
index 9601579..345be2c 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/Helper.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
@@ -55,8 +55,6 @@
import com.sun.star.util.XChangesBatch;
import java.net.*;
import java.io.*;
-import java.util.Hashtable;
-import java.util.Random;
import javax.net.ssl.SSLException;
import javax.swing.text.html.HTMLEditorKit;
@@ -149,11 +147,9 @@
private static final String sHTMLHeader = "<HTML><HEAD><meta http-equiv=\"Content-Type\"
content=\"text/html; charset=utf-8\" /><TITLE></TITLE></HEAD><BODY>";
private static final String sHTMLFooter = "</BODY></HTML>";
- private static Random m_aRandom;
private static MultiThreadedHttpConnectionManager m_aConnectionManager;
private static HttpClient m_aClient;
private static boolean m_bAllowConnection = true;
- private static Hashtable m_aAcceptedUnknownCerts;
private static Boolean m_bShowInBrowser = null;
@@ -245,7 +241,7 @@
XPropertySet xProps = Helper.GetConfigProps( xContext,
"org.openoffice.Office.Custom.WikiExtension/Settings" );
xProps.setPropertyValue( "PreselectShowBrowser", new Boolean( bValue ) );
- XChangesBatch xBatch = ( XChangesBatch ) UnoRuntime.queryInterface(
XChangesBatch.class, xProps );
+ XChangesBatch xBatch = UnoRuntime.queryInterface( XChangesBatch.class, xProps );
if ( xBatch != null )
xBatch.commitChanges();
}
@@ -262,7 +258,7 @@
{
XMultiComponentFactory xFactory = xContext.getServiceManager();
if ( xFactory != null )
- m_xPasswordContainer = (XPasswordContainer)UnoRuntime.queryInterface(
+ m_xPasswordContainer = UnoRuntime.queryInterface(
XPasswordContainer.class,
xFactory.createInstanceWithContext(
"com.sun.star.task.PasswordContainer", xContext ) );
}
@@ -280,7 +276,7 @@
{
XMultiComponentFactory xFactory = xContext.getServiceManager();
if ( xFactory != null )
- m_xInteractionHandler = ( XInteractionHandler )UnoRuntime.queryInterface(
+ m_xInteractionHandler = UnoRuntime.queryInterface(
XInteractionHandler.class,
xFactory.createInstanceWithContext(
"com.sun.star.task.InteractionHandler", xContext ) );
}
@@ -384,8 +380,8 @@
try
{
Object oTempFile = xContext.getServiceManager().createInstanceWithContext(
"com.sun.star.io.TempFile", xContext );
- XStream xStream = ( XStream ) UnoRuntime.queryInterface( XStream.class, oTempFile
);
- XSeekable xSeekable = ( XSeekable ) UnoRuntime.queryInterface( XSeekable.class,
oTempFile );
+ XStream xStream = UnoRuntime.queryInterface( XStream.class, oTempFile );
+ XSeekable xSeekable = UnoRuntime.queryInterface( XSeekable.class, oTempFile );
if ( xStream != null && xSeekable != null )
{
XOutputStream xOutputStream = xStream.getOutputStream();
@@ -418,13 +414,13 @@
try
{
Object oTempFile = xContext.getServiceManager().createInstanceWithContext(
"com.sun.star.io.TempFile", xContext );
- XPropertySet xPropertySet = ( XPropertySet ) UnoRuntime.queryInterface(
XPropertySet.class, oTempFile );
+ XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, oTempFile );
xPropertySet.setPropertyValue( "RemoveFile", Boolean.FALSE );
sURL = ( String ) xPropertySet.getPropertyValue( "Uri" );
- XInputStream xInputStream = ( XInputStream ) UnoRuntime.queryInterface(
XInputStream.class, oTempFile );
+ XInputStream xInputStream = UnoRuntime.queryInterface( XInputStream.class, oTempFile );
xInputStream.closeInput();
- XOutputStream xOutputStream = ( XOutputStream ) UnoRuntime.queryInterface(
XOutputStream.class, oTempFile );
+ XOutputStream xOutputStream = UnoRuntime.queryInterface( XOutputStream.class,
oTempFile );
xOutputStream.closeOutput();
} catch ( com.sun.star.uno.Exception ex )
{
@@ -454,6 +450,8 @@
sEachLine = aBufReader.readLine();
}
sText = aBuf.toString();
+
+ aBufReader.close();
} catch ( Exception e )
{
e.printStackTrace();
@@ -489,7 +487,7 @@
throw new com.sun.star.uno.RuntimeException();
Object oModuleManager = xFactory.createInstanceWithContext(
"com.sun.star.frame.ModuleManager", xContext );
- XModuleManager xModuleManager = ( XModuleManager ) UnoRuntime.queryInterface(
XModuleManager.class, oModuleManager );
+ XModuleManager xModuleManager = UnoRuntime.queryInterface( XModuleManager.class,
oModuleManager );
if ( xModuleManager != null )
aDocServiceName = xModuleManager.identify( xModel );
}
@@ -511,7 +509,7 @@
try
{
Object oFilterFactory = xContext.getServiceManager().createInstanceWithContext(
"com.sun.star.document.FilterFactory", xContext );
- XContainerQuery xQuery = ( XContainerQuery )UnoRuntime.queryInterface(
XContainerQuery.class, oFilterFactory );
+ XContainerQuery xQuery = UnoRuntime.queryInterface( XContainerQuery.class,
oFilterFactory );
if ( xQuery != null )
{
NamedValue[] aRequest = new NamedValue[2];
@@ -562,7 +560,7 @@
{
XMultiComponentFactory xFactory = xContext.getServiceManager();
Object oConfigProvider = xFactory.createInstanceWithContext(
"com.sun.star.configuration.ConfigurationProvider", xContext );
- xConfigurationProvider = ( XMultiServiceFactory ) UnoRuntime.queryInterface(
XMultiServiceFactory.class, oConfigProvider );
+ xConfigurationProvider = UnoRuntime.queryInterface( XMultiServiceFactory.class,
oConfigProvider );
}
if ( xConfigurationProvider == null )
@@ -592,7 +590,7 @@
protected static XPropertySet GetConfigProps( XComponentContext xContext, String sNodepath )
throws com.sun.star.uno.Exception
{
- XPropertySet xProps = ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class,
GetConfig( xContext, sNodepath, true ) );
+ XPropertySet xProps = UnoRuntime.queryInterface( XPropertySet.class, GetConfig( xContext,
sNodepath, true ) );
if ( xProps == null )
throw new com.sun.star.uno.RuntimeException();
@@ -603,7 +601,7 @@
protected static XNameContainer GetConfigNameContainer( XComponentContext xContext, String
sNodepath )
throws com.sun.star.uno.Exception
{
- XNameContainer xContainer = ( XNameContainer ) UnoRuntime.queryInterface(
XNameContainer.class, GetConfig( xContext, sNodepath, true ) );
+ XNameContainer xContainer = UnoRuntime.queryInterface( XNameContainer.class, GetConfig(
xContext, sNodepath, true ) );
if ( xContainer == null )
throw new com.sun.star.uno.RuntimeException();
@@ -613,7 +611,7 @@
protected static XNameAccess GetConfigNameAccess( XComponentContext xContext, String sNodepath
)
throws com.sun.star.uno.Exception
{
- XNameAccess xNameAccess = ( XNameAccess ) UnoRuntime.queryInterface( XNameAccess.class,
GetConfig( xContext, sNodepath, false ) );
+ XNameAccess xNameAccess = UnoRuntime.queryInterface( XNameAccess.class, GetConfig(
xContext, sNodepath, false ) );
if ( xNameAccess == null )
throw new com.sun.star.uno.RuntimeException();
@@ -679,7 +677,7 @@
try
{
Object oSystemShell = xContext.getServiceManager().createInstanceWithContext(
"com.sun.star.system.SystemShellExecute", xContext );
- XSystemShellExecute xSystemShell = (XSystemShellExecute)UnoRuntime.queryInterface(
XSystemShellExecute.class, oSystemShell );
+ XSystemShellExecute xSystemShell = UnoRuntime.queryInterface(
XSystemShellExecute.class, oSystemShell );
if ( xSystemShell != null )
xSystemShell.execute( sURL, "", SystemShellExecuteFlags.URIS_ONLY );
}
@@ -701,7 +699,6 @@
SetConfigurationProxy( aHostConfig, xContext );
}
- boolean bNoUnknownCertNotification = false;
if ( aHostConfig.getProtocol().getScheme().equals( "https" )
&& AllowUnknownCert( xContext, aURI.getHost() ) )
{
@@ -855,12 +852,12 @@
private static XControl GetControlFromDialog( XDialog xDialog, String aControlName )
{
XControl xResult = null;
- XControlContainer xControlCont = (XControlContainer) UnoRuntime.queryInterface(
XControlContainer.class, xDialog );
+ XControlContainer xControlCont = UnoRuntime.queryInterface( XControlContainer.class,
xDialog );
if ( xControlCont != null )
{
Object oControl = xControlCont.getControl( aControlName );
- xResult = ( XControl ) UnoRuntime.queryInterface( XControl.class, oControl );
+ xResult = UnoRuntime.queryInterface( XControl.class, oControl );
}
return xResult;
@@ -870,7 +867,7 @@
{
XControl xControl = GetControlFromDialog( xDialog, aControlName );
if ( xControl != null )
- return ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class,
xControl.getModel() );
+ return UnoRuntime.queryInterface( XPropertySet.class, xControl.getModel() );
return null;
}
@@ -919,7 +916,7 @@
boolean bResult = false;
try
{
- XMasterPasswordHandling xMasterHdl =
(XMasterPasswordHandling)UnoRuntime.queryInterface( XMasterPasswordHandling.class,
GetPasswordContainer( xContext ) );
+ XMasterPasswordHandling xMasterHdl = UnoRuntime.queryInterface(
XMasterPasswordHandling.class, GetPasswordContainer( xContext ) );
if ( xMasterHdl != null )
bResult = xMasterHdl.isPersistentStoringAllowed();
}
@@ -934,7 +931,7 @@
protected static void ShowError( XComponentContext xContext, XDialog xDialog, int nTitleID,
int nErrorID, String sArg, boolean bQuery )
{
XWindowPeer xPeer = null;
- XControl xControl = (XControl)UnoRuntime.queryInterface( XControl.class, xDialog );
+ XControl xControl = UnoRuntime.queryInterface( XControl.class, xDialog );
if ( xControl != null )
xPeer = xControl.getPeer();
ShowError( xContext, xPeer, nTitleID, nErrorID, sArg, bQuery );
@@ -946,8 +943,6 @@
if ( xContext != null && nErrorID >= 0 && nErrorID < STRINGS_NUM )
{
- boolean bShown = false;
-
String sError = null;
String sTitle = "";
@@ -975,7 +970,7 @@
{
XMultiComponentFactory xFactory = xContext.getServiceManager();
if ( xFactory != null )
- xMBFactory = (XMessageBoxFactory)UnoRuntime.queryInterface(
+ xMBFactory = UnoRuntime.queryInterface(
XMessageBoxFactory.class,
xFactory.createInstanceWithContext(
"com.sun.star.awt.Toolkit", xContext ) );
@@ -1004,7 +999,6 @@
if ( xMB != null )
{
bResult = MainThreadDialogExecutor.Execute( xContext, xMB );
- bShown = true;
}
}
}
@@ -1030,7 +1024,7 @@
XNameAccess xNameAccess = GetConfigNameAccess( xContext,
"org.openoffice.Office.Custom.WikiExtension/SpecialData" );
if ( xNameAccess.hasByName( aURL ) )
{
- XNameAccess xEntry = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class,
xNameAccess.getByName( aURL ) );
+ XNameAccess xEntry = UnoRuntime.queryInterface( XNameAccess.class,
xNameAccess.getByName( aURL ) );
if ( xEntry != null && xEntry.hasByName( "AllowUnknownCertificate" ) )
return AnyConverter.toBoolean( xEntry.getByName( "AllowUnknownCertificate" ) );
}
@@ -1050,10 +1044,10 @@
XNameAccess xNameAccess = GetConfigNameAccess( xContext,
"org.openoffice.Office.Custom.WikiExtension/SpecialData" );
if ( xNameAccess.hasByName( aURL ) )
{
- XNameAccess xEntry = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class,
xNameAccess.getByName( aURL ) );
+ XNameAccess xEntry = UnoRuntime.queryInterface( XNameAccess.class,
xNameAccess.getByName( aURL ) );
if ( xEntry != null )
{
- XNameAccess xArgs = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class,
xEntry.getByName( "AdditionalLoginArguments" ) );
+ XNameAccess xArgs = UnoRuntime.queryInterface( XNameAccess.class,
xEntry.getByName( "AdditionalLoginArguments" ) );
if ( xArgs != null )
{
String[] pNames = xArgs.getElementNames();
@@ -1062,7 +1056,7 @@
String[][] pResult = new String[pNames.length][2];
for ( int nInd = 0; nInd < pNames.length; nInd++ )
{
- XNameAccess xArgument = (XNameAccess)UnoRuntime.queryInterface(
XNameAccess.class, xArgs.getByName( pNames[nInd] ) );
+ XNameAccess xArgument = UnoRuntime.queryInterface(
XNameAccess.class, xArgs.getByName( pNames[nInd] ) );
if ( xArgument == null )
throw new com.sun.star.uno.RuntimeException();
@@ -1112,7 +1106,7 @@
{
try
{
- XComponent xComp = (XComponent)UnoRuntime.queryInterface( XComponent.class,
oObject );
+ XComponent xComp = UnoRuntime.queryInterface( XComponent.class, oObject );
if ( xComp != null )
xComp.dispose();
}
diff --git a/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
index 643b238..b0dfb38 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
@@ -78,7 +78,7 @@
if ( xFactory == null )
throw new com.sun.star.uno.RuntimeException();
- XRequestCallback xRequest = (XRequestCallback)UnoRuntime.queryInterface(
+ XRequestCallback xRequest = UnoRuntime.queryInterface(
XRequestCallback.class,
xFactory.createInstanceWithContext( "com.sun.star.awt.AsyncCallback",
xContext ) );
if ( xRequest != null )
diff --git a/swext/mediawiki/src/com/sun/star/wiki/Settings.java
b/swext/mediawiki/src/com/sun/star/wiki/Settings.java
index 87cc378..f18ff8f 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/Settings.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/Settings.java
@@ -18,6 +18,12 @@
package com.sun.star.wiki;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameAccess;
import com.sun.star.container.XNameContainer;
@@ -27,23 +33,18 @@
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.util.XChangesBatch;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
public class Settings
{
- private XComponentContext m_xContext;
- private int lastUsedWikiServer = 0;
-
-
- /* Singelton */
+ /* Singleton */
private static Settings m_instance;
- private Vector<Hashtable<String, String>> m_WikiConnections = new Vector<Hashtable<String,
String>>();
- private Vector<Hashtable<String, Object>> m_aWikiDocs = new Vector<Hashtable<String,
Object>>();
+ private XComponentContext m_xContext;
+ private int lastUsedWikiServer = 0;
+ private List<Map<String, String>> m_WikiConnections = new ArrayList<Map<String, String>>();
+ private List<Map<String, Object>> m_aWikiDocs = new ArrayList<Map<String, Object>>();
private Settings( XComponentContext ctx )
{
@@ -61,13 +62,13 @@
}
- public void addWikiCon ( Hashtable<String, String> wikiCon )
+ public void addWikiCon ( Map<String, String> wikiCon )
{
m_WikiConnections.add( wikiCon );
}
- public Vector<Hashtable<String, String>> getWikiCons()
+ public List<Map<String, String>> getWikiCons()
{
return m_WikiConnections;
}
@@ -77,17 +78,17 @@
String url = "";
if ( num >=0 && num < m_WikiConnections.size() )
{
- Hashtable ht = m_WikiConnections.get( num );
- url = ( String ) ht.get( "Url" );
+ Map<String,String> ht = m_WikiConnections.get( num );
+ url = ht.get( "Url" );
}
return url;
}
- public void addWikiDoc ( Hashtable<String, Object> aWikiDoc )
+ public void addWikiDoc ( Map<String, Object> aWikiDoc )
{
String sURL = ( String ) aWikiDoc.get( "CompleteUrl" );
- Hashtable aEntry = getDocByCompleteUrl( sURL );
+ Map<String,Object> aEntry = getDocByCompleteUrl( sURL );
if ( aEntry != null )
{
@@ -104,7 +105,7 @@
}
- public Vector<Hashtable<String, Object>> getWikiDocs()
+ public List<Map<String, Object>> getWikiDocs()
{
return m_aWikiDocs;
}
@@ -112,11 +113,11 @@
public Object[] getWikiDocList( int serverid, int num )
{
String wikiserverurl = getWikiConUrlByNumber( serverid );
- Vector<String> theDocs = new Vector<String>();
+ List<String> theDocs = new ArrayList<String>();
String [] docs = new String[0];
for ( int i=0; i<m_aWikiDocs.size(); i++ )
{
- Hashtable ht = m_aWikiDocs.get( i );
+ Map<String,Object> ht = m_aWikiDocs.get( i );
String docurl = ( String ) ht.get( "Url" );
if ( docurl.equals( wikiserverurl ) )
{
@@ -141,19 +142,19 @@
String [] WikiList = new String [m_WikiConnections.size()];
for ( int i=0; i<m_WikiConnections.size(); i++ )
{
- Hashtable ht = m_WikiConnections.get( i );
- WikiList[i] = ( String ) ht.get( "Url" );
+ Map<String,String> ht = m_WikiConnections.get( i );
+ WikiList[i] = ht.get( "Url" );
}
return WikiList;
}
- public Hashtable<String, String> getSettingByUrl( String sUrl )
+ public Map<String, String> getSettingByUrl( String sUrl )
{
- Hashtable<String, String> ht = null;
+ Map<String, String> ht = null;
for( int i=0;i<m_WikiConnections.size();i++ )
{
- Hashtable<String, String> h1 = m_WikiConnections.get( i );
+ Map<String, String> h1 = m_WikiConnections.get( i );
String u1 = h1.get( "Url" );
if ( u1.equals( sUrl ) )
{
@@ -180,12 +181,12 @@
return ht;
}
- public Hashtable getDocByCompleteUrl( String curl )
+ public Map<String,Object> getDocByCompleteUrl( String curl )
{
- Hashtable ht = null;
+ Map<String,Object> ht = null;
for( int i=0;i<m_aWikiDocs.size();i++ )
{
- Hashtable h1 = m_aWikiDocs.get( i );
+ Map<String,Object> h1 = m_aWikiDocs.get( i );
String u1 = ( String ) h1.get( "CompleteUrl" );
if ( u1.equals( curl ) )
{
@@ -198,11 +199,10 @@
public void removeSettingByUrl( String sUrl )
{
- Hashtable ht = null;
for( int i=0;i<m_WikiConnections.size();i++ )
{
- Hashtable h1 = m_WikiConnections.get( i );
- String u1 = ( String ) h1.get( "Url" );
+ Map<String,String> h1 = m_WikiConnections.get( i );
+ String u1 = h1.get( "Url" );
if ( u1.equals( sUrl ) )
{
m_WikiConnections.remove( i );
@@ -228,13 +228,13 @@
for ( int i=0; i< m_WikiConnections.size(); i++ )
{
Object oNewConnection = xConnectionFactory.createInstance();
- Hashtable ht = m_WikiConnections.get( i );
+ Map<String,String> ht = m_WikiConnections.get( i );
XNameReplace xNewConn = UnoRuntime.queryInterface( XNameReplace.class,
oNewConnection );
if ( xNewConn != null )
xNewConn.replaceByName( "UserName", ht.get( "Username" ) );
- xContainer.insertByName( (String)ht.get( "Url" ), xNewConn );
+ xContainer.insertByName( ht.get( "Url" ), xNewConn );
}
// commit changes
XChangesBatch xBatch = UnoRuntime.queryInterface( XChangesBatch.class, xContainer );
@@ -251,15 +251,14 @@
XSingleServiceFactory xDocListFactory = UnoRuntime.queryInterface(
XSingleServiceFactory.class, xContainer2 );
for ( int i=0; i< m_aWikiDocs.size(); i++ )
{
- Hashtable ht = m_aWikiDocs.get( i );
+ Map<String,Object> ht = m_aWikiDocs.get( i );
Object oNewDoc = xDocListFactory.createInstance();
XNameReplace xNewDoc = UnoRuntime.queryInterface( XNameReplace.class, oNewDoc );
- Enumeration e = ht.keys();
- while ( e.hasMoreElements() )
+ for ( Iterator<String> iter = ht.keySet().iterator(); iter.hasNext(); )
{
- String key = ( String ) e.nextElement();
+ String key = iter.next();
xNewDoc.replaceByName( key, ht.get( key ) );
}
@@ -292,7 +291,7 @@
String [] allCons = xConnectionList.getElementNames();
for ( int i=0; i<allCons.length; i++ )
{
- Hashtable<String, String> ht = new Hashtable<String, String>();
+ Map<String, String> ht = new HashMap<String, String>();
ht.put( "Url", allCons[i] );
ht.put( "Username", "" );
ht.put( "Password", "" );
@@ -322,7 +321,7 @@
{
Object oDoc = xRecentDocs.getByName( allDocs[i] );
XNameAccess xDoc = UnoRuntime.queryInterface( XNameAccess.class, oDoc );
- Hashtable<String, Object> ht = new Hashtable<String, Object>();
+ Map<String, Object> ht = new HashMap<String, Object>();
ht.put( "Url", xDoc.getByName( "Url" ) );
ht.put( "CompleteUrl", xDoc.getByName( "CompleteUrl" ) );
ht.put( "Doc", xDoc.getByName( "Doc" ) );
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java
b/swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java
index 7cdafeb..1495404 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java
@@ -18,13 +18,17 @@
package com.sun.star.wiki;
-import java.io.*;
-import java.util.Hashtable;
-import javax.swing.text.html.*;
-import com.sun.star.uno.XComponentContext;
+import java.io.StringReader;
+import java.util.Map;
-import org.apache.commons.httpclient.*;
-import org.apache.commons.httpclient.methods.*;
+import javax.swing.text.html.HTMLEditorKit;
+
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+import com.sun.star.uno.XComponentContext;
public class WikiArticle
@@ -34,27 +38,27 @@
private String m_sEditTime = "";
private String m_sEditToken = "";
- protected String m_sHTMLCode;
+ private String m_sHTMLCode;
private boolean m_bNoArticle = true;
- protected String m_sWikiUser;
- protected String m_sWikiPass;
+ private String m_sWikiUser;
+ private String m_sWikiPass;
- protected String m_sTitle = "";
+ private String m_sTitle = "";
private URI m_aMainURI;
private HostConfiguration m_aHostConfig;
/** Creates a new instance of WikiArticle */
- public WikiArticle( XComponentContext xContext, String sTitle, Hashtable wikiSettings, boolean
bLogin, WikiPropDialog aPropDialog )
+ public WikiArticle( XComponentContext xContext, String sTitle, Map<String,String>
wikiSettings, boolean bLogin, WikiPropDialog aPropDialog )
throws java.net.MalformedURLException, com.sun.star.uno.Exception, java.io.IOException,
WikiCancelException
{
m_xContext = xContext;
- String sMainUrl = (String) wikiSettings.get("Url");
- m_sWikiUser = (String) wikiSettings.get("Username");
- m_sWikiPass = (String) wikiSettings.get("Password");
+ String sMainUrl = wikiSettings.get("Url");
+ m_sWikiUser = wikiSettings.get("Username");
+ m_sWikiPass = wikiSettings.get("Password");
m_sTitle = sTitle;
m_aMainURI = new URI( sMainUrl );
@@ -77,8 +81,8 @@
if ( MainThreadDialogExecutor.Show( xContext, aDialog ) )
{
- m_sWikiUser = (String) wikiSettings.get("Username");
- m_sWikiPass = (String) wikiSettings.get("Password");
+ m_sWikiUser = wikiSettings.get("Username");
+ m_sWikiPass = wikiSettings.get("Password");
}
else
throw new WikiCancelException();
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java
b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java
index e65c4fb..5a1dc4f 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java
@@ -38,13 +38,12 @@
public class WikiDialog implements XDialogEventHandler, XTopWindowListener
{
- XComponentContext m_xContext;
- XControlContainer m_xControlContainer;
- XDialog m_xDialog;
- String[] m_aMethods;
- boolean m_bAction = false;
- Settings m_aSettings;
-
+ protected XComponentContext m_xContext;
+ private XControlContainer m_xControlContainer;
+ protected XDialog m_xDialog;
+ private String[] m_aMethods;
+ protected boolean m_bAction = false;
+ protected Settings m_aSettings;
protected Thread m_aThread;
protected boolean m_bThreadFinished = false;
@@ -59,11 +58,11 @@
{
Object obj;
obj = xMCF.createInstanceWithContext("com.sun.star.awt.DialogProvider2", m_xContext );
- XDialogProvider2 xDialogProvider = (XDialogProvider2) UnoRuntime.queryInterface(
XDialogProvider2.class, obj );
+ XDialogProvider2 xDialogProvider = UnoRuntime.queryInterface( XDialogProvider2.class,
obj );
m_xDialog = xDialogProvider.createDialogWithHandler( DialogURL, this );
- m_xControlContainer = (XControlContainer)UnoRuntime.queryInterface(
XControlContainer.class, m_xDialog );
- XTopWindow xTopWindow = (XTopWindow)UnoRuntime.queryInterface( XTopWindow.class,
m_xDialog );
+ m_xControlContainer = UnoRuntime.queryInterface( XControlContainer.class, m_xDialog );
+ XTopWindow xTopWindow = UnoRuntime.queryInterface( XTopWindow.class, m_xDialog );
if ( xTopWindow != null )
xTopWindow.addTopWindowListener( this );
}
@@ -128,10 +127,10 @@
{
if ( xDialog != null && sTitle != null )
{
- XControl xDialogControl = (XControl)UnoRuntime.queryInterface( XControl.class, xDialog
);
+ XControl xDialogControl = UnoRuntime.queryInterface( XControl.class, xDialog );
if ( xDialogControl != null )
{
- XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xDialogControl.getModel() );
+ XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class,
xDialogControl.getModel() );
if ( xPropSet != null )
xPropSet.setPropertyValue( "Title", sTitle );
}
@@ -150,7 +149,7 @@
if ( xControlContainer != null && sControl != null )
{
XControl xControl = xControlContainer.getControl(sControl);
- xPS = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel()
);
+ xPS = UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel() );
}
if ( xPS == null )
@@ -168,7 +167,7 @@
try
{
Object oDialogProvider =
xContext.getServiceManager().createInstanceWithContext("com.sun.star.awt.DialogProvider2", xContext
);
- XDialogProvider2 xDialogProvider = (XDialogProvider2) UnoRuntime.queryInterface(
XDialogProvider2.class, oDialogProvider );
+ XDialogProvider2 xDialogProvider = UnoRuntime.queryInterface(
XDialogProvider2.class, oDialogProvider );
if ( xDialogProvider != null )
xResult = xDialogProvider.createDialog( sURL );
@@ -178,7 +177,7 @@
SetTitle( xResult, Helper.GetLocalizedString( xContext, nTitleID ) );
if ( pControls != null && pStringIDs != null && pControls.length ==
pStringIDs.length )
{
- XControlContainer xControlContainer =
(XControlContainer)UnoRuntime.queryInterface( XControlContainer.class, xResult );
+ XControlContainer xControlContainer = UnoRuntime.queryInterface(
XControlContainer.class, xResult );
for ( int nInd = 0; nInd < pControls.length; nInd++ )
GetPropSet( xControlContainer, pControls[nInd] ).setPropertyValue(
"Label", new Integer( pStringIDs[nInd] ) );
}
@@ -197,16 +196,16 @@
{
try
{
- XControl xDialogControl = ( XControl ) UnoRuntime.queryInterface( XControl.class,
m_xDialog );
+ XControl xDialogControl = UnoRuntime.queryInterface( XControl.class, m_xDialog );
XControlModel xDialogModel = null;
if ( xDialogControl != null )
xDialogModel = xDialogControl.getModel();
- XMultiServiceFactory xDialogFactory = ( XMultiServiceFactory )
UnoRuntime.queryInterface( XMultiServiceFactory.class, xDialogModel );
+ XMultiServiceFactory xDialogFactory = UnoRuntime.queryInterface(
XMultiServiceFactory.class, xDialogModel );
if ( xDialogFactory != null )
{
- XControlModel xThrobberModel = (XControlModel)UnoRuntime.queryInterface(
XControlModel.class, xDialogFactory.createInstance( "com.sun.star.awt.UnoThrobberControlModel" ) );
- XPropertySet xThrobberProps = (XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xThrobberModel );
+ XControlModel xThrobberModel = UnoRuntime.queryInterface( XControlModel.class,
xDialogFactory.createInstance( "com.sun.star.awt.UnoThrobberControlModel" ) );
+ XPropertySet xThrobberProps = UnoRuntime.queryInterface( XPropertySet.class,
xThrobberModel );
if ( xThrobberProps != null )
{
xThrobberProps.setPropertyValue( "Name", "WikiThrobber" );
@@ -215,7 +214,7 @@
xThrobberProps.setPropertyValue( "Height", new Integer( Width ) );
xThrobberProps.setPropertyValue( "Width", new Integer( Height ) );
- XNameContainer xDialogContainer = (XNameContainer)UnoRuntime.queryInterface(
XNameContainer.class, xDialogModel );
+ XNameContainer xDialogContainer = UnoRuntime.queryInterface(
XNameContainer.class, xDialogModel );
xDialogContainer.insertByName( "WikiThrobber", xThrobberModel );
}
}
@@ -234,7 +233,7 @@
{
try
{
- XThrobber xThrobber = (XThrobber)UnoRuntime.queryInterface( XThrobber.class,
m_xControlContainer.getControl( "WikiThrobber" ) );
+ XThrobber xThrobber = UnoRuntime.queryInterface( XThrobber.class,
m_xControlContainer.getControl( "WikiThrobber" ) );
if ( xThrobber != null )
{
if ( bActive )
@@ -256,7 +255,7 @@
{
try
{
- XWindow xWindow = (XWindow)UnoRuntime.queryInterface( XWindow.class,
m_xControlContainer.getControl( "WikiThrobber" ) );
+ XWindow xWindow = UnoRuntime.queryInterface( XWindow.class,
m_xControlContainer.getControl( "WikiThrobber" ) );
if ( xWindow != null )
xWindow.setVisible( bVisible );
}
@@ -273,7 +272,7 @@
{
try
{
- XWindow xWindow = (XWindow)UnoRuntime.queryInterface( XWindow.class,
m_xControlContainer.getControl( aControl ) );
+ XWindow xWindow = UnoRuntime.queryInterface( XWindow.class,
m_xControlContainer.getControl( aControl ) );
if ( xWindow != null )
xWindow.setFocus();
}
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java
b/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java
index 182400d..592b748 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java
@@ -18,24 +18,27 @@
package com.sun.star.wiki;
-import com.sun.star.awt.XDialog;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.lang.EventObject;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.net.ssl.SSLException;
-import org.apache.commons.httpclient.*;
-import org.apache.commons.httpclient.methods.*;
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+import com.sun.star.awt.XDialog;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.XComponentContext;
public class WikiEditSettingDialog extends WikiDialog
{
private final String sOKMethod = "OK";
- String[] Methods =
- {sOKMethod };
- private Hashtable setting;
+ private String[] Methods = {sOKMethod };
+ private Map<String,String> setting;
private boolean addMode;
private boolean m_bAllowURLChange = true;
@@ -43,7 +46,7 @@
{
super( xContext, DialogURL );
super.setMethods( Methods );
- setting = new Hashtable();
+ setting = new HashMap<String,String>();
addMode = true;
InsertThrobber( 184, 20, 10, 10 );
@@ -51,7 +54,7 @@
InitSaveCheckbox( xContext, false );
}
- public WikiEditSettingDialog( XComponentContext xContext, String DialogURL, Hashtable ht,
boolean bAllowURLChange )
+ public WikiEditSettingDialog( XComponentContext xContext, String DialogURL, Map<String,String>
ht, boolean bAllowURLChange )
{
super( xContext, DialogURL );
super.setMethods( Methods );
@@ -69,8 +72,8 @@
if ( Helper.PasswordStoringIsAllowed( m_xContext ) )
{
- String[] pPasswords = Helper.GetPasswordsForURLAndUser( m_xContext,
(String)ht.get( "Url" ), (String)ht.get( "Username" ) );
- bInitSaveCheckBox = ( pPasswords != null && pPasswords.length > 0 &&
pPasswords[0].equals( (String)ht.get( "Password" ) ) );
+ String[] pPasswords = Helper.GetPasswordsForURLAndUser( m_xContext, ht.get( "Url"
), ht.get( "Username" ) );
+ bInitSaveCheckBox = ( pPasswords != null && pPasswords.length > 0 &&
pPasswords[0].equals( ht.get( "Password" ) ) );
}
// the password should be entered by the user or the Cancel should be pressed
@@ -100,9 +103,9 @@
if ( bResult && Helper.PasswordStoringIsAllowed( m_xContext )
&& ( (Short)( GetPropSet( "SaveBox" ).getPropertyValue("State") ) ).shortValue() !=
(short)0 )
{
- String sURL = (String)setting.get( "Url" );
- String sUserName = (String)setting.get( "Username" );
- String sPassword = (String)setting.get( "Password" );
+ String sURL = setting.get( "Url" );
+ String sUserName = setting.get( "Username" );
+ String sPassword = setting.get( "Password" );
if ( sURL != null && sURL.length() > 0 && sUserName != null && sUserName.length()
0 && sPassword != null && sPassword.length() > 0 )
{
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java
b/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java
index 0b37a65..ff9f85a 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java
@@ -18,42 +18,38 @@
package com.sun.star.wiki;
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.net.ssl.SSLException;
+
import com.sun.star.awt.XWindowPeer;
import com.sun.star.beans.PropertyValue;
import com.sun.star.frame.DispatchDescriptor;
import com.sun.star.frame.XController;
-import com.sun.star.frame.XDesktop;
import com.sun.star.frame.XDispatch;
import com.sun.star.frame.XDispatchProvider;
import com.sun.star.frame.XFrame;
import com.sun.star.frame.XModel;
import com.sun.star.frame.XStatusListener;
import com.sun.star.frame.XStorable;
-import com.sun.star.lang.XComponent;
import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.lib.uno.helper.WeakBase;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
-import com.sun.star.lib.uno.helper.Factory;
-import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.lib.uno.helper.WeakBase;
import com.sun.star.util.XCloseBroadcaster;
-import com.sun.star.view.XSelectionSupplier;
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import javax.net.ssl.SSLException;
public final class WikiEditorImpl extends WeakBase
implements com.sun.star.lang.XServiceInfo, XDispatchProvider, XDispatch, XInitialization
{
- private final XComponentContext m_xContext;
private static final String m_implementationName = WikiEditorImpl.class.getName();
private static final String[] m_serviceNames = {"com.sun.star.wiki.WikiEditor" };
@@ -63,16 +59,11 @@
// protocol name that this protocol handler handles
public static final String protocolName = "vnd.com.sun.star.wiki:";
- private Map m_statusListeners = new HashMap();
-
-
- private XComponent xComp;
- private String sTempUrl;
-
+ private final XComponentContext m_xContext;
+ private Map<String, com.sun.star.frame.XStatusListener> m_statusListeners = new
HashMap<String, com.sun.star.frame.XStatusListener>();
private XFrame m_xFrame;
private XModel m_xModel;
private Settings m_aSettings;
-
private String m_aFilterName;
public WikiEditorImpl( XComponentContext xContext )
@@ -119,8 +110,6 @@
}
- private XSelectionSupplier m_sel;
- private XController m_ctrl;
private boolean m_bInitialized;
public synchronized void initialize( Object[] args ) throws com.sun.star.uno.Exception
{
@@ -131,10 +120,9 @@
if ( args.length > 0 )
{
m_bInitialized = true;
- m_xFrame = ( XFrame )UnoRuntime.queryInterface( XFrame.class, args[0] );
+ m_xFrame = UnoRuntime.queryInterface( XFrame.class, args[0] );
// become close listener
- XCloseBroadcaster cb = ( XCloseBroadcaster )UnoRuntime.queryInterface(
- XCloseBroadcaster.class, m_xFrame );
+ XCloseBroadcaster cb = UnoRuntime.queryInterface( XCloseBroadcaster.class, m_xFrame );
}
}
@@ -242,13 +230,10 @@
public void callStatusListeners()
{
- Set entries = m_statusListeners.entrySet();
- Iterator iter = entries.iterator();
- while ( iter.hasNext() )
+ for (Iterator<String> iter = m_statusListeners.keySet().iterator(); iter.hasNext(); )
{
- Map.Entry entry = ( Map.Entry ) iter.next();
- String uristring = ( String ) entry.getKey();
- XStatusListener listener = ( XStatusListener ) entry.getValue();
+ String uristring = iter.next();
+ XStatusListener listener = m_statusListeners.get(uristring);
callStatusListener( uristring, listener );
}
}
@@ -257,7 +242,6 @@
{
try
{
-
URI uri = new URI( uristring );
// check whether any blogs are live...
@@ -300,7 +284,7 @@
if ( m_aFilterName == null || m_aFilterName.length() == 0 )
{
Helper.ShowError( m_xContext,
- (XWindowPeer)UnoRuntime.queryInterface(
XWindowPeer.class, m_xFrame.getContainerWindow() ),
+ UnoRuntime.queryInterface( XWindowPeer.class,
m_xFrame.getContainerWindow() ),
Helper.DLG_SENDTITLE,
Helper.NOWIKIFILTER_ERROR,
null,
@@ -329,7 +313,7 @@
}
}
- public boolean SendArticleImpl( WikiPropDialog aSendDialog, Hashtable aWikiSetting )
+ public boolean SendArticleImpl( WikiPropDialog aSendDialog, Map<String,String> aWikiSetting )
{
boolean bResult = false;
@@ -349,7 +333,7 @@
aSendDialog.SetThrobberActive( false );
bAllowSending = Helper.ShowError(
m_xContext,
- (XWindowPeer)UnoRuntime.queryInterface( XWindowPeer.class,
m_xFrame.getContainerWindow() ),
+ UnoRuntime.queryInterface( XWindowPeer.class,
m_xFrame.getContainerWindow() ),
Helper.DLG_SENDTITLE,
Helper.DLG_WIKIPAGEEXISTS_LABEL1,
aSendDialog.GetWikiTitle(),
@@ -369,7 +353,7 @@
sTemp2Url = Helper.CreateTempFile( m_xContext );
- XStorable xStore = ( com.sun.star.frame.XStorable )UnoRuntime.queryInterface (
XStorable.class, m_xModel );
+ XStorable xStore = UnoRuntime.queryInterface ( XStorable.class, m_xModel );
if ( xStore == null )
throw new com.sun.star.uno.RuntimeException();
@@ -379,10 +363,8 @@
if ( aArticle.setArticle( sWikiCode, aSendDialog.m_sWikiComment,
aSendDialog.m_bWikiMinorEdit ) )
{
bResult = true;
- Object desktop = m_xContext.getServiceManager().createInstanceWithContext(
"com.sun.star.frame.Desktop", m_xContext );
- XDesktop xDesktop = ( XDesktop ) UnoRuntime.queryInterface(
com.sun.star.frame.XDesktop.class, desktop );
Helper.SetDocTitle( m_xModel, aArticle.GetTitle() );
- Hashtable aDocInfo = new Hashtable();
+ Map<String,Object> aDocInfo = new HashMap<String,Object>();
aDocInfo.put( "Doc", aArticle.GetTitle() );
aDocInfo.put( "Url", aArticle.GetMainURL() );
aDocInfo.put( "CompleteUrl", aArticle.GetMainURL() + aArticle.GetTitle() );
@@ -392,7 +374,7 @@
else
{
Helper.ShowError( m_xContext,
- (XWindowPeer)UnoRuntime.queryInterface(
XWindowPeer.class, m_xFrame.getContainerWindow() ),
+ UnoRuntime.queryInterface( XWindowPeer.class,
m_xFrame.getContainerWindow() ),
Helper.DLG_SENDTITLE,
Helper.GENERALSEND_ERROR,
null,
@@ -410,7 +392,7 @@
{
// report the error only if sending was not cancelled
Helper.ShowError( m_xContext,
- (XWindowPeer)UnoRuntime.queryInterface( XWindowPeer.class,
m_xFrame.getContainerWindow() ),
+ UnoRuntime.queryInterface( XWindowPeer.class,
m_xFrame.getContainerWindow() ),
Helper.DLG_SENDTITLE,
Helper.UNKNOWNCERT_ERROR,
null,
@@ -423,7 +405,7 @@
{
// report the error only if sending was not cancelled
Helper.ShowError( m_xContext,
- (XWindowPeer)UnoRuntime.queryInterface( XWindowPeer.class,
m_xFrame.getContainerWindow() ),
+ UnoRuntime.queryInterface( XWindowPeer.class,
m_xFrame.getContainerWindow() ),
Helper.DLG_SENDTITLE,
Helper.GENERALSEND_ERROR,
null,
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java
b/swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java
index 7d2bec8..b16be39 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java
@@ -31,7 +31,7 @@
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
-import java.util.Hashtable;
+import java.util.Map;
public final class WikiOptionsEventHandlerImpl extends WeakBase
implements XServiceInfo, XContainerWindowEventHandler, XDialogEventHandler
@@ -65,7 +65,7 @@
if ( m_xControlContainer != null )
{
XControl xControl = m_xControlContainer.getControl(sControl);
- XPropertySet xListProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,
xControl.getModel() );
+ XPropertySet xListProps = UnoRuntime.queryInterface(XPropertySet.class,
xControl.getModel() );
return xListProps;
}
@@ -128,7 +128,7 @@
XPropertySet xListProps = GetPropSet( "WikiList" );
if ( xListProps != null )
{
- Hashtable ht = null;
+ Map<String,String> ht = null;
try
{
short[] pSel = (short []) xListProps.getPropertyValue( "SelectedItems" );
@@ -136,7 +136,7 @@
if ( pSel.length > 0 && pItems.length > pSel[0] )
{
String selName = pItems[pSel[0]];
- ht = m_aSettings.getSettingByUrl( pItems[pSel[0]] );
+ ht = m_aSettings.getSettingByUrl( selName );
}
}
catch ( Exception ex )
@@ -178,7 +178,6 @@
{
try
{
-
GetPropSet( "FixedLine1" ).setPropertyValue( "Label", Helper.GetLocalizedString(
m_xContext, Helper.DLG_MEDIAWIKIEXTENSION_STRING ) );
GetPropSet( "AddButton" ).setPropertyValue( "Label", Helper.GetLocalizedString(
m_xContext, Helper.DLG_ADDBUTTON ) );
GetPropSet( "EditButton" ).setPropertyValue( "Label", Helper.GetLocalizedString(
m_xContext, Helper.DLG_EDITBUTTON ) );
@@ -221,7 +220,7 @@
{
try
{
- String sEvent = (String)AnyConverter.toString( aEventObject );
+ String sEvent = AnyConverter.toString( aEventObject );
if ( sEvent != null )
{
if ( sEvent.equals( sOk ) )
@@ -233,9 +232,8 @@
{
if ( sEvent.equals( sInitialize ) )
{
- m_xDialog = (XDialog)UnoRuntime.queryInterface( XDialog.class, xWindow
);
- m_xControlContainer = (XControlContainer)UnoRuntime.queryInterface(
- XControlContainer.class, m_xDialog );
+ m_xDialog = UnoRuntime.queryInterface( XDialog.class, xWindow );
+ m_xControlContainer = UnoRuntime.queryInterface(
XControlContainer.class, m_xDialog );
m_aSettings = Settings.getSettings( m_xContext );
m_aSettings.loadConfiguration(); // throw away all the noncommited
changes
InitStrings();
@@ -277,8 +275,6 @@
public boolean callHandlerMethod( XDialog xDialog, Object aEventObject, String sMethod )
throws WrappedTargetException, com.sun.star.uno.RuntimeException
{
-
-
return true;
}
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java
b/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java
index adec27e..c184fcf 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java
@@ -18,25 +18,26 @@
package com.sun.star.wiki;
+import java.util.Map;
+
import com.sun.star.awt.XDialog;
import com.sun.star.beans.XPropertySet;
import com.sun.star.lang.EventObject;
import com.sun.star.uno.XComponentContext;
-import java.util.Hashtable;
public class WikiPropDialog extends WikiDialog{
- WikiEditorImpl m_aWikiEditor;
+ private WikiEditorImpl m_aWikiEditor;
private final String sSendMethod = "Send";
private final String sWikiListMethod = "WikiListChange";
private final String sArticleTextMethod = "ArticleTextChange";
private final String sAddWikiMethod = "AddWiki";
- String[] m_pMethods = {sSendMethod, sWikiListMethod, sArticleTextMethod, sAddWikiMethod};
+ private String[] m_pMethods = {sSendMethod, sWikiListMethod, sArticleTextMethod,
sAddWikiMethod};
private String m_sWikiTitle = "";
- protected String m_sWikiEngineURL = "";
+ private String m_sWikiEngineURL = "";
protected String m_sWikiComment = "";
protected boolean m_bWikiMinorEdit = false;
@@ -283,7 +284,7 @@
SetThrobberActive( true );
// the following method might show a dialog, should be used in main thread
- final Hashtable aWikiSettings = m_aSettings.getSettingByUrl( m_sWikiEngineURL );
+ final Map<String,String> aWikiSettings = m_aSettings.getSettingByUrl( m_sWikiEngineURL
);
if ( Helper.AllowThreadUsage( m_xContext ) )
{
m_aThread = new Thread( "com.sun.star.thread.WikiEditorSendingThread" )
--
To view, visit https://gerrit.libreoffice.org/3430
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id85abee74857325a113133bf61474b962256489c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Noel Grandin <noelgrandin@gmail.com>
Context
- [PATCH] Java cleanup in mediawiki extension · Noel Grandin (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.