diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-11 15:32:10 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-11-12 08:01:55 +0000 |
commit | 36ff1527c9cb20542d3097d123d221c40a356795 (patch) | |
tree | 52590ce642803a862bc331b3eae2e2b100b8e85f /toolkit/test | |
parent | 1eb31467a5af90fe41dc646dd716bdb7d3e5db45 (diff) |
java: reduce excessive code indentation levels
by using early return in some methods
Change-Id: I3611c8c89b3a94ef7e1772d178acf065fd7fcdc7
Reviewed-on: https://gerrit.libreoffice.org/12374
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'toolkit/test')
-rw-r--r-- | toolkit/test/accessibility/TextUpdateListener.java | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/toolkit/test/accessibility/TextUpdateListener.java b/toolkit/test/accessibility/TextUpdateListener.java index 61b499655879..ef590f1a7106 100644 --- a/toolkit/test/accessibility/TextUpdateListener.java +++ b/toolkit/test/accessibility/TextUpdateListener.java @@ -29,34 +29,30 @@ class TextUpdateListener implements TreeModelListener public void treeNodesChanged(TreeModelEvent e) { try { - // if the change is to the first child of a DefaultMutableTreeNode - // with an XAccessibleText child, then we call updateText - int[] aIndices = e.getChildIndices(); - if( (aIndices != null) && - (aIndices.length > 0) ) - { + // if the change is to the first child of a DefaultMutableTreeNode + // with an XAccessibleText child, then we call updateText + int[] aIndices = e.getChildIndices(); + if (aIndices == null || aIndices.length >= 0) { + return; + } // we have a parent... lets check for XAccessibleText then - DefaultMutableTreeNode aParent = (DefaultMutableTreeNode) - (e.getTreePath().getLastPathComponent()); - DefaultMutableTreeNode aNode = (DefaultMutableTreeNode) - (aParent.getChildAt(aIndices[0])); - if( aParent.getUserObject() instanceof XAccessibleText) - { + DefaultMutableTreeNode aParent = (DefaultMutableTreeNode) (e + .getTreePath().getLastPathComponent()); + DefaultMutableTreeNode aNode = (DefaultMutableTreeNode) (aParent + .getChildAt(aIndices[0])); + if (aParent.getUserObject() instanceof XAccessibleText) { // aha! we have an xText. So we can now check for // the various cases we support - XAccessibleText xText = - (XAccessibleText)aParent.getUserObject(); + XAccessibleText xText = (XAccessibleText) aParent + .getUserObject(); - if( aIndices[0] == 0 ) - { + if (aIndices[0] == 0) { // first child! Then we call updateText - updateText( xText, aNode.toString() ); + updateText(xText, aNode.toString()); } } + } catch (com.sun.star.lang.IndexOutOfBoundsException aException) { } - } - catch (com.sun.star.lang.IndexOutOfBoundsException aException) - {} } // don't care: |