diff options
author | Noel Grandin <noel@peralex.com> | 2014-06-04 11:43:58 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-06-04 11:52:34 +0200 |
commit | cc25f70ef1e9fa7637b4bfd332ebdc33844a41c2 (patch) | |
tree | 76fe846c5b4ec24faa6ee53d34c49554eac3d4a8 /odk | |
parent | adc20c3937f3119d39af5a0c8e4a439d8127fe63 (diff) |
compareTo -> equals
convert OUString::compareTo usage to equals to startsWith where it
is more appropriate
Change-Id: I6f5b5b7942429c0099ad082ba4984fd18e422121
Diffstat (limited to 'odk')
9 files changed, 28 insertions, 28 deletions
diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java index 27a97ec40345..1e3fd149ee12 100644 --- a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java +++ b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java @@ -125,7 +125,7 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor // XJobExecutor public void trigger(String sEvent) { - if ( sEvent.compareTo( "execute" ) == 0 ) { + if ( sEvent.equals( "execute" ) ) { try { createDialog(); } diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java index f4f3b7cf6a95..0653ee11055d 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java @@ -150,12 +150,12 @@ public class ProtocolHandlerAddon { /*IN*/String sTargetFrameName, /*IN*/int iSearchFlags ) { XDispatch xRet = null; - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Protocol.equals("org.openoffice.Office.addon.example:") ) { + if ( aURL.Path.equals( "Function1" ) ) xRet = this; - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path.equals( "Function2" ) ) xRet = this; - if ( aURL.Path.compareTo( "Help" ) == 0 ) + if ( aURL.Path.equals( "Help" ) ) xRet = this; } return xRet; @@ -177,17 +177,17 @@ public class ProtocolHandlerAddon { public void dispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) { - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) + if ( aURL.Protocol.equals("org.openoffice.Office.addon.example:") ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Path.equals( "Function1" ) ) { showMessageBox("SDK DevGuide Add-On example", "Function 1 activated"); } - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path.equals( "Function2" ) ) { showMessageBox("SDK DevGuide Add-On example", "Function 2 activated"); } - if ( aURL.Path.compareTo( "Help" ) == 0 ) + if ( aURL.Path.equals( "Help" ) ) { showMessageBox("About SDK DevGuide Add-On example", "This is the SDK Add-On example"); } diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java index 101540ee748f..7b20bb4e56a6 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java @@ -75,7 +75,7 @@ public class Desk sFile = lArguments[i].substring(5); } - ViewContainer.mbInplace = (sMode.compareTo("inplace")==0); + ViewContainer.mbInplace = sMode.equals("inplace"); // Connect to remote office. OfficeConnect.createConnection(); diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java index 0fb4ecb6c578..b72f30ac755c 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java @@ -390,7 +390,7 @@ public class DocumentView extends JFrame String sCommand = aEvent.getActionCommand(); // open any file from disk - if( sCommand.compareTo(COMMAND_OPEN) == 0 ) + if( sCommand.equals(COMMAND_OPEN) ) { String sURL = FunctionHelper.askUserForFileURL(DocumentView.this,true); if(sURL!=null) @@ -399,14 +399,14 @@ public class DocumentView extends JFrame else // save current document - if( sCommand.compareTo(COMMAND_SAVE) == 0 ) + if( sCommand.equals(COMMAND_SAVE) ) { DocumentView.this.save(); } else // export current document to html - if( sCommand.compareTo(COMMAND_EXPORT) == 0 ) + if( sCommand.equals(COMMAND_EXPORT)) { String sURL = FunctionHelper.askUserForFileURL(DocumentView.this,false); if(sURL!=null) @@ -415,7 +415,7 @@ public class DocumentView extends JFrame else // exit application - if( sCommand.compareTo(COMMAND_EXIT) == 0 ) + if( sCommand.equals(COMMAND_EXIT) ) { // This will force deleting of this and // all other currently opened views automatically! diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java index 43f98d232d83..2f9b8e153bee 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java @@ -958,7 +958,7 @@ public class FunctionHelper { com.sun.star.frame.XFrame xFrame = (com.sun.star.frame.XFrame)AnyConverter.toObject(new com.sun.star.uno.Type(com.sun.star.frame.XFrame.class), xContainer.getByIndex(i)); sName = new String(BASEFRAMENAME+mnViewCount); - while(sName.compareTo(xFrame.getName())==0) + while(sName.equals(xFrame.getName())) { ++mnViewCount; sName = new String(BASEFRAMENAME+mnViewCount); diff --git a/odk/examples/java/Inspector/InspectorAddon.java b/odk/examples/java/Inspector/InspectorAddon.java index 6ca6c4260438..b32bde1d2dfc 100644 --- a/odk/examples/java/Inspector/InspectorAddon.java +++ b/odk/examples/java/Inspector/InspectorAddon.java @@ -72,8 +72,8 @@ public class InspectorAddon { public XDispatch queryDispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/String sTargetFrameName, /*IN*/int iSearchFlags ) { XDispatch xRet = null; - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.Inspector:") == 0 ) { - if ( aURL.Path.compareTo( "inspect" ) == 0 ){ + if ( aURL.Protocol.equals("org.openoffice.Office.addon.Inspector:") ) { + if ( aURL.Path.equals( "inspect" ) ){ // Todo: Check if the frame is already administered (use hashtable) xRet = new Dispatcher(m_xFrame); } @@ -114,7 +114,7 @@ public class InspectorAddon { // XDispatch public void dispatch( /*IN*/com.sun.star.util.URL _aURL, /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) { try{ - if ( _aURL.Protocol.compareTo("org.openoffice.Office.addon.Inspector:") == 0 ){ + if ( _aURL.Protocol.equals("org.openoffice.Office.addon.Inspector:") ){ if ( _aURL.Path.equals("inspect")){ Object oUnoInspectObject = xModel; com.sun.star.lang.XMultiComponentFactory xMCF = m_xContext.getServiceManager(); diff --git a/odk/examples/java/Inspector/ProtocolHandlerAddon.java b/odk/examples/java/Inspector/ProtocolHandlerAddon.java index 00bc253cb703..518ab913e674 100644 --- a/odk/examples/java/Inspector/ProtocolHandlerAddon.java +++ b/odk/examples/java/Inspector/ProtocolHandlerAddon.java @@ -151,12 +151,12 @@ public class ProtocolHandlerAddon { /*IN*/String sTargetFrameName, /*IN*/int iSearchFlags ) { XDispatch xRet = null; - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Protocol.equals("org.openoffice.Office.addon.example:") ) { + if ( aURL.Path.equals( "Function1" ) ) xRet = this; - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path.equals( "Function2" ) ) xRet = this; - if ( aURL.Path.compareTo( "Help" ) == 0 ) + if ( aURL.Path.equals( "Help" ) ) xRet = this; } return xRet; @@ -178,17 +178,17 @@ public class ProtocolHandlerAddon { public void dispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) { - if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) + if ( aURL.Protocol.equals("org.openoffice.Office.addon.example:") ) { - if ( aURL.Path.compareTo( "Function1" ) == 0 ) + if ( aURL.Path.equals( "Function1" ) ) { showMessageBox("SDK DevGuide Add-On example", "Function 1 activated"); } - if ( aURL.Path.compareTo( "Function2" ) == 0 ) + if ( aURL.Path.equals( "Function2" ) ) { showMessageBox("SDK DevGuide Add-On example", "Function 2 activated"); } - if ( aURL.Path.compareTo( "Help" ) == 0 ) + if ( aURL.Path.equals( "Help" ) ) { showMessageBox("About SDK DevGuide Add-On example", "This is the SDK Add-On example"); } diff --git a/odk/examples/java/Spreadsheet/EuroAdaption.java b/odk/examples/java/Spreadsheet/EuroAdaption.java index 8168aee4f1a4..fddaaf16b3a7 100644 --- a/odk/examples/java/Spreadsheet/EuroAdaption.java +++ b/odk/examples/java/Spreadsheet/EuroAdaption.java @@ -189,7 +189,7 @@ public class EuroAdaption { // change the numberformat only on cellranges with a // currency numberformat if( ( (fType & com.sun.star.util.NumberFormat.CURRENCY) > 0) && - ( sCurrencySymbol.compareTo( sOldSymbol ) == 0 ) ) { + ( sCurrencySymbol.equals( sOldSymbol ) ) ) { boolean bThousandSep = AnyConverter.toBoolean( xFormat.getPropertyValue("ThousandsSeparator")); boolean bNegativeRed = AnyConverter.toBoolean( diff --git a/odk/examples/java/Text/StyleInitialization.java b/odk/examples/java/Text/StyleInitialization.java index 5acf7559d673..f743c471e5ed 100644 --- a/odk/examples/java/Text/StyleInitialization.java +++ b/odk/examples/java/Text/StyleInitialization.java @@ -206,7 +206,7 @@ public class StyleInitialization { sFontname = sFontname.toLowerCase(); // if the style use the font 'Albany', apply it to the current paragraph - if( sFontname.compareTo("albany") == 0 ) { + if( sFontname.equals("albany") ) { // create a property set from the current paragraph, to change the paragraph style xPropertySet = UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, xTextRange ); |