diff options
Diffstat (limited to 'org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/anchors')
-rw-r--r-- | org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/anchors/ExtensionReorderingTest.java | 118 |
1 files changed, 59 insertions, 59 deletions
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<IConfigurationElement> 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); |