summaryrefslogtreecommitdiff
path: root/odk
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-11-12 09:55:57 +0200
committerNoel Grandin <noelgrandin@gmail.com>2014-11-12 11:03:29 +0000
commitbb437029c1e5331bcc3f8fb2fc87837142a52f33 (patch)
tree56bde4059792a5284e90ae3b10ee4388cc913a54 /odk
parent84f7f412bfc9e18b1ff8b133ceda7757eae28c36 (diff)
java: convert fields to local variables where possible
found by PMD Change-Id: I05b45382b8fb1b734657ce9421a20e6ef6fbe542 Reviewed-on: https://gerrit.libreoffice.org/12376 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'odk')
-rw-r--r--odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java5
-rw-r--r--odk/examples/DevelopersGuide/Database/OpenQuery.java5
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java6
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Number_Formats.java10
-rw-r--r--odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java4
-rw-r--r--odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java3
-rw-r--r--odk/examples/DevelopersGuide/Text/TextDocuments.java14
7 files changed, 18 insertions, 29 deletions
diff --git a/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java b/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java
index 30700ed90faf..48108d8b21d1 100644
--- a/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java
+++ b/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java
@@ -73,9 +73,9 @@ public class ListenAtCalcRangeInDraw implements XChartDataChangeEventListener
Helper aHelper = new Helper( args );
maSheetDoc = aHelper.createSpreadsheetDocument();
- maDrawDoc = aHelper.createDrawingDocument();
+ XModel aDrawDoc = aHelper.createDrawingDocument();
CalcHelper aCalcHelper = new CalcHelper( maSheetDoc );
- ChartHelper aChartHelper = new ChartHelper( maDrawDoc );
+ ChartHelper aChartHelper = new ChartHelper( aDrawDoc );
XCellRange aRange = aCalcHelper.insertFormulaRange( 3, 30 );
@@ -185,7 +185,6 @@ public class ListenAtCalcRangeInDraw implements XChartDataChangeEventListener
// __________ private __________
private XSpreadsheetDocument maSheetDoc;
- private XModel maDrawDoc;
private XChartDocument maChartDocument;
private XChartData maChartData;
}
diff --git a/odk/examples/DevelopersGuide/Database/OpenQuery.java b/odk/examples/DevelopersGuide/Database/OpenQuery.java
index 48e291132691..0aa972aaaf6b 100644
--- a/odk/examples/DevelopersGuide/Database/OpenQuery.java
+++ b/odk/examples/DevelopersGuide/Database/OpenQuery.java
@@ -47,9 +47,6 @@ import com.sun.star.beans.XPropertySet;
public class OpenQuery {
- private XComponentContext xContext = null;
- private XMultiComponentFactory xMCF = null;
-
/**
* @param args the command line arguments
*/
@@ -67,6 +64,8 @@ public class OpenQuery {
}
protected void openQuery() throws com.sun.star.uno.Exception, java.lang.Exception {
+ XComponentContext xContext = null;
+ XMultiComponentFactory xMCF = null;
try {
// get the remote office component context
xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
index 407cfa4f0052..2a3bad305c94 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java
@@ -101,10 +101,8 @@ public class DocumentView extends JFrame
private String msName ;
- private JButton mbtOpen ;
private JButton mbtSave ;
private JButton mbtExport ;
- private JButton mbtExit ;
private boolean mbDead ;
@@ -122,10 +120,10 @@ public class DocumentView extends JFrame
// create and add command buttons to a panel
// it will be a sub panel of later layouted UI
- mbtOpen = new JButton("Open ..." );
+ JButton mbtOpen = new JButton("Open ..." );
mbtSave = new JButton("Save" );
mbtExport = new JButton("Save as HTML ...");
- mbtExit = new JButton("Exit" );
+ JButton mbtExit = new JButton("Exit" );
mbtOpen.setEnabled (true );
mbtSave.setEnabled (false);
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Number_Formats.java b/odk/examples/DevelopersGuide/OfficeDev/Number_Formats.java
index f6a8f8c035d8..4a406a0305a5 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Number_Formats.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Number_Formats.java
@@ -184,14 +184,14 @@ public class Number_Formats
{
// get the remote office context. If necessary a new office
// process is started
- maOfficeContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
+ XComponentContext aOfficeContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
System.out.println("Connected to a running office ...");
- maServiceManager = maOfficeContext.getServiceManager();
+ XMultiComponentFactory aServiceManager = aOfficeContext.getServiceManager();
// create a new spreadsheet document
XComponentLoader aLoader = UnoRuntime.queryInterface(
- XComponentLoader.class, maServiceManager.createInstanceWithContext(
- "com.sun.star.frame.Desktop", maOfficeContext) );
+ XComponentLoader.class, aServiceManager.createInstanceWithContext(
+ "com.sun.star.frame.Desktop", aOfficeContext) );
maSpreadsheetDoc = UnoRuntime.queryInterface(
XSpreadsheetDocument.class,
@@ -207,8 +207,6 @@ public class Number_Formats
// __________ private members and methods __________
- private XComponentContext maOfficeContext;
- private XMultiComponentFactory maServiceManager;
private XSpreadsheetDocument maSpreadsheetDoc;
private XSpreadsheet maSheet; // the first sheet
diff --git a/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java b/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java
index 2a1d3836517f..35b15635fbf6 100644
--- a/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java
+++ b/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java
@@ -53,7 +53,7 @@ import com.sun.star.bridge.XBridge;
public class ConnectionAwareClient extends java.awt.Frame
implements ActionListener , com.sun.star.lang.XEventListener
{
- private Button _btnWriter,_btnCalc;
+ private Button _btnWriter;
private Label _txtLabel;
private String _url;
@@ -68,7 +68,7 @@ public class ConnectionAwareClient extends java.awt.Frame
Panel p1 = new Panel();
_btnWriter = new Button("New writer");
- _btnCalc = new Button("New calc");
+ Button _btnCalc = new Button("New calc");
_txtLabel = new Label( "disconnected" );
_btnWriter.addActionListener(this);
diff --git a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java
index a68ba22bcb4b..b117d7f35c86 100644
--- a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java
+++ b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java
@@ -199,7 +199,6 @@ class ScriptSelectorPanel extends JPanel {
private XBrowseNode myrootnode = null;
public JTextField textField;
public JTree tree;
- private DefaultTreeModel treeModel;
public ScriptSelectorPanel(XBrowseNode root)
{
@@ -229,7 +228,7 @@ class ScriptSelectorPanel extends JPanel {
}
};
initNodes(myrootnode, top);
- treeModel = new DefaultTreeModel(top);
+ DefaultTreeModel treeModel = new DefaultTreeModel(top);
tree = new JTree(treeModel);
tree.setCellRenderer(new ScriptTreeRenderer());
diff --git a/odk/examples/DevelopersGuide/Text/TextDocuments.java b/odk/examples/DevelopersGuide/Text/TextDocuments.java
index de5b7c2093cb..d1d09442e6ab 100644
--- a/odk/examples/DevelopersGuide/Text/TextDocuments.java
+++ b/odk/examples/DevelopersGuide/Text/TextDocuments.java
@@ -117,7 +117,6 @@ public class TextDocuments {
private XTextDocument mxDoc = null;
private XMultiServiceFactory mxDocFactory = null;
private XMultiServiceFactory mxFactory = null;
- private XPropertySet mxDocProps = null;
private XText mxDocText = null;
private XTextCursor mxDocCursor = null;
private XTextContent mxFishSection = null;
@@ -127,18 +126,16 @@ public class TextDocuments {
* @param args the command line arguments
*/
public static void main(String[] args) {
- TextDocuments textDocuments1 = new TextDocuments();
- try {
+ TextDocuments textDocuments1 = new TextDocuments();
+ try {
// output directory for store test;
sOutputDir = args[0];
textDocuments1.runDemo();
- }
- catch (java.lang.Exception e){
+ } catch (java.lang.Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
- }
- finally {
+ } finally {
System.exit(0);
}
}
@@ -291,8 +288,7 @@ public class TextDocuments {
// Get a reference to the document's property set. This contains document
// information like the current word count
- mxDocProps = UnoRuntime.queryInterface(
- XPropertySet.class, mxDoc );
+ UnoRuntime.queryInterface(XPropertySet.class, mxDoc );
// Simple text insertion example
BodyTextExample ();