From b65017a2a7af290f6681da7b197a52efe83d5185 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 27 Jun 2012 15:40:17 +0200 Subject: Java5 update - usage generics where possible Change-Id: I12f8c448961919e153047e28fee2a0acf3af1002 --- qadevOOo/tests/java/mod/_sw/SwXTextView.java | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'qadevOOo/tests/java/mod/_sw/SwXTextView.java') diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextView.java b/qadevOOo/tests/java/mod/_sw/SwXTextView.java index 6d5798ef1349..b27c77da8510 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextView.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextView.java @@ -144,12 +144,12 @@ public class SwXTextView extends TestCase { XTextCursor oCursor = oText.createTextCursor(); oFrame1 = SOF.createInstance (xTextDoc, "com.sun.star.text.TextFrame" ); - first = (XTextFrame)UnoRuntime.queryInterface + first = UnoRuntime.queryInterface ( XTextFrame.class, oFrame1); oText.insertTextContent(oCursor,first, false); first.getText().setString("Frame 1"); oFrame2 = SOF.createInstance(xTextDoc, "com.sun.star.text.TextFrame" ); - second = (XTextFrame)UnoRuntime.queryInterface + second = UnoRuntime.queryInterface ( XTextFrame.class, oFrame2); oText.insertTextContent(oCursor,second, false); second.getText().setString("Frame 2"); @@ -164,7 +164,7 @@ public class SwXTextView extends TestCase { throw new StatusException("Couldn't insert text table ", Ex); } - XSearchable oSearch = (XSearchable)UnoRuntime.queryInterface + XSearchable oSearch = UnoRuntime.queryInterface (XSearchable.class, xTextDoc); XSearchDescriptor xSDesc = oSearch.createSearchDescriptor(); xSDesc.setSearchString("SwXTextRanges"); @@ -188,10 +188,8 @@ public class SwXTextView extends TestCase { return -1; } - XIndexAccess indAc1 = (XIndexAccess) - UnoRuntime.queryInterface(XIndexAccess.class, o1); - XIndexAccess indAc2 = (XIndexAccess) - UnoRuntime.queryInterface(XIndexAccess.class, o2); + XIndexAccess indAc1 = UnoRuntime.queryInterface(XIndexAccess.class, o1); + XIndexAccess indAc2 = UnoRuntime.queryInterface(XIndexAccess.class, o2); if (indAc1 != null && indAc2 != null) { int c1 = indAc1.getCount(); @@ -199,10 +197,8 @@ public class SwXTextView extends TestCase { return c1 == c2 ? 0 : 1; } - XText text1 = (XText) - UnoRuntime.queryInterface(XText.class, o1); - XText text2 = (XText) - UnoRuntime.queryInterface(XText.class, o2); + XText text1 = UnoRuntime.queryInterface(XText.class, o1); + XText text2 = UnoRuntime.queryInterface(XText.class, o2); if (text1 != null && text2 != null) { return text1.getString().equals(text2.getString()) ? 0 : 1; @@ -214,8 +210,7 @@ public class SwXTextView extends TestCase { return compare(this, obj) == 0; } }); - XSelectionSupplier xsel = (XSelectionSupplier) - UnoRuntime.queryInterface(XSelectionSupplier.class,xContr); + XSelectionSupplier xsel = UnoRuntime.queryInterface(XSelectionSupplier.class,xContr); try { xsel.select(second); } catch (Exception e) { -- cgit