summaryrefslogtreecommitdiff
path: root/odk/examples/DevelopersGuide/OfficeDev
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-08-12 15:27:21 +0200
committerNoel Grandin <noel@peralex.com>2014-08-19 14:57:18 +0200
commit4b4bff34027cca49fd13e82d33d1b399848838fa (patch)
tree361bde1ae9cf88160694bec9d5f3c1893d398f66 /odk/examples/DevelopersGuide/OfficeDev
parentc552aac9f889b094caaa35c3fd9d12fe7c3fc73c (diff)
java: no need to instantiate String objects directly
Change-Id: I7610774c94bf673ed3b574ffce04c4ee6ca93c03
Diffstat (limited to 'odk/examples/DevelopersGuide/OfficeDev')
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java26
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java14
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java14
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java2
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java4
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java2
10 files changed, 38 insertions, 38 deletions
diff --git a/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java b/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java
index eaecc4c5e44e..bb5a8bd6e1f4 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java
@@ -69,7 +69,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor {
com.sun.star.text.XTextDocument xDoc =UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class,
xComponent);
- String infoMsg = new String("All context menus of the created document frame contains now a 'Help' entry with the submenus 'Content', 'Help Agent' and 'Tips'.\n\nPress 'Return' in the shell to remove the context menu interceptor and finish the example!");
+ String infoMsg = "All context menus of the created document frame contains now a 'Help' entry with the submenus 'Content', 'Help Agent' and 'Tips'.\n\nPress 'Return' in the shell to remove the context menu interceptor and finish the example!";
xDoc.getText().setString(infoMsg);
// ensure that the document content is optimal visible
@@ -176,9 +176,9 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor {
"com.sun.star.ui.ActionTriggerContainer" ));
// intialize root menu entry
- xRootMenuEntry.setPropertyValue( "Text", new String( "Help" ));
- xRootMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5410" ));
- xRootMenuEntry.setPropertyValue( "HelpURL", new String( "5410" ));
+ xRootMenuEntry.setPropertyValue( "Text", "Help");
+ xRootMenuEntry.setPropertyValue( "CommandURL", "slot:5410");
+ xRootMenuEntry.setPropertyValue( "HelpURL", "5410");
xRootMenuEntry.setPropertyValue( "SubContainer", xSubMenuContainer );
// create menu entries for the new sub menu
@@ -188,9 +188,9 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor {
XPropertySet.class, xMenuElementFactory.createInstance(
"com.sun.star.ui.ActionTrigger" ));
- xMenuEntry.setPropertyValue( "Text", new String( "Content" ));
- xMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5401" ));
- xMenuEntry.setPropertyValue( "HelpURL", new String( "5401" ));
+ xMenuEntry.setPropertyValue( "Text", "Content" );
+ xMenuEntry.setPropertyValue( "CommandURL", "slot:5401" );
+ xMenuEntry.setPropertyValue( "HelpURL", "5401" );
// insert menu entry to sub menu
xSubMenuContainer.insertByIndex( 0, xMenuEntry );
@@ -200,9 +200,9 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor {
com.sun.star.beans.XPropertySet.class,
xMenuElementFactory.createInstance(
"com.sun.star.ui.ActionTrigger" ));
- xMenuEntry.setPropertyValue( "Text", new String( "Help Agent" ));
- xMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5962" ));
- xMenuEntry.setPropertyValue( "HelpURL", new String( "5962" ));
+ xMenuEntry.setPropertyValue( "Text", "Help Agent" );
+ xMenuEntry.setPropertyValue( "CommandURL", "slot:5962" );
+ xMenuEntry.setPropertyValue( "HelpURL", "5962" );
// insert menu entry to sub menu
xSubMenuContainer.insertByIndex( 1, xMenuEntry );
@@ -212,9 +212,9 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor {
com.sun.star.beans.XPropertySet.class,
xMenuElementFactory.createInstance(
"com.sun.star.ui.ActionTrigger" ));
- xMenuEntry.setPropertyValue( "Text", new String( "Tips" ));
- xMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5404" ));
- xMenuEntry.setPropertyValue( "HelpURL", new String( "5404" ));
+ xMenuEntry.setPropertyValue( "Text", "Tips" );
+ xMenuEntry.setPropertyValue( "CommandURL", "slot:5404" );
+ xMenuEntry.setPropertyValue( "HelpURL", "5404" );
// insert menu entry to sub menu
xSubMenuContainer.insertByIndex( 2, xMenuEntry );
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java
index 77779e73be54..d21f8d36705b 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java
@@ -60,8 +60,8 @@ public class Desk
public static void main(String[] lArguments)
{
// Analyze command line parameters.
- String sMode = new String("inplace");
- String sFile = new String("private:factory/swriter");
+ String sMode = "inplace";
+ String sFile = "private:factory/swriter";
for(int i=0; i<lArguments.length; ++i)
{
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
index 7439b31fe898..bffa7321678a 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
@@ -668,13 +668,13 @@ public class FunctionHelper
// Find out possible filter name.
String sFilter = null;
if(xInfo.supportsService("com.sun.star.text.TextDocument")==true)
- sFilter = new String("HTML (StarWriter)");
+ sFilter = "HTML (StarWriter)";
else
if(xInfo.supportsService("com.sun.star.text.WebDocument")==true)
- sFilter = new String("HTML");
+ sFilter = "HTML";
else
if(xInfo.supportsService("com.sun.star.sheet.SpreadsheetDocument")==true)
- sFilter = new String("HTML (StarCalc)");
+ sFilter = "HTML (StarCalc)";
// Check for existing state of this filter.
if(sFilter!=null)
@@ -842,23 +842,23 @@ public class FunctionHelper
for (int i=0; i<nCount; ++i )
{
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);
+ sName = BASEFRAMENAME+mnViewCount;
while(sName.equals(xFrame.getName()))
{
++mnViewCount;
- sName = new String(BASEFRAMENAME+mnViewCount);
+ sName = BASEFRAMENAME+mnViewCount;
}
}
}
catch(com.sun.star.uno.Exception exCreateFailed)
{
- sName = new String(BASEFRAMENAME);
+ sName = BASEFRAMENAME;
}
if (sName==null)
{
System.out.println("invalid name!");
- sName = new String(BASEFRAMENAME);
+ sName = BASEFRAMENAME;
}
return sName;
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java b/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java
index 37fbc0988c3c..d600609dc3d9 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java
@@ -52,10 +52,10 @@ public class DisableCommandsTest extends java.lang.Object {
*/
final static private String[] aCommandURLTestSet =
{
- new String( "Open" ),
- new String( "About" ),
- new String( "SelectAll" ),
- new String( "Quit" ),
+ "Open",
+ "About",
+ "SelectAll",
+ "Quit",
};
private static XComponentContext xRemoteContext = null;
@@ -252,7 +252,7 @@ public class DisableCommandsTest extends java.lang.Object {
new com.sun.star.beans.PropertyValue[1];
lParams[0] = new com.sun.star.beans.PropertyValue();
- lParams[0].Name = new String("nodepath");
+ lParams[0].Name = "nodepath";
lParams[0].Value = "/org.openoffice.Office.Commands/Execute/Disabled";
try {
@@ -308,7 +308,7 @@ public class DisableCommandsTest extends java.lang.Object {
new com.sun.star.beans.PropertyValue[1];
lParams[0] = new com.sun.star.beans.PropertyValue();
- lParams[0].Name = new String("nodepath");
+ lParams[0].Name = "nodepath";
lParams[0].Value = "/org.openoffice.Office.Commands/Execute/Disabled";
try {
@@ -345,7 +345,7 @@ public class DisableCommandsTest extends java.lang.Object {
if ( xPropertySet != null ) {
// Create a unique node name.
- String aCmdNodeName = new String( "Command-" );
+ String aCmdNodeName = "Command-";
aCmdNodeName += i;
// Insert the node into the Disabled set
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java
index c09e7ce8057d..f12b2cf2d1d8 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java
@@ -144,7 +144,7 @@ public class AsciiReplaceFilter
}
// these are safe, thus no errorhandling needed:
- m_sInternalName = new String() ;
+ m_sInternalName = "" ;
m_xDocument = null ;
m_bImport = true ;
m_nFilterProcState = FILTERPROC_STOPPED ;
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java
index 5d6e9a3dda5b..ce221117201a 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java
@@ -121,8 +121,8 @@ public class FilterOptions
m_xOutput = null ;
m_bStreamOwner = false ;
m_sURL = null ;
- m_sOld = new String();
- m_sNew = new String();
+ m_sOld = "";
+ m_sNew = "";
m_bCaseChange = false ;
m_bLower = false ;
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java
index 01b9acd7f9c9..f0200973dfdc 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java
@@ -61,11 +61,11 @@ public class XHyphenatedWord_impl implements
//!! none of these cases should ever occur!
//!! values provided only for safety
if (this.aWord == null)
- this.aWord = new String();
+ this.aWord = "";
if (this.aLang == null)
this.aLang = new Locale();
if (this.aHyphenatedWord == null)
- this.aHyphenatedWord = new String();
+ this.aHyphenatedWord = "";
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java
index 0df2eb430b09..9f4cf4d5b4bb 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java
@@ -48,7 +48,7 @@ public class XMeaning_impl implements
//!! none of these cases should ever occur!
//!! values provided only for safety
if (this.aMeaning == null)
- this.aMeaning = new String();
+ this.aMeaning = "";
// a meaning without synonyms may be OK though.
// still for safety an empty existing array has to be provided.
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java
index cf59d407bf13..5ffb37d34dcd 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java
@@ -56,11 +56,11 @@ public class XPossibleHyphens_impl implements
//!! none of these cases should ever occur!
//!! values provided only for safety
if (this.aWord == null)
- this.aWord = new String();
+ this.aWord = "";
if (this.aLang == null)
this.aLang = new Locale();
if (this.aHyphWord == null)
- this.aHyphWord = new String();
+ this.aHyphWord = "";
// having no hyphenation positions is OK though.
// still for safety an empty existing array has to be provided.
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java
index ae26a447ce55..aeb0275c978c 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java
@@ -57,7 +57,7 @@ public class XSpellAlternatives_impl implements
//!! none of these cases should ever occur!
//!! values provided only for safety
if (this.aWord == null)
- this.aWord = new String();
+ this.aWord = "";
if (this.aLanguage == null)
this.aLanguage = new Locale();