From 419eca0c3fb8f14fc0976f479db971e66fcf0b22 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Sun, 2 Oct 2011 16:52:20 -0700 Subject: [PATCH] Cosmetics. --- .../index/tests/IndexIncludeTest.java | 23 +++++++++---------- .../internal/index/tests/IndexNamesTests.java | 19 +++++---------- .../eclipse/cdt/ui/tests/BaseUITestCase.java | 23 ++++++++++--------- 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexIncludeTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexIncludeTest.java index e9acad9167f..2fda9e95f00 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexIncludeTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexIncludeTest.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * Markus Schorn - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.internal.index.tests; @@ -48,8 +48,8 @@ public class IndexIncludeTest extends IndexTestBase { return suite; } - private ICProject fProject= null; - private IIndex fIndex= null; + private ICProject fProject; + private IIndex fIndex; public IndexIncludeTest(String name) { super(name); @@ -61,8 +61,8 @@ public class IndexIncludeTest extends IndexTestBase { if (fProject == null) { fProject= createProject(true, "resources/indexTests/includes"); IPathEntry[] entries= new IPathEntry[] { - CoreModel.newIncludeEntry(fProject.getPath(), - null, fProject.getResource().getLocation())}; + CoreModel.newIncludeEntry(fProject.getPath(), null, + fProject.getResource().getLocation()) }; fProject.setRawPathEntries(entries, npm()); } fIndex= CCorePlugin.getIndexManager().getIndex(fProject); @@ -141,7 +141,7 @@ public class IndexIncludeTest extends IndexTestBase { // #include public void testIncludeProperties() throws Exception { waitForIndexer(); - TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()}; + TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() }; String content= readTaggedComment("source20061107"); TestSourceReader.createFile(fProject.getProject(), "user20061107.h", ""); TestSourceReader.createFile(fProject.getProject(), "system20061107.h", ""); @@ -163,7 +163,7 @@ public class IndexIncludeTest extends IndexTestBase { } public void testIncludeProperties_2() throws Exception { - TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()}; + TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() }; TestSourceReader.createFile(fProject.getProject(), "header20061107.h", ""); String content = "// comment \n#include \"header20061107.h\"\n"; IFile file= TestSourceReader.createFile(fProject.getProject(), "intermed20061107.h", content); @@ -186,7 +186,7 @@ public class IndexIncludeTest extends IndexTestBase { } public void testInactiveInclude() throws Exception { - TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()}; + TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() }; String content = "#if 0\n#include \"inactive20070213.h\"\n#endif\n"; IFile file= TestSourceReader.createFile(fProject.getProject(), "source20070213.cpp", content); CCorePlugin.getIndexManager().reindex(fProject); @@ -207,7 +207,7 @@ public class IndexIncludeTest extends IndexTestBase { } public void testUnresolvedInclude() throws Exception { - TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()}; + TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() }; String content = "#include \"unresolved20070213.h\"\n"; IFile file= TestSourceReader.createFile(fProject.getProject(), "source20070214.cpp", content); CCorePlugin.getIndexManager().reindex(fProject); @@ -318,7 +318,7 @@ public class IndexIncludeTest extends IndexTestBase { // #include "resolved20070426.h" public void testFixedContext() throws Exception { - TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()}; + TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() }; String source= getContentsForTest(1)[0].toString(); IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070426.h", ""); IFile s1= TestSourceReader.createFile(fProject.getProject(), "s1.cpp", source); @@ -404,7 +404,7 @@ public class IndexIncludeTest extends IndexTestBase { // #include "unesolved20070427.h" public void testUpdateIncludes() throws Exception { waitForIndexer(); - TestScannerProvider.sIncludes= new String[]{fProject.getProject().getLocation().toOSString()}; + TestScannerProvider.sIncludes= new String[] { fProject.getProject().getLocation().toOSString() }; CharSequence[] source= getContentsForTest(4); IFile header= TestSourceReader.createFile(fProject.getProject(), "resolved20070427.h", ""); IFile s1= TestSourceReader.createFile(fProject.getProject(), "s20070427.cpp", @@ -446,7 +446,6 @@ public class IndexIncludeTest extends IndexTestBase { source[0].toString() + "\nint h20070427;"); TestSourceReader.waitUntilFileIsIndexed(fIndex, s1, INDEXER_WAIT_TIME); standardCheckUpdateIncludes(header, s1, "h20070427"); - } private void standardCheckUpdateIncludes(IFile header, IFile s1, String tag) throws Exception { diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java index 2b220298a8d..123318398e4 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexNamesTests.java @@ -6,9 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * Markus Schorn - initial API and implementation *******************************************************************************/ - package org.eclipse.cdt.internal.index.tests; import java.io.IOException; @@ -129,8 +128,7 @@ public class IndexNamesTests extends BaseTestCase { enclosing= enclosed[1].getEnclosingDefinition(); assertNotNull(enclosing); assertName("main", enclosing); - } - finally { + } finally { fIndex.releaseReadLock(); } } @@ -223,8 +221,7 @@ public class IndexNamesTests extends BaseTestCase { enclosing= enclosed[2].getEnclosingDefinition(); assertNotNull(enclosing); assertName("func", enclosing); - } - finally { + } finally { fIndex.releaseReadLock(); } } @@ -274,8 +271,7 @@ public class IndexNamesTests extends BaseTestCase { assertEquals(couldbepolymorphic[j], indexName.couldBePolymorphicMethodCall()); assertEquals(container[j], CPPVisitor.getQualifiedName(fIndex.findBinding(indexName))[0]); j++; - } - else { + } else { assertEquals(false, indexName.couldBePolymorphicMethodCall()); } } @@ -285,7 +281,6 @@ public class IndexNamesTests extends BaseTestCase { } } - // int _i, ri, wi, rwi; // int* rp; int* wp; int* rwp; // const int* cip= &ri; @@ -339,14 +334,12 @@ public class IndexNamesTests extends BaseTestCase { assertEquals("Read access for " + msg, isRead, indexName.isReadAccess()); assertEquals("Write access for " + msg, isWrite, indexName.isWriteAccess()); j++; - } - else { + } else { assertEquals(false, indexName.couldBePolymorphicMethodCall()); } } assertEquals(count, j); - } - finally { + } finally { fIndex.releaseReadLock(); } } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/BaseUITestCase.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/BaseUITestCase.java index 23ac2125a3b..c0f5047458b 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/BaseUITestCase.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/BaseUITestCase.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Markus Schorn - initial API and implementation + * Markus Schorn - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.ui.tests; @@ -125,7 +125,7 @@ public class BaseUITestCase extends BaseTestCase { while (firstTime || System.currentTimeMillis() < endTime) { if (!firstTime) { Thread.sleep(sleep); - sleep= Math.min(250, sleep*2); + sleep= Math.min(250, sleep * 2); } firstTime= false; @@ -143,7 +143,7 @@ public class BaseUITestCase extends BaseTestCase { } } finally { index.releaseReadLock(); - int time= (int) (endTime- System.currentTimeMillis()); + int time= (int) (endTime - System.currentTimeMillis()); if (time > 0) { CCorePlugin.getIndexManager().joinIndexer(time, npm()); } @@ -153,10 +153,11 @@ public class BaseUITestCase extends BaseTestCase { } protected void runEventQueue(int time) { - final long endTime= System.currentTimeMillis()+time; - while(true) { - while (Display.getCurrent().readAndDispatch()); - long diff= endTime-System.currentTimeMillis(); + final long endTime= System.currentTimeMillis() + time; + while (true) { + while (Display.getCurrent().readAndDispatch()) + ; + long diff= endTime - System.currentTimeMillis(); if (diff <= 0) { break; } @@ -169,18 +170,18 @@ public class BaseUITestCase extends BaseTestCase { } protected void expandTreeItem(Tree tree, int idx) { - expandTreeItem(tree, new int[] {idx}); + expandTreeItem(tree, new int[] { idx }); } protected void expandTreeItem(Tree tree, int idx1, int idx2) { - expandTreeItem(tree, new int[] {idx1, idx2}); + expandTreeItem(tree, new int[] { idx1, idx2 }); } protected void expandTreeItem(Tree tree, int[] idxs) { TreeItem item= tree.getItem(idxs[0]); assertNotNull(item); expandTreeItem(item); - for (int i=1; i < idxs.length; i++) { + for (int i= 1; i < idxs.length; i++) { item= item.getItem(idxs[i]); assertNotNull(item); expandTreeItem(item); @@ -206,7 +207,7 @@ public class BaseUITestCase extends BaseTestCase { protected void selectTreeItem(Tree tree, int[] idxs) { TreeItem item= tree.getItem(idxs[0]); assertNotNull(item); - for (int i=1; i < idxs.length; i++) { + for (int i= 1; i < idxs.length; i++) { item= item.getItem(idxs[i]); assertNotNull(item); }