From 6afacb4913af567c273ad62405455ce6e72b6cb9 Mon Sep 17 00:00:00 2001 From: Paul Pazderski Date: Sun, 19 May 2019 23:32:16 +0200 Subject: Bug 547304 - [cleanup] Fix wrong space/tab indentation This change fixes space or mixed tab/space indentations in all Java files. This also includes two or three space indentations and even fix most stray single spaces in indentations. The change includes only whitespace formatting and no code changes. Change-Id: Ie21edf6dba7384276d834e9fd10805b1f304403f --- .../intro/anchors/ExtensionReorderingTest.java | 118 ++--- .../ua/tests/intro/performance/OpenIntroTest.java | 8 +- .../ua/tests/intro/util/IntroModelSerializer.java | 560 ++++++++++----------- 3 files changed, 343 insertions(+), 343 deletions(-) (limited to 'org.eclipse.ua.tests/intro/org') diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/anchors/ExtensionReorderingTest.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/anchors/ExtensionReorderingTest.java index ccadfbe51..3c5b9072a 100644 --- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/anchors/ExtensionReorderingTest.java +++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/anchors/ExtensionReorderingTest.java @@ -69,7 +69,7 @@ public class ExtensionReorderingTest { /* * Recursive test to test all permutations of integers 0-4 with no * repeats. - * @param next the next element that has not been filled in yet + * @param next the next element that has not been filled in yet */ private void tryAll(int next) { for (int value = 0; value < numContributions; value++) { @@ -89,8 +89,8 @@ public class ExtensionReorderingTest { if (next + 1 == numContributions) { count++; if (count % cycle == 0) { - testReordering(order); - count = 0; + testReordering(order); + count = 0; } } else { tryAll(next + 1); @@ -126,67 +126,67 @@ public class ExtensionReorderingTest { } public void readIntroConfig() { - IExtensionRegistry registry= Platform.getExtensionRegistry(); - IConfigurationElement[] configElements = registry - .getConfigurationElementsFor("org.eclipse.ui.intro.config"); + IExtensionRegistry registry= Platform.getExtensionRegistry(); + IConfigurationElement[] configElements = registry + .getConfigurationElementsFor("org.eclipse.ui.intro.config"); - config = getConfigurationFromAttribute( - configElements, "introId", "org.eclipse.ua.tests.intro.anchors"); + config = getConfigurationFromAttribute( + configElements, "introId", "org.eclipse.ua.tests.intro.anchors"); - introConfigExtensions = null; + introConfigExtensions = null; - introConfigExtensions = getIntroConfigExtensions( - "configId", "org.eclipse.ua.tests.intro.config.anchors"); + introConfigExtensions = getIntroConfigExtensions( + "configId", "org.eclipse.ua.tests.intro.config.anchors"); } private IConfigurationElement getConfigurationFromAttribute( - IConfigurationElement[] configElements, String attributeName, - String attributeValue) { - - // find all configs with given attribute and attribute value. - IConfigurationElement[] filteredConfigElements = getConfigurationsFromAttribute( - configElements, attributeName, attributeValue); - // now validate that we got only one. - IConfigurationElement config = ModelLoaderUtil - .validateSingleContribution(filteredConfigElements, attributeName); - return config; + IConfigurationElement[] configElements, String attributeName, + String attributeValue) { + + // find all configs with given attribute and attribute value. + IConfigurationElement[] filteredConfigElements = getConfigurationsFromAttribute( + configElements, attributeName, attributeValue); + // now validate that we got only one. + IConfigurationElement config = ModelLoaderUtil + .validateSingleContribution(filteredConfigElements, attributeName); + return config; } protected IConfigurationElement[] getConfigurationsFromAttribute( - IConfigurationElement[] configElements, String attributeName, - String attributeValue) { + IConfigurationElement[] configElements, String attributeName, + String attributeValue) { - // find all configs with given attribute and attribute value. + // find all configs with given attribute and attribute value. Vector elements = new Vector<>(); - for (IConfigurationElement configElement : configElements) { - String currentAttributeValue = configElement - .getAttribute(attributeName); - if (currentAttributeValue != null - && currentAttributeValue.equals(attributeValue)) - elements.add(configElement); - } - - // now return array. - IConfigurationElement[] filteredConfigElements = new IConfigurationElement[elements - .size()]; - elements.copyInto(filteredConfigElements); - - return filteredConfigElements; - } + for (IConfigurationElement configElement : configElements) { + String currentAttributeValue = configElement + .getAttribute(attributeName); + if (currentAttributeValue != null + && currentAttributeValue.equals(attributeValue)) + elements.add(configElement); + } + + // now return array. + IConfigurationElement[] filteredConfigElements = new IConfigurationElement[elements + .size()]; + elements.copyInto(filteredConfigElements); + + return filteredConfigElements; + } protected IConfigurationElement[] getIntroConfigExtensions( - String attrributeName, String attributeValue) { + String attrributeName, String attributeValue) { IExtensionRegistry registry= Platform.getExtensionRegistry(); - IConfigurationElement[] configExtensionElements = registry - .getConfigurationElementsFor("org.eclipse.ui.intro.configExtension"); + IConfigurationElement[] configExtensionElements = registry + .getConfigurationElementsFor("org.eclipse.ui.intro.configExtension"); - IConfigurationElement[] configExtensions = getConfigurationsFromAttribute( - configExtensionElements, attrributeName, attributeValue); + IConfigurationElement[] configExtensions = getConfigurationsFromAttribute( + configExtensionElements, attrributeName, attributeValue); - return configExtensions; - } + return configExtensions; + } @Test public void testOrder123456() { @@ -216,28 +216,28 @@ public class ExtensionReorderingTest { AbstractIntroElement p3link = extn1.findChild("page3link"); assertNotNull(p3link); if (elements >= 4) { - IntroPage extn4 = (IntroPage) model.findChild("page4"); - assertNotNull(extn4); + IntroPage extn4 = (IntroPage) model.findChild("page4"); + assertNotNull(extn4); AbstractIntroElement p4link = extn2.findChild("page4link"); assertNotNull(p4link); - if (elements >= 5) { - IntroPage extn5 = (IntroPage) model.findChild("page5"); - assertNotNull(extn5); + if (elements >= 5) { + IntroPage extn5 = (IntroPage) model.findChild("page5"); + assertNotNull(extn5); AbstractIntroElement p5link = extn4.findChild("page5link"); AbstractIntroElement p5linkR = extn4.findChild("page5linkR"); if (elements == 5) { - assertNotNull(p5link); - assertNull(p5linkR); + assertNotNull(p5link); + assertNull(p5linkR); } else { - assertNull(p5link); - assertNotNull(p5linkR); - } - } + assertNull(p5link); + assertNotNull(p5linkR); + } + } } if (elements >= 6) { IntroPage extn6 = (IntroPage) model.findChild("page6"); - assertNotNull(extn6); - extn6.getChildren(); + assertNotNull(extn6); + extn6.getChildren(); AbstractIntroElement actionlinks = extn6.findChild("action-links"); AbstractIntroElement p5linkR = extn6.findChild("page5linkR"); assertNotNull(actionlinks); diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java index e06949544..10a305d50 100644 --- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java +++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java @@ -41,8 +41,8 @@ public class OpenIntroTest extends PerformanceTestCase { super.setUp(); closeIntro(); // test extensions filter by this system property - System.setProperty("org.eclipse.ua.tests.property.isTesting", "true"); //$NON-NLS-1$ //$NON-NLS-2$ - ExtensionPointManager.getInst().setExtensionFilter(UserAssistanceTestPlugin.getPluginId()); + System.setProperty("org.eclipse.ua.tests.property.isTesting", "true"); //$NON-NLS-1$ //$NON-NLS-2$ + ExtensionPointManager.getInst().setExtensionFilter(UserAssistanceTestPlugin.getPluginId()); } @Override @@ -50,8 +50,8 @@ public class OpenIntroTest extends PerformanceTestCase { super.tearDown(); closeIntro(); // test extensions filter by this system property - System.setProperty("org.eclipse.ua.tests.property.isTesting", "false"); //$NON-NLS-1$ //$NON-NLS-2$ - ExtensionPointManager.getInst().setExtensionFilter(null); + System.setProperty("org.eclipse.ua.tests.property.isTesting", "false"); //$NON-NLS-1$ //$NON-NLS-2$ + ExtensionPointManager.getInst().setExtensionFilter(null); } public void testOpenIntro() throws Exception { diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java index ec1d1a200..293b327e7 100644 --- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java +++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java @@ -39,324 +39,324 @@ public class IntroModelSerializer { private StringBuilder buffer; - public IntroModelSerializer(IntroModelRoot root) { + public IntroModelSerializer(IntroModelRoot root) { this.buffer = new StringBuilder(); - printModelRootInfo(root, buffer); - - // Root Page - IntroHomePage rootPage = root.getRootPage(); - printHomePage(rootPage, buffer); - printPageChildren(rootPage, buffer); - - IntroPage[] pages = root.getPages(); - printPages(pages, buffer); - - buffer.append("\n\n"); //$NON-NLS-1$ - printModelFlagTests(root, buffer); - } - - /* - * Removes any platform/machine-specific paths from the given URL. This is - * used to remove absolute paths from the serialized model in order to compare - * results in automated tests. - */ - private String filterURL(String url) { - if (url != null && url.startsWith("file:/")) { - return "file:/" + "" + url.substring(url.lastIndexOf('/')); - } - return url; - } + printModelRootInfo(root, buffer); + + // Root Page + IntroHomePage rootPage = root.getRootPage(); + printHomePage(rootPage, buffer); + printPageChildren(rootPage, buffer); + + IntroPage[] pages = root.getPages(); + printPages(pages, buffer); + + buffer.append("\n\n"); //$NON-NLS-1$ + printModelFlagTests(root, buffer); + } + + /* + * Removes any platform/machine-specific paths from the given URL. This is + * used to remove absolute paths from the serialized model in order to compare + * results in automated tests. + */ + private String filterURL(String url) { + if (url != null && url.startsWith("file:/")) { + return "file:/" + "" + url.substring(url.lastIndexOf('/')); + } + return url; + } private void printModelRootInfo(IntroModelRoot model, StringBuilder text) { - text.append("Intro Model Content:"); //$NON-NLS-1$ - text.append("\n======================"); //$NON-NLS-1$ - text.append("\n\nModel has valid config = " + model.hasValidConfig()); //$NON-NLS-1$ - text.append("\nPresentation type = " //$NON-NLS-1$ - + model.getPresentation().getType()); - text.append("\nHome page id = " //$NON-NLS-1$ - + model.getPresentation().getHomePageId()); - IntroHead headContent = model.getPresentation().getHead(); - if (headContent != null) - text.append("\nPresentation Shared Head = " + headContent.getSrc()); //$NON-NLS-1$ - text.append("\nNumber of pages (not including Root Page) = " //$NON-NLS-1$ - + model.getPages().length); - text.append("\nNumber of shared groups = " //$NON-NLS-1$ - + model.getChildrenOfType(AbstractIntroElement.GROUP).length); - text - .append("\nNumber of unresolved extensions = " //$NON-NLS-1$ - + model - .getChildrenOfType(AbstractIntroElement.CONTAINER_EXTENSION).length); - } - - /** - * @param text - * @param root - */ + text.append("Intro Model Content:"); //$NON-NLS-1$ + text.append("\n======================"); //$NON-NLS-1$ + text.append("\n\nModel has valid config = " + model.hasValidConfig()); //$NON-NLS-1$ + text.append("\nPresentation type = " //$NON-NLS-1$ + + model.getPresentation().getType()); + text.append("\nHome page id = " //$NON-NLS-1$ + + model.getPresentation().getHomePageId()); + IntroHead headContent = model.getPresentation().getHead(); + if (headContent != null) + text.append("\nPresentation Shared Head = " + headContent.getSrc()); //$NON-NLS-1$ + text.append("\nNumber of pages (not including Root Page) = " //$NON-NLS-1$ + + model.getPages().length); + text.append("\nNumber of shared groups = " //$NON-NLS-1$ + + model.getChildrenOfType(AbstractIntroElement.GROUP).length); + text + .append("\nNumber of unresolved extensions = " //$NON-NLS-1$ + + model + .getChildrenOfType(AbstractIntroElement.CONTAINER_EXTENSION).length); + } + + /** + * @param text + * @param root + */ private void printHomePage(AbstractIntroPage rootPage, StringBuilder text) { - text.append("\n\nHOME PAGE: "); //$NON-NLS-1$ - text.append("\n--------------"); //$NON-NLS-1$ - text - .append("\n\tis dynamic= " + ((IntroModelRoot) rootPage.getParent()).isDynamic()); //$NON-NLS-1$ - - text.append("\n\tid = " + rootPage.getId()); //$NON-NLS-1$ - text.append("\n\ttitle = " + rootPage.getTitle()); //$NON-NLS-1$ - text.append("\n\tstyle = " + filterURL(rootPage.getStyle())); //$NON-NLS-1$ - text.append("\n\talt-style = " + filterURL(rootPage.getAltStyle())); //$NON-NLS-1$ - text.append("\n\turl = " + filterURL(rootPage.getUrl())); //$NON-NLS-1$ - text.append("\n\tstyle-id = " + rootPage.getStyleId()); //$NON-NLS-1$ - printPageStyles(rootPage, text); - } + text.append("\n\nHOME PAGE: "); //$NON-NLS-1$ + text.append("\n--------------"); //$NON-NLS-1$ + text + .append("\n\tis dynamic= " + ((IntroModelRoot) rootPage.getParent()).isDynamic()); //$NON-NLS-1$ + + text.append("\n\tid = " + rootPage.getId()); //$NON-NLS-1$ + text.append("\n\ttitle = " + rootPage.getTitle()); //$NON-NLS-1$ + text.append("\n\tstyle = " + filterURL(rootPage.getStyle())); //$NON-NLS-1$ + text.append("\n\talt-style = " + filterURL(rootPage.getAltStyle())); //$NON-NLS-1$ + text.append("\n\turl = " + filterURL(rootPage.getUrl())); //$NON-NLS-1$ + text.append("\n\tstyle-id = " + rootPage.getStyleId()); //$NON-NLS-1$ + printPageStyles(rootPage, text); + } private void printPageStyles(AbstractIntroPage page, StringBuilder text) { - text.append("\n\tpage styles are = "); //$NON-NLS-1$ - String[] styles = page.getStyles(); - for (String style : styles) + text.append("\n\tpage styles are = "); //$NON-NLS-1$ + String[] styles = page.getStyles(); + for (String style : styles) text.append(filterURL(style + "\n\t\t\t")); //$NON-NLS-1$ - text.append("\n\tpage alt-styles are = "); //$NON-NLS-1$ + text.append("\n\tpage alt-styles are = "); //$NON-NLS-1$ final Map altStylesHashtable = page.getAltStyles(); - if (altStylesHashtable == null) - return; - - Set set = altStylesHashtable.keySet(); - String[] sorted = new String[set.size()]; - set.toArray(sorted); - for (int i=0;i set = altStylesHashtable.keySet(); + String[] sorted = new String[set.size()]; + set.toArray(sorted); + for (int i=0;i