Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.help.webapp/.settings/org.eclipse.jdt.core.prefs61
-rw-r--r--org.eclipse.help.webapp/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.help.webapp/build.properties1
-rw-r--r--org.eclipse.help.webapp/pom.xml4
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/HelpWebappPlugin.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java18
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java11
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ButtonData.java20
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CookiesData.java6
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CssUtil.java12
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/EnabledTopicUtils.java28
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/FrameData.java24
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IconFinder.java26
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IndexData.java21
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/LayoutData.java24
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java22
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java10
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ScopeSavingSearchData.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java76
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TocData.java42
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarButton.java4
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarData.java23
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TopicFinder.java16
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java42
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/View.java6
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetData.java20
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetManagerData.java41
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/AboutParser.java6
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ContextParser.java3
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ExtensionParser.java3
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/IndexFragmentParser.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/IndexParser.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/NavParser.java5
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ParseElement.java13
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ResultParser.java7
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/SearchParser.java5
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/TocFragmentParser.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/TocParser.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AboutService.java21
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AdvancedSearchService.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ContentService.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ContextService.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ExtensionService.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/IndexFragmentService.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/IndexService.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/NavService.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/SearchService.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/SearchStateService.java3
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/TocFragmentService.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/TocService.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/AboutServlet.java40
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java12
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContentServlet.java3
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java11
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ControlServlet.java35
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java18
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/DynamicXHTMLFilter.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java6
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtensionServlet.java11
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtraFilters.java19
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadAndBodyOutputStream.java3
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadOutputStream.java3
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/HighlightFilter.java34
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java39
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexServlet.java10
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java64
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java3
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/LiveHelpServlet.java3
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java5
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootFilter.java3
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PreferenceWriter.java7
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PrioritizedFilter.java10
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/SearchServlet.java14
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java18
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ShowInTocFilter.java1
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java3
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocServlet.java17
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java32
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/WebappWorkingSetManager.java17
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/SearchXMLGenerator.java11
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java14
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java14
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/Activator.java2
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/LinkCheckServlet.java1
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckLinkAction.java12
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckTocAction.java13
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/LoadTocAction.java47
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/VisitPageAction.java2
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/dialogs/SelectTocDialog.java15
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/AddScriptFilter.java1
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/OnLoadFilter.java11
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/PrebuiltIndexChecker.java4
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/TocLinkChecker.java26
-rw-r--r--org.eclipse.ua.tests/.settings/org.eclipse.jdt.core.prefs50
-rw-r--r--org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/FileUtil.java4
-rw-r--r--org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/ResourceFinder.java8
-rw-r--r--org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/UATestContentProducer.java1
-rw-r--r--org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/XMLUtil.java5
-rw-r--r--org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/servlet/CounterServlet.java1
-rw-r--r--org.eclipse.ua.tests/build.properties3
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestCheatSheetManagerEvents.java3
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestCompositeParser.java5
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestPersistence.java8
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestState.java1
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestTaskEvents.java2
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/ActionWithParameters.java2
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/CommandHandler.java10
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/FailingAction.java1
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/NegateIntegerHandler.java1
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/SimpleAction.java1
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestActionExecution.java1
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestCommandExecution.java5
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestVariableSubstitution.java1
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCategories.java22
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCollection.java1
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetManager.java16
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestStatePersistence.java11
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/InvalidCheatsheet.java1
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/NoError.java1
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/performance/OpenCheatSheetTest.java1
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializer.java27
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializerTest.java8
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/MockTaskEditor.java4
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/NavigateAction.java2
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/StatusCheck.java4
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/TestTaskEditor.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/CriteriaUtilitiesTest.java12
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/ParseCriteriaDefinition.java5
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/ParseTocWithCriteria.java56
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/SampleCriteriaDefinitionProvider.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/SampleCriteriaProvider.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/TestCriteriaProvider.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java13
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ConcurrentTocAccess.java5
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextLinkSorter.java7
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextTest.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/DocumentReaderTest.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexEntryTest.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexSeeTest.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ResourceTest.java12
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/TopicTest.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserContext.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteria.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteriaDefinition.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteriaDefinitionContribution.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionDefinition.java5
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionValueDefinition.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndex.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexEntry.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexSee.java5
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexSubpath.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserToc.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserToc2.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserTopic.java5
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserTopic2.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/BuildHtmlSearchIndex.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/HelpServerTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/IndexAssemblePerformanceTest.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/LowIterationHelpServerTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/OpenHelpTest.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/TocAssemblePerformanceTest.java8
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/BookmarksTest.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/HelpDataTest.java31
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java35
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ContentServletTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ContextServletTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/GetContentUsingRemoteHelp.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/GetContextUsingRemoteHelp.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/IndexServletTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/JettyTestServer.java7
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadIndexUsingRemoteHelp.java8
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadTocUsingRemoteHelp.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockContentServlet.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockContextServlet.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockIndexServlet.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockSearchServlet.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockTocServlet.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchServletTest.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchUsingRemote.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemotePreferenceTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchIndexCreation.java2
-rwxr-xr-xorg.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchServletTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchUsingRemoteHelp.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TocManagerTest.java31
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TocServletTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/MockScope.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AnalyzerTest.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/InfocenterWorkingSetManagerTest.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockSearchParticipant.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockSearchParticipantXML.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/UATestContentExtensionProvider.java5
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/WorkingSetManagerTest.java50
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/EnabledTopicTest.java10
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/HelpData.java10
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java19
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocProviderTest.java9
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocSortingTest.java28
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/UaTestTocProvider.java9
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/LoadTestServlet.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ParallelTestSupport.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ProducerSerializerTest.java10
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/TocModelSerializer.java8
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/TocModelSerializerTest.java19
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ChildLinkInsertion.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilter.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterOne.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterThree.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterTwo.java3
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterExtensionTest.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerBinding.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/LocaleTest.java9
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletRequest.java69
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletResponse.java37
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ParallelServerAccessTest.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/RestrictedTopicParameter.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/TocZipTest.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/AdvancedSearchServiceTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ContentServiceTest.java5
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ContextServiceTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ExtensionServiceTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/IndexFragmentServiceTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/IndexServiceTest.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/SearchServiceTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocFragmentServiceTest.java12
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocServiceTest.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestFrame.java5
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestHelpToolbarFrame.java8
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchButton.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchData.java12
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchView.java8
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/anchors/ExtensionReorderingTest.java10
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java16
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/parser/ValidTest.java33
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java2
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java60
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializerTest.java31
244 files changed, 1503 insertions, 909 deletions
diff --git a/org.eclipse.help.webapp/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.help.webapp/.settings/org.eclipse.jdt.core.prefs
index cadacde6f..b0192a3a1 100644
--- a/org.eclipse.help.webapp/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.help.webapp/.settings/org.eclipse.jdt.core.prefs
@@ -1,55 +1,102 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
diff --git a/org.eclipse.help.webapp/META-INF/MANIFEST.MF b/org.eclipse.help.webapp/META-INF/MANIFEST.MF
index 205a5c08c..a413287bb 100644
--- a/org.eclipse.help.webapp/META-INF/MANIFEST.MF
+++ b/org.eclipse.help.webapp/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %help_webapp_plugin_name
Bundle-SymbolicName: org.eclipse.help.webapp;singleton:=true
-Bundle-Version: 3.6.400.qualifier
+Bundle-Version: 3.7.0.qualifier
Bundle-Activator: org.eclipse.help.internal.webapp.HelpWebappPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.help.webapp/build.properties b/org.eclipse.help.webapp/build.properties
index 061e6b155..b9efe9acb 100644
--- a/org.eclipse.help.webapp/build.properties
+++ b/org.eclipse.help.webapp/build.properties
@@ -25,4 +25,5 @@ bin.includes = plugin.xml,\
web-archive/,\
advancedstate/
output.. = bin/
+javacWarnings..=-unavoidableGenericProblems
diff --git a/org.eclipse.help.webapp/pom.xml b/org.eclipse.help.webapp/pom.xml
index 517ee79fb..a88515ef6 100644
--- a/org.eclipse.help.webapp/pom.xml
+++ b/org.eclipse.help.webapp/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2014 Eclipse Foundation.
+ Copyright (c) 2012, 2015 Eclipse Foundation.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@
</parent>
<groupId>org.eclipse.help</groupId>
<artifactId>org.eclipse.help.webapp</artifactId>
- <version>3.6.400-SNAPSHOT</version>
+ <version>3.7.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/HelpWebappPlugin.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/HelpWebappPlugin.java
index ecc42c499..3bf9ca78a 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/HelpWebappPlugin.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/HelpWebappPlugin.java
@@ -68,6 +68,7 @@ public class HelpWebappPlugin extends Plugin {
*
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
@@ -85,6 +86,7 @@ public class HelpWebappPlugin extends Plugin {
*
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
//bundleContext = null;
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java
index 77e82accc..c25cb1b53 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2014 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,16 +21,17 @@ import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Locale;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.help.IHelpContentProducer;
import org.eclipse.help.internal.base.HelpBasePlugin;
import org.eclipse.help.internal.base.MissingContentManager;
+import org.eclipse.help.internal.base.MissingContentManager.Placeholder;
import org.eclipse.help.internal.base.remote.RemoteStatusData;
import org.eclipse.help.internal.base.util.ProxyUtil;
import org.eclipse.help.internal.protocols.HelpURLStreamHandler;
import org.eclipse.help.internal.util.ProductPreferences;
import org.eclipse.help.internal.webapp.data.UrlUtil;
import org.eclipse.help.internal.webapp.data.WebappPreferences;
-import org.eclipse.core.runtime.Platform;
public class StatusProducer implements IHelpContentProducer {
@@ -52,6 +53,7 @@ public class StatusProducer implements IHelpContentProducer {
+ @Override
public InputStream getInputStream(String pluginID, String href, Locale locale) {
// Only accept requests for our pages. Otherwise
@@ -81,8 +83,8 @@ public class StatusProducer implements IHelpContentProducer {
// Get all remote sites, and subset of non-working sites
- ArrayList remoteSites = RemoteStatusData.getRemoteSites();
- ArrayList badSites = RemoteStatusData.checkSitesConnectivity(remoteSites);
+ ArrayList<URL> remoteSites = RemoteStatusData.getRemoteSites();
+ ArrayList<URL> badSites = RemoteStatusData.checkSitesConnectivity(remoteSites);
RemoteStatusData.clearCache();
// Check to see if there are any enabled remote sites.
@@ -197,7 +199,7 @@ public class StatusProducer implements IHelpContentProducer {
String activeLink =
MessageFormat.format(
WebappResources.getString("remotePreferences", locale), //$NON-NLS-1$
- new String[]{getActiveLink(locale)});
+ getActiveLink(locale));
pageBuffer.append(tab(3)+activeLink);
@@ -285,13 +287,13 @@ public class StatusProducer implements IHelpContentProducer {
pageBuffer.append(WebappResources.getString("installInstructions", locale)); //$NON-NLS-1$
pageBuffer.append("</p>\n"); //$NON-NLS-1$
pageBuffer.append(tab(3)+"<ul>\n"); //$NON-NLS-1$
- for (int i = 0; i < unresolved.length; i++ ) {
+ for (Placeholder element : unresolved) {
pageBuffer.append(tab(4) + "<li>\n"); //$NON-NLS-1$
pageBuffer.append(tab(5) + "<a href = \""); //$NON-NLS-1$
- String href = unresolved[i].placeholderPage;
+ String href = element.placeholderPage;
pageBuffer.append(UrlUtil.getHelpURL(href, 2));
pageBuffer.append("\">"); //$NON-NLS-1$
- pageBuffer.append(unresolved[i].bundle);
+ pageBuffer.append(element.bundle);
pageBuffer.append("</a>\n"); //$NON-NLS-1$
pageBuffer.append(tab(4) + "</li>\n"); //$NON-NLS-1$
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java
index 0da3e8d45..e6d696278 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/WebappResources.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,9 +21,8 @@ import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
-import org.osgi.framework.Bundle;
-
import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
/**
* Uses a resource bundle to load images and strings from a property file in a
@@ -32,7 +31,7 @@ import org.eclipse.core.runtime.Platform;
public class WebappResources {
// resource bundles indexed by locale
- private static HashMap resourceBundleTable = new HashMap();
+ private static HashMap<Locale, ResourceBundle> resourceBundleTable = new HashMap<Locale, ResourceBundle>();
/**
* Returns a string from a property file. It uses 'name' as a the key to
@@ -93,7 +92,7 @@ public class WebappResources {
try {
String stringFromPropertiesFile = bundle.getString(name);
stringFromPropertiesFile = MessageFormat.format(
- stringFromPropertiesFile, args);
+ stringFromPropertiesFile, (Object[]) args);
return stringFromPropertiesFile;
} catch (Exception e) {
return name;
@@ -111,7 +110,7 @@ public class WebappResources {
locale = getDefaultLocale();
// check cache
- ResourceBundle bundle = (ResourceBundle) resourceBundleTable
+ ResourceBundle bundle = resourceBundleTable
.get(locale);
// load bundle
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ButtonData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ButtonData.java
index 14a05a10a..d1d0d8b17 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ButtonData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ButtonData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,7 +13,6 @@ package org.eclipse.help.internal.webapp.data;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletContext;
@@ -30,7 +29,7 @@ import org.eclipse.help.webapp.AbstractButton;
public class ButtonData extends RequestData {
private static final String BUTTON_EXTENSION_POINT = "org.eclipse.help.webapp.toolbarButton"; //$NON-NLS-1$
- private List allButtons;
+ private List<AbstractButton> allButtons;
public ButtonData(ServletContext context, HttpServletRequest request,
HttpServletResponse response) {
@@ -42,30 +41,29 @@ public class ButtonData extends RequestData {
IConfigurationElement[] elements = registry
.getConfigurationElementsFor(BUTTON_EXTENSION_POINT);
if (allButtons == null) {
- allButtons = new ArrayList();
- for (int i = 0; i < elements.length; i++) {
+ allButtons = new ArrayList<AbstractButton>();
+ for (IConfigurationElement element : elements) {
Object obj = null;
try {
- obj = elements[i].createExecutableExtension("class"); //$NON-NLS-1$
+ obj = element.createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
HelpWebappPlugin.logError("Create extension failed:[" //$NON-NLS-1$
+ BUTTON_EXTENSION_POINT + "].", e); //$NON-NLS-1$
}
if (obj instanceof AbstractButton) {
- allButtons.add(obj);
+ allButtons.add((AbstractButton) obj);
}
}
Collections.sort(allButtons);
}
- List buttonList = new ArrayList();
- for (Iterator iter = allButtons.iterator(); iter.hasNext();) {
- AbstractButton button = (AbstractButton) iter.next();
+ List<AbstractButton> buttonList = new ArrayList<AbstractButton>();
+ for (AbstractButton button : allButtons) {
//if (button.isVisible() && button.getLocation() == location) {
buttonList.add(button);
//}
}
- AbstractButton[] buttons = (AbstractButton[]) buttonList.toArray(new AbstractButton[buttonList.size()]);
+ AbstractButton[] buttons = buttonList.toArray(new AbstractButton[buttonList.size()]);
return buttons;
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CookiesData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CookiesData.java
index e51f60221..cb99a265e 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CookiesData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CookiesData.java
@@ -33,9 +33,9 @@ public class CookiesData extends RequestData {
public boolean isSynchToc() {
Cookie[] cookies = request.getCookies();
if (cookies != null) {
- for (int i=0;i<cookies.length;++i) {
- if ("synchToc".equals(cookies[i].getName())) { //$NON-NLS-1$
- return String.valueOf(true).equals(cookies[i].getValue());
+ for (Cookie cookie : cookies) {
+ if ("synchToc".equals(cookie.getName())) { //$NON-NLS-1$
+ return String.valueOf(true).equals(cookie.getValue());
}
}
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CssUtil.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CssUtil.java
index f9df4178c..d5b80f9aa 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CssUtil.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CssUtil.java
@@ -11,7 +11,6 @@
package org.eclipse.help.internal.webapp.data;
-import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
@@ -54,18 +53,17 @@ public class CssUtil {
return result;
}
- public static void addCssFiles(final String preference, List list) {
+ public static void addCssFiles(final String preference, List<String> list) {
String topicCssPath = Platform.getPreferencesService().getString(HelpBasePlugin.PLUGIN_ID, preference, "", null); //$NON-NLS-1$
String[] cssFiles = CssUtil.getCssFilenames(topicCssPath);
- for (int i = 0; i < cssFiles.length; i++) {
- list.add(cssFiles[i]);
+ for (String cssFile : cssFiles) {
+ list.add(cssFile);
}
}
- public static String createCssIncludes(List cssFiles, String backPath) {
+ public static String createCssIncludes(List<String> cssFiles, String backPath) {
StringBuffer script = new StringBuffer();
- for (Iterator iter = cssFiles.iterator(); iter.hasNext();) {
- String cssPath = (String) iter.next();
+ for (String cssPath : cssFiles) {
script.append(cssLink1);
script.append(fixCssPath(cssPath, backPath));
script.append(cssLink2);
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/EnabledTopicUtils.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/EnabledTopicUtils.java
index 88cad13b0..95200c1ac 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/EnabledTopicUtils.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/EnabledTopicUtils.java
@@ -46,8 +46,8 @@ public class EnabledTopicUtils {
public static boolean hasEnabledSubtopic(ITopic topic) {
ITopic[] subtopics = topic.getSubtopics();
- for (int i = 0; i < subtopics.length; i++) {
- if (isEnabled(subtopics[i])) {
+ for (ITopic subtopic : subtopics) {
+ if (isEnabled(subtopic)) {
return true;
}
}
@@ -66,8 +66,8 @@ public class EnabledTopicUtils {
}
// A toc is enabled only if at least one subtopic is enabled
ITopic[] subtopics = toc.getTopics();
- for (int i = 0; i < subtopics.length; i++) {
- if (isEnabled(subtopics[i])) {
+ for (ITopic subtopic : subtopics) {
+ if (isEnabled(subtopic)) {
return true;
}
}
@@ -84,21 +84,21 @@ public class EnabledTopicUtils {
return false;
}
ITopic[] topics = entry.getTopics();
- for (int i=0;i<topics.length;++i) {
- if (isEnabled(topics[i])) {
+ for (ITopic topic : topics) {
+ if (isEnabled(topic)) {
return true;
}
}
IIndexEntry[] subentries = entry.getSubentries();
- for (int i=0;i<subentries.length;++i) {
- if (isEnabled(subentries[i])) {
+ for (IIndexEntry subentrie : subentries) {
+ if (isEnabled(subentrie)) {
return true;
}
}
if (entry instanceof IIndexEntry2) {
IIndexSee[] sees = ((IIndexEntry2)entry).getSees();
- for (int i = 0; i < sees.length; i++) {
- if (isEnabled(sees[i])) {
+ for (IIndexSee see : sees) {
+ if (isEnabled(see)) {
return true;
}
}
@@ -118,13 +118,13 @@ public class EnabledTopicUtils {
public static IIndexEntry[] getEnabled(IIndexEntry[] entries) {
for (int i=0;i<entries.length;++i) {
if (!isEnabled(entries[i])) {
- List list = new ArrayList(entries.length);
+ List<IIndexEntry> list = new ArrayList<IIndexEntry>(entries.length);
for (int j=0;j<entries.length;++j) {
if (j < i || isEnabled(entries[j])) {
list.add(entries[j]);
}
}
- return (IIndexEntry[])list.toArray(new IIndexEntry[list.size()]);
+ return list.toArray(new IIndexEntry[list.size()]);
}
}
return entries;
@@ -138,13 +138,13 @@ public class EnabledTopicUtils {
public static ITopic[] getEnabled(ITopic[] topics) {
for (int i=0;i<topics.length;++i) {
if (!isEnabled(topics[i])) {
- List list = new ArrayList(topics.length);
+ List<ITopic> list = new ArrayList<ITopic>(topics.length);
for (int j=0;j<topics.length;++j) {
if (j < i || isEnabled(topics[j])) {
list.add(topics[j]);
}
}
- return (ITopic[])list.toArray(new ITopic[list.size()]);
+ return list.toArray(new ITopic[list.size()]);
}
}
return topics;
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/FrameData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/FrameData.java
index 3d1688827..393d8bbb2 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/FrameData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/FrameData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,7 +13,6 @@ package org.eclipse.help.internal.webapp.data;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletContext;
@@ -30,7 +29,7 @@ import org.eclipse.help.webapp.AbstractFrame;
public class FrameData extends RequestData {
private static final String FRAME_EXTENSION_POINT = "org.eclipse.help.webapp.frame"; //$NON-NLS-1$
- private List allFrames;
+ private List<AbstractFrame> allFrames;
public FrameData(ServletContext context, HttpServletRequest request,
HttpServletResponse response) {
@@ -42,30 +41,29 @@ public class FrameData extends RequestData {
IConfigurationElement[] elements = registry
.getConfigurationElementsFor(FRAME_EXTENSION_POINT);
if (allFrames == null) {
- allFrames = new ArrayList();
- for (int i = 0; i < elements.length; i++) {
+ allFrames = new ArrayList<AbstractFrame>();
+ for (IConfigurationElement element : elements) {
Object obj = null;
try {
- obj = elements[i].createExecutableExtension("class"); //$NON-NLS-1$
+ obj = element.createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
HelpWebappPlugin.logError("Create extension failed:[" //$NON-NLS-1$
+ FRAME_EXTENSION_POINT + "].", e); //$NON-NLS-1$
}
if (obj instanceof AbstractFrame) {
- allFrames.add(obj);
+ allFrames.add((AbstractFrame) obj);
}
}
Collections.sort(allFrames);
}
- List frameList = new ArrayList();
- for (Iterator iter = allFrames.iterator(); iter.hasNext();) {
- AbstractFrame frame = (AbstractFrame) iter.next();
+ List<AbstractFrame> frameList = new ArrayList<AbstractFrame>();
+ for (AbstractFrame frame : allFrames) {
if (frame.isVisible() && frame.getLocation() == location) {
frameList.add(frame);
}
}
- AbstractFrame[] frames = (AbstractFrame[]) frameList.toArray(new AbstractFrame[frameList.size()]);
+ AbstractFrame[] frames = frameList.toArray(new AbstractFrame[frameList.size()]);
return frames;
}
@@ -76,9 +74,9 @@ public class FrameData extends RequestData {
public String getContentAreaFrameSizes() {
String size = "24,*"; //$NON-NLS-1$
AbstractFrame[] frames = getFrames(AbstractFrame.BELOW_CONTENT);
- for (int f = 0; f < frames.length; f++) {
+ for (AbstractFrame frame : frames) {
size += ',';
- size += frames[f].getSize();
+ size += frame.getSize();
}
return size;
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IconFinder.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IconFinder.java
index 0cf0dd4e1..20d3a4228 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IconFinder.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IconFinder.java
@@ -14,6 +14,7 @@ package org.eclipse.help.internal.webapp.data;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
+
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.Platform;
@@ -38,12 +39,12 @@ public class IconFinder {
public static int TYPEICON_LEAF = 2;
- private static Map IconPathMap = null; // hash table
+ private static Map<String, String> IconPathMap = null; // hash table
private static void addIconPath(String IconKey, String IconPath) {
if (IconPathMap == null) {
- IconPathMap = new HashMap();
- IconPathMap = new TreeMap(); // sorted map
+ IconPathMap = new HashMap<String, String>();
+ IconPathMap = new TreeMap<String, String>(); // sorted map
}
IconPathMap.put(IconKey, IconPath);
}
@@ -125,24 +126,23 @@ public class IconFinder {
IExtension[] extensionsFound = Platform.getExtensionRegistry()
.getExtensionPoint(EXT_PT).getExtensions();
- for (int i = 0; i < extensionsFound.length; i++) {
+ for (IExtension element : extensionsFound) {
- IConfigurationElement[] configElements = extensionsFound[i]
+ IConfigurationElement[] configElements = element
.getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- if (configElements[j].getName().equals(TOC_ICON_ELEMENT)) {
- IConfigurationElement iconElem = configElements[j];
+ for (IConfigurationElement iconElem : configElements) {
+ if (iconElem.getName().equals(TOC_ICON_ELEMENT)) {
String attrs[] = iconElem.getAttributeNames();
String contributorID = iconElem.getContributor().getName();
- for (int k = 0; k < attrs.length; k++) {
- if (attrs[k].equals(OPEN_ICON_PATH))
+ for (String attr : attrs) {
+ if (attr.equals(OPEN_ICON_PATH))
IconFinder.setIconImagePath(contributorID, iconElem.getAttribute(OPEN_ICON_PATH),iconElem.getAttribute(TOC_ICON_ID) + OPEN);
- if (attrs[k].equals(CLOSED_ICON_PATH))
+ if (attr.equals(CLOSED_ICON_PATH))
IconFinder.setIconImagePath(contributorID,iconElem.getAttribute(CLOSED_ICON_PATH),iconElem.getAttribute(TOC_ICON_ID)+ CLOSED);
- if (attrs[k].equals(LEAF_ICON_PATH))
+ if (attr.equals(LEAF_ICON_PATH))
IconFinder.setIconImagePath(contributorID, iconElem.getAttribute(LEAF_ICON_PATH),iconElem.getAttribute(TOC_ICON_ID) + LEAF);
- if (attrs[k].equals(ICON_ALT_TEXT))
+ if (attr.equals(ICON_ALT_TEXT))
IconFinder.setIconAltText(iconElem.getAttribute(ICON_ALT_TEXT),iconElem.getAttribute(TOC_ICON_ID) + ALT);
}
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IndexData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IndexData.java
index 14f6344e5..13e2ea997 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IndexData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IndexData.java
@@ -81,8 +81,7 @@ public class IndexData extends ActivitiesData {
public void generateIds(Writer out) throws IOException {
boolean first = true;
IIndexEntry[] entries = index.getEntries();
- for (int i=0;i<entries.length;++i) {
- IIndexEntry entry = entries[i];
+ for (IIndexEntry entry : entries) {
if (entry != null && entry.getKeyword() != null && entry.getKeyword().length() > 0) {
if (first) {
first = false;
@@ -105,9 +104,9 @@ public class IndexData extends ActivitiesData {
public void generateIndex(Writer out) throws IOException {
this.out = out;
IIndexEntry[] entries = index.getEntries();
- for (int i=0;i<entries.length;++i) {
- if (EnabledTopicUtils.isEnabled(entries[i])) {
- generateEntry(entries[i], 0);
+ for (IIndexEntry entrie : entries) {
+ if (EnabledTopicUtils.isEnabled(entrie)) {
+ generateEntry(entrie, 0);
}
}
}
@@ -168,8 +167,8 @@ public class IndexData extends ActivitiesData {
public void generateBasicIndex(Writer out) throws IOException {
this.out = out;
IIndexEntry[] entries = index.getEntries();
- for (int i=0;i<entries.length;++i) {
- generateBasicEntry(entries[i], 0);
+ for (IIndexEntry entrie : entries) {
+ generateBasicEntry(entrie, 0);
}
}
@@ -302,9 +301,7 @@ public class IndexData extends ActivitiesData {
out.write(expandedCollapsed);
out.write("\">\n"); //$NON-NLS-1$
}
- for (int i = 0; i < topics.length; ++i) {
- ITopic topic = (ITopic)topics[i];
-
+ for (ITopic topic : topics) {
out.write("<li>"); //$NON-NLS-1$
if (usePlusMinus && advancedUI) {
out.write("<img class=\"h\" src=\""); //$NON-NLS-1$
@@ -350,8 +347,8 @@ public class IndexData extends ActivitiesData {
out.write("<ul class=\"expanded\">\n"); //$NON-NLS-1$
}
IIndexEntry[] subentries = entry.getSubentries();
- for (int i=0;i<subentries.length;++i) {
- generateEntry(subentries[i], level);
+ for (IIndexEntry subentrie : subentries) {
+ generateEntry(subentrie, level);
}
if (advancedUI) {
out.write("</ul>\n"); //$NON-NLS-1$
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/LayoutData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/LayoutData.java
index 3a33356fe..a578cc517 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/LayoutData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/LayoutData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -157,7 +157,7 @@ public class LayoutData extends RequestData {
"", //$NON-NLS-1$
preferences.getImagesDirectory() + "/bookmarks_view.gif", (char)0, false); //$NON-NLS-1$
- ArrayList viewList = new ArrayList();
+ ArrayList<AbstractView> viewList = new ArrayList<AbstractView>();
viewList.add(tocview);
if (indexview != null) {
viewList.add(indexview);
@@ -170,28 +170,28 @@ public class LayoutData extends RequestData {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] elements = registry
.getConfigurationElementsFor(VIEW_EXTENSION_POINT);
- for (int i = 0; i < elements.length; i++) {
+ for (IConfigurationElement element : elements) {
Object obj = null;
try {
- obj = elements[i].createExecutableExtension("class"); //$NON-NLS-1$
+ obj = element.createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
HelpWebappPlugin.logError("Create extension failed:[" //$NON-NLS-1$
+ VIEW_EXTENSION_POINT + "].", e); //$NON-NLS-1$
}
if (obj instanceof AbstractView) {
- viewList.add(obj);
+ viewList.add((AbstractView) obj);
}
}
- views = (AbstractView[]) viewList.toArray(new AbstractView[viewList.size()]);
+ views = viewList.toArray(new AbstractView[viewList.size()]);
return views;
}
public String getVisibleView() {
String requestedView = request.getParameter("tab"); //$NON-NLS-1$
AbstractView[] allViews = getViews();
- for (int i = 0; i < allViews.length; i++) {
- if (allViews[i].getName().equals(requestedView)) {
+ for (AbstractView allView : allViews) {
+ if (allView.getName().equals(requestedView)) {
return requestedView;
}
}
@@ -201,9 +201,9 @@ public class LayoutData extends RequestData {
public AbstractView getCurrentView() {
String name = request.getParameter("view"); //$NON-NLS-1$
views = getViews();
- for (int i = 0; i < views.length; i++)
- if (views[i].getName().equals(name))
- return views[i];
+ for (AbstractView view : views)
+ if (view.getName().equals(name))
+ return view;
return null;
}
@@ -216,7 +216,7 @@ public class LayoutData extends RequestData {
try {
Bundle bundle = Platform.getBundle(resourceContainer);
BundleContext bundleContext = HelpWebappPlugin.getContext();
- ServiceReference ref = bundleContext.getServiceReference(BundleLocalization.class.getName());
+ ServiceReference<?> ref = bundleContext.getServiceReference(BundleLocalization.class.getName());
BundleLocalization localization = (BundleLocalization) bundleContext.getService(ref);
return localization.getLocalization(bundle, locale).getString(resource);
} catch (Exception e) {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java
index ee0a2ecfe..6ee161c9b 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java
@@ -215,8 +215,8 @@ public class PrintData extends RequestData {
}
ITopic[] subtopics = ScopeUtils.inScopeTopics(topic.getSubtopics(), scope);
- for (int i = 0; i < subtopics.length; ++i) {
- topicsRequested += topicsRequested(subtopics[i]);
+ for (ITopic subtopic : subtopics) {
+ topicsRequested += topicsRequested(subtopic);
}
return topicsRequested;
}
@@ -288,13 +288,13 @@ public class PrintData extends RequestData {
*/
public void generateContent(Writer out) throws IOException {
int topicsGenerated = 0;
- generateContent(getTopic(), null, topicsGenerated, new HashSet(), out);
+ generateContent(getTopic(), null, topicsGenerated, new HashSet<String>(), out);
}
/*
* Auxiliary method for recursively generating print content.
*/
- private int generateContent(ITopic topic, String sectionId, int topicsGenerated, Set generated, Writer out) throws IOException {
+ private int generateContent(ITopic topic, String sectionId, int topicsGenerated, Set<String> generated, Writer out) throws IOException {
if (topicsGenerated < allowedMaxTopics) {
String href = topic.getHref();
if (href != null && href.length() > 0) {
@@ -435,9 +435,9 @@ public class PrintData extends RequestData {
return HelpPlugin.getTocManager().getTocs(getLocale())[index];
}
IToc[] tocs = HelpPlugin.getTocManager().getTocs(getLocale());
- for (int i=0;i<tocs.length;++i) {
- if (tocs[i].getTopic(topicParam) != null) {
- return tocs[i];
+ for (IToc toc : tocs) {
+ if (toc.getTopic(topicParam) != null) {
+ return toc;
}
}
}
@@ -467,13 +467,13 @@ public class PrintData extends RequestData {
}
else {
IToc[] tocs = HelpPlugin.getTocManager().getTocs(getLocale());
- for (int i=0;i<tocs.length;++i) {
- ITopic topic = tocs[i].getTopic(topicParam);
+ for (IToc toc : tocs) {
+ ITopic topic = toc.getTopic(topicParam);
if (topic != null) {
return topic;
}
// Test for root node as topic
- topic = tocs[i].getTopic(null);
+ topic = toc.getTopic(null);
if (topicParam.equals(topic.getHref())) {
return topic;
}
@@ -493,7 +493,7 @@ public class PrintData extends RequestData {
}
private String getCssIncludes() {
- List css = new ArrayList();
+ List<String> css = new ArrayList<String>();
CssUtil.addCssFiles("topic_css", css); //$NON-NLS-1$
return CssUtil.createCssIncludes(css, "../"); //$NON-NLS-1$
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java
index f7809e307..e8272d4d0 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java
@@ -67,7 +67,7 @@ public class RequestScope {
HttpServletResponse resp, boolean isSearchFilter) {
AbstractHelpScope[] scopeArray;
String scopeString;
- List scopes = new ArrayList();
+ List<AbstractHelpScope> scopes = new ArrayList<AbstractHelpScope>();
if (ProductPreferences.useEnablementFilters()) {
scopes.add(new FilterScope()); // Workbench is always filtered, infocenter may be
}
@@ -98,7 +98,7 @@ public class RequestScope {
} catch (Exception e) {
}
}
- scopeArray = (AbstractHelpScope[]) scopes.toArray(new AbstractHelpScope[scopes.size()]);
+ scopeArray = scopes.toArray(new AbstractHelpScope[scopes.size()]);
return scopeArray;
}
@@ -157,9 +157,9 @@ public class RequestScope {
// check if scope was passed earlier in this session
Cookie[] cookies = request.getCookies();
if (cookies != null) {
- for (int c = 0; c < cookies.length; c++) {
- if (cookieName.equals(cookies[c].getName())) {
- return URLCoder.decode(cookies[c].getValue());
+ for (Cookie cookie : cookies) {
+ if (cookieName.equals(cookie.getName())) {
+ return URLCoder.decode(cookie.getValue());
}
}
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ScopeSavingSearchData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ScopeSavingSearchData.java
index f7081059c..6b99d15b4 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ScopeSavingSearchData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ScopeSavingSearchData.java
@@ -22,6 +22,7 @@ public class ScopeSavingSearchData extends SearchData {
super(context, request, response);
}
+ @Override
protected boolean canSaveScope() {
return true;
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java
index 2ec4fc0fb..4ffa432ac 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,6 +18,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
+
import javax.servlet.ServletContext;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
@@ -42,6 +43,7 @@ import org.eclipse.help.internal.search.SearchQuery;
import org.eclipse.help.internal.search.SearchResults;
import org.eclipse.help.internal.webapp.HelpWebappPlugin;
import org.eclipse.help.internal.webapp.servlet.WebappWorkingSetManager;
+import org.eclipse.help.internal.workingset.AdaptableHelpResource;
import org.eclipse.help.internal.workingset.AdaptableSelectedToc;
import org.eclipse.help.internal.workingset.AdaptableSelectedTopic;
import org.eclipse.help.internal.workingset.AdaptableToc;
@@ -49,7 +51,6 @@ import org.eclipse.help.internal.workingset.AdaptableTopic;
import org.eclipse.help.internal.workingset.WorkingSet;
import org.eclipse.help.search.AbstractSearchProcessor;
import org.eclipse.help.search.ISearchEngineResult;
-import org.eclipse.help.search.ISearchEngineResult2;
import org.eclipse.help.search.ISearchResult;
import org.eclipse.help.search.SearchProcessorInfo;
import org.eclipse.osgi.util.NLS;
@@ -81,7 +82,7 @@ public class SearchData extends ActivitiesData {
private QueryTooComplexException queryException = null;
// List of alternate search terms
- private List altList = new ArrayList();
+ private List<String> altList = new ArrayList<String>();
private boolean showCategories = false;
@@ -137,20 +138,18 @@ public class SearchData extends ActivitiesData {
altList.clear();
AbstractSearchProcessor processors[] = SearchManager.getSearchProcessors();
- for (int p=0;p<processors.length;p++)
- {
+ for (AbstractSearchProcessor processor : processors) {
SearchProcessorInfo result =
- processors[p].preSearch(searchWord);
+ processor.preSearch(searchWord);
if (result!=null)
{
String alternates[] = result.getAlternateTerms();
if (alternates!=null)
{
- for (int a=0;a<alternates.length;a++)
- {
+ for (String alternate : alternates) {
String div =
- "<div><a target=\"_self\" href=\"./searchView.jsp?searchWord="+alternates[a]+"\">"+ //$NON-NLS-1$ //$NON-NLS-2$
- alternates[a]+
+ "<div><a target=\"_self\" href=\"./searchView.jsp?searchWord="+alternate+"\">"+ //$NON-NLS-1$ //$NON-NLS-2$
+ alternate+
"</a></div>"; //$NON-NLS-1$
if (!altList.contains(div))
@@ -179,9 +178,8 @@ public class SearchData extends ActivitiesData {
ISearchResult results[] = SearchManager.convertHitsToResults(hits);
boolean reset= false;
- for (int p=0;p<processors.length;p++)
- {
- ISearchResult tmp[] = processors[p].postSearch(searchWord,results);
+ for (AbstractSearchProcessor processor : processors) {
+ ISearchResult tmp[] = processor.postSearch(searchWord,results);
if (tmp!=null)
{
reset = true;
@@ -324,9 +322,9 @@ public class SearchData extends ActivitiesData {
public boolean isShowDescriptions() {
Cookie[] cookies = request.getCookies();
if (cookies != null) {
- for (int i=0;i<cookies.length;++i) {
- if ("showDescriptions".equals(cookies[i].getName())) { //$NON-NLS-1$
- return String.valueOf(true).equals(cookies[i].getValue());
+ for (Cookie cookie : cookies) {
+ if ("showDescriptions".equals(cookie.getName())) { //$NON-NLS-1$
+ return String.valueOf(true).equals(cookie.getValue());
}
}
}
@@ -375,8 +373,8 @@ public class SearchData extends ActivitiesData {
String[] books = request.getParameterValues("scope"); //$NON-NLS-1$
if (books == null)
return false;
- for (int i = 0; i < books.length; i++) {
- if (books[i].equals(href)) {
+ for (String book : books) {
+ if (book.equals(href)) {
return true;
}
}
@@ -458,7 +456,7 @@ public class SearchData extends ActivitiesData {
String fieldSearchStr = request.getParameter("fieldSearch"); //$NON-NLS-1$
boolean fieldSearch = fieldSearchStr != null ? new Boolean(
fieldSearchStr).booleanValue() : false;
- return new SearchQuery(searchWord == null ? "" : searchWord, fieldSearch, new ArrayList(), //$NON-NLS-1$
+ return new SearchQuery(searchWord == null ? "" : searchWord, fieldSearch, new ArrayList<String>(), //$NON-NLS-1$
getLocale());
}
@@ -505,9 +503,9 @@ public class SearchData extends ActivitiesData {
return null;
}
// confirm working set exists and use it
- ArrayList workingSetCol = new ArrayList(scopes.length);
- for (int s = 0; s < scopes.length; s++) {
- WorkingSet ws = wsmgr.getWorkingSet(scopes[s]);
+ ArrayList<WorkingSet> workingSetCol = new ArrayList<WorkingSet>(scopes.length);
+ for (String scope : scopes) {
+ WorkingSet ws = wsmgr.getWorkingSet(scope);
if (ws != null) {
workingSetCol.add(ws);
}
@@ -515,7 +513,7 @@ public class SearchData extends ActivitiesData {
if (workingSetCol.size() == 0) {
return null;
}
- return (WorkingSet[]) workingSetCol
+ return workingSetCol
.toArray(new WorkingSet[workingSetCol.size()]);
}
@@ -534,14 +532,14 @@ public class SearchData extends ActivitiesData {
return null;
}
// create working set from books
- ArrayList tocs = new ArrayList(scopes.length);
- for (int s = 0; s < scopes.length; s++) {
- AdaptableToc toc = wsmgr.getAdaptableToc(scopes[s]);
+ ArrayList<AdaptableToc> tocs = new ArrayList<AdaptableToc>(scopes.length);
+ for (String scope : scopes) {
+ AdaptableToc toc = wsmgr.getAdaptableToc(scope);
if (toc != null) {
tocs.add(toc);
}
}
- AdaptableToc[] adaptableTocs = (AdaptableToc[]) tocs
+ AdaptableToc[] adaptableTocs = tocs
.toArray(new AdaptableToc[tocs.size()]);
WorkingSet[] workingSets = new WorkingSet[1];
workingSets[0] = wsmgr.createWorkingSet("temp", adaptableTocs); //$NON-NLS-1$
@@ -560,7 +558,7 @@ public class SearchData extends ActivitiesData {
}
IToc toc = tocData.getTocs()[selectedToc];
ITopic[] topics = tocData.getTopicPathFromRootPath(toc);
- List resources = new ArrayList();
+ List<AdaptableHelpResource> resources = new ArrayList<AdaptableHelpResource>();
AdaptableToc adaptableToc = new AdaptableToc(toc);
if (topics != null) {
ITopic selectedTopic = topics[topics.length - 1];
@@ -586,7 +584,7 @@ public class SearchData extends ActivitiesData {
}
IToc toc = tocData.getTocs()[selectedToc];
ITopic[] topics = tocData.getTopicPathFromRootPath(toc);
- List resources = new ArrayList();
+ List<AdaptableHelpResource> resources = new ArrayList<AdaptableHelpResource>();
AdaptableSelectedToc adaptableSelectedToc = new AdaptableSelectedToc(toc);
if (topics != null) {
ITopic selectedTopic = topics[topics.length - 1];
@@ -640,7 +638,7 @@ public class SearchData extends ActivitiesData {
result.append(ServletResources.getString("AlternateSearchQueries", request)); //$NON-NLS-1$
result.append("<ul>"); //$NON-NLS-1$
for (int a=0;a<altList.size();a++)
- result.append("<li>"+(String)altList.get(a)+"</li>"); //$NON-NLS-1$ //$NON-NLS-2$
+ result.append("<li>"+altList.get(a)+"</li>"); //$NON-NLS-1$ //$NON-NLS-2$
result.append("</ul>"); //$NON-NLS-1$
return result.toString();
@@ -656,12 +654,13 @@ public class SearchData extends ActivitiesData {
super(workingSets, maxHits, locale, isQuickSearch);
setFilter(filter);
}
- public void addHits(List hits, String highlightTerms) {
- List filtered = new ArrayList();
- Iterator iter = hits.iterator();
+ @Override
+ public void addHits(List<SearchHit> hits, String highlightTerms) {
+ List<SearchHit> filtered = new ArrayList<SearchHit>();
+ Iterator<SearchHit> iter = hits.iterator();
while (iter.hasNext()) {
- Object obj = iter.next();
- if (!(obj instanceof ISearchEngineResult2 && ((ISearchEngineResult2)obj).canOpen())) {
+ SearchHit obj = iter.next();
+ if (!(obj != null && obj.canOpen())) {
filtered.add(obj);
}
}
@@ -679,10 +678,9 @@ public class SearchData extends ActivitiesData {
* contain {@code null} elements
*/
private static void primallySortByCategory(ISearchEngineResult[] toSort) {
- Arrays.sort(toSort, new Comparator() {
- public int compare(Object e1, Object e2) {
- IHelpResource c1 = ((ISearchEngineResult)e1).getCategory();
- IHelpResource c2 = ((ISearchEngineResult)e2).getCategory();
+ Arrays.sort(toSort, new Comparator<ISearchEngineResult>() {
+ @Override
+ public int compare(ISearchEngineResult c1, ISearchEngineResult c2) {
if (c1 == null && c2 == null) return 0;
if (c1 == null) return 1;
if (c2 == null) return -1;
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TocData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TocData.java
index d024888ce..2ab235081 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TocData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TocData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,7 +15,6 @@ import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletContext;
@@ -303,8 +302,8 @@ public class TocData extends ActivitiesData {
*/
public void generateBasicToc(int toc, Writer out) throws IOException {
ITopic[] topics = getEnabledSubtopics(tocs[toc]);
- for (int i = 0; i < topics.length; i++) {
- generateBasicTopic(topics[i], out);
+ for (ITopic topic : topics) {
+ generateBasicTopic(topic, out);
}
}
@@ -331,8 +330,8 @@ public class TocData extends ActivitiesData {
out.write("<ul>\n"); //$NON-NLS-1$
- for (int i = 0; i < topics.length; i++) {
- generateBasicTopic(topics[i], out);
+ for (ITopic topic2 : topics) {
+ generateBasicTopic(topic2, out);
}
out.write("</ul>\n"); //$NON-NLS-1$
@@ -384,8 +383,8 @@ public class TocData extends ActivitiesData {
* @return ITopic[]
*/
public ITopic[] getEnabledSubtopics(Object element) {
- List topics = getEnabledSubtopicList(element);
- return (ITopic[])topics.toArray(new ITopic[topics.size()]);
+ List<ITopic> topics = getEnabledSubtopicList(element);
+ return topics.toArray(new ITopic[topics.size()]);
}
/**
* Obtains children topics for a given navigation element. Topics from TOCs
@@ -394,10 +393,10 @@ public class TocData extends ActivitiesData {
* @param navigationElement
* @return List of ITopic
*/
- private List getEnabledSubtopicList(Object element) {
+ private List<ITopic> getEnabledSubtopicList(Object element) {
if (element instanceof IToc && !isEnabled((IToc) element))
- return Collections.EMPTY_LIST;
- List children;
+ return Collections.emptyList();
+ List<ITopic> children;
if (element instanceof IToc) {
children = Arrays.asList(((IToc)element).getTopics());
}
@@ -406,18 +405,18 @@ public class TocData extends ActivitiesData {
}
else {
// unknown element type
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- List childTopics = new ArrayList(children.size());
- for (Iterator childrenIt = children.iterator(); childrenIt.hasNext();) {
- Object c = childrenIt.next();
+ List<ITopic> childTopics = new ArrayList<ITopic>(children.size());
+ for (ITopic iTopic : children) {
+ Object c = iTopic;
if ((c instanceof ITopic)) {
// add topic only if it will not end up being an empty
// container
if (((((ITopic) c).getHref() != null && ((ITopic) c)
.getHref().length() > 0) || getEnabledSubtopicList(c).size() > 0) &&
!UAContentFilter.isFiltered(c, HelpEvaluationContext.getContext())) {
- childTopics.add(c);
+ childTopics.add((ITopic) c);
}
} else {
// it is a Toc, Anchor or Link,
@@ -453,19 +452,18 @@ public class TocData extends ActivitiesData {
} catch (IOException ioe) {
}
ITopic[] topics = topic.getSubtopics();
- for (int i = 0; i < topics.length; i++) {
- generateTopicLinks(topics[i], w, indent + 1);
+ for (ITopic topic2 : topics) {
+ generateTopicLinks(topic2, w, indent + 1);
}
}
public void generateLinks(Writer out) {
- for (int i = 0; i < tocs.length; i++) {
- IToc toc = tocs[i];
+ for (IToc toc : tocs) {
ITopic tocTopic = toc.getTopic(null);
generateTopicLinks(tocTopic, out, 0);
ITopic[] topics = toc.getTopics();
- for (int t = 0; t < topics.length; t++) {
- generateTopicLinks(topics[t], out, 1);
+ for (ITopic topic : topics) {
+ generateTopicLinks(topic, out, 1);
}
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarButton.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarButton.java
index b10805d86..425c7f791 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarButton.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarButton.java
@@ -62,14 +62,14 @@ public class ToolbarButton {
}
public String[][] getMenuData() {
- List list = new ArrayList();
+ List<String[]> list = new ArrayList<String[]>();
StringTokenizer tok = new StringTokenizer(param, ","); //$NON-NLS-1$
while(tok.hasMoreTokens()) {
String token = tok.nextToken();
int index = token.indexOf('=');
list.add(new String[] { token.substring(0, index), token.substring(index + 1) });
}
- return (String[][])list.toArray(new String[list.size()][]);
+ return list.toArray(new String[list.size()][]);
}
public String getTooltip() {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarData.java
index df73c517e..81a05a370 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarData.java
@@ -46,8 +46,8 @@ public class ToolbarData extends RequestData {
* down menu).
*/
public boolean hasMenu() {
- for (int i=0;i<buttons.length;++i) {
- if ("menu".equals(buttons[i].getAction())) { //$NON-NLS-1$
+ for (ToolbarButton button : buttons) {
+ if ("menu".equals(button.getAction())) { //$NON-NLS-1$
return true;
}
}
@@ -74,7 +74,7 @@ public class ToolbarData extends RequestData {
return;
}
- List buttonList = new ArrayList();
+ List<ToolbarButton> buttonList = new ArrayList<ToolbarButton>();
for (int i = 0; i < names.length; i++) {
if ("".equals(names[i])) //$NON-NLS-1$
buttonList.add(new ToolbarButton());
@@ -101,21 +101,21 @@ public class ToolbarData extends RequestData {
+ "/" + "maximize.gif", //$NON-NLS-1$ //$NON-NLS-2$
"restore_maximize", null, "off")); //$NON-NLS-1$ //$NON-NLS-2$
}
- buttons = (ToolbarButton[]) buttonList
+ buttons = buttonList
.toArray(new ToolbarButton[buttonList.size()]);
}
- private void addExtensionButtons(List buttonList) {
+ private void addExtensionButtons(List<ToolbarButton> buttonList) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] elements = registry
.getConfigurationElementsFor(BUTTON_EXTENSION_POINT);
- List extensionButtons = new ArrayList();
- List scripts = new ArrayList();
- for (int i = 0; i < elements.length; i++) {
+ List<AbstractButton> extensionButtons = new ArrayList<AbstractButton>();
+ List<String> scripts = new ArrayList<String>();
+ for (IConfigurationElement element : elements) {
Object obj = null;
try {
- obj = elements[i].createExecutableExtension("class"); //$NON-NLS-1$
+ obj = element.createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
HelpWebappPlugin.logError("Create extension failed:[" //$NON-NLS-1$
+ BUTTON_EXTENSION_POINT + "].", e); //$NON-NLS-1$
@@ -135,8 +135,7 @@ public class ToolbarData extends RequestData {
Collections.sort(extensionButtons);
- for (Iterator iter = extensionButtons.iterator(); iter.hasNext();) {
- AbstractButton button = (AbstractButton) iter.next();
+ for (AbstractButton button : extensionButtons) {
String scriptFile = button.getJavaScriptURL();
if (scriptFile != null) {
scripts.add(UrlUtil.getRelativePath(request, scriptFile));
@@ -149,7 +148,7 @@ public class ToolbarData extends RequestData {
button.getState());
buttonList.add(toolButton);
}
- scriptFiles = (String[]) scripts.toArray(new String[scripts.size()]);
+ scriptFiles = scripts.toArray(new String[scripts.size()]);
}
public ToolbarButton[] getButtons() {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TopicFinder.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TopicFinder.java
index cd00d1509..c9a0a0119 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TopicFinder.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TopicFinder.java
@@ -111,7 +111,7 @@ public class TopicFinder {
if (topics != null) {
for (int i = 0; i < topics.length; ++i) {
// returns path in reverse order
- List reversePath = getTopicPathInTopic(topicToFind, topics[i]);
+ List<ITopic> reversePath = getTopicPathInTopic(topicToFind, topics[i]);
if (reversePath != null) {
prependFilteredIndex(i, topics);
return invertPath(reversePath);
@@ -121,11 +121,11 @@ public class TopicFinder {
return null;
}
- private ITopic[] invertPath(List reversePath) {
+ private ITopic[] invertPath(List<ITopic> reversePath) {
// reverse and return
ITopic[] path = new ITopic[reversePath.size()];
for (int j = 0; j < path.length; ++j) {
- path[j] = (ITopic) reversePath.get((path.length - 1)
+ path[j] = reversePath.get((path.length - 1)
- j);
}
return path;
@@ -145,16 +145,16 @@ public class TopicFinder {
* Finds the topic in the given topic sub-tree. Returns a path of ITopics to
* that topic in reverse order (from the topic up).
*/
- private List getTopicPathInTopic(ITopic topicToFind, ITopic topic) {
+ private List<ITopic> getTopicPathInTopic(ITopic topicToFind, ITopic topic) {
if (sameTopic(topicToFind, topic)) {
// found it. start the list to be created recursively
- List path = new ArrayList();
+ List<ITopic> path = new ArrayList<ITopic>();
path.add(topic);
return path;
} else {
ITopic[] subtopics = topic.getSubtopics();
for (int i = 0; i < subtopics.length; ++i) {
- List path = getTopicPathInTopic(topicToFind, subtopics[i]);
+ List<ITopic> path = getTopicPathInTopic(topicToFind, subtopics[i]);
if (path != null) {
// it was in a subtopic.. add to the path and return
path.add(topic);
@@ -331,8 +331,8 @@ public class TopicFinder {
if (!tocEnabled)
return false;
ITopic[] topics = toc.getTopics();
- for (int i = 0; i < topics.length; i++) {
- if (ScopeUtils.showInTree(topics[i], scope)) {
+ for (ITopic topic : topics) {
+ if (ScopeUtils.showInTree(topic, scope)) {
return true;
}
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java
index e4d8347d9..36c293ca5 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.StringTokenizer;
@@ -28,13 +27,12 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.help.internal.HelpPlugin;
import org.eclipse.help.internal.base.BaseHelpSystem;
import org.eclipse.help.internal.base.HelpBasePlugin;
import org.eclipse.help.internal.util.ProductPreferences;
-import org.eclipse.core.runtime.Platform;
-
public class UrlUtil {
// for Safari build 125.1 finds version 125
@@ -45,7 +43,7 @@ public class UrlUtil {
private static String defaultLocale;
// Locales that infocenter can serve in addition to the default locale.
// null indicates that infocenter can serve every possible client locale.
- private static Collection locales;
+ private static Collection<String> locales;
private static final int INFOCENTER_DIRECTION_BY_LOCALE = 1;
private static final int INFOCENTER_DIRECTION_LTR = 2;
@@ -60,12 +58,11 @@ public class UrlUtil {
char[] wordChars = new char[str.length()];
str.getChars(0, str.length(), wordChars, 0);
StringBuffer jsEncoded = new StringBuffer();
- for (int j = 0; j < wordChars.length; j++) {
- int unicode = wordChars[j];
+ for (char unicode : wordChars) {
// to enhance readability, do not encode A-Z,a-z
if (('A' <= unicode && unicode <= 'Z')
|| ('a' <= unicode && unicode <= 'z')) {
- jsEncoded.append(wordChars[j]);
+ jsEncoded.append(unicode);
continue;
}
// encode the character
@@ -134,9 +131,9 @@ public class UrlUtil {
try {
String hostname = InetAddress.getLocalHost().getHostName();
InetAddress[] addr = InetAddress.getAllByName(hostname);
- for (int i = 0; i < addr.length; i++) {
+ for (InetAddress element : addr) {
// test all addresses retrieved from the local machine
- if (addr[i].getHostAddress().equals(reqIP))
+ if (element.getHostAddress().equals(reqIP))
return true;
}
} catch (IOException ioe) {
@@ -515,8 +512,8 @@ public class UrlUtil {
return request.getLocale().toString();
}
// match client browser locales with one of infocenter locales
- for (Enumeration e = request.getLocales(); e.hasMoreElements();) {
- String locale = ((Locale) e.nextElement()).toString();
+ for (Enumeration<Locale> e = request.getLocales(); e.hasMoreElements();) {
+ String locale = e.nextElement().toString();
if (locale.length() >= 5) {
String ll_CC = locale.substring(0, 5);
if (locales.contains(ll_CC)) {
@@ -580,9 +577,9 @@ public class UrlUtil {
// check if locale was passed earlier in this session
Cookie[] cookies = request.getCookies();
if (cookies != null) {
- for (int c = 0; c < cookies.length; c++) {
- if ("lang".equals(cookies[c].getName())) { //$NON-NLS-1$
- forcedLocale = cookies[c].getValue();
+ for (Cookie cookie : cookies) {
+ if ("lang".equals(cookie.getName())) { //$NON-NLS-1$
+ forcedLocale = cookie.getValue();
break;
}
}
@@ -631,21 +628,21 @@ public class UrlUtil {
}
// locale strings as passed in command line or in preferences
- final List infocenterLocales= new ArrayList();
+ final List<String> infocenterLocales= new ArrayList<String>();
// first check if locales passed as command line arguments
String[] args = Platform.getCommandLineArgs();
boolean localeOption = false;
- for (int i = 0; i < args.length; i++) {
- if ("-locales".equalsIgnoreCase(args[i])) { //$NON-NLS-1$
+ for (String arg : args) {
+ if ("-locales".equalsIgnoreCase(arg)) { //$NON-NLS-1$
localeOption = true;
continue;
- } else if (args[i].startsWith("-")) { //$NON-NLS-1$
+ } else if (arg.startsWith("-")) { //$NON-NLS-1$
localeOption = false;
continue;
}
if (localeOption) {
- infocenterLocales.add(args[i]);
+ infocenterLocales.add(arg);
}
}
// if no locales from command line, get them from preferences
@@ -661,9 +658,8 @@ public class UrlUtil {
// format locales and collect in a set for lookup
if (!infocenterLocales.isEmpty()) {
- locales = new HashSet(10, 0.4f);
- for (Iterator it = infocenterLocales.iterator(); it.hasNext();) {
- String locale = (String) it.next();
+ locales = new HashSet<String>(10, 0.4f);
+ for (String locale : infocenterLocales) {
if (locale.length() >= 5) {
locales.add(locale.substring(0, 2).toLowerCase(Locale.ENGLISH) + "_" //$NON-NLS-1$
+ locale.substring(3, 5).toUpperCase(Locale.ENGLISH));
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/View.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/View.java
index 016a6c33d..f34603cc4 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/View.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/View.java
@@ -31,10 +31,12 @@ public class View extends AbstractView {
this.isDeferred = isDeferred;
}
+ @Override
public String getName() {
return name;
}
+ @Override
public String getURL() {
return url;
}
@@ -44,6 +46,7 @@ public class View extends AbstractView {
*
* @return String
*/
+ @Override
public String getImageURL() {
int i = imageURL.lastIndexOf('/');
return imageURL.substring(0, i) + "/e_" + imageURL.substring(i + 1); //$NON-NLS-1$
@@ -54,6 +57,7 @@ public class View extends AbstractView {
*
* @return char or 0 if no shortcut
*/
+ @Override
public char getKey() {
return shortcut;
}
@@ -62,6 +66,7 @@ public class View extends AbstractView {
* Returns whether or not this view should do a deferred load; i.e. it will
* take some time to load and should show a progress message while loading.
*/
+ @Override
public boolean isDeferred() {
return isDeferred;
}
@@ -75,6 +80,7 @@ public class View extends AbstractView {
return null;
}
+ @Override
public String getTitle(Locale locale) {
return WebappResources.getString(name, locale);
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetData.java
index 1b0a99d70..e288ef807 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -91,8 +91,8 @@ public class WorkingSetData extends RequestData {
// See if the toc is in the working set
AdaptableToc adaptableToc = tocs[toc];
AdaptableHelpResource[] elements = ws.getElements();
- for (int i = 0; i < elements.length; i++) {
- if (elements[i] == adaptableToc)
+ for (AdaptableHelpResource element : elements) {
+ if (element == adaptableToc)
return STATE_CHECKED;
}
@@ -149,8 +149,8 @@ public class WorkingSetData extends RequestData {
return STATE_UNCHECKED;
AdaptableTopic adaptableTopic = topics[topic];
AdaptableHelpResource[] elements = ws.getElements();
- for (int i = 0; i < elements.length; i++) {
- if (elements[i] == adaptableTopic)
+ for (AdaptableHelpResource element : elements) {
+ if (element == adaptableTopic)
return STATE_CHECKED;
}
return STATE_UNCHECKED;
@@ -228,14 +228,14 @@ public class WorkingSetData extends RequestData {
return STATE_UNCHECKED;
String category = categories[index];
- Map criteriaMap = new HashMap();
+ Map<String, Set<String>> criteriaMap = new HashMap<String, Set<String>>();
CriterionResource[] criteria = ws.getCriteria();
CriteriaUtilities.addCriteriaToMap(criteriaMap, criteria);
if(!criteriaMap.keySet().contains(category))
return STATE_UNCHECKED;
- Set criterionValuesFromWS = (Set) criteriaMap.get(category);
- Set criterionValuesSet = new HashSet(Arrays.asList(getCriterionValueIds(category)));
+ Set<String> criterionValuesFromWS = criteriaMap.get(category);
+ Set<String> criterionValuesSet = new HashSet<String>(Arrays.asList(getCriterionValueIds(category)));
if(criterionValuesFromWS.containsAll(criterionValuesSet)){
return STATE_CHECKED;
}else{
@@ -254,11 +254,11 @@ public class WorkingSetData extends RequestData {
return STATE_UNCHECKED;
String category = categories[categoryIndex];
- Map criteriaMap = new HashMap();
+ Map<String, Set<String>> criteriaMap = new HashMap<String, Set<String>>();
CriterionResource[] criteria = ws.getCriteria();
CriteriaUtilities.addCriteriaToMap(criteriaMap, criteria);
- Set criterionValuesFromWS = (Set) criteriaMap.get(category);
+ Set<String> criterionValuesFromWS = criteriaMap.get(category);
String[] crietriaValues = getCriterionValueIds(category);
if (valueIndex < 0 || valueIndex >= crietriaValues.length){
return STATE_UNCHECKED;
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetManagerData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetManagerData.java
index 8ca95b09d..398db2c09 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetManagerData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetManagerData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,7 +15,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -74,9 +73,9 @@ public class WorkingSetManagerData extends RequestData {
if (hrefs == null)
hrefs = new String[0];
- ArrayList selectedElements = new ArrayList(hrefs.length);
- for (int i = 0; i < hrefs.length; i++) {
- AdaptableHelpResource res = getAdaptableHelpResource(hrefs[i]);
+ ArrayList<AdaptableHelpResource> selectedElements = new ArrayList<AdaptableHelpResource>(hrefs.length);
+ for (String href : hrefs) {
+ AdaptableHelpResource res = getAdaptableHelpResource(href);
if (res != null)
selectedElements.add(res);
}
@@ -118,9 +117,9 @@ public class WorkingSetManagerData extends RequestData {
if (hrefs == null)
hrefs = new String[0];
- ArrayList selectedElements = new ArrayList(hrefs.length);
- for (int i = 0; i < hrefs.length; i++) {
- AdaptableHelpResource res = getAdaptableHelpResource(hrefs[i]);
+ ArrayList<AdaptableHelpResource> selectedElements = new ArrayList<AdaptableHelpResource>(hrefs.length);
+ for (String href : hrefs) {
+ AdaptableHelpResource res = getAdaptableHelpResource(href);
if (res != null)
selectedElements.add(res);
}
@@ -209,23 +208,22 @@ public class WorkingSetManagerData extends RequestData {
// all values in one criterion selected: version
// one criterion value selected(based on criterion category name and index of the value)
// eg:version_1_
- List category = Arrays.asList(getCriterionIds());
+ List<String> category = Arrays.asList(getCriterionIds());
String[] criteria = request.getParameterValues("criteria"); //$NON-NLS-1$
if (criteria == null)
criteria = new String[0];
- Map selectedElements = new HashMap();
- for (int i = 0; i < criteria.length; ++i) {
- String criterion = criteria[i];
+ Map<String, Set<String>> selectedElements = new HashMap<String, Set<String>>();
+ for (String criterion : criteria) {
if(category.contains(criterion)){
- List allValuesInCategory = Arrays.asList(getCriterionValueIds(criterion));
+ List<String> allValuesInCategory = Arrays.asList(getCriterionValueIds(criterion));
if(0 == allValuesInCategory.size()){
continue;
}
- Set elements = (Set)selectedElements.get(criterion);
+ Set<String> elements = selectedElements.get(criterion);
if(null == elements){
- elements = new HashSet();
+ elements = new HashSet<String>();
}
elements.addAll(allValuesInCategory);
selectedElements.put(criterion, elements);
@@ -248,9 +246,9 @@ public class WorkingSetManagerData extends RequestData {
String selectedValue = values[index];
if(null == selectedValue || 0 == selectedValue.length())
continue;
- Set existedElements = (Set)selectedElements.get(criterionName);
+ Set<String> existedElements = selectedElements.get(criterionName);
if(null == existedElements){
- existedElements = new HashSet();
+ existedElements = new HashSet<String>();
}
existedElements.add(selectedValue);
selectedElements.put(criterionName, existedElements);
@@ -260,11 +258,10 @@ public class WorkingSetManagerData extends RequestData {
}
- List resources = new ArrayList();
- for(Iterator iter = selectedElements.keySet().iterator(); iter.hasNext();){
- String key = (String)iter.next();
- Set values = (Set) selectedElements.get(key);
- CriterionResource resource = new CriterionResource(key, new ArrayList(values));
+ List<CriterionResource> resources = new ArrayList<CriterionResource>();
+ for (String key : selectedElements.keySet()) {
+ Set<String> values = selectedElements.get(key);
+ CriterionResource resource = new CriterionResource(key, new ArrayList<String>(values));
resources.add(resource);
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/AboutParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/AboutParser.java
index 766b422ee..9e630dd9a 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/AboutParser.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/AboutParser.java
@@ -30,6 +30,7 @@ public class AboutParser extends ResultParser {
this.setIdentifier(JSonHelper.PLUGIN_ID);
}
+ @Override
public void startElement(String uri, String lname, String name, Attributes attrs) {
currentTag = name;
@@ -57,6 +58,7 @@ public class AboutParser extends ResultParser {
element = elem;
}
+ @Override
public void characters(char[] ch, int start, int length) {
if ((service == Utils.PREFERENCE
&& (currentTag.equalsIgnoreCase(XMLHelper.ELEMENT_PREFERENCES)
@@ -83,6 +85,7 @@ public class AboutParser extends ResultParser {
}
}
+ @Override
public void endElement(String uri, String lname, String name) {
if (element != null) {
@@ -91,6 +94,7 @@ public class AboutParser extends ResultParser {
currentTag = ""; //$NON-NLS-1$
}
+ @Override
public String toJSON() {
StringBuffer buf = new StringBuffer();
@@ -109,7 +113,7 @@ public class AboutParser extends ResultParser {
buf.append(JSonHelper.getQuotes(label));
buf.append(JSonHelper.COMMA);
- ParseElement elem = (ParseElement) items.get(0);
+ ParseElement elem = items.get(0);
if (elem != null)
buf.append(elem.toJSON());
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ContextParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ContextParser.java
index 7b4ac5c2e..9730bedb2 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ContextParser.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ContextParser.java
@@ -25,6 +25,7 @@ public class ContextParser extends ResultParser {
super(JSonHelper.TITLE);
}
+ @Override
public void startElement(String uri, String lname, String name, Attributes attrs) {
currentTag = name;
@@ -49,6 +50,7 @@ public class ContextParser extends ResultParser {
}
+ @Override
public void characters(char[] ch, int start, int length) {
if (element != null
@@ -72,6 +74,7 @@ public class ContextParser extends ResultParser {
}
}
+ @Override
public void endElement(String uri, String lname, String name) {
if (name.equalsIgnoreCase(XMLHelper.ELEMENT_DESCRIPTION))
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ExtensionParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ExtensionParser.java
index 12a2e9a0a..da71b2f32 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ExtensionParser.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ExtensionParser.java
@@ -24,6 +24,7 @@ public class ExtensionParser extends ResultParser {
super(JSonHelper.TITLE);
}
+ @Override
public void startElement(String uri, String lname, String name, Attributes attrs) {
currentTag = name;
@@ -46,6 +47,7 @@ public class ExtensionParser extends ResultParser {
}
+ @Override
public void characters(char[] ch, int start, int length) {
if (element != null) {
@@ -67,6 +69,7 @@ public class ExtensionParser extends ResultParser {
}
}
+ @Override
public void endElement(String uri, String lname, String name) {
if (element != null) {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/IndexFragmentParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/IndexFragmentParser.java
index efc9f42bd..4209aac47 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/IndexFragmentParser.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/IndexFragmentParser.java
@@ -24,6 +24,7 @@ public class IndexFragmentParser extends ResultParser{
super(JSonHelper.TITLE);
}
+ @Override
public void startElement(String uri, String lname, String name, Attributes attrs) {
if (name.equalsIgnoreCase(XMLHelper.ELEMENT_NODE))
{
@@ -46,6 +47,7 @@ public class IndexFragmentParser extends ResultParser{
}
+ @Override
public void endElement(String uri, String lname, String name) {
if (element != null
&& name.equalsIgnoreCase(XMLHelper.ELEMENT_NODE)) {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/IndexParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/IndexParser.java
index 980867f16..52398614e 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/IndexParser.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/IndexParser.java
@@ -24,6 +24,7 @@ public class IndexParser extends ResultParser {
super(JSonHelper.TITLE);
}
+ @Override
public void startElement(String uri, String lname, String name, Attributes attrs) {
if (name.equalsIgnoreCase(XMLHelper.ELEMENT_INDEX_CONTRIBUTIONS)
|| name.equalsIgnoreCase(XMLHelper.ELEMENT_INDEX))
@@ -47,6 +48,7 @@ public class IndexParser extends ResultParser {
}
+ @Override
public void endElement(String uri, String lname, String name) {
if (name.equalsIgnoreCase(XMLHelper.ELEMENT_INDEX_CONTRIBUTIONS)
|| name.equalsIgnoreCase(XMLHelper.ELEMENT_INDEX))
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/NavParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/NavParser.java
index 4dc2e38cb..0c6e85385 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/NavParser.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/NavParser.java
@@ -23,6 +23,7 @@ public class NavParser extends ResultParser {
super(JSonHelper.TITLE);
}
+ @Override
public void startElement(String uri, String lname, String name, Attributes attrs) {
Properties properties = new Properties();
@@ -43,6 +44,7 @@ public class NavParser extends ResultParser {
element = elem;
}
+ @Override
public void endElement(String uri, String lname, String name) {
if (element != null) {
@@ -50,6 +52,7 @@ public class NavParser extends ResultParser {
}
}
+ @Override
public String toJSON() {
StringBuffer buf = new StringBuffer();
@@ -68,7 +71,7 @@ public class NavParser extends ResultParser {
buf.append(JSonHelper.getQuotes(label));
buf.append(JSonHelper.COMMA);
- ParseElement elem = (ParseElement) items.get(0);
+ ParseElement elem = items.get(0);
if (elem != null)
buf.append(elem.toJSON());
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ParseElement.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ParseElement.java
index e22f72a60..5d78c58f3 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ParseElement.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ParseElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,7 +21,7 @@ import org.eclipse.help.internal.webapp.utils.JSonHelper;
public class ParseElement {
private Properties props;
- private ArrayList children = new ArrayList();
+ private ArrayList<ParseElement> children = new ArrayList<ParseElement>();
private ParseElement parent;
public ParseElement(Properties props, ParseElement parent) {
@@ -49,6 +49,7 @@ public class ParseElement {
return (props != null) ? props.getProperty(key) : ""; //$NON-NLS-1$
}
+ @Override
public String toString() {
return (props != null) ? props.toString() : ""; //$NON-NLS-1$
}
@@ -74,7 +75,7 @@ public class ParseElement {
buff.append(JSonHelper.BEGIN_BRACE);
if (props != null) {
- Enumeration enumObj = props.keys();
+ Enumeration<?> enumObj = props.keys();
while (enumObj.hasMoreElements()) {
String key = (String) enumObj.nextElement();
@@ -113,7 +114,7 @@ public class ParseElement {
if (i > 0)
buff.append(JSonHelper.COMMA);
- ParseElement element = (ParseElement) children.get(i);
+ ParseElement element = children.get(i);
buff.append(element.toJSON(level + 2));
}
@@ -133,7 +134,7 @@ public class ParseElement {
StringBuffer buff = new StringBuffer();
if (props != null) {
- Enumeration enumObj = props.keys();
+ Enumeration<?> enumObj = props.keys();
while (enumObj.hasMoreElements()) {
String key = (String) enumObj.nextElement();
@@ -172,7 +173,7 @@ public class ParseElement {
if (i > 0)
buff.append(JSonHelper.COMMA);
- ParseElement child = (ParseElement) children.get(i);
+ ParseElement child = children.get(i);
buff.append(child.toJSON(1));
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ResultParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ResultParser.java
index c078a14b6..ba3f5df48 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ResultParser.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/ResultParser.java
@@ -27,7 +27,7 @@ public class ResultParser extends DefaultHandler {
protected String id;
protected String label;
- protected ArrayList items = new ArrayList(); //parser populates the items arrayList withe parsed data.
+ protected ArrayList<ParseElement> items = new ArrayList<ParseElement>(); //parser populates the items arrayList withe parsed data.
public ResultParser(String label) {
this(label, JSonHelper.ID);
@@ -59,11 +59,12 @@ public class ResultParser extends DefaultHandler {
this.id = id;
}
- public ArrayList getItems()
+ public ArrayList<ParseElement> getItems()
{
return items;
}
+ @Override
public String toString()
{
return items.toString();
@@ -97,7 +98,7 @@ public class ResultParser extends DefaultHandler {
if (i > 0)
buf.append(JSonHelper.COMMA);
- ParseElement element = (ParseElement) items.get(i);
+ ParseElement element = items.get(i);
buf.append(element.toJSON(1));
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/SearchParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/SearchParser.java
index f152f474f..42c5d7357 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/SearchParser.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/SearchParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,6 +26,7 @@ public class SearchParser extends ResultParser {
super(JSonHelper.LABEL);
}
+ @Override
public void startElement(String uri,
String lname, String name, Attributes attrs) {
@@ -54,6 +55,7 @@ public class SearchParser extends ResultParser {
}
}
+ @Override
public void characters(char[] ch, int start, int length) {
if (currentTag.equalsIgnoreCase(XMLHelper.ELEMENT_HIT)
@@ -74,6 +76,7 @@ public class SearchParser extends ResultParser {
}
}
+ @Override
public void endElement(String uri, String lname, String name) {
if (name.equalsIgnoreCase(XMLHelper.ELEMENT_HIT)) {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/TocFragmentParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/TocFragmentParser.java
index a985a68ac..3c9faeb2f 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/TocFragmentParser.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/TocFragmentParser.java
@@ -47,6 +47,7 @@ public class TocFragmentParser extends ResultParser {
super.parse(in);
}
+ @Override
public void startElement(String uri,
String lname, String name, Attributes attrs) {
@@ -82,6 +83,7 @@ public class TocFragmentParser extends ResultParser {
}
}
+ @Override
public void endElement(String uri, String lname, String name) {
if (name.equalsIgnoreCase(XMLHelper.ELEMENT_NODE)
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/TocParser.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/TocParser.java
index e7a452932..1e79f4931 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/TocParser.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/parser/TocParser.java
@@ -24,6 +24,7 @@ public class TocParser extends ResultParser {
super(JSonHelper.LABEL);
}
+ @Override
public void startElement(String uri, String lname, String name, Attributes attrs) {
if (name.equalsIgnoreCase(XMLHelper.ELEMENT_TOC_CONTRIBUTIONS))
return;
@@ -46,6 +47,7 @@ public class TocParser extends ResultParser {
}
+ @Override
public void endElement(String uri, String lname, String name) {
if (name.equalsIgnoreCase(XMLHelper.ELEMENT_TOC_CONTRIBUTIONS))
return;
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AboutService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AboutService.java
index 45a302358..65c5f23a8 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AboutService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AboutService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,7 +16,6 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletException;
@@ -67,6 +66,7 @@ public class AboutService extends AboutServlet {
private long service;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
@@ -185,14 +185,14 @@ public class AboutService extends AboutServlet {
buf.append(XMLGenerator.xmlEscape(title));
buf.append("\""); //$NON-NLS-1$
- List plugins = new ArrayList();
+ List<PluginDetails> plugins = new ArrayList<PluginDetails>();
Bundle[] bundles = HelpWebappPlugin.getContext().getBundles();
- for (int k = 0; k < bundles.length; k++) {
- plugins.add(pluginDetails(bundles[k]));
+ for (Bundle bundle : bundles) {
+ plugins.add(pluginDetails(bundle));
}
- Comparator pluginComparator = new PluginComparator(sortColumn);
+ Comparator<PluginDetails> pluginComparator = new PluginComparator(sortColumn);
Collections.sort(plugins, pluginComparator );
String[] headerColumns = new String[]{
@@ -202,17 +202,16 @@ public class AboutService extends AboutServlet {
"pluginId" //$NON-NLS-1$
};
- for (int i = 0; i < headerColumns.length; i++) {
+ for (String headerColumn : headerColumns) {
buf.append("\n "); //$NON-NLS-1$
- buf.append(headerColumns[i]);
+ buf.append(headerColumn);
buf.append("=\""); //$NON-NLS-1$
- buf.append(XMLGenerator.xmlEscape(WebappResources.getString(headerColumns[i], locale)));
+ buf.append(XMLGenerator.xmlEscape(WebappResources.getString(headerColumn, locale)));
buf.append("\""); //$NON-NLS-1$
}
buf.append(">"); //$NON-NLS-1$
- for (Iterator iter = plugins.iterator(); iter.hasNext();) {
- PluginDetails details = (PluginDetails) iter.next();
+ for (PluginDetails details : plugins) {
buf.append("\n <plugin"); //$NON-NLS-1$
for (int i = 0; i < headerColumns.length; i++) {
buf.append("\n "); //$NON-NLS-1$
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AdvancedSearchService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AdvancedSearchService.java
index 3bce8e348..fec4440a3 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AdvancedSearchService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AdvancedSearchService.java
@@ -64,6 +64,7 @@ public class AdvancedSearchService extends HttpServlet {
private static final long serialVersionUID = 1L;
public static final String XID = "xid"; //$NON-NLS-1$
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ContentService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ContentService.java
index 3b72eee48..453828c46 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ContentService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ContentService.java
@@ -44,6 +44,7 @@ public class ContentService extends HttpServlet {
private static final long serialVersionUID = 1L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ContextService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ContextService.java
index 82147869e..db3912ba4 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ContextService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ContextService.java
@@ -53,6 +53,7 @@ public class ContextService extends ContextServlet {
private static final long serialVersionUID = 1L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ExtensionService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ExtensionService.java
index 292e987a5..7aefc6cbb 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ExtensionService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/ExtensionService.java
@@ -48,6 +48,7 @@ public class ExtensionService extends ExtensionServlet {
private static final long serialVersionUID = 1L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/IndexFragmentService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/IndexFragmentService.java
index 1fae9c881..8b1bdcb3e 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/IndexFragmentService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/IndexFragmentService.java
@@ -62,6 +62,7 @@ public class IndexFragmentService extends IndexFragmentServlet {
private static final long serialVersionUID = 1L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/IndexService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/IndexService.java
index 6c52ef6d7..39cda3468 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/IndexService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/IndexService.java
@@ -49,6 +49,7 @@ public class IndexService extends IndexServlet {
private static final long serialVersionUID = 1L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/NavService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/NavService.java
index b634cc173..a2f31ad9e 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/NavService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/NavService.java
@@ -60,6 +60,7 @@ public class NavService extends NavServlet {
private static final long serialVersionUID = 1L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/SearchService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/SearchService.java
index 4c304e34c..c61c4a127 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/SearchService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/SearchService.java
@@ -49,6 +49,7 @@ public class SearchService extends SearchServlet {
private static final long serialVersionUID = 1L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/SearchStateService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/SearchStateService.java
index 6183516a7..a13f65651 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/SearchStateService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/SearchStateService.java
@@ -41,6 +41,7 @@ public class SearchStateService extends HttpServlet {
private final static String STATE = "state"; //$NON-NLS-1$
private final static String PERCENT = "percent"; //$NON-NLS-1$
+ @Override
public void init() throws ServletException {
}
@@ -48,6 +49,7 @@ public class SearchStateService extends HttpServlet {
* Called by the server (via the <code>service</code> method) to allow a
* Servlet to handle a GET request.
*/
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
@@ -62,6 +64,7 @@ public class SearchStateService extends HttpServlet {
* Handle the search requests,
*
*/
+ @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
process(req, resp);
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/TocFragmentService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/TocFragmentService.java
index 31befb0c2..6bcff3fbb 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/TocFragmentService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/TocFragmentService.java
@@ -54,6 +54,7 @@ public class TocFragmentService extends TocFragmentServlet {
private static final long serialVersionUID = 1L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/TocService.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/TocService.java
index 67f87b60e..34ac42f9b 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/TocService.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/TocService.java
@@ -48,6 +48,7 @@ public class TocService extends TocServlet {
private static final long serialVersionUID = 1L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/AboutServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/AboutServlet.java
index f69da7437..0916c9306 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/AboutServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/AboutServlet.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,11 +11,18 @@
package org.eclipse.help.internal.webapp.servlet;
-import com.ibm.icu.text.Collator;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Locale;
+
import javax.servlet.ServletException;
-import javax.servlet.http.*;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import org.eclipse.core.runtime.Platform;
import org.eclipse.help.internal.webapp.HelpWebappPlugin;
import org.eclipse.help.internal.webapp.WebappResources;
@@ -23,6 +30,8 @@ import org.eclipse.help.internal.webapp.data.UrlUtil;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
+import com.ibm.icu.text.Collator;
+
/**
* A servlet that provides an informational page about the plugins that make up
* the web application.
@@ -46,7 +55,7 @@ public class AboutServlet extends HttpServlet {
}
}
- protected class PluginComparator implements Comparator {
+ protected class PluginComparator implements Comparator<PluginDetails> {
public PluginComparator(int column) {
this.column = column;
@@ -54,9 +63,8 @@ public class AboutServlet extends HttpServlet {
private int column;
- public int compare(Object o1, Object o2) {
- PluginDetails pd1 = (PluginDetails) o1;
- PluginDetails pd2 = (PluginDetails) o2;
+ @Override
+ public int compare(PluginDetails pd1, PluginDetails pd2) {
return Collator.getInstance().compare(pd1.columns[column], pd2.columns[column]);
}
@@ -73,6 +81,7 @@ public class AboutServlet extends HttpServlet {
private static final String XHTML_2 = "</title>\n <style type = \"text/css\"> td { padding-right : 10px; }</style></head>\n<body>\n"; //$NON-NLS-1$
private static final String XHTML_3 = "</body>\n</html>"; //$NON-NLS-1$
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
resp.setContentType("text/html; charset=UTF-8"); //$NON-NLS-1$
@@ -112,14 +121,14 @@ public class AboutServlet extends HttpServlet {
}
buf.append("<table>"); //$NON-NLS-1$
- List plugins = new ArrayList();
+ List<PluginDetails> plugins = new ArrayList<PluginDetails>();
Bundle[] bundles = HelpWebappPlugin.getContext().getBundles();
- for (int k = 0; k < bundles.length; k++) {
- plugins.add(pluginDetails(bundles[k]));
+ for (Bundle bundle : bundles) {
+ plugins.add(pluginDetails(bundle));
}
- Comparator pluginComparator = new PluginComparator(sortColumn);
+ Comparator<PluginDetails> pluginComparator = new PluginComparator(sortColumn);
Collections.sort(plugins, pluginComparator);
String[] headerColumns = new String[] {WebappResources.getString("provider", locale), //$NON-NLS-1$
WebappResources.getString("pluginName", locale), //$NON-NLS-1$
@@ -128,8 +137,7 @@ public class AboutServlet extends HttpServlet {
};
PluginDetails header = new PluginDetails(headerColumns);
buf.append(headerRowFor(header));
- for (Iterator iter = plugins.iterator(); iter.hasNext();) {
- PluginDetails details = (PluginDetails) iter.next();
+ for (PluginDetails details : plugins) {
buf.append(tableRowFor(details));
}
buf.append("</table>"); //$NON-NLS-1$
@@ -194,7 +202,7 @@ public class AboutServlet extends HttpServlet {
return row;
}
- protected Object pluginDetails(Bundle bundle) {
+ protected PluginDetails pluginDetails(Bundle bundle) {
String[] values = new String[] {getResourceString(bundle, Constants.BUNDLE_VENDOR), getResourceString(bundle, Constants.BUNDLE_NAME), getResourceString(bundle, Constants.BUNDLE_VERSION), bundle.getSymbolicName()};
PluginDetails details = new PluginDetails(values);
@@ -202,7 +210,7 @@ public class AboutServlet extends HttpServlet {
}
private static String getResourceString(Bundle bundle, String headerName) {
- String value = (String) bundle.getHeaders().get(headerName);
+ String value = bundle.getHeaders().get(headerName);
return value == null ? null : Platform.getResourceString(bundle, value);
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java
index bfa9735f2..f93445005 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java
@@ -39,6 +39,7 @@ public class BreadcrumbsFilter implements IFilter {
/* (non-Javadoc)
* @see org.eclipse.help.internal.webapp.servlet.IFilter#filter(javax.servlet.http.HttpServletRequest, java.io.OutputStream)
*/
+ @Override
public OutputStream filter(HttpServletRequest req, OutputStream out) {
String uri = req.getRequestURI();
if (uri == null || !uri.endsWith("html") && !uri.endsWith("htm") && !UrlUtil.isNavPath(uri)) { //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java
index e3ca3861d..8f21ad7a1 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java
@@ -90,11 +90,11 @@ public class ChildLinkInserter {
String servletPath = req.getServletPath();
if ("/nav".equals(servletPath)) return new ITopic[0]; //$NON-NLS-1$
Toc[] tocs = HelpPlugin.getTocManager().getTocs(locale);
- for (int i = 0; i < tocs.length; i++) {
- if (pathInfo.equals(tocs[i].getTopic())) {
- return tocs[i].getTopics();
+ for (Toc toc : tocs) {
+ if (pathInfo.equals(toc.getTopic())) {
+ return toc.getTopics();
}
- ITopic topic = tocs[i].getTopic(pathInfo);
+ ITopic topic = toc.getTopic(pathInfo);
if (topic != null) {
return topic.getSubtopics();
}
@@ -116,8 +116,8 @@ public class ChildLinkInserter {
public void addStyle() throws UnsupportedEncodingException, IOException {
ITopic[] subtopics = getSubtopics();
- for (int i = 0; i < subtopics.length; ++i) {
- if (ScopeUtils.showInTree(subtopics[i], scope)) {
+ for (ITopic subtopic : subtopics) {
+ if (ScopeUtils.showInTree(subtopic, scope)) {
out.write(HAS_CHILDREN.getBytes(UTF_8));
return;
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContentServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContentServlet.java
index c0e8d4196..185c302c5 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContentServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContentServlet.java
@@ -25,6 +25,7 @@ public class ContentServlet extends HttpServlet {
/**
*/
+ @Override
public void init() throws ServletException {
try {
connector = new EclipseConnector(getServletContext());
@@ -37,6 +38,7 @@ public class ContentServlet extends HttpServlet {
* Called by the server (via the <code>service</code> method) to allow a
* servlet to handle a GET request.
*/
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
@@ -53,6 +55,7 @@ public class ContentServlet extends HttpServlet {
* Handle the search requests,
*
*/
+ @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
if (connector != null)
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java
index b3c28c40a..7118ebf14 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ContextServlet.java
@@ -37,6 +37,7 @@ public class ContextServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final String PARAMETER_ID = "id"; //$NON-NLS-1$
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String response = processRequest(req, resp);
@@ -89,13 +90,13 @@ public class ContextServlet extends HttpServlet {
}
IHelpResource[] topics = context.getRelatedTopics();
- for (int i=0;i<topics.length;++i) {
+ for (IHelpResource topic : topics) {
buff.append(" <" + Topic.NAME); //$NON-NLS-1$
- if (topics[i].getLabel() != null) {
- buff.append("\n " + Topic.ATTRIBUTE_LABEL + "=\"" + topics[i].getLabel() + '"'); //$NON-NLS-1$ //$NON-NLS-2$
+ if (topic.getLabel() != null) {
+ buff.append("\n " + Topic.ATTRIBUTE_LABEL + "=\"" + topic.getLabel() + '"'); //$NON-NLS-1$ //$NON-NLS-2$
}
- if (topics[i].getHref() != null) {
- buff.append("\n " + Topic.ATTRIBUTE_HREF + "=\"" + topics[i].getHref() + '"'); //$NON-NLS-1$ //$NON-NLS-2$
+ if (topic.getHref() != null) {
+ buff.append("\n " + Topic.ATTRIBUTE_HREF + "=\"" + topic.getHref() + '"'); //$NON-NLS-1$ //$NON-NLS-2$
}
buff.append("> </" + Topic.NAME + ">\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ControlServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ControlServlet.java
index f2580185c..570aa29e4 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ControlServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ControlServlet.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,16 +10,22 @@
*******************************************************************************/
package org.eclipse.help.internal.webapp.servlet;
-import java.io.*;
-import java.lang.reflect.*;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
-import javax.servlet.*;
-import javax.servlet.http.*;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.internal.base.*;
-import org.eclipse.help.internal.webapp.data.*;
-import org.osgi.framework.*;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.help.internal.base.BaseHelpSystem;
+import org.eclipse.help.internal.base.HelpApplication;
+import org.eclipse.help.internal.base.HelpDisplay;
+import org.eclipse.help.internal.webapp.data.UrlUtil;
+import org.osgi.framework.Bundle;
/**
* Servlet to control Eclipse helpApplication from standalone application.
@@ -103,6 +109,7 @@ public class ControlServlet extends HttpServlet {
* Called by the servlet container to indicate to a servlet that the servlet
* is being placed into service.
*/
+ @Override
public void init() throws ServletException {
super.init();
if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_STANDALONE) {
@@ -114,6 +121,7 @@ public class ControlServlet extends HttpServlet {
* Called by the server (via the <code>service</code> method) to allow a
* servlet to handle a GET request.
*/
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
processRequest(req, resp);
@@ -123,6 +131,7 @@ public class ControlServlet extends HttpServlet {
* Called by the server (via the <code>service</code> method) to allow a
* servlet to handle a POST request.
*/
+ @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
processRequest(req, resp);
@@ -202,13 +211,13 @@ public class ControlServlet extends HttpServlet {
System.out.println("No class name for command " + command); //$NON-NLS-1$
return;
}
- Class c = bundle.loadClass(className);
+ Class<?> c = bundle.loadClass(className);
if (c == null) {
System.out.println("No class for command " + command); //$NON-NLS-1$
return;
}
- Class[] parameterTypes = getParameterTypes(className);
- Constructor constr = c.getConstructor(parameterTypes);
+ Class<?>[] parameterTypes = getParameterTypes(className);
+ Constructor<?> constr = c.getConstructor(parameterTypes);
if (constr == null) {
System.out.println("No expected constructor for command " //$NON-NLS-1$
+ command);
@@ -262,7 +271,7 @@ public class ControlServlet extends HttpServlet {
return null;
}
- private Class[] getParameterTypes(String className) {
+ private Class<?>[] getParameterTypes(String className) {
if (CLASS_INSTALL.equals(className))
return new Class[]{String.class, String.class, String.class,
String.class, String.class};
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java
index af6bbe400..65cfefadd 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java
@@ -12,7 +12,6 @@ package org.eclipse.help.internal.webapp.servlet;
import java.io.*;
import java.util.HashSet;
-import java.util.Iterator;
import javax.servlet.http.*;
@@ -36,9 +35,9 @@ public class CookieUtil {
String ret = null;
Cookie[] cookies = request.getCookies();
if (cookies != null) {
- for (int i = 0; i < cookies.length; i++) {
- if (name.equals(cookies[i].getName())) {
- ret = cookies[i].getValue();
+ for (Cookie cookie : cookies) {
+ if (name.equals(cookie.getName())) {
+ ret = cookie.getValue();
break;
}
}
@@ -109,11 +108,11 @@ public class CookieUtil {
public static void deleteObsoleteCookies(HttpServletRequest request, HttpServletResponse response) {
Cookie[] cookies = request.getCookies();
- HashSet cookiesToKeep= new HashSet();
- HashSet cookiesToDelete = new HashSet();
+ HashSet<String> cookiesToKeep= new HashSet<String>();
+ HashSet<String> cookiesToDelete = new HashSet<String>();
if (cookies != null) {
- for (int i = 0; i < cookies.length; i++) {
- String name = cookies[i].getName();
+ for (Cookie cookie : cookies) {
+ String name = cookie.getName();
if (isObsoleteCookie(name) || cookiesToKeep.contains(name)) {
cookiesToDelete.add(name);
}
@@ -121,8 +120,7 @@ public class CookieUtil {
}
}
- for (Iterator iter = cookiesToDelete.iterator(); iter.hasNext();) {
- String name = (String) iter.next();
+ for (String name : cookiesToDelete) {
deleteCookieUsingPath(name, request, response, request.getContextPath() + "/advanced/"); //$NON-NLS-1$
deleteCookieUsingPath(name, request, response, "/"); //$NON-NLS-1$
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/DynamicXHTMLFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/DynamicXHTMLFilter.java
index d94b80377..97058e2c0 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/DynamicXHTMLFilter.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/DynamicXHTMLFilter.java
@@ -41,6 +41,7 @@ public class DynamicXHTMLFilter implements IFilter {
/* (non-Javadoc)
* @see org.eclipse.help.internal.webapp.servlet.IFilter#filter(javax.servlet.http.HttpServletRequest, java.io.OutputStream)
*/
+ @Override
public OutputStream filter(final HttpServletRequest req, final OutputStream out) {
final String uri = req.getRequestURI();
if (uri == null || !uri.endsWith("html") && !uri.endsWith("htm")) { //$NON-NLS-1$ //$NON-NLS-2$
@@ -60,6 +61,7 @@ public class DynamicXHTMLFilter implements IFilter {
* the document is processed then pushed through the filter.
*/
ByteArrayOutputStream out2 = new ByteArrayOutputStream() {
+ @Override
public void close() throws IOException {
super.close();
byte[] buf = toByteArray();
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java
index 23ec1df69..be84d0ca9 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java
@@ -186,14 +186,14 @@ public class EclipseConnector {
OutputStream out = resp.getOutputStream();
IFilter filters[] = pageNotFound ? errorPageFilters : allFilters;
if (isProcessingRequired(resp.getContentType())) {
- for (int i = 0; i < filters.length; i++) {
+ for (IFilter filter : filters) {
// condition for enabling remote css
- if((filters[i] instanceof InjectionFilter) && is instanceof RemoteHelpInputStream){
+ if((filter instanceof InjectionFilter) && is instanceof RemoteHelpInputStream){
InjectionFilter ifilter = new InjectionFilter(true);
out=ifilter.filter(req, out);
}
else{
- out = filters[i].filter(req, out);
+ out = filter.filter(req, out);
}
}
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtensionServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtensionServlet.java
index 52628b2c1..f9159cec6 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtensionServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtensionServlet.java
@@ -34,9 +34,10 @@ import org.eclipse.help.internal.webapp.data.UrlUtil;
public class ExtensionServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
- private Map responseByLocale;
+ private Map<String, String> responseByLocale;
private DocumentWriter writer;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// set the character-set to UTF-8 before calling resp.getWriter()
@@ -50,9 +51,9 @@ public class ExtensionServlet extends HttpServlet {
req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
if (responseByLocale == null) {
- responseByLocale = new WeakHashMap();
+ responseByLocale = new WeakHashMap<String, String>();
}
- String response = (String)responseByLocale.get(locale);
+ String response = responseByLocale.get(locale);
if (response == null) {
ContentExtension[] extensions = HelpPlugin.getContentExtensionManager().getExtensions(locale);
try {
@@ -70,11 +71,11 @@ public class ExtensionServlet extends HttpServlet {
StringBuffer buf = new StringBuffer();
buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$
buf.append("<contentExtensions>\n"); //$NON-NLS-1$
- for (int i = 0; i < extensions.length; ++i) {
+ for (ContentExtension extension : extensions) {
if (writer == null) {
writer = new DocumentWriter();
}
- buf.append(writer.writeString(extensions[i], false));
+ buf.append(writer.writeString(extension, false));
}
buf.append("</contentExtensions>\n"); //$NON-NLS-1$
return buf.toString();
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtraFilters.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtraFilters.java
index 8e28b218b..88bf3f619 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtraFilters.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtraFilters.java
@@ -29,7 +29,7 @@ public class ExtraFilters implements IFilter {
public static final String CONTENTFILTER_XP_NAME = "org.eclipse.help.webapp.contentFilter"; //$NON-NLS-1$
- private static List filters = null;
+ private static List<PrioritizedFilter> filters = null;
public ExtraFilters() {
if (filters == null) {
@@ -38,15 +38,15 @@ public class ExtraFilters implements IFilter {
}
private void readFilters() {
- filters = new ArrayList();
+ filters = new ArrayList<PrioritizedFilter>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] elements = registry
.getConfigurationElementsFor(CONTENTFILTER_XP_NAME);
- for (int i = 0; i < elements.length; i++) {
+ for (IConfigurationElement element : elements) {
Object obj = null;
try {
- obj = elements[i].createExecutableExtension("class"); //$NON-NLS-1$
+ obj = element.createExecutableExtension("class"); //$NON-NLS-1$
} catch (CoreException e) {
HelpWebappPlugin.logError("Create extension failed:[" //$NON-NLS-1$
+ CONTENTFILTER_XP_NAME + "].", e); //$NON-NLS-1$
@@ -54,7 +54,7 @@ public class ExtraFilters implements IFilter {
if (obj instanceof IFilter) {
int priority = 0;
- String priStr = elements[i].getAttribute("priority"); //$NON-NLS-1$
+ String priStr = element.getAttribute("priority"); //$NON-NLS-1$
if (priStr != null && !"".equals(priStr)) { //$NON-NLS-1$
try {
priority = Integer.parseInt(priStr);
@@ -77,17 +77,18 @@ public class ExtraFilters implements IFilter {
* For JUnit testing
*/
public static void setFilters(PrioritizedFilter[] newFilters) {
- filters = new ArrayList();
- for (int i = 0; i < newFilters.length; i++) {
- filters.add(newFilters[i]);
+ filters = new ArrayList<PrioritizedFilter>();
+ for (PrioritizedFilter newFilter : newFilters) {
+ filters.add(newFilter);
}
sortFilters();
}
+ @Override
public OutputStream filter(HttpServletRequest req, OutputStream out) {
PrioritizedFilter filter;
for(int index = 0; index < filters.size(); index++) {
- filter = (PrioritizedFilter)filters.get(index);
+ filter = filters.get(index);
out = filter.filter(req, out);
}
return out;
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadAndBodyOutputStream.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadAndBodyOutputStream.java
index b041305ab..0b0d440df 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadAndBodyOutputStream.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadAndBodyOutputStream.java
@@ -103,6 +103,7 @@ public class FilterHTMLHeadAndBodyOutputStream extends FilterOutputStream {
* @exception IOException
* if an I/O error occurs.
*/
+ @Override
public final void write(int b) throws IOException {
switch (state) {
case STATE_START:
@@ -291,6 +292,7 @@ public class FilterHTMLHeadAndBodyOutputStream extends FilterOutputStream {
state = areaState;
}
+ @Override
public void write(byte b[], int off, int len) throws IOException {
if (state == STATE_DONE) {
out.write(b, off, len);
@@ -306,6 +308,7 @@ public class FilterHTMLHeadAndBodyOutputStream extends FilterOutputStream {
*
* @see java.io.FilterOutputStream#close()
*/
+ @Override
public void close() throws IOException {
reset();
super.close();
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadOutputStream.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadOutputStream.java
index c94af67e6..e92a0a21d 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadOutputStream.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadOutputStream.java
@@ -66,6 +66,7 @@ public class FilterHTMLHeadOutputStream extends FilterOutputStream {
* @exception IOException
* if an I/O error occurs.
*/
+ @Override
public final void write(int b) throws IOException {
switch (state) {
case STATE_START:
@@ -139,6 +140,7 @@ public class FilterHTMLHeadOutputStream extends FilterOutputStream {
state = STATE_START;
}
+ @Override
public void write(byte b[], int off, int len) throws IOException {
if (state == STATE_DONE) {
out.write(b, off, len);
@@ -154,6 +156,7 @@ public class FilterHTMLHeadOutputStream extends FilterOutputStream {
*
* @see java.io.FilterOutputStream#close()
*/
+ @Override
public void close() throws IOException {
reset();
super.close();
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java
index ba0826b49..499ceb647 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java
@@ -33,6 +33,7 @@ public class FramesetFilter implements IFilter {
/*
* @see IFilter#filter(HttpServletRequest, OutputStream)
*/
+ @Override
public OutputStream filter(HttpServletRequest req, OutputStream out) {
String uri = req.getRequestURI();
String url = req.getPathInfo();
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/HighlightFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/HighlightFilter.java
index f572c0813..e016866af 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/HighlightFilter.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/HighlightFilter.java
@@ -35,6 +35,7 @@ public class HighlightFilter implements IFilter {
/*
* @see IFilter#filter(HttpServletRequest, OutputStream)
*/
+ @Override
public OutputStream filter(HttpServletRequest req, OutputStream out) {
String uri = req.getRequestURI();
if (uri == null) {
@@ -44,7 +45,7 @@ public class HighlightFilter implements IFilter {
return out;
}
- Collection keywords = getWords(req);
+ Collection<String> keywords = getWords(req);
if (keywords.size() == 0) {
return out;
}
@@ -64,17 +65,17 @@ public class HighlightFilter implements IFilter {
* @param keywords
* @return byte[]
*/
- private byte[] createJScript(HttpServletRequest req, Collection keywords) {
+ private byte[] createJScript(HttpServletRequest req, Collection<String> keywords) {
StringBuffer buf = new StringBuffer(scriptPart1);
StringBuffer buf2 = new StringBuffer(sheetRefPart1);
// append comma separated list of keywords
- Iterator it = keywords.iterator();
+ Iterator<String> it = keywords.iterator();
if (!it.hasNext())
return null;
- String keyword = (String) it.next();
+ String keyword = it.next();
buf.append("\"").append(keyword).append("\""); //$NON-NLS-1$ //$NON-NLS-2$
while (it.hasNext()) {
- keyword = (String) it.next();
+ keyword = it.next();
buf.append(", \"").append(keyword).append("\""); //$NON-NLS-1$ //$NON-NLS-2$
}
buf.append(scriptPart2);
@@ -102,9 +103,9 @@ public class HighlightFilter implements IFilter {
*
* @return Collection of String
*/
- private Collection getWords(HttpServletRequest req) {
+ private Collection<String> getWords(HttpServletRequest req) {
// Collect words to hash set to eliminate duplcates
- Collection tokens = new ArrayList();
+ Collection<String> tokens = new ArrayList<String>();
String searchWord = req.getParameter("resultof"); //$NON-NLS-1$
if (searchWord == null) {
@@ -141,12 +142,11 @@ public class HighlightFilter implements IFilter {
*
* @return Collection of String
*/
- private Collection encodeKeyWords(Collection col) {
+ private Collection<String> encodeKeyWords(Collection<String> col) {
if (col == null)
return col;
- Collection result = new ArrayList();
- for (Iterator it = col.iterator(); it.hasNext();) {
- String word = (String) it.next();
+ Collection<String> result = new ArrayList<String>();
+ for (String word : col) {
int l = word.length();
if (l < 1)
continue;
@@ -161,14 +161,13 @@ public class HighlightFilter implements IFilter {
*
* @return Collection of String
*/
- private Collection removeWildCards(Collection col) {
+ private Collection<String> removeWildCards(Collection<String> col) {
if (col == null)
return col;
// Split words into parts: before "*" and after "*"
- Collection resultPass1 = new ArrayList();
- for (Iterator it = col.iterator(); it.hasNext();) {
- String word = (String) it.next();
+ Collection<String> resultPass1 = new ArrayList<String>();
+ for (String word : col) {
int index;
while ((index = word.indexOf("*")) >= 0) { //$NON-NLS-1$
if (index > 0)
@@ -181,9 +180,8 @@ public class HighlightFilter implements IFilter {
}
// Split words into parts: before "?" and after "?"
- Collection resultPass2 = new ArrayList();
- for (Iterator it = resultPass1.iterator(); it.hasNext();) {
- String word = (String) it.next();
+ Collection<String> resultPass2 = new ArrayList<String>();
+ for (String word : resultPass1) {
int index;
while ((index = word.indexOf("?")) >= 0) { //$NON-NLS-1$
if (index > 0)
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java
index d3f857ffa..4d3996385 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java
@@ -13,7 +13,6 @@ package org.eclipse.help.internal.webapp.servlet;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
@@ -51,7 +50,7 @@ import com.ibm.icu.text.Collator;
public class IndexFragmentServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
- private static Map locale2Response = new WeakHashMap();
+ private static Map<String, String> locale2Response = new WeakHashMap<String, String>();
private String startParameter;
private String sizeParameter;
private String entryParameter;
@@ -67,6 +66,7 @@ public class IndexFragmentServlet extends HttpServlet {
private static final String SHOW_ALL = "showAll"; //$NON-NLS-1$
private Collator collator = Collator.getInstance();
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// set the character-set to UTF-8 before calling resp.getWriter()
@@ -132,7 +132,7 @@ public class IndexFragmentServlet extends HttpServlet {
private StringBuffer buf;
private int count = 0;
private String locale;
- private List entryList;
+ private List<Integer> entryList;
private IIndexEntry[] entries;
private boolean enablePrevious = true;
private boolean enableNext = true;
@@ -157,7 +157,7 @@ public class IndexFragmentServlet extends HttpServlet {
if (entries.length == 0) {
generateEmptyIndexMessage();
} else {
- entryList = new ArrayList();
+ entryList = new ArrayList<Integer>();
int nextEntry = findFirstEntry(entries);
if (PREVIOUS.equals(modeParameter)) {
int remaining = getPreviousEntries(nextEntry, size);
@@ -170,8 +170,7 @@ public class IndexFragmentServlet extends HttpServlet {
getPreviousEntries(nextEntry, 1);
}
}
- for (Iterator iter = entryList.iterator(); iter.hasNext();) {
- Integer entryId = (Integer)iter.next();
+ for (Integer entryId : entryList) {
generateEntry(entries[entryId.intValue()], 0, "e" + entryId.intValue()); //$NON-NLS-1$
}
}
@@ -286,14 +285,14 @@ public class IndexFragmentServlet extends HttpServlet {
IIndexEntry[] subentries = entry.getSubentries();
int subentryCount = 0;
- for (int i=0; i<subentries.length; ++i) {
- count += enabledEntryCount(subentries[i]);
+ for (IIndexEntry subentrie : subentries) {
+ count += enabledEntryCount(subentrie);
}
int seeCount = 0;
IIndexSee[] sees = entry instanceof IIndexEntry2 ? ((IIndexEntry2)entry).getSees() : new IIndexSee[0];
- for (int s = 0; s < sees.length; s++) {
- if (ScopeUtils.showInTree(sees[s], scope)) {
+ for (IIndexSee see : sees) {
+ if (ScopeUtils.showInTree(see, scope)) {
seeCount++;
}
}
@@ -309,8 +308,8 @@ public class IndexFragmentServlet extends HttpServlet {
private int enabledTopicCount(IIndexEntry entry) {
int topicCount = 0;
ITopic[] topics = entry.getTopics();
- for (int i = 0; i < topics.length; i++) {
- if (scope.inScope(topics[i])) {
+ for (ITopic topic : topics) {
+ if (scope.inScope(topic)) {
topicCount++;
}
}
@@ -368,16 +367,15 @@ public class IndexFragmentServlet extends HttpServlet {
private void generateSubentries(IIndexEntry entry, int level) {
IIndexEntry[] subentries = entry.getSubentries();
- for (int i=0;i<subentries.length;++i) {
- generateEntry(subentries[i], level, "s" + count++); //$NON-NLS-1$
+ for (IIndexEntry subentrie : subentries) {
+ generateEntry(subentrie, level, "s" + count++); //$NON-NLS-1$
}
}
private void generateTopicList(IIndexEntry entry) {
ITopic[] topics = entry.getTopics();
- for (int i = 0; i < topics.length; ++i) {
- ITopic topic = (ITopic) topics[i];
+ for (ITopic topic : topics) {
if (ScopeUtils.showInTree(topic, scope)) {
//
String label = UrlUtil.htmlEncode(topic.getLabel());
@@ -402,18 +400,17 @@ public class IndexFragmentServlet extends HttpServlet {
}
private void generateSees(IIndexSee[] sees) {
- for (int i = 0; i < sees.length; i++) {
- IIndexSee see = sees[i];
- if (ScopeUtils.showInTree(see, scope)) {
+ for (IIndexSee see : sees) {
+ if (ScopeUtils.showInTree(see, scope)) {
//
String key = see.isSeeAlso() ? "SeeAlso" : "See"; //$NON-NLS-1$ //$NON-NLS-2$
String seePrefix = WebappResources.getString(key, UrlUtil
.getLocale(locale));
String seeTarget = see.getKeyword();
IIndexSubpath[] subpathElements = see.getSubpathElements();
- for (int pathIndex = 0; pathIndex < subpathElements.length; pathIndex++ ) {
+ for (IIndexSubpath subpathElement : subpathElements) {
seeTarget += ", "; //$NON-NLS-1$
- seeTarget += subpathElements[pathIndex].getKeyword();
+ seeTarget += subpathElement.getKeyword();
}
String label = NLS.bind(seePrefix, seeTarget);
String encodedLabel = UrlUtil.htmlEncode(label);
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexServlet.java
index 7ecc0d291..2442e6d36 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexServlet.java
@@ -39,9 +39,10 @@ import org.eclipse.help.internal.webapp.data.UrlUtil;
public class IndexServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
- private Map responseByLocale;
+ private Map<String, String> responseByLocale;
private DocumentWriter writer;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// set the character-set to UTF-8 before calling resp.getWriter()
@@ -56,9 +57,9 @@ public class IndexServlet extends HttpServlet {
req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
if (responseByLocale == null) {
- responseByLocale = new WeakHashMap();
+ responseByLocale = new WeakHashMap<String, String>();
}
- String response = (String)responseByLocale.get(locale);
+ String response = responseByLocale.get(locale);
if (response == null) {
IndexContribution[] contributions = HelpPlugin.getIndexManager().getIndexContributions(locale);
try {
@@ -80,8 +81,7 @@ public class IndexServlet extends HttpServlet {
if (writer == null) {
writer = new DocumentWriter();
}
- for (int i=0;i<contributions.length;++i) {
- IndexContribution contrib = contributions[i];
+ for (IndexContribution contrib : contributions) {
buf.append("<indexContribution\n"); //$NON-NLS-1$
buf.append(" id=\"" + contrib.getId() + '"'); //$NON-NLS-1$
buf.append(" locale=\"" + contrib.getLocale() + "\">\n"); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java
index a5b0ae821..1ec970f7a 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -52,12 +52,12 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
// Current working set , empty string means all documents
private String currentWorkingSet = ""; //$NON-NLS-1$
- private SortedSet workingSets = new TreeSet(new WorkingSetComparator());
+ private SortedSet<WorkingSet> workingSets = new TreeSet<WorkingSet>(new WorkingSetComparator());
private String locale;
private AdaptableTocsArray root;
private static final String UNCATEGORIZED = "Uncategorized"; //$NON-NLS-1$
- private Map allCriteriaValues;
+ private Map<String, Set<String>> allCriteriaValues;
/**
* Constructor
@@ -72,6 +72,7 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
restoreState();
}
+ @Override
public AdaptableTocsArray getRoot() {
if (root == null)
root = new AdaptableTocsArray(HelpPlugin.getTocManager().getTocs(
@@ -82,6 +83,7 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
/**
* Adds a new working set and saves it
*/
+ @Override
public void addWorkingSet(WorkingSet workingSet) throws IOException {
if (workingSet == null || workingSets.contains(workingSet))
return;
@@ -92,11 +94,13 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
/**
* Creates a new working set
*/
+ @Override
public WorkingSet createWorkingSet(String name,
AdaptableHelpResource[] elements) {
return new WorkingSet(name, elements);
}
+ @Override
public WorkingSet createWorkingSet(String name, AdaptableHelpResource[] elements, CriterionResource[] criteria) {
return new WorkingSet(name, elements, criteria);
}
@@ -105,13 +109,14 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
* Returns a working set by name
*
*/
+ @Override
public WorkingSet getWorkingSet(String name) {
if (name == null || workingSets == null)
return null;
- Iterator iter = workingSets.iterator();
+ Iterator<WorkingSet> iter = workingSets.iterator();
while (iter.hasNext()) {
- WorkingSet workingSet = (WorkingSet) iter.next();
+ WorkingSet workingSet = iter.next();
if (name.equals(workingSet.getName()))
return workingSet;
}
@@ -123,14 +128,16 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
*
* @see org.eclipse.help.internal.workingset.IHelpWorkingSetManager#getWorkingSets()
*/
+ @Override
public WorkingSet[] getWorkingSets() {
- return (WorkingSet[]) workingSets.toArray(new WorkingSet[workingSets
+ return workingSets.toArray(new WorkingSet[workingSets
.size()]);
}
/**
* Removes specified working set
*/
+ @Override
public void removeWorkingSet(WorkingSet workingSet) {
workingSets.remove(workingSet);
try {
@@ -206,7 +213,7 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
continue;
}
String name = URLCoder.decode(nameAndCriteria[0]);
- List criteriaResource = new ArrayList();
+ List<CriterionResource> criteriaResource = new ArrayList<CriterionResource>();
for (int j = 1; j < nameAndCriteria.length; ++j) {
String criterion = nameAndCriteria[j];
String[] keyAndValue = criterion.split("#", -1); //$NON-NLS-1$
@@ -218,7 +225,7 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
if(criterionValues.length < 1)
continue;
- List criterionValuesList = Arrays.asList(criterionValues);
+ List<String> criterionValuesList = Arrays.asList(criterionValues);
CriterionResource criterionResource = new CriterionResource(key, criterionValuesList);
criteriaResource.add(criterionResource);
@@ -249,21 +256,20 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
data.append(URLCoder.compactEncode(currentWorkingSet /* , "UTF8" */
));
- for (Iterator i = workingSets.iterator(); i.hasNext();) {
+ for (WorkingSet ws : workingSets) {
data.append('|');
- WorkingSet ws = (WorkingSet) i.next();
data.append(URLCoder.compactEncode(ws.getName() /* , "UTF8" */
));
AdaptableHelpResource[] resources = ws.getElements();
AdaptableToc lastTopicParent = null;
- for (int j = 0; j < resources.length; j++) {
+ for (AdaptableHelpResource resource : resources) {
- IAdaptable parent = resources[j].getParent();
+ IAdaptable parent = resource.getParent();
if (parent == getRoot()) {
// saving toc
data.append('&');
- data.append(URLCoder.compactEncode(resources[j].getHref()
+ data.append(URLCoder.compactEncode(resource.getHref()
/* , "UTF8" */
));
lastTopicParent = null;
@@ -272,7 +278,7 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
AdaptableToc toc = (AdaptableToc) parent;
AdaptableHelpResource[] siblings = (toc).getChildren();
for (int t = 0; t < siblings.length; t++) {
- if (siblings[t] == resources[j]) {
+ if (siblings[t] == resource) {
data.append('&');
if (!toc.equals(lastTopicParent)) {
data.append(URLCoder.compactEncode(toc.getHref()
@@ -298,22 +304,19 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
StringBuffer data = new StringBuffer();
data.append(URLCoder.compactEncode(currentWorkingSet));
//|scope1$platform#AIX,WINDOWS,$version#1.0,2.0,
- for (Iterator i = workingSets.iterator(); i.hasNext();) {
+ for (WorkingSet ws : workingSets) {
data.append('|');
- WorkingSet ws = (WorkingSet) i.next();
data.append(URLCoder.compactEncode(ws.getName()));
CriterionResource[] criteria = ws.getCriteria();
- for (int j = 0; j < criteria.length; ++ j){
- CriterionResource criterion = criteria[j];
+ for (CriterionResource criterion : criteria) {
String criterionName = criterion.getCriterionName();
- List criterionValues = criterion.getCriterionValues();
+ List<String> criterionValues = criterion.getCriterionValues();
if(null != criterionValues && !criterionValues.isEmpty()){
data.append('$');
data.append(URLCoder.compactEncode(criterionName));
data.append('#');
- for (Iterator iter = criterionValues.iterator(); iter.hasNext();) {
- String value = (String) iter.next();
+ for (String value : criterionValues) {
data.append(URLCoder.compactEncode(value+','));
}
}
@@ -343,15 +346,18 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
* @param changedWorkingSet
* the working set that has changed
*/
+ @Override
public void workingSetChanged(WorkingSet changedWorkingSet)
throws IOException {
saveState();
}
+ @Override
public AdaptableToc getAdaptableToc(String href) {
return getRoot().getAdaptableToc(href);
}
+ @Override
public AdaptableTopic getAdaptableTopic(String id) {
if (id == null || id.length() == 0)
@@ -384,10 +390,12 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
return null;
}
+ @Override
public String getCurrentWorkingSet() {
return currentWorkingSet;
}
+ @Override
public void setCurrentWorkingSet(String workingSet) {
currentWorkingSet = workingSet;
try {
@@ -396,6 +404,7 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
}
}
+ @Override
public boolean isCriteriaScopeEnabled(){
if(null == allCriteriaValues){
allCriteriaValues = HelpPlugin.getCriteriaManager().getAllCriteriaValues(locale);
@@ -407,14 +416,14 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
}
}
+ @Override
public String[] getCriterionIds() {
if(null == allCriteriaValues){
allCriteriaValues = HelpPlugin.getCriteriaManager().getAllCriteriaValues(locale);
}
- List criterionIds = new ArrayList();
+ List<String> criterionIds = new ArrayList<String>();
if(null != allCriteriaValues){
- for(Iterator iter = allCriteriaValues.keySet().iterator(); iter.hasNext();){
- String criterion = (String) iter.next();
+ for (String criterion : allCriteriaValues.keySet()) {
if(null == criterion || 0 == criterion.length() || 0 == getCriterionValueIds(criterion).length)
continue;
criterionIds.add(criterion);
@@ -427,13 +436,14 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
}
+ @Override
public String[] getCriterionValueIds(String criterionName) {
if(null == allCriteriaValues){
allCriteriaValues = HelpPlugin.getCriteriaManager().getAllCriteriaValues(locale);
}
- List valueIds = new ArrayList();
+ List<String> valueIds = new ArrayList<String>();
if(null != criterionName && null != allCriteriaValues) {
- Set criterionValues = (Set)allCriteriaValues.get(criterionName);
+ Set<String> criterionValues = allCriteriaValues.get(criterionName);
if(null != criterionValues && !criterionValues.isEmpty()) {
valueIds.addAll(criterionValues);
Collections.sort(valueIds);
@@ -446,10 +456,12 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
}
+ @Override
public String getCriterionDisplayName(String criterionId) {
return HelpPlugin.getCriteriaManager().getCriterionDisplayName(criterionId, locale);
}
+ @Override
public String getCriterionValueDisplayName(String criterionId, String criterionValueId) {
return HelpPlugin.getCriteriaManager().getCriterionValueDisplayName(criterionId, criterionValueId, locale);
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java
index 320039798..dd1136a43 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java
@@ -48,6 +48,7 @@ public class InjectionFilter implements IFilter {
/*
* @see IFilter#filter(HttpServletRequest, OutputStream)
*/
+ @Override
public OutputStream filter(HttpServletRequest req, OutputStream out) {
boolean isUnfiltered = ProductPreferences.useEnablementFilters();
@@ -68,7 +69,7 @@ public class InjectionFilter implements IFilter {
return out;
}
- List cssIncludes = new ArrayList();
+ List<String> cssIncludes = new ArrayList<String>();
if (isNav) {
CssUtil.addCssFiles(NAV_CSS, cssIncludes);
} else {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/LiveHelpServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/LiveHelpServlet.java
index 863b3f954..f0f9a665d 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/LiveHelpServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/LiveHelpServlet.java
@@ -27,6 +27,7 @@ public class LiveHelpServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
*/
+ @Override
public void init() throws ServletException {
if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_INFOCENTER) {
throw new ServletException();
@@ -37,6 +38,7 @@ public class LiveHelpServlet extends HttpServlet {
* Called by the server (via the <code>service</code> method) to allow a
* servlet to handle a GET request.
*/
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_INFOCENTER) {
@@ -63,6 +65,7 @@ public class LiveHelpServlet extends HttpServlet {
* Handle the search requests,
*
*/
+ @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doGet(req, resp);
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java
index e0dc0f7ca..7e87f5848 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java
@@ -49,6 +49,7 @@ public class NavServlet extends HttpServlet {
new FramesetFilter(), new InjectionFilter(false), new BreadcrumbsFilter(),
new ShowInTocFilter(), new ExtraFilters() };
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
Locale locale = getLocale(req, resp);
@@ -66,8 +67,8 @@ public class NavServlet extends HttpServlet {
}
OutputStream out = resp.getOutputStream();
- for (int i = 0; i < filters.length; i++) {
- out = filters[i].filter(req, out);
+ for (IFilter filter : filters) {
+ out = filter.filter(req, out);
}
PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, "UTF-8")); //$NON-NLS-1$
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootFilter.java
index c03f89e7f..a3432aee8 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootFilter.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootFilter.java
@@ -24,7 +24,8 @@ import org.eclipse.help.webapp.IFilter;
*/
public class PluginsRootFilter implements IFilter {
- public OutputStream filter(HttpServletRequest req, OutputStream out) {
+ @Override
+ public OutputStream filter(HttpServletRequest req, OutputStream out) {
String pathPrefix = FilterUtils.getRelativePathPrefix(req);
if (pathPrefix.length() >= 3) {
return new PluginsRootResolvingStream(out, req, pathPrefix.substring(0, pathPrefix.length() - 3));
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java
index 147613ea9..0e3499346 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java
@@ -56,6 +56,7 @@ public class PluginsRootResolvingStream extends OutputStream {
this.req = req;
}
+ @Override
public void write(int b) throws IOException {
switch(state) {
case INITIAL_STATE:
@@ -211,6 +212,7 @@ public class PluginsRootResolvingStream extends OutputStream {
}
+ @Override
public void close() throws IOException {
if (state == IN_QUOTE) {
flushPluginsRootCharacters();
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PreferenceWriter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PreferenceWriter.java
index 8cb91dc82..510972cf1 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PreferenceWriter.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PreferenceWriter.java
@@ -51,10 +51,10 @@ public class PreferenceWriter {
private void writePreference(String plugin) {
try {
IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(plugin);
- Set keySet = new HashSet();
+ Set<String> keySet = new HashSet<String>();
prefs = DefaultScope.INSTANCE.getNode(plugin);
keySet.addAll(Arrays.asList(prefs.keys()));
- String[] allKeys = (String[]) keySet.toArray(new String[keySet.size()]);
+ String[] allKeys = keySet.toArray(new String[keySet.size()]);
if (allKeys.length > 0) {
Arrays.sort(allKeys);
@@ -68,8 +68,7 @@ public class PreferenceWriter {
buf.append(XMLGenerator.xmlEscape(plugin));
buf.append("\">"); //$NON-NLS-1$
}
- for (int i = 0; i < allKeys.length; i++) {
- String key = allKeys[i];
+ for (String key : allKeys) {
String value = Platform.getPreferencesService().getString
(plugin, key, "", null); //$NON-NLS-1$
if (!isXML) {
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PrioritizedFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PrioritizedFilter.java
index ce3ba3396..4014dc59d 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PrioritizedFilter.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PrioritizedFilter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,7 @@ import javax.servlet.http.HttpServletRequest;
import org.eclipse.help.webapp.IFilter;
-public class PrioritizedFilter implements IFilter, Comparable {
+public class PrioritizedFilter implements IFilter, Comparable<PrioritizedFilter> {
private IFilter filter;
private int priority;
@@ -34,10 +34,12 @@ public class PrioritizedFilter implements IFilter, Comparable {
/*
* smaller number ranks higher
*/
- public int compareTo(Object o) {
- return priority() - ((PrioritizedFilter)o).priority();
+ @Override
+ public int compareTo(PrioritizedFilter o) {
+ return priority() - o.priority();
}
+ @Override
public OutputStream filter(HttpServletRequest req, OutputStream out) {
return filter.filter(req, out);
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/SearchServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/SearchServlet.java
index 23c82e285..b1649e541 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/SearchServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/SearchServlet.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,6 +26,7 @@ import org.eclipse.help.internal.base.BaseHelpSystem;
import org.eclipse.help.internal.search.ISearchHitCollector;
import org.eclipse.help.internal.search.ISearchQuery;
import org.eclipse.help.internal.search.QueryTooComplexException;
+import org.eclipse.help.internal.search.SearchHit;
import org.eclipse.help.internal.search.SearchQuery;
import org.eclipse.help.internal.webapp.data.UrlUtil;
import org.eclipse.help.internal.webapp.utils.SearchXMLGenerator;
@@ -39,14 +40,16 @@ import org.eclipse.help.internal.webapp.utils.SearchXMLGenerator;
public class SearchServlet extends HttpServlet {
private final class HitCollector implements ISearchHitCollector {
- public Collection results = new ArrayList();
+ public Collection<SearchHit> results = new ArrayList<SearchHit>();
- public void addHits(List hits, String wordsSearched) {
+ @Override
+ public void addHits(List<SearchHit> hits, String wordsSearched) {
if (results != null) {
results.addAll(hits);
}
}
+ @Override
public void addQTCException(QueryTooComplexException exception)
throws QueryTooComplexException {
searchException = exception;
@@ -57,6 +60,7 @@ public class SearchServlet extends HttpServlet {
private static final String PARAMETER_PHRASE = "phrase"; //$NON-NLS-1$
private QueryTooComplexException searchException;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String response = processRequest(req, resp);
@@ -75,7 +79,7 @@ public class SearchServlet extends HttpServlet {
resp.setContentType("application/xml; charset=UTF-8"); //$NON-NLS-1$
String phrase = req.getParameter(PARAMETER_PHRASE);
if (phrase != null) {
- ISearchQuery query = new SearchQuery(phrase, false, Collections.EMPTY_LIST, locale);
+ ISearchQuery query = new SearchQuery(phrase, false, Collections.<String> emptyList(), locale);
collector.results.clear();
BaseHelpSystem.getSearchManager().search(query, collector, new NullProgressMonitor());
if (searchException == null) {
@@ -85,7 +89,7 @@ public class SearchServlet extends HttpServlet {
return ""; //$NON-NLS-1$
}
- public static String serialize(Collection results) {
+ public static String serialize(Collection<SearchHit> results) {
return SearchXMLGenerator.serialize(results);
}
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java
index e0a6db4f7..f86834db7 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java
@@ -26,7 +26,8 @@ public class ServletPrintWriter extends PrintWriter{
* Writes a single character.
* @param c int specifying a character to be written.
*/
- public void write(int c) {
+ @Override
+ public void write(int c) {
synchronized (lock) {
buffer.append((char)(c));
}
@@ -38,7 +39,8 @@ public class ServletPrintWriter extends PrintWriter{
* @param off Offset from which to start writing characters
* @param len Number of characters to write
*/
- public void write(char buf[], int off, int len) {
+ @Override
+ public void write(char buf[], int off, int len) {
synchronized (lock) {
buffer.append(buf, off, len);
}
@@ -49,7 +51,8 @@ public class ServletPrintWriter extends PrintWriter{
* Writer class because it must suppress I/O exceptions.
* @param buf Array of characters to be written
*/
- public void write(char buf[]) {
+ @Override
+ public void write(char buf[]) {
write(buf, 0, buf.length);
}
@@ -59,7 +62,8 @@ public class ServletPrintWriter extends PrintWriter{
* @param off Offset from which to start writing characters
* @param len Number of characters to write
*/
- public void write(String s, int off, int len) {
+ @Override
+ public void write(String s, int off, int len) {
synchronized (lock) {
buffer.append(s.toCharArray(), off, off+len);
}
@@ -70,11 +74,13 @@ public class ServletPrintWriter extends PrintWriter{
* because it must suppress I/O exceptions.
* @param s String to be written
*/
- public void write(String s) {
+ @Override
+ public void write(String s) {
write(s, 0, s.length());
}
- public String toString()
+ @Override
+ public String toString()
{
return buffer.toString();
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ShowInTocFilter.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ShowInTocFilter.java
index 78484d3e1..6334a0d55 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ShowInTocFilter.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ShowInTocFilter.java
@@ -28,6 +28,7 @@ public class ShowInTocFilter implements IFilter {
/*
* @see IFilter#filter(HttpServletRequest, OutputStream)
*/
+ @Override
public OutputStream filter(HttpServletRequest req, OutputStream out) {
String uri = req.getRequestURI();
if (uri == null) return out;
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java
index 8be75f275..11d273117 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java
@@ -41,9 +41,10 @@ import org.eclipse.help.internal.webapp.data.UrlUtil;
public class TocFragmentServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
- private static Map locale2Response = new WeakHashMap();
+ private static Map<String, String> locale2Response = new WeakHashMap<String, String>();
private boolean isErrorSuppress;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// set the character-set to UTF-8 before calling resp.getWriter()
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocServlet.java
index 5421cdbc8..b11cb226f 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocServlet.java
@@ -39,10 +39,11 @@ import org.eclipse.help.internal.webapp.data.UrlUtil;
public class TocServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
- private Map responseByLocale;
+ private Map<String, String> responseByLocale;
private DocumentWriter writer;
private static boolean clearCache;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// set the character-set to UTF-8 before calling resp.getWriter()
@@ -57,14 +58,14 @@ public class TocServlet extends HttpServlet {
req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
if (clearCache){
- responseByLocale = new WeakHashMap();
+ responseByLocale = new WeakHashMap<String, String>();
clearCache = false;
}
if (responseByLocale == null) {
- responseByLocale = new WeakHashMap();
+ responseByLocale = new WeakHashMap<String, String>();
}
- String response = (String)responseByLocale.get(locale);
+ String response = responseByLocale.get(locale);
if (response == null) {
TocContribution[] contributions = HelpPlugin.getTocManager().getTocContributions(locale);
try {
@@ -86,8 +87,8 @@ public class TocServlet extends HttpServlet {
if (writer == null) {
writer = new DocumentWriter();
}
- for (int i = 0; i < contributions.length; ++i) {
- TocContribution contrib = contributions[i];
+ for (TocContribution contribution : contributions) {
+ TocContribution contrib = contribution;
if (!contrib.isSubToc()) {
buf.append("<tocContribution"); //$NON-NLS-1$
if (contrib.getCategoryId() != null) {
@@ -101,8 +102,8 @@ public class TocServlet extends HttpServlet {
buf.append("\n isPrimary=\"" + contrib.isPrimary() + "\">\n"); //$NON-NLS-1$ //$NON-NLS-2$
buf.append(writer.writeString((Toc)contrib.getToc(), false));
String[] hrefs = contrib.getExtraDocuments();
- for (int j=0;j<hrefs.length;++j) {
- buf.append(" <extraDocument href=\"" + hrefs[j] + "\"/>\n"); //$NON-NLS-1$//$NON-NLS-2$
+ for (String href : hrefs) {
+ buf.append(" <extraDocument href=\"" + href + "\"/>\n"); //$NON-NLS-1$//$NON-NLS-2$
}
buf.append("</tocContribution>\n"); //$NON-NLS-1$
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java
index 90699e38a..79a19a057 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ValidatorServlet.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 IBM Corporation and others.
+ * Copyright (c) 2011, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -53,7 +53,7 @@ import org.eclipse.help.internal.webapp.utils.Utils;
public class ValidatorServlet extends HttpServlet {
private static final long serialVersionUID = -3783758607845176051L;
- private Hashtable servletTable = new Hashtable();
+ private Hashtable<String, HttpServlet> servletTable = new Hashtable<String, HttpServlet>();
protected void process(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
@@ -94,20 +94,20 @@ public class ValidatorServlet extends HttpServlet {
private HttpServlet getServlet(String name)
throws CoreException {
- HttpServlet servlet = (HttpServlet)servletTable.get(name);
+ HttpServlet servlet = servletTable.get(name);
if (servlet == null) {
IConfigurationElement[] configs =
Platform.getExtensionRegistry().getConfigurationElementsFor(HelpWebappPlugin.PLUGIN_ID+".validatedServlet"); //$NON-NLS-1$
- for (int c=0; c < configs.length; c++) {
+ for (IConfigurationElement config2 : configs) {
- String alias = configs[c].getAttribute("alias"); //$NON-NLS-1$
+ String alias = config2.getAttribute("alias"); //$NON-NLS-1$
if (alias != null) {
if (isMatch(alias, name)) {
- servlet = (HttpServlet)configs[c].createExecutableExtension("class"); //$NON-NLS-1$
+ servlet = (HttpServlet)config2.createExecutableExtension("class"); //$NON-NLS-1$
servletTable.put(name, servlet);
break;
}
@@ -132,11 +132,13 @@ public class ValidatorServlet extends HttpServlet {
return false;
}
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
process(req, resp);
}
+ @Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
process(req, resp);
@@ -144,13 +146,13 @@ public class ValidatorServlet extends HttpServlet {
public boolean isSecure(HttpServletRequest req,HttpServletResponseAdv resp)
throws SecurityException {
- Enumeration names = req.getParameterNames();
- List values = new ArrayList();
- List scripts = new ArrayList();
+ Enumeration<String> names = req.getParameterNames();
+ List<String> values = new ArrayList<String>();
+ List<String> scripts = new ArrayList<String>();
while (names.hasMoreElements()) {
- String name = (String)names.nextElement();
+ String name = names.nextElement();
String val = req.getParameter(name);
values.add(val);
if (replaceAll(val, '+', "").indexOf("<script")>-1) //$NON-NLS-1$ //$NON-NLS-2$
@@ -160,18 +162,12 @@ public class ValidatorServlet extends HttpServlet {
if (resp.getWriter() != null) {
String data = resp.getString();
for (int s=0; s < scripts.size(); s++)
- if (data.indexOf((String)scripts.get(s)) > -1)
+ if (data.indexOf(scripts.get(s)) > -1)
throw new SecurityException("Potential cross-site scripting detected."); //$NON-NLS-1$
}
return true;
}
-
- public void isScript(List params,OutputStream out) {
-
-// ByteArrayOutputStream bOut = new ByteArrayOutputStream(out);
- }
-
public String replaceAll(String str, char remove, String add) {
@@ -198,6 +194,7 @@ public class ValidatorServlet extends HttpServlet {
this.response = response;
}
+ @Override
public PrintWriter getWriter() {
if (writer == null && stream == null)
@@ -205,6 +202,7 @@ public class ValidatorServlet extends HttpServlet {
return writer;
}
+ @Override
public ServletOutputStream getOutputStream() throws IOException {
if (stream == null && writer == null)
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/WebappWorkingSetManager.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/WebappWorkingSetManager.java
index 22baa4c50..08d438449 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/WebappWorkingSetManager.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/WebappWorkingSetManager.java
@@ -50,12 +50,14 @@ public class WebappWorkingSetManager implements IHelpWorkingSetManager {
}
}
+ @Override
public AdaptableTocsArray getRoot() {
return wSetManager.getRoot();
}
/**
* Adds a new working set and saves it
*/
+ @Override
public void addWorkingSet(WorkingSet workingSet) throws IOException {
wSetManager.addWorkingSet(workingSet);
}
@@ -63,11 +65,13 @@ public class WebappWorkingSetManager implements IHelpWorkingSetManager {
/**
* Creates a new working set
*/
+ @Override
public WorkingSet createWorkingSet(String name,
AdaptableHelpResource[] elements) {
return wSetManager.createWorkingSet(name, elements);
}
+ @Override
public WorkingSet createWorkingSet(String name, AdaptableHelpResource[] elements, CriterionResource[] criteria) {
return wSetManager.createWorkingSet(name, elements, criteria);
}
@@ -76,6 +80,7 @@ public class WebappWorkingSetManager implements IHelpWorkingSetManager {
* Returns a working set by name
*
*/
+ @Override
public WorkingSet getWorkingSet(String name) {
return wSetManager.getWorkingSet(name);
}
@@ -84,12 +89,14 @@ public class WebappWorkingSetManager implements IHelpWorkingSetManager {
*
* @see org.eclipse.ui.IWorkingSetManager#getWorkingSets()
*/
+ @Override
public WorkingSet[] getWorkingSets() {
return wSetManager.getWorkingSets();
}
/**
* Removes specified working set
*/
+ @Override
public void removeWorkingSet(WorkingSet workingSet) {
wSetManager.removeWorkingSet(workingSet);
}
@@ -101,45 +108,55 @@ public class WebappWorkingSetManager implements IHelpWorkingSetManager {
* @param changedWorkingSet
* the working set that has changed
*/
+ @Override
public void workingSetChanged(WorkingSet changedWorkingSet)
throws IOException {
wSetManager.workingSetChanged(changedWorkingSet);
}
+ @Override
public AdaptableToc getAdaptableToc(String href) {
return wSetManager.getAdaptableToc(href);
}
+ @Override
public AdaptableTopic getAdaptableTopic(String id) {
return wSetManager.getAdaptableTopic(id);
}
+ @Override
public String getCurrentWorkingSet() {
return wSetManager.getCurrentWorkingSet();
}
+ @Override
public void setCurrentWorkingSet(String scope) {
wSetManager.setCurrentWorkingSet(scope);
}
+ @Override
public boolean isCriteriaScopeEnabled(){
return wSetManager.isCriteriaScopeEnabled();
}
+ @Override
public String[] getCriterionIds() {
return wSetManager.getCriterionIds();
}
+ @Override
public String[] getCriterionValueIds(String criterionId) {
return wSetManager.getCriterionValueIds(criterionId);
}
+ @Override
public String getCriterionDisplayName(String criterionId) {
return wSetManager.getCriterionDisplayName(criterionId);
}
+ @Override
public String getCriterionValueDisplayName(String criterionId, String criterionValueId) {
return wSetManager.getCriterionValueDisplayName(criterionId, criterionValueId);
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/SearchXMLGenerator.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/SearchXMLGenerator.java
index cd86bc65e..a55b55c47 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/SearchXMLGenerator.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/utils/SearchXMLGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,18 +22,17 @@ import org.eclipse.help.internal.webapp.servlet.XMLGenerator;
public class SearchXMLGenerator {
- public static String serialize(Collection results) {
- return serialize((results != null) ? results.toArray() : null, false);
+ public static String serialize(Collection<SearchHit> results) {
+ return serialize((results != null) ? results.toArray(new SearchHit[results.size()]) : null, false);
}
- public static String serialize(Object[] hits, boolean boolIsCategory) {
+ public static String serialize(SearchHit[] hits, boolean boolIsCategory) {
StringBuffer buf = new StringBuffer();
buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$
buf.append("<searchHits>\n"); //$NON-NLS-1$
if (hits != null) {
- for (int i = 0; i < hits.length; i++) {
- SearchHit hit = (SearchHit) hits[i];
+ for (SearchHit hit : hits) {
serialize(hit, buf, " ", boolIsCategory); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java
index 94f3682a6..4f629090d 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@ import java.util.Locale;
* @since 3.5
*/
-public abstract class AbstractButton implements Comparable {
+public abstract class AbstractButton implements Comparable<AbstractButton> {
/**
* Gets the id which will be assigned to the image of the button in the
@@ -114,9 +114,13 @@ public abstract class AbstractButton implements Comparable {
return true;
}
- final public int compareTo(Object o) {
- if (o instanceof AbstractButton) {
- String objectName = ((AbstractButton)o).getId();
+ /**
+ * @since 3.7
+ */
+ @Override
+ final public int compareTo(AbstractButton o) {
+ if (o != null) {
+ String objectName = o.getId();
return (getId().compareTo(objectName));
}
return 0;
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java
index c60661174..eee722824 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,7 +16,7 @@ package org.eclipse.help.webapp;
* @since 3.5
*/
-public abstract class AbstractFrame implements Comparable {
+public abstract class AbstractFrame implements Comparable<AbstractFrame> {
/**
* Constant returned from getFrameLocation() function to indicate that
@@ -66,9 +66,13 @@ public abstract class AbstractFrame implements Comparable {
return "\"marginwidth=\"1\" marginheight=\"1\" frameborder=\"1\" scrolling=\"no\""; //$NON-NLS-1$
}
- final public int compareTo(Object o) {
- if (o instanceof AbstractFrame) {
- String objectName = ((AbstractFrame)o).getName();
+ /**
+ * @since 3.7
+ */
+ @Override
+ final public int compareTo(AbstractFrame o) {
+ if (o != null) {
+ String objectName = o.getName();
return (getName().compareTo(objectName));
}
return 0;
diff --git a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/Activator.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/Activator.java
index f2b0f4a4e..eeba7fd89 100644
--- a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/Activator.java
+++ b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/Activator.java
@@ -35,6 +35,7 @@ public class Activator extends AbstractUIPlugin {
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
@@ -44,6 +45,7 @@ public class Activator extends AbstractUIPlugin {
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
diff --git a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/LinkCheckServlet.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/LinkCheckServlet.java
index 241844ed7..4dd0d3e94 100644
--- a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/LinkCheckServlet.java
+++ b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/LinkCheckServlet.java
@@ -20,6 +20,7 @@ import javax.servlet.http.HttpServletResponse;
public class LinkCheckServlet extends HttpServlet {
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
diff --git a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckLinkAction.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckLinkAction.java
index ae635fabd..9e5b6547a 100644
--- a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckLinkAction.java
+++ b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckLinkAction.java
@@ -14,7 +14,6 @@ package org.eclipse.ua.tests.doc.internal.actions;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.runtime.Platform;
@@ -26,15 +25,17 @@ import org.eclipse.help.internal.base.HelpBasePlugin;
public class CheckLinkAction implements ILiveHelpAction {
private static final String HELP_TOPIC = "/help/topic";
- private static Map links = new HashMap();
+ private static Map<String, String> links = new HashMap<String, String>();
private String link;
public final static String ALL_PAGES_LOADED = "ALL_PAGES_LOADED";
public final static String CHECK_LINKS = "CHECK_LINKS";
+ @Override
public void setInitializationString(String data) {
link = data;
}
+ @Override
public void run() {
//System.out.println("Link = " + link);
if (ALL_PAGES_LOADED.equals(link)) {
@@ -53,8 +54,7 @@ public class CheckLinkAction implements ILiveHelpAction {
setPageNotFoundPreference("");
System.out.println("Start checking " + links.size() + " links");
int count = 0;
- for (Iterator iter = links.keySet().iterator(); iter.hasNext(); ) {
- String next = (String)iter.next();
+ for (String next : links.keySet()) {
count++;
if (count % 1000 == 0) {
System.out.println("Checked " + count + " links");
@@ -79,14 +79,14 @@ public class CheckLinkAction implements ILiveHelpAction {
opened = false;
}
if (!opened) {
- String containingPage = (String) links.get(next);
+ String containingPage = links.get(next);
System.out.println("Cannot open link from " + trimPath(containingPage)
+ " to " + trimPath(next));
}
}
//EclipseConnector.setNotFoundCallout(null);
setPageNotFoundPreference(errorPage);
- links = new HashMap();
+ links = new HashMap<String, String>();
System.out.println("End check links");
}
diff --git a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckTocAction.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckTocAction.java
index 34b20c0ab..8d4fbd9f4 100644
--- a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckTocAction.java
+++ b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckTocAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,14 +26,14 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class CheckTocAction implements IWorkbenchWindowActionDelegate {
private IWorkbenchWindow window;
- public static List errors = new ArrayList();
+ public static List<BrokenLink> errors = new ArrayList<BrokenLink>();
public static void showErrors() {
if (errors.size() == 0) {
reportStatus("No errors detected in load");
}
for (int i = 0; i < errors.size(); i++) {
- BrokenLink link = (BrokenLink)errors.get(i);
+ BrokenLink link = errors.get(i);
reportStatus("Invalid link in \"" + link.getTocID() + "\": " + link.getHref());
}
}
@@ -55,6 +55,7 @@ public class CheckTocAction implements IWorkbenchWindowActionDelegate {
* in the workbench UI.
* @see IWorkbenchWindowActionDelegate#run
*/
+ @Override
public void run(IAction action) {
SelectTocDialog dlg = new SelectTocDialog(window.getShell());
dlg.open();
@@ -67,8 +68,7 @@ public class CheckTocAction implements IWorkbenchWindowActionDelegate {
}
public void checkTocFilesExist(Toc[] tocsToCheck) {
- for (int i = 0; i < tocsToCheck.length; i++) {
- Toc toc = tocsToCheck[i];
+ for (Toc toc : tocsToCheck) {
String id = toc.getTocContribution().getId();
reportStatus("Testing " + id);
String[] href = { id };
@@ -90,6 +90,7 @@ public class CheckTocAction implements IWorkbenchWindowActionDelegate {
* the delegate has been created.
* @see IWorkbenchWindowActionDelegate#selectionChanged
*/
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
}
@@ -98,6 +99,7 @@ public class CheckTocAction implements IWorkbenchWindowActionDelegate {
* resources we previously allocated.
* @see IWorkbenchWindowActionDelegate#dispose
*/
+ @Override
public void dispose() {
}
@@ -106,6 +108,7 @@ public class CheckTocAction implements IWorkbenchWindowActionDelegate {
* be able to provide parent shell for the message dialog.
* @see IWorkbenchWindowActionDelegate#init
*/
+ @Override
public void init(IWorkbenchWindow window) {
this.window = window;
}
diff --git a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/LoadTocAction.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/LoadTocAction.java
index a4f5bcb8f..8375718ac 100644
--- a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/LoadTocAction.java
+++ b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/LoadTocAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -39,9 +39,9 @@ import org.eclipse.ui.PlatformUI;
*/
public class LoadTocAction implements IWorkbenchWindowActionDelegate {
private IWorkbenchWindow window;
- private static ArrayList topicList;
+ private static ArrayList<String> topicList;
private static String firstHref;
- public static List errors = new ArrayList();
+ public static List<String> errors = new ArrayList<String>();
public static String lastPage;
public static String currentPage;
@@ -49,6 +49,7 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
String lastHref;
int timesSame = 0;
boolean isComplete = false;
+ @Override
public void run() {
while (!isComplete) {
if (lastHref == lastPage) {
@@ -80,8 +81,8 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
} else {
reportStatus("Testing complete, errors found");
}
- for (Iterator iter = errors.iterator(); iter.hasNext();) {
- String errorMessage = (String)iter.next();
+ for (Iterator<String> iter = errors.iterator(); iter.hasNext();) {
+ String errorMessage = iter.next();
reportStatus(errorMessage);
}
errors = null;
@@ -94,6 +95,7 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
}
private class NotFoundCallout implements EclipseConnector.INotFoundCallout {
+ @Override
public void notFound(String url) {
if (errors != null) {
errors.add("Error opening " + lastPage + "\n cannot load " + url);
@@ -101,14 +103,15 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
}
}
- private class LinkProvider implements Iterator {
- private List links;
+ private class LinkProvider implements Iterator<String> {
+ private List<String> links;
int lastLink = -1;
- public LinkProvider(List links) {
+ public LinkProvider(List<String> links) {
this.links = links;
}
+ @Override
public boolean hasNext() {
if (topicList != null && lastLink < links.size() && links.size() > 0) {
return true;
@@ -118,24 +121,26 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
return false;
}
- public Object next() {
+ @Override
+ public String next() {
if (lastLink >= 0 && lastLink < links.size()) {
- lastPage = (String) links.get(lastLink);
+ lastPage = links.get(lastLink);
//System.out.println("Last page is " + lastPage);
}
lastLink++;
if (lastLink < links.size()) {
- currentPage = (String)links.get(lastLink);
+ currentPage = links.get(lastLink);
//System.out.println("Current page is " + currentPage);
return currentPage;
} else if (lastLink == links.size()) {
- currentPage = (String)links.get(lastLink - 1);
+ currentPage = links.get(lastLink - 1);
//System.out.println("Current page is " + currentPage);
return currentPage;
}
return null;
}
+ @Override
public void remove() {
}
@@ -153,6 +158,7 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
* in the workbench UI.
* @see IWorkbenchWindowActionDelegate#run
*/
+ @Override
public void run(IAction action) {
showErrors();
SelectTocDialog dlg = new SelectTocDialog(window.getShell());
@@ -172,10 +178,9 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
}
firstHref = null;
- topicList = new ArrayList();
- for (int i = 0; i < tocsToCheck.length; i++) {
- Toc toc = tocsToCheck[i];
- reportStatus("Test level = " + testKind + " testing " + toc.getTocContribution().getId());
+ topicList = new ArrayList<String>();
+ for (Toc toc : tocsToCheck) {
+ reportStatus("Test level = " + testKind + " testing " + toc.getTocContribution().getId());
ITopic[] topics = toc.getTopics();
addTopics(topics);
}
@@ -183,9 +188,9 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
LinkProvider linkProvider = new LinkProvider(topicList);
OnLoadFilter.setLinkProvider(linkProvider);
EclipseConnector.setNotFoundCallout(new NotFoundCallout());
- errors = new ArrayList();
+ errors = new ArrayList<String>();
if (linkProvider.hasNext()) {
- firstHref = (String)linkProvider.next();
+ firstHref = linkProvider.next();
PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(firstHref);
new MonitorThread().start();
} else {
@@ -194,8 +199,7 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
}
private void addTopics(ITopic[] topics) {
- for (int i = 0; i < topics.length; i++) {
- ITopic nextTopic = topics[i];
+ for (ITopic nextTopic : topics) {
addTopic(nextTopic);
}
}
@@ -227,6 +231,7 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
* the delegate has been created.
* @see IWorkbenchWindowActionDelegate#selectionChanged
*/
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
}
@@ -235,6 +240,7 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
* resources we previously allocated.
* @see IWorkbenchWindowActionDelegate#dispose
*/
+ @Override
public void dispose() {
}
@@ -243,6 +249,7 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
* be able to provide parent shell for the message dialog.
* @see IWorkbenchWindowActionDelegate#init
*/
+ @Override
public void init(IWorkbenchWindow window) {
this.window = window;
}
diff --git a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/VisitPageAction.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/VisitPageAction.java
index 9e3ce5b6f..6fe8c0b2f 100644
--- a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/VisitPageAction.java
+++ b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/VisitPageAction.java
@@ -17,10 +17,12 @@ public class VisitPageAction implements ILiveHelpAction {
public static String lastPageVisited = "NO_PAGES_VISITED";
+ @Override
public void setInitializationString(String data) {
lastPageVisited = data;
}
+ @Override
public void run() {
}
diff --git a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/dialogs/SelectTocDialog.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/dialogs/SelectTocDialog.java
index a90ef44e6..6b8eb5c0b 100644
--- a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/dialogs/SelectTocDialog.java
+++ b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/dialogs/SelectTocDialog.java
@@ -46,11 +46,13 @@ public class SelectTocDialog extends Dialog {
setShellStyle(getShellStyle() | SWT.RESIZE);
}
+ @Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Check Table of Contents");
}
+ @Override
protected Control createDialogArea(Composite parent) {
Composite inner = new Composite(parent, SWT.NULL);
inner.setLayout(new GridLayout());
@@ -58,8 +60,8 @@ public class SelectTocDialog extends Dialog {
Label selectLabel = new Label(inner, SWT.NULL);
selectLabel.setText("Select a TOC to check");
tocList = new List(inner, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- for (int i = 0; i < tocs.length; i++) {
- tocList.add(tocs[i].getLabel());
+ for (Toc toc : tocs) {
+ tocList.add(toc.getLabel());
}
tocList.setSelection(0);
GridData tocData = new GridData(GridData.FILL_BOTH);
@@ -76,6 +78,7 @@ public class SelectTocDialog extends Dialog {
return inner;
}
+ @Override
protected void okPressed() {
selectedTocs = tocList.getSelectionIndices();
if (existButton.getSelection()) {
@@ -91,11 +94,11 @@ public class SelectTocDialog extends Dialog {
}
public Toc[] getTocsToCheck() {
- ArrayList selected = new ArrayList();
- for (int i = 0; i < selectedTocs.length; i++) {
- selected.add(tocs[selectedTocs[i]]);
+ ArrayList<Toc> selected = new ArrayList<Toc>();
+ for (int selectedToc : selectedTocs) {
+ selected.add(tocs[selectedToc]);
}
- Toc[] tocsToCheck = (Toc[]) selected.toArray(new Toc[0]) ;
+ Toc[] tocsToCheck = selected.toArray(new Toc[0]) ;
return tocsToCheck;
}
diff --git a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/AddScriptFilter.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/AddScriptFilter.java
index eaaff6d2c..b755401c4 100644
--- a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/AddScriptFilter.java
+++ b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/AddScriptFilter.java
@@ -28,6 +28,7 @@ public class AddScriptFilter implements IFilter {
/*
* @see IFilter#filter(HttpServletRequest, OutputStream)
*/
+ @Override
public OutputStream filter(HttpServletRequest req, OutputStream out) {
String relativePath = FilterUtils.getRelativePathPrefix(req);
StringBuffer script = new StringBuffer();
diff --git a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/OnLoadFilter.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/OnLoadFilter.java
index 07a37ab52..1bada0a2b 100644
--- a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/OnLoadFilter.java
+++ b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/OnLoadFilter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -46,7 +46,7 @@ public class OnLoadFilter implements IFilter {
state = 20;
out.write(b);
if (linkProvider.hasNext()) {
- String location = (String)linkProvider.next();
+ String location = linkProvider.next();
String onload = getOnloadText(pathPrefix + location, testKind);
out.write(onload.getBytes());
//System.out.println("Onload = " + onload);
@@ -110,6 +110,7 @@ public class OnLoadFilter implements IFilter {
this.pathPrefix = prefix;
}
+ @Override
public void write(int b) throws IOException {
updateState(b);
if (state != 20) {
@@ -117,6 +118,7 @@ public class OnLoadFilter implements IFilter {
}
}
+ @Override
public void close() throws IOException {
out.close();
super.close();
@@ -129,12 +131,13 @@ public class OnLoadFilter implements IFilter {
this.testKind = testKind;
}
- private static Iterator linkProvider;
+ private static Iterator<String> linkProvider;
protected String getCommentText() {
return "comment";
}
+ @Override
public OutputStream filter(HttpServletRequest req, OutputStream out) {
if (linkProvider == null) {
return out;
@@ -146,7 +149,7 @@ public class OnLoadFilter implements IFilter {
return new OutFilter(out, "PLUGINS_ROOT");
}
- public static void setLinkProvider(Iterator provider) {
+ public static void setLinkProvider(Iterator<String> provider) {
linkProvider = provider;
}
diff --git a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/PrebuiltIndexChecker.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/PrebuiltIndexChecker.java
index 2f1988370..616d345da 100644
--- a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/PrebuiltIndexChecker.java
+++ b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/PrebuiltIndexChecker.java
@@ -70,8 +70,8 @@ public class PrebuiltIndexChecker extends TestCase {
assertNotNull(bundle);
String[] suffixes = { "", "/indexed_contributions", "/indexed_docs", "/indexed_dependencies" };
- for (int i = 0; i < suffixes.length; i++) {
- String fullPath = filepath + suffixes[i];
+ for (String suffixe : suffixes) {
+ String fullPath = filepath + suffixe;
IPath path = new Path(fullPath);
URL url = FileLocator.find(bundle, path, null);
assertNotNull("could not open: " + fullPath, url);
diff --git a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/TocLinkChecker.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/TocLinkChecker.java
index d3ed82096..08d6e4e88 100644
--- a/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/TocLinkChecker.java
+++ b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/TocLinkChecker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,24 +38,28 @@ import org.eclipse.help.internal.validation.TocValidator.BrokenLink;
public class TocLinkChecker extends TestCase {
private final class ReferenceFilter extends TocValidator.Filter {
+ @Override
public boolean isIncluded(String href) {
return href.startsWith("reference");
}
}
private final class NonReferenceFilter extends TocValidator.Filter {
+ @Override
public boolean isIncluded(String href) {
return !href.startsWith("reference");
}
}
private final class NonReferenceNonSampleFilter extends TocValidator.Filter {
+ @Override
public boolean isIncluded(String href) {
return !href.startsWith("reference") && !href.startsWith("samples");
}
}
private final class ReferenceOrSampleFilter extends TocValidator.Filter {
+ @Override
public boolean isIncluded(String href) {
return href.startsWith("reference") || href.startsWith("samples");
}
@@ -72,49 +76,49 @@ public class TocLinkChecker extends TestCase {
}
public void testPlatformUser() throws Exception {
- ArrayList failures = TocValidator.validate(PLATFORM_USER);
+ ArrayList<BrokenLink> failures = TocValidator.validate(PLATFORM_USER);
doAssert(failures);
}
public void testPlatformIsvStatic() throws Exception {
- ArrayList failures = TocValidator.filteredValidate(PLATFORM_ISV, new NonReferenceNonSampleFilter());
+ ArrayList<BrokenLink> failures = TocValidator.filteredValidate(PLATFORM_ISV, new NonReferenceNonSampleFilter());
doAssert(failures);
}
public void testPlatformIsvGenerated() throws Exception {
- ArrayList failures = TocValidator.filteredValidate(PLATFORM_ISV, new ReferenceOrSampleFilter());
+ ArrayList<BrokenLink> failures = TocValidator.filteredValidate(PLATFORM_ISV, new ReferenceOrSampleFilter());
doAssert(failures);
}
public void testPdeUserStatic() throws Exception {
- ArrayList failures = TocValidator.filteredValidate(PDE_USER, new NonReferenceFilter());
+ ArrayList<BrokenLink> failures = TocValidator.filteredValidate(PDE_USER, new NonReferenceFilter());
doAssert(failures);
}
public void testPdeUserGenerated() throws Exception {
- ArrayList failures = TocValidator.filteredValidate(PDE_USER, new ReferenceFilter());
+ ArrayList<BrokenLink> failures = TocValidator.filteredValidate(PDE_USER, new ReferenceFilter());
doAssert(failures);
}
public void testJdtUser() throws Exception {
- ArrayList failures = TocValidator.validate(JDT_USER);
+ ArrayList<BrokenLink> failures = TocValidator.validate(JDT_USER);
doAssert(failures);
}
public void testJdtIsvStatic() throws Exception {
- ArrayList failures = TocValidator.filteredValidate(JDT_ISV, new NonReferenceFilter());
+ ArrayList<BrokenLink> failures = TocValidator.filteredValidate(JDT_ISV, new NonReferenceFilter());
doAssert(failures);
}
public void testJdtIsvGenerated() throws Exception {
- ArrayList failures = TocValidator.filteredValidate(JDT_ISV, new ReferenceFilter());
+ ArrayList<BrokenLink> failures = TocValidator.filteredValidate(JDT_ISV, new ReferenceFilter());
doAssert(failures);
}
- private void doAssert(List failures) {
+ private void doAssert(List<BrokenLink> failures) {
StringBuffer message = new StringBuffer();
for (int i = 0; i < failures.size(); i++) {
- BrokenLink link = (BrokenLink)failures.get(i);
+ BrokenLink link = failures.get(i);
message.append("Invalid link in \"" + link.getTocID() + "\": " + link.getHref() + "\n");
}
Assert.assertTrue(message.toString(), failures.isEmpty());
diff --git a/org.eclipse.ua.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ua.tests/.settings/org.eclipse.jdt.core.prefs
index 7dd04dded..8ce0943ea 100644
--- a/org.eclipse.ua.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.ua.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,54 +1,96 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/FileUtil.java b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/FileUtil.java
index ac7056114..3335e6aca 100644
--- a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/FileUtil.java
+++ b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/FileUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -63,7 +63,7 @@ public class FileUtil {
out.write(buffer, 0, num);
}
String result = new String(out.toByteArray(), "UTF-8");
- if (result != null) {
+ if (result.length() > 0) {
// filter windows-specific newline
result = result.replaceAll("\r", "");
}
diff --git a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/ResourceFinder.java b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/ResourceFinder.java
index 43b1aebab..7cb43adb7 100644
--- a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/ResourceFinder.java
+++ b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/ResourceFinder.java
@@ -64,15 +64,15 @@ public class ResourceFinder {
private static URL[] findFiles(File[] files, String suffix, boolean recursive) {
List<URL> list = new ArrayList<URL>();
if (files != null) {
- for (int i=0;i<files.length;++i) {
- if (files[i].isDirectory()) {
+ for (File file : files) {
+ if (file.isDirectory()) {
if (recursive) {
- list.addAll(Arrays.asList(findFiles(files[i].listFiles(), suffix, recursive)));
+ list.addAll(Arrays.asList(findFiles(file.listFiles(), suffix, recursive)));
}
}
else {
try {
- URL url = files[i].toURI().toURL();
+ URL url = file.toURI().toURL();
if (url.toString().endsWith(suffix)) {
list.add(url);
}
diff --git a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/UATestContentProducer.java b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/UATestContentProducer.java
index ddf428f2a..c81b7c4c2 100644
--- a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/UATestContentProducer.java
+++ b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/UATestContentProducer.java
@@ -20,6 +20,7 @@ import org.eclipse.help.internal.util.URLCoder;
public class UATestContentProducer implements IHelpContentProducer {
+ @Override
public InputStream getInputStream(String pluginId, String href,
Locale locale) {
if (href.startsWith("generated/")) {
diff --git a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/XMLUtil.java b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/XMLUtil.java
index 1dd3cba09..ec2f86480 100644
--- a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/XMLUtil.java
+++ b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/XMLUtil.java
@@ -73,6 +73,7 @@ public class XMLUtil extends Assert {
/* (non-Javadoc)
* @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
*/
+ @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
buf.append('<');
buf.append(qName);
@@ -98,6 +99,7 @@ public class XMLUtil extends Assert {
/* (non-Javadoc)
* @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
*/
+ @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
buf.append('<');
buf.append('/');
@@ -108,6 +110,7 @@ public class XMLUtil extends Assert {
/* (non-Javadoc)
* @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int)
*/
+ @Override
public void characters(char[] ch, int start, int length) throws SAXException {
buf.append(ch, start, length);
}
@@ -118,6 +121,7 @@ public class XMLUtil extends Assert {
*
* @see org.xml.sax.helpers.DefaultHandler#resolveEntity(java.lang.String, java.lang.String)
*/
+ @Override
public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
try {
return entityResolver.resolveEntity(publicId, systemId);
@@ -126,6 +130,7 @@ public class XMLUtil extends Assert {
}
}
+ @Override
public String toString() {
return buf.toString();
}
diff --git a/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/servlet/CounterServlet.java b/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/servlet/CounterServlet.java
index 836c2885f..cb385bdba 100644
--- a/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/servlet/CounterServlet.java
+++ b/org.eclipse.ua.tests/browser/org/eclipse/ua/tests/browser/servlet/CounterServlet.java
@@ -34,6 +34,7 @@ public class CounterServlet extends HttpServlet {
private static final String XHTML_3 = "</body>\n</html>"; //$NON-NLS-1$
private static int counter = 0;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
diff --git a/org.eclipse.ua.tests/build.properties b/org.eclipse.ua.tests/build.properties
index dee69179c..74abeb4e3 100644
--- a/org.eclipse.ua.tests/build.properties
+++ b/org.eclipse.ua.tests/build.properties
@@ -28,4 +28,5 @@ source.ua-tests.jar = base/,\
cheatsheet/,\
help/,\
intro/
-javacWarnings.ua-tests.jar=-raw
+javacWarnings.ua-tests.jar=-unavoidableGenericProblems
+
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestCheatSheetManagerEvents.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestCheatSheetManagerEvents.java
index 4103e88bb..1753b182b 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestCheatSheetManagerEvents.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestCheatSheetManagerEvents.java
@@ -26,17 +26,20 @@ public class TestCheatSheetManagerEvents extends TestCase {
private int handler2Calls;
private class Handler1 extends CheatSheetListener {
+ @Override
public void cheatSheetEvent(ICheatSheetEvent event) {
handler1Calls++;
}
}
private class Handler2 extends CheatSheetListener {
+ @Override
public void cheatSheetEvent(ICheatSheetEvent event) {
handler2Calls++;
}
}
+ @Override
protected void setUp() throws Exception {
element = new CheatSheetElement("Name");
manager = new CheatSheetManager(element);
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestCompositeParser.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestCompositeParser.java
index eb29d7b4c..6e35cb4b5 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestCompositeParser.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestCompositeParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,6 +31,7 @@ public class TestCompositeParser extends TestCase {
private static final String COMPOSITES_FOLDER = "data/cheatsheet/composite/";
private CompositeCheatSheetParser parser;
+ @Override
protected void setUp() throws Exception {
parser = new CompositeCheatSheetParser();
}
@@ -99,7 +100,7 @@ public class TestCompositeParser extends TestCase {
CompositeCheatSheetModel model = parseTestFile("ValidParameter.xml");
assertNotNull(model);
assertTrue(parser.getStatus().isOK());
- Dictionary params = model.getRootTask().getParameters();
+ Dictionary<String, String> params = model.getRootTask().getParameters();
assertEquals(1, params.size());
assertEquals("b", params.get("a"));
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestPersistence.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestPersistence.java
index 21e1e1f98..c0f842d78 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestPersistence.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestPersistence.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -95,7 +95,7 @@ public class TestPersistence extends TestCase {
helper.saveCompositeState(model, null);
createCompositeCheatSheet();
- model.loadState(new Hashtable());
+ model.loadState(new Hashtable<String, String>());
assertEquals(ICompositeCheatSheetTask.IN_PROGRESS, task1.getState());
assertEquals(ICompositeCheatSheetTask.COMPLETED, task2.getState());
}
@@ -124,7 +124,7 @@ public class TestPersistence extends TestCase {
helper.saveCompositeState(model, null);
createCompositeCheatSheet();
- model.loadState(new Hashtable());
+ model.loadState(new Hashtable<String, String>());
editor1.setInput(task1, model.getTaskMemento(task1.getId()));
editor2.setInput(task2, model.getTaskMemento(task2.getId()));
assertEquals(value1, editor1.getValue());
@@ -140,7 +140,7 @@ public class TestPersistence extends TestCase {
values.put("One", "1");
values.put("Two", "2");
helper.saveCompositeState(model, values);
- Map restoredValues = new Hashtable();
+ Map<String, String> restoredValues = new Hashtable<String, String>();
createCompositeCheatSheet();
model.loadState(restoredValues);
assertEquals(2, restoredValues.size());
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestState.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestState.java
index 99bdcf5da..f29225236 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestState.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestState.java
@@ -29,6 +29,7 @@ public class TestState extends TestCase {
private CompositeCheatSheetModel model;
+ @Override
protected void setUp() throws Exception {
model = new CompositeCheatSheetModel("name", "description", "explorerId");
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestTaskEvents.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestTaskEvents.java
index 7b2a19e2a..6b645d9d6 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestTaskEvents.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestTaskEvents.java
@@ -76,6 +76,7 @@ public class TestTaskEvents extends TestCase {
}
public class ModelObserver implements Observer {
+ @Override
public void update(Observable o, Object arg) {
taskMap.put((ICompositeCheatSheetTask)arg);
}
@@ -123,6 +124,7 @@ public class TestTaskEvents extends TestCase {
group2.addSubtask(task2B);
}
+ @Override
protected void setUp() throws Exception {
resetTaskMap();
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/ActionWithParameters.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/ActionWithParameters.java
index 069f68a6e..ab25fa2b9 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/ActionWithParameters.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/ActionWithParameters.java
@@ -28,10 +28,12 @@ public class ActionWithParameters extends Action implements ICheatSheetAction {
/**
* Should never be called
*/
+ @Override
public void run() {
Assert.fail("Should not call this version of run");
}
+ @Override
public void run(String[] params, ICheatSheetManager manager) {
ActionEnvironment.setParams(params);
ActionEnvironment.actionCompleted();
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/CommandHandler.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/CommandHandler.java
index 86f533cbb..64c89854b 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/CommandHandler.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/CommandHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,7 +26,7 @@ public class CommandHandler extends AbstractHandler {
public static final String RESULT_TO_STRING = "RESULT_TO_STRING";
- private static Map params;
+ private static Map<String, String> params;
private static int timesCompleted;
private static boolean throwException;
@@ -36,14 +36,14 @@ public class CommandHandler extends AbstractHandler {
throwException = false;
}
- @SuppressWarnings("unchecked")
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
if (throwException) {
throw new RuntimeException();
}
// Copy all the parameters
- params = new HashMap();
+ params = new HashMap<String, String>();
params.putAll(event.getParameters());
timesCompleted++;
@@ -51,7 +51,7 @@ public class CommandHandler extends AbstractHandler {
return RESULT_TO_STRING;
}
- public static Map getParams() {
+ public static Map<String, String> getParams() {
return params;
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/FailingAction.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/FailingAction.java
index c74769eea..150dbd8b1 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/FailingAction.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/FailingAction.java
@@ -19,6 +19,7 @@ import org.eclipse.jface.action.Action;
public class FailingAction extends Action {
+ @Override
public void run() {
// Return a failure status
notifyResult(false);
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/NegateIntegerHandler.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/NegateIntegerHandler.java
index 87980ecb2..42009134c 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/NegateIntegerHandler.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/NegateIntegerHandler.java
@@ -16,6 +16,7 @@ import org.eclipse.core.commands.ExecutionException;
public class NegateIntegerHandler extends AbstractHandler {
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Integer val = (Integer)event.getObjectParameterForExecution("number");
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/SimpleAction.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/SimpleAction.java
index 0c1f5ed0e..31eb17cff 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/SimpleAction.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/SimpleAction.java
@@ -19,6 +19,7 @@ import org.eclipse.jface.action.Action;
public class SimpleAction extends Action {
+ @Override
public void run() {
if (ActionEnvironment.shouldThrowException()) {
throw new RuntimeException();
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestActionExecution.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestActionExecution.java
index fe6ff19fa..4d581af26 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestActionExecution.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestActionExecution.java
@@ -33,6 +33,7 @@ public class TestActionExecution extends TestCase {
private static final String ACTION_WITH_PARAMETERS_CLASS =
ACTION_PACKAGE + ".ActionWithParameters"; //$NON-NLS-1$
+ @Override
protected void setUp() throws Exception {
ActionEnvironment.reset();
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestCommandExecution.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestCommandExecution.java
index 73f239928..a65dd6f6b 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestCommandExecution.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestCommandExecution.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -51,6 +51,7 @@ public class TestCommandExecution extends TestCase {
private static final String RETURN_STORE = "retData";
private static final String PARENT_RETURN_STORE = "parent.retData";
+ @Override
protected void setUp() throws Exception {
CommandHandler.reset();
}
@@ -108,7 +109,7 @@ public class TestCommandExecution extends TestCase {
private void checkCommandExecution() {
assertTrue(CommandHandler.getTimesCompleted() == 1);
- Map params = CommandHandler.getParams();
+ Map<?, ?> params = CommandHandler.getParams();
assertEquals(2, params.size());
assertTrue(params.containsKey(PARAM1_ID));
assertEquals(PARAM1_VALUE, params.get(PARAM1_ID));
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestVariableSubstitution.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestVariableSubstitution.java
index 64100aad9..b8513153a 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestVariableSubstitution.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/TestVariableSubstitution.java
@@ -24,6 +24,7 @@ import junit.framework.TestCase;
public class TestVariableSubstitution extends TestCase {
private CheatSheetManager manager;
+ @Override
protected void setUp() throws Exception {
manager = new CheatSheetManager(new CheatSheetElement("name"));
manager.setData("p1", "one");
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCategories.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCategories.java
index 8cd83ceb4..45c900a3e 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCategories.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCategories.java
@@ -23,16 +23,16 @@ public class TestCheatSheetCategories extends TestCase {
public void testForCollection() {
CheatSheetCollectionElement cheatSheets =
- (CheatSheetCollectionElement)CheatSheetRegistryReader.getInstance().getCheatSheets();
+ CheatSheetRegistryReader.getInstance().getCheatSheets();
Object[] subCategories = cheatSheets.getChildren();
- for (int i = 0; i < subCategories.length; i++) {
- assertTrue(subCategories[i] instanceof CheatSheetCollectionElement);
+ for (Object subCategorie : subCategories) {
+ assertTrue(subCategorie instanceof CheatSheetCollectionElement);
}
}
public void testFindTestCategory() {
CheatSheetCollectionElement cheatSheets =
- (CheatSheetCollectionElement)CheatSheetRegistryReader.getInstance().getCheatSheets();
+ CheatSheetRegistryReader.getInstance().getCheatSheets();
CheatSheetCollectionElement testCat = findChildCategory(cheatSheets, TEST_CATEGORY);
assertNotNull("Cannot find category org.eclipse.ua.tests.cheatsheet.cheatSheetsTestCat",
testCat);
@@ -40,7 +40,7 @@ public class TestCheatSheetCategories extends TestCase {
public void testFindQualifiedSubcategory() {
CheatSheetCollectionElement cheatSheets =
- (CheatSheetCollectionElement)CheatSheetRegistryReader.getInstance().getCheatSheets();
+ CheatSheetRegistryReader.getInstance().getCheatSheets();
CheatSheetCollectionElement testCat = findChildCategory(cheatSheets, TEST_CATEGORY);
CheatSheetCollectionElement subCat = findChildCategory(testCat,
"org.eclipse.ua.tests.subcategory");
@@ -49,7 +49,7 @@ public class TestCheatSheetCategories extends TestCase {
public void testFindCsInUnqualifiedSubcategory() {
CheatSheetCollectionElement cheatSheets =
- (CheatSheetCollectionElement)CheatSheetRegistryReader.getInstance().getCheatSheets();
+ CheatSheetRegistryReader.getInstance().getCheatSheets();
CheatSheetCollectionElement testCat = findChildCategory(cheatSheets, TEST_CATEGORY);
CheatSheetCollectionElement subCat = findChildCategory(testCat,
"org.eclipse.ua.tests.subcategory");
@@ -60,7 +60,7 @@ public class TestCheatSheetCategories extends TestCase {
public void testFindCsInQualifiedSubcategory() {
CheatSheetCollectionElement cheatSheets =
- (CheatSheetCollectionElement)CheatSheetRegistryReader.getInstance().getCheatSheets();
+ CheatSheetRegistryReader.getInstance().getCheatSheets();
CheatSheetCollectionElement testCat = findChildCategory(cheatSheets, TEST_CATEGORY);
CheatSheetCollectionElement subCat = findChildCategory(testCat,
"org.eclipse.ua.tests.subcategory");
@@ -72,8 +72,8 @@ public class TestCheatSheetCategories extends TestCase {
private CheatSheetCollectionElement findChildCategory(
CheatSheetCollectionElement collection, String id) {
Object[] subCategories = collection.getChildren();
- for (int i = 0; i < subCategories.length; i++) {
- CheatSheetCollectionElement child = (CheatSheetCollectionElement)subCategories[i];
+ for (Object subCategorie : subCategories) {
+ CheatSheetCollectionElement child = (CheatSheetCollectionElement)subCategorie;
if (child.getId().equals(id)) {
return child;
}
@@ -83,8 +83,8 @@ public class TestCheatSheetCategories extends TestCase {
private CheatSheetElement findCheatsheet(
CheatSheetCollectionElement collection, String id) {
Object[] cheatSheets = collection.getCheatSheets();
- for (int i = 0; i < cheatSheets.length; i++) {
- CheatSheetElement child = (CheatSheetElement)cheatSheets[i];
+ for (Object cheatSheet : cheatSheets) {
+ CheatSheetElement child = (CheatSheetElement)cheatSheet;
if (child.getID().equals(id)) {
return child;
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCollection.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCollection.java
index 6eba26d22..b3df20055 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCollection.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCollection.java
@@ -28,6 +28,7 @@ public class TestCheatSheetCollection extends TestCase {
private CheatSheetCollectionElement c11;
private CheatSheetCollectionElement c12;
+ @Override
protected void setUp() throws Exception {
root = new CheatSheetCollectionElement("rootPlugin", "rootId", "rootName", root);
csA = new CheatSheetElement("A");
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetManager.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetManager.java
index 06e11848a..ec1d7d854 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetManager.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,11 +13,11 @@ package org.eclipse.ua.tests.cheatsheet.other;
import java.util.Set;
+import junit.framework.TestCase;
+
import org.eclipse.ui.internal.cheatsheets.registry.CheatSheetElement;
import org.eclipse.ui.internal.cheatsheets.views.CheatSheetManager;
-import junit.framework.TestCase;
-
public class TestCheatSheetManager extends TestCase {
private static final String CHEATSHEET_ID = "RandomId0234";
@@ -56,7 +56,7 @@ public class TestCheatSheetManager extends TestCase {
assertEquals(VALUE_A, manager.getDataQualified(KEY1));
assertEquals(VALUE_B, manager.getData(PARENT_KEY1));
assertEquals(VALUE_B, manager.getDataQualified(PARENT_KEY1));
- Set keys = manager.getKeySet();
+ Set<?> keys = manager.getKeySet();
assertEquals(keys.size(), 2);
assertTrue(keys.contains(KEY1));
assertTrue(keys.contains(PARENT_KEY1));
@@ -76,12 +76,12 @@ public class TestCheatSheetManager extends TestCase {
assertEquals(VALUE_A, manager.getDataQualified(KEY1));
assertNull(manager.getData(PARENT_KEY1));
assertEquals(VALUE_B, manager.getDataQualified(PARENT_KEY1));
- Set keys = manager.getKeySet();
+ Set<?> keys = manager.getKeySet();
assertEquals(keys.size(), 1);
assertTrue(keys.contains(KEY1));
assertFalse(keys.contains(PARENT_KEY1));
- Set parentKeys = parentManager.getKeySet();
+ Set<?> parentKeys = parentManager.getKeySet();
assertEquals(parentKeys.size(), 1);
assertTrue(parentKeys.contains(KEY1));
assertFalse(parentKeys.contains(PARENT_KEY1));
@@ -100,12 +100,12 @@ public class TestCheatSheetManager extends TestCase {
assertEquals(VALUE_A, manager.getDataQualified(KEY1));
assertNull(manager.getDataQualified(PARENT_KEY1));
assertEquals(VALUE_B, manager.getData(PARENT_KEY1));
- Set keys = manager.getKeySet();
+ Set<?> keys = manager.getKeySet();
assertEquals(keys.size(), 2);
assertTrue(keys.contains(KEY1));
assertTrue(keys.contains(PARENT_KEY1));
- Set parentKeys = parentManager.getKeySet();
+ Set<?> parentKeys = parentManager.getKeySet();
assertEquals(parentKeys.size(), 0);
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestStatePersistence.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestStatePersistence.java
index f3274a024..cd71999f7 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestStatePersistence.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestStatePersistence.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,13 +20,13 @@ import java.util.Hashtable;
import java.util.List;
import java.util.Properties;
+import junit.framework.TestCase;
+
import org.eclipse.ui.internal.cheatsheets.data.CheatSheetSaveHelper;
import org.eclipse.ui.internal.cheatsheets.data.IParserTags;
import org.eclipse.ui.internal.cheatsheets.registry.CheatSheetElement;
import org.eclipse.ui.internal.cheatsheets.views.CheatSheetManager;
-import junit.framework.TestCase;
-
public class TestStatePersistence extends TestCase {
private static final String VALUE2 = "value2";
@@ -57,6 +57,7 @@ public class TestStatePersistence extends TestCase {
* Initialize the properties that will be saved. Individual tests will modify
* the properties which apply to a particular test.
*/
+ @Override
protected void setUp() throws Exception {
propsToSave = new PropertySet();
propsToSave.button = 1;
@@ -96,7 +97,7 @@ public class TestStatePersistence extends TestCase {
private PropertySet restore(String id) {
PropertySet result = new PropertySet();
Properties restored = helper.loadState(id);
- result.id = (String)restored.getProperty(IParserTags.ID);
+ result.id = restored.getProperty(IParserTags.ID);
result.button = Integer.parseInt(restored.getProperty(IParserTags.BUTTON));
result.currentItem = Integer.parseInt(restored.getProperty(IParserTags.CURRENT));
result.completed = (ArrayList<String>) restored.get(IParserTags.COMPLETED);
@@ -105,7 +106,7 @@ public class TestStatePersistence extends TestCase {
result.expandRestore = (ArrayList<String>) restored.get(IParserTags.EXPANDRESTORE);
result.subItemCompleted = (Hashtable<String, String>) restored.get(IParserTags.SUBITEMCOMPLETED);
result.subItemSkipped = (Hashtable<String, String>) restored.get(IParserTags.SUBITEMSKIPPED);
- Hashtable managerData = (Hashtable) restored.get(IParserTags.MANAGERDATA);
+ Hashtable<String, String> managerData = (Hashtable<String, String>) restored.get(IParserTags.MANAGERDATA);
CheatSheetElement csElement = new CheatSheetElement(id);
result.manager = new CheatSheetManager(csElement);
result.manager.setData(managerData);
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/InvalidCheatsheet.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/InvalidCheatsheet.java
index 470a867c0..329dd0612 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/InvalidCheatsheet.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/InvalidCheatsheet.java
@@ -27,6 +27,7 @@ public class InvalidCheatsheet extends TestCase {
private static final String INVALID_CHEATSHEET_FOLDER = "data/cheatsheet/invalid/";
private CheatSheetParser parser;
+ @Override
protected void setUp() throws Exception {
parser = new CheatSheetParser();
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/NoError.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/NoError.java
index 3e93eadc5..ca86efedd 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/NoError.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/NoError.java
@@ -31,6 +31,7 @@ public class NoError extends TestCase {
private CheatSheetParser parser;
+ @Override
protected void setUp() throws Exception {
parser = new CheatSheetParser();
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/performance/OpenCheatSheetTest.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/performance/OpenCheatSheetTest.java
index dfffdc238..c633667d4 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/performance/OpenCheatSheetTest.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/performance/OpenCheatSheetTest.java
@@ -32,6 +32,7 @@ public class OpenCheatSheetTest extends PerformanceTestCase {
return new TestSuite(OpenCheatSheetTest.class);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
OpenIntroTest.closeIntro();
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializer.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializer.java
index 4e2171092..730396423 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializer.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation and others.
+ * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -178,7 +178,6 @@ public class CheatSheetModelSerializer {
/*
* Serializes the given array with the specified indentation.
*/
- @SuppressWarnings("unchecked")
public static String serialize(Object[] array, String indent) {
StringBuffer buf = new StringBuffer();
if (array == null) {
@@ -189,21 +188,20 @@ public class CheatSheetModelSerializer {
}
else {
buf.append(indent + "<array>\n");
- for (int i=0;i<array.length;++i) {
- Object obj = array[i];
+ for (Object obj : array) {
if (obj != null) {
- Class c = obj.getClass();
+ Class<?> c = obj.getClass();
/*
* Find a serializer method that knows how to serialize this
* object.
*/
boolean found = false;
Method[] methods = CheatSheetModelSerializer.class.getMethods();
- for (int j=0;j<methods.length;++j) {
- Class[] params = methods[j].getParameterTypes();
+ for (Method method : methods) {
+ Class<?>[] params = method.getParameterTypes();
if (params.length == 2 && params[0].isAssignableFrom(c) && params[1].equals(String.class)) {
try {
- buf.append(methods[j].invoke(null, new Object[] {obj, indent + " "}));
+ buf.append(method.invoke(null, new Object[] {obj, indent + " "}));
}
catch(Exception e) {
buf.append(indent + " " + e + ", cause: " + e.getCause());
@@ -229,8 +227,7 @@ public class CheatSheetModelSerializer {
/*
* Serializes the given List with the specified indentation.
*/
- @SuppressWarnings("unchecked")
- public static String serialize(List list, String indent) {
+ public static String serialize(List<?> list, String indent) {
StringBuffer buf = new StringBuffer();
if (list == null) {
buf.append(indent + "<nullList/>\n");
@@ -240,22 +237,22 @@ public class CheatSheetModelSerializer {
}
else {
buf.append(indent + "<list>\n");
- Iterator iter = list.iterator();
+ Iterator<?> iter = list.iterator();
while (iter.hasNext()) {
Object obj = iter.next();
if (obj != null) {
- Class c = obj.getClass();
+ Class<?> c = obj.getClass();
/*
* Find a serializer method that knows how to serialize this
* object.
*/
boolean found = false;
Method[] methods = CheatSheetModelSerializer.class.getMethods();
- for (int i=0;i<methods.length;++i) {
- Class[] params = methods[i].getParameterTypes();
+ for (Method method : methods) {
+ Class<?>[] params = method.getParameterTypes();
if (params.length == 2 && params[0].isAssignableFrom(c) && params[1].equals(String.class)) {
try {
- buf.append(methods[i].invoke(null, new Object[] {obj, indent + " "}));
+ buf.append(method.invoke(null, new Object[] {obj, indent + " "}));
}
catch(Exception e) {
buf.append(indent + " " + e + ", cause: " + e.getCause());
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializerTest.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializerTest.java
index b64cf3f8d..cdd2d0d43 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializerTest.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/CheatSheetModelSerializerTest.java
@@ -57,12 +57,12 @@ public class CheatSheetModelSerializerTest extends TestCase {
public void testRunSerializer() throws IOException {
URL[] urls = ResourceFinder.findFiles(UserAssistanceTestPlugin.getDefault(), "data/cheatsheet/valid", ".xml", true);
Assert.assertTrue("Unable to find sample cheat sheets to test parser", urls.length > 0);
- for (int i=0;i<urls.length;++i) {
+ for (URL url : urls) {
CheatSheetParser parser = new CheatSheetParser();
- CheatSheet sheet = (CheatSheet)parser.parse(urls[i], UserAssistanceTestPlugin.getPluginId(), CheatSheetParser.ANY);
- Assert.assertNotNull("Tried parsing a valid cheat sheet but parser returned null: " + urls[i], sheet);
+ CheatSheet sheet = (CheatSheet)parser.parse(url, UserAssistanceTestPlugin.getPluginId(), CheatSheetParser.ANY);
+ Assert.assertNotNull("Tried parsing a valid cheat sheet but parser returned null: " + url, sheet);
- PrintWriter out = new PrintWriter(new FileOutputStream(FileUtil.getResultFile(urls[i].toString().substring("file:/".length()))));
+ PrintWriter out = new PrintWriter(new FileOutputStream(FileUtil.getResultFile(url.toString().substring("file:/".length()))));
out.print(CheatSheetModelSerializer.serialize(sheet));
out.close();
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/MockTaskEditor.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/MockTaskEditor.java
index b30900cab..d794f9a71 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/MockTaskEditor.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/MockTaskEditor.java
@@ -28,11 +28,13 @@ public class MockTaskEditor extends TaskEditor {
private static final String KEY = "key";
+ @Override
public Control getControl() {
// Not used by tests
return null;
}
+ @Override
public void setInput(IEditableTask task, IMemento memento) {
if (memento == null) {
setValue(NO_MEMENTO);
@@ -41,10 +43,12 @@ public class MockTaskEditor extends TaskEditor {
}
}
+ @Override
public void saveState(IMemento memento) {
memento.putString(KEY, getValue());
}
+ @Override
public void createControl(Composite parent, FormToolkit toolkit) {
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/NavigateAction.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/NavigateAction.java
index f706ab87c..a1f353289 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/NavigateAction.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/NavigateAction.java
@@ -22,6 +22,7 @@ public class NavigateAction extends Action implements ICheatSheetAction {
final String finalNewSheet = newSheet;
try {
Display.getCurrent().asyncExec( new Runnable() {
+ @Override
public void run() {
OpenCheatSheetAction csAction = new OpenCheatSheetAction( finalNewSheet );
csAction.run();
@@ -33,6 +34,7 @@ public class NavigateAction extends Action implements ICheatSheetAction {
}
}
+ @Override
public void run( String[] params, ICheatSheetManager manager ) {
go( params[ 0 ] );
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/StatusCheck.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/StatusCheck.java
index 5f0fb8d4c..9a152979c 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/StatusCheck.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/StatusCheck.java
@@ -32,8 +32,8 @@ public class StatusCheck {
public static void assertMultiStatusContains(IStatus status, String text) {
Assert.assertTrue(status instanceof MultiStatus);
IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (children[i].getMessage().indexOf(text) >= 0) {
+ for (IStatus element : children) {
+ if (element.getMessage().indexOf(text) >= 0) {
return;
}
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/TestTaskEditor.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/TestTaskEditor.java
index 4223c121c..6d373fce4 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/TestTaskEditor.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/TestTaskEditor.java
@@ -31,6 +31,7 @@ public class TestTaskEditor extends TaskEditor {
private Composite control;
+ @Override
public void createControl(Composite parent, FormToolkit toolkit) {
control = new Composite(parent, SWT.NULL);
control.setLayout(new GridLayout());
@@ -39,14 +40,17 @@ public class TestTaskEditor extends TaskEditor {
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
+ @Override
public Control getControl() {
return control;
}
+ @Override
public void setInput(IEditableTask task, IMemento memento) {
// Do nothing
}
+ @Override
public void saveState(IMemento memento) {
// Do nothing
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/CriteriaUtilitiesTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/CriteriaUtilitiesTest.java
index 8b3b0e7b0..22c98730d 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/CriteriaUtilitiesTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/CriteriaUtilitiesTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,31 +19,31 @@ import org.eclipse.help.internal.base.util.CriteriaUtilities;
public class CriteriaUtilitiesTest extends TestCase {
public void testNullValues() {
- List values = CriteriaUtilities.getCriteriaValues(null);
+ List<String> values = CriteriaUtilities.getCriteriaValues(null);
assertEquals(0, values.size());
}
public void testSingleValue() {
- List values = CriteriaUtilities.getCriteriaValues("1.0");
+ List<String> values = CriteriaUtilities.getCriteriaValues("1.0");
assertEquals(1, values.size());
assertEquals("1.0", values.get(0));
}
public void testSingleValueWithWhitespace() {
- List values = CriteriaUtilities.getCriteriaValues(" 1.0 ");
+ List<String> values = CriteriaUtilities.getCriteriaValues(" 1.0 ");
assertEquals(1, values.size());
assertEquals("1.0", values.get(0));
}
public void testMultipleValues() {
- List values = CriteriaUtilities.getCriteriaValues(" 1.0, 2.0 ");
+ List<String> values = CriteriaUtilities.getCriteriaValues(" 1.0, 2.0 ");
assertEquals(2, values.size());
assertEquals("1.0", values.get(0));
assertEquals("2.0", values.get(1));
}
public void testUppercaseValue() {
- List values = CriteriaUtilities.getCriteriaValues("LINUX");
+ List<String> values = CriteriaUtilities.getCriteriaValues("LINUX");
assertEquals(1, values.size());
assertNotSame("linux", values.get(0));
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/ParseCriteriaDefinition.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/ParseCriteriaDefinition.java
index c38c891cf..1345a9b6b 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/ParseCriteriaDefinition.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/ParseCriteriaDefinition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * Copyright (c) 2010, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,8 +43,7 @@ public class ParseCriteriaDefinition extends TestCase {
CriteriaDefinitionContribution result_a_b = parser.parse(new CriteriaDefinitionFile(UserAssistanceTestPlugin.getPluginId(), "data/help/criteria/criteria_definition/result_a_b.xml", "en"));
CriteriaDefinitionAssembler assembler = new CriteriaDefinitionAssembler();
- @SuppressWarnings("unchecked")
- List contributions = new ArrayList(Arrays.asList(new Object[] { a, b }));
+ List<CriteriaDefinitionContribution> contributions = new ArrayList<CriteriaDefinitionContribution>(Arrays.asList(a, b));
CriteriaDefinition assembled = assembler.assemble(contributions);
String expected = serialize((UAElement)result_a_b.getCriteriaDefinition());
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/ParseTocWithCriteria.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/ParseTocWithCriteria.java
index fa3d5b2fe..e97706995 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/ParseTocWithCriteria.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/ParseTocWithCriteria.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * Copyright (c) 2010, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -65,19 +65,17 @@ public class ParseTocWithCriteria extends TestCase {
Map<String, Set<String>> criteria = new HashMap<String, Set<String>>();
CriteriaUtilities.addCriteriaToMap(criteria, toc.getCriteria());
assertEquals(2, criteria.size());
- Object versions = criteria.get("version");
+ Set<String> versions = criteria.get("version");
assertNotNull(versions);
- Set versionSet = (Set)versions;
- assertEquals(2, versionSet.size());
- assertTrue(versionSet.contains("1.0"));
- assertTrue(versionSet.contains("2.0"));
+ assertEquals(2, versions.size());
+ assertTrue(versions.contains("1.0"));
+ assertTrue(versions.contains("2.0"));
- Object platforms = criteria.get("platform");
+ Set<String> platforms = criteria.get("platform");
assertNotNull(platforms);
- Set platformSet = (Set)platforms;
- assertEquals(2, platformSet.size());
- assertTrue(platformSet.contains("linux"));
- assertTrue(platformSet.contains("win32"));
+ assertEquals(2, platforms.size());
+ assertTrue(platforms.contains("linux"));
+ assertTrue(platforms.contains("win32"));
}
public void testCopyTocWithCriteria() throws Exception {
@@ -86,36 +84,33 @@ public class ParseTocWithCriteria extends TestCase {
Map<String, Set<String>> criteria = new HashMap<String, Set<String>>();
CriteriaUtilities.addCriteriaToMap(criteria, toc.getCriteria());
assertEquals(2, criteria.size());
- Object versions = criteria.get("version");
+ Set<String> versions = criteria.get("version");
assertNotNull(versions);
- Set versionSet = (Set)versions;
- assertEquals(2, versionSet.size());
- assertTrue(versionSet.contains("1.0"));
- assertTrue(versionSet.contains("2.0"));
+ assertEquals(2, versions.size());
+ assertTrue(versions.contains("1.0"));
+ assertTrue(versions.contains("2.0"));
- Object platforms = criteria.get("platform");
+ Set<String> platforms = criteria.get("platform");
assertNotNull(platforms);
- Set platformSet = (Set)platforms;
- assertEquals(2, platformSet.size());
- assertTrue(platformSet.contains("linux"));
- assertTrue(platformSet.contains("win32"));
+ assertEquals(2, platforms.size());
+ assertTrue(platforms.contains("linux"));
+ assertTrue(platforms.contains("win32"));
}
public void testTopicWithCriteria() throws Exception {
IToc toc = parseToc("data/help/criteria/c1.xml");
- ITopic[] topics = (ITopic[]) toc.getTopics();
+ ITopic[] topics = toc.getTopics();
assertEquals(topics.length, 2);
// First topic
Map<String, Set<String>> criteria = new HashMap<String, Set<String>>();
assertTrue(topics[0] instanceof ITopic2);
CriteriaUtilities.addCriteriaToMap(criteria, ((ITopic2)topics[0]).getCriteria());
assertEquals(2, criteria.size());
- Object versions = criteria.get("version");
+ Set<String> versions = criteria.get("version");
assertNotNull(versions);
- Set versionSet = (Set)versions;
- assertEquals(1, versionSet.size());
- assertTrue(versionSet.contains("1.0"));
- assertFalse(versionSet.contains("2.0"));
+ assertEquals(1, versions.size());
+ assertTrue(versions.contains("1.0"));
+ assertFalse(versions.contains("2.0"));
// Second topic
@@ -124,10 +119,9 @@ public class ParseTocWithCriteria extends TestCase {
CriteriaUtilities.addCriteriaToMap(criteria, ((ITopic2)topics[1]).getCriteria());
versions = criteria.get("version");
assertNotNull(versions);
- versionSet = (Set)versions;
- assertEquals(1, versionSet.size());
- assertTrue(versionSet.contains("2.0"));
- assertFalse(versionSet.contains("1.0"));
+ assertEquals(1, versions.size());
+ assertTrue(versions.contains("2.0"));
+ assertFalse(versions.contains("1.0"));
}
public void testCriteriaScoping1() throws Exception {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/SampleCriteriaDefinitionProvider.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/SampleCriteriaDefinitionProvider.java
index 591b04ebc..795c52d6f 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/SampleCriteriaDefinitionProvider.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/SampleCriteriaDefinitionProvider.java
@@ -21,6 +21,7 @@ import org.eclipse.ua.tests.help.other.UserCriterionValueDefinition;
public class SampleCriteriaDefinitionProvider extends
AbstractCriteriaDefinitionProvider {
+ @Override
public ICriteriaDefinitionContribution[] getCriteriaDefinitionContributions(
String locale) {
if (locale.startsWith("es")) {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/SampleCriteriaProvider.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/SampleCriteriaProvider.java
index 8e81967bb..673097355 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/SampleCriteriaProvider.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/SampleCriteriaProvider.java
@@ -23,10 +23,12 @@ public class SampleCriteriaProvider extends AbstractCriteriaProvider {
public static final String CONTAINS_LETTER = "containsLetter";
+ @Override
public ICriteria[] getCriteria(ITopic topic) {
return getCriteriaFromLabel(topic.getLabel());
}
+ @Override
public ICriteria[] getCriteria(IToc toc) {
return getCriteriaFromLabel(toc.getLabel());
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/TestCriteriaProvider.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/TestCriteriaProvider.java
index 9396c1c71..d3727b523 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/TestCriteriaProvider.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/TestCriteriaProvider.java
@@ -92,8 +92,8 @@ public class TestCriteriaProvider extends TestCase {
private boolean containsCriterion(ICriteria[] allCriteria,
String name, String value) {
- for (int i = 0; i < allCriteria.length; i++) {
- if (allCriteria[i].getName().equals(name) && allCriteria[i].getValue().equals(value)) {
+ for (ICriteria element : allCriteria) {
+ if (element.getName().equals(name) && element.getValue().equals(value)) {
return true;
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
index 863c8899c..89d8953a1 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
@@ -38,6 +38,7 @@ public class DynamicXHTMLProcessorTest extends TestCase {
return new TestSuite(DynamicXHTMLProcessorTest.class);
}
+ @Override
protected void setUp() throws Exception {
// activate the UI plug-in for UI filtering ability
HelpUIPlugin.getDefault();
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
index 6c905bf8c..1b75f5bec 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
@@ -39,6 +39,7 @@ public class XMLProcessorTest extends TestCase {
return new TestSuite(XMLProcessorTest.class);
}
+ @Override
protected void setUp() throws Exception {
// activate the UI plug-in for UI filtering ability
HelpUIPlugin.getDefault();
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java
index d2760d799..0698f5b50 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -53,8 +53,7 @@ public class IndexAssemblerTest extends TestCase {
IndexContribution result_a_b_c = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/result_a_b_c.xml", "en"));
IndexAssembler assembler = new IndexAssembler();
- @SuppressWarnings("unchecked")
- List contributions = new ArrayList(Arrays.asList(new Object[] { a, b, c }));
+ List<IndexContribution> contributions = new ArrayList<IndexContribution>(Arrays.asList(a, b, c));
Index assembled = assembler.assemble(contributions, Platform.getNL());
String expected = serialize((UAElement)result_a_b_c.getIndex());
@@ -66,10 +65,9 @@ public class IndexAssemblerTest extends TestCase {
IndexFileParser parser = new IndexFileParser();
IndexContribution contrib = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/d.xml", "en"));
IndexAssembler assembler = new IndexAssembler();
- @SuppressWarnings("unchecked")
- List contributions = new ArrayList(Arrays.asList(new Object[] { contrib }));
+ List<IndexContribution> contributions = new ArrayList<IndexContribution>(Arrays.asList(contrib));
Index index = assembler.assemble(contributions, Platform.getNL());
- IIndexEntry[] children = (IIndexEntry[]) index.getEntries();
+ IIndexEntry[] children = index.getEntries();
assertEquals(2,children.length);
IIndexEntry eclipseEntry = children[0];
assertEquals("eclipse", eclipseEntry.getKeyword());
@@ -94,8 +92,7 @@ public class IndexAssemblerTest extends TestCase {
IndexFileParser parser = new IndexFileParser();
IndexContribution contrib = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/hasTitle.xml", "en"));
IndexAssembler assembler = new IndexAssembler();
- @SuppressWarnings("unchecked")
- List contributions = new ArrayList(Arrays.asList(new Object[] { contrib }));
+ List<IndexContribution> contributions = new ArrayList<IndexContribution>(Arrays.asList(contrib));
Index index = assembler.assemble(contributions, Platform.getNL());
IIndexEntry[] children = index.getEntries();
assertEquals(1,children.length);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ConcurrentTocAccess.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ConcurrentTocAccess.java
index 0a8d0e00e..494e5ec70 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ConcurrentTocAccess.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ConcurrentTocAccess.java
@@ -72,6 +72,7 @@ public class ConcurrentTocAccess extends TestCase {
this.toc = toc;
}
+ @Override
public void run() {
try {
int result = traverseToc(toc);
@@ -148,8 +149,8 @@ public class ConcurrentTocAccess extends TestCase {
private int computeNumberOfLeafTopics(int[] dimensions) {
int expectedLeaves = 1;
- for (int dim = 0; dim < dimensions.length; dim++) {
- expectedLeaves = expectedLeaves * dimensions[dim];
+ for (int dimension : dimensions) {
+ expectedLeaves = expectedLeaves * dimension;
}
return expectedLeaves;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextLinkSorter.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextLinkSorter.java
index 1c337ece0..5ea4d2f91 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextLinkSorter.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextLinkSorter.java
@@ -33,10 +33,12 @@ public class ContextLinkSorter extends TestCase {
this.label = label;
}
+ @Override
public String getHref() {
return href;
}
+ @Override
public String getLabel() {
return label;
}
@@ -49,6 +51,7 @@ public class ContextLinkSorter extends TestCase {
private class TestContext implements IContext2 {
+ @Override
public String getCategory(IHelpResource topic) {
if (topic instanceof TestResource) {
return ((TestResource)topic).getCategory();
@@ -56,18 +59,22 @@ public class ContextLinkSorter extends TestCase {
return null;
}
+ @Override
public String getStyledText() {
return null;
}
+ @Override
public String getTitle() {
return null;
}
+ @Override
public IHelpResource[] getRelatedTopics() {
return null;
}
+ @Override
public String getText() {
return null;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextTest.java
index 26b262357..5f571eb4c 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextTest.java
@@ -53,6 +53,7 @@ public class ContextTest extends TestCase {
return new TestSuite(ContextTest.class);
}
+ @Override
protected void setUp() throws Exception {
// Required for isEnabled() to work correctly
BaseHelpSystem.setMode(BaseHelpSystem.MODE_WORKBENCH);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/DocumentReaderTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/DocumentReaderTest.java
index 927e2efea..a17f311b8 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/DocumentReaderTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/DocumentReaderTest.java
@@ -75,6 +75,7 @@ public class DocumentReaderTest extends TestCase {
}
public int status = RUNNING;
+ @Override
public void run() {
try {
for (int i = 0; i < 10; i++) {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexEntryTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexEntryTest.java
index cbea6f7cd..789157c24 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexEntryTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexEntryTest.java
@@ -71,6 +71,7 @@ public class IndexEntryTest extends TestCase {
return new TestSuite(IndexEntryTest.class);
}
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.setMode(BaseHelpSystem.MODE_WORKBENCH);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexSeeTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexSeeTest.java
index c2355f78b..eef4cc91e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexSeeTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexSeeTest.java
@@ -48,6 +48,7 @@ public class IndexSeeTest extends TestCase {
return new TestSuite(IndexSeeTest.class);
}
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.setMode(BaseHelpSystem.MODE_WORKBENCH);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ResourceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ResourceTest.java
index fcb4ee64d..97732e3a4 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ResourceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ResourceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,16 +38,16 @@ public class ResourceTest extends TestCase {
checkFields(org.eclipse.ui.internal.intro.universal.Messages.class);
}
- private void checkFields(Class messages) throws IllegalAccessException {
+ private void checkFields(Class<?> messages) throws IllegalAccessException {
Field[] fields = messages.getFields();
- for (int i = 0; i < fields.length; i++) {
- int modifiers = fields[i].getModifiers();
+ for (Field field : fields) {
+ int modifiers = field.getModifiers();
if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers)) {
- Object value = fields[i].get(null);
+ Object value = field.get(null);
if (value instanceof String) {
String stringValue = (String)value;
if (stringValue.startsWith("NLS missing message")) {
- fail("Missing resource for " + fields[i].getName());
+ fail("Missing resource for " + field.getName());
}
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/TopicTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/TopicTest.java
index feb4408c8..ec26997e2 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/TopicTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/TopicTest.java
@@ -63,6 +63,7 @@ public class TopicTest extends TestCase {
return new TestSuite(TopicTest.class);
}
+ @Override
protected void setUp() throws Exception {
// Required for isEnabled() to work correctly
BaseHelpSystem.setMode(BaseHelpSystem.MODE_WORKBENCH);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserContext.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserContext.java
index 2f5e7113d..00ff25515 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserContext.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserContext.java
@@ -34,26 +34,32 @@ public class UserContext implements IContext3 {
this.text = text;
}
+ @Override
public ICommandLink[] getRelatedCommands() {
return new ICommandLink[0];
}
+ @Override
public String getCategory(IHelpResource topic) {
return null;
}
+ @Override
public String getStyledText() {
return getText();
}
+ @Override
public String getTitle() {
return title;
}
+ @Override
public IHelpResource[] getRelatedTopics() {
return children.toArray(new IHelpResource[0]);
}
+ @Override
public String getText() {
return text;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteria.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteria.java
index f7d1172a7..5a8e3bc08 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteria.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteria.java
@@ -26,18 +26,22 @@ public class UserCriteria implements ICriteria {
this.enabled = enabled;
}
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return enabled;
}
+ @Override
public IUAElement[] getChildren() {
return null;
}
+ @Override
public String getName() {
return name;
}
+ @Override
public String getValue() {
return value;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteriaDefinition.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteriaDefinition.java
index 6bb087f80..82ece43f6 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteriaDefinition.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteriaDefinition.java
@@ -23,10 +23,12 @@ public class UserCriteriaDefinition implements ICriteriaDefinition {
private List<ICriterionDefinition> children = new ArrayList<ICriterionDefinition>();
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return true;
}
+ @Override
public ICriterionDefinition[] getCriterionDefinitions() {
return children.toArray(new ICriterionDefinition[0]);
}
@@ -35,6 +37,7 @@ public class UserCriteriaDefinition implements ICriteriaDefinition {
children.add(definition);
}
+ @Override
public IUAElement[] getChildren() {
return getCriterionDefinitions();
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteriaDefinitionContribution.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteriaDefinitionContribution.java
index cd2167f4e..ffb97a999 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteriaDefinitionContribution.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriteriaDefinitionContribution.java
@@ -29,6 +29,7 @@ public class UserCriteriaDefinitionContribution implements ICriteriaDefinitionCo
this.criteriaDefinition = criteriaDefinition;
}
+ @Override
public ICriteriaDefinition getCriteriaDefinition() {
return criteriaDefinition;
}
@@ -37,6 +38,7 @@ public class UserCriteriaDefinitionContribution implements ICriteriaDefinitionCo
this.id = id;
}
+ @Override
public String getId() {
return id;
}
@@ -45,6 +47,7 @@ public class UserCriteriaDefinitionContribution implements ICriteriaDefinitionCo
this.locale = locale;
}
+ @Override
public String getLocale() {
return locale;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionDefinition.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionDefinition.java
index 3fe7a1bd8..228b9582d 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionDefinition.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionDefinition.java
@@ -30,6 +30,7 @@ public class UserCriterionDefinition implements ICriterionDefinition {
this.name = name;
}
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return true;
}
@@ -38,6 +39,7 @@ public class UserCriterionDefinition implements ICriterionDefinition {
this.id = id;
}
+ @Override
public String getId() {
return id;
}
@@ -46,14 +48,17 @@ public class UserCriterionDefinition implements ICriterionDefinition {
this.name = name;
}
+ @Override
public String getName() {
return name;
}
+ @Override
public IUAElement[] getChildren() {
return getCriterionValueDefinitions();
}
+ @Override
public ICriterionValueDefinition[] getCriterionValueDefinitions() {
return children.toArray(new ICriterionValueDefinition[0]);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionValueDefinition.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionValueDefinition.java
index 557d7cef2..b868b23c7 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionValueDefinition.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionValueDefinition.java
@@ -25,18 +25,22 @@ public class UserCriterionValueDefinition implements ICriterionValueDefinition {
this.name = name;
}
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return true;
}
+ @Override
public String getId() {
return id;
}
+ @Override
public String getName() {
return name;
}
+ @Override
public IUAElement[] getChildren() {
return new IUAElement[0];
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndex.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndex.java
index ff1cea384..aad3d535f 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndex.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndex.java
@@ -32,6 +32,7 @@ public class UserIndex implements IIndex {
this.enabled = true;
}
+ @Override
public IUAElement[] getChildren() {
return getEntries();
}
@@ -40,10 +41,12 @@ public class UserIndex implements IIndex {
entries.add(child);
}
+ @Override
public IIndexEntry[] getEntries() {
return entries.toArray(new IIndexEntry[0]);
}
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return enabled;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexEntry.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexEntry.java
index 153cb0d73..22a531cc1 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexEntry.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexEntry.java
@@ -33,6 +33,7 @@ public class UserIndexEntry implements IIndexEntry2 {
private boolean isEnabled;
private String keyword;
+ @Override
public IUAElement[] getChildren() {
IUAElement[] subentries = getSubentries();
IUAElement[] sees = getSees();
@@ -44,6 +45,7 @@ public class UserIndexEntry implements IIndexEntry2 {
return result;
}
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return isEnabled;
}
@@ -65,18 +67,22 @@ public class UserIndexEntry implements IIndexEntry2 {
this.isEnabled = isEnabled;
}
+ @Override
public IIndexSee[] getSees() {
return sees.toArray(new IIndexSee[0]);
}
+ @Override
public String getKeyword() {
return keyword;
}
+ @Override
public IIndexEntry[] getSubentries() {
return subentries.toArray(new IIndexEntry[0]);
}
+ @Override
public ITopic[] getTopics() {
return topics.toArray(new ITopic[0]);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexSee.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexSee.java
index e6dbbba13..eb33d6ba8 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexSee.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexSee.java
@@ -25,10 +25,12 @@ public class UserIndexSee implements IIndexSee {
private boolean isEnabled;
private String keyword;
+ @Override
public IUAElement[] getChildren() {
return getSubpathElements();
}
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return isEnabled;
}
@@ -42,14 +44,17 @@ public class UserIndexSee implements IIndexSee {
this.isEnabled = isEnabled;
}
+ @Override
public String getKeyword() {
return keyword;
}
+ @Override
public IIndexSubpath[] getSubpathElements() {
return children.toArray(new IIndexSubpath[0]);
}
+ @Override
public boolean isSeeAlso() {
return false;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexSubpath.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexSubpath.java
index d1d578ab3..15daf770d 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexSubpath.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserIndexSubpath.java
@@ -25,14 +25,17 @@ public class UserIndexSubpath implements IIndexSubpath {
}
+ @Override
public String getKeyword() {
return keyword;
}
+ @Override
public IUAElement[] getChildren() {
return new IUAElement[0];
}
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return true;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserToc.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserToc.java
index 4b88be2c3..3385a05ca 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserToc.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserToc.java
@@ -34,14 +34,17 @@ public class UserToc implements IToc {
/*
* Not exercised by any test so return of null is OK for now
*/
+ @Override
public ITopic getTopic(String href) {
return null;
}
+ @Override
public ITopic[] getTopics() {
return children.toArray(new ITopic[0]);
}
+ @Override
public IUAElement[] getChildren() {
return getTopics();
}
@@ -50,14 +53,17 @@ public class UserToc implements IToc {
children.add(child);
}
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return isEnabled;
}
+ @Override
public String getHref() {
return href;
}
+ @Override
public String getLabel() {
return label;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserToc2.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserToc2.java
index 5ba01f56e..fff009650 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserToc2.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserToc2.java
@@ -26,6 +26,7 @@ public class UserToc2 extends UserToc implements IToc2 {
private List<ICriteria> criteria = new ArrayList<ICriteria>();
+ @Override
public IUAElement[] getChildren() {
IUAElement[] criteriaElements = getCriteria();
IUAElement[] topics = getTopics();
@@ -39,14 +40,17 @@ public class UserToc2 extends UserToc implements IToc2 {
criteria.add(child);
}
+ @Override
public ICriteria[] getCriteria() {
return criteria.toArray(new ICriteria[0]);
}
+ @Override
public String getIcon() {
return null;
}
+ @Override
public boolean isSorted() {
return false;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserTopic.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserTopic.java
index a73a93610..c10c16ee8 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserTopic.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserTopic.java
@@ -29,22 +29,27 @@ public class UserTopic implements ITopic {
private String href;
private String label;
+ @Override
public ITopic[] getSubtopics() {
return children.toArray(new ITopic[0]);
}
+ @Override
public IUAElement[] getChildren() {
return getSubtopics();
}
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return isEnabled;
}
+ @Override
public String getHref() {
return href;
}
+ @Override
public String getLabel() {
return label;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserTopic2.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserTopic2.java
index a7aeb1ce4..82df19c89 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserTopic2.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserTopic2.java
@@ -22,6 +22,7 @@ public class UserTopic2 extends UserTopic implements ITopic2 {
private List<ICriteria> criteria = new ArrayList<ICriteria>();
+ @Override
public IUAElement[] getChildren() {
IUAElement[] criteriaElements = getCriteria();
IUAElement[] topics = getSubtopics();
@@ -39,14 +40,17 @@ public class UserTopic2 extends UserTopic implements ITopic2 {
criteria.add(child);
}
+ @Override
public ICriteria[] getCriteria() {
return criteria.toArray(new ICriteria[0]);
}
+ @Override
public String getIcon() {
return null;
}
+ @Override
public boolean isSorted() {
return false;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/BuildHtmlSearchIndex.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/BuildHtmlSearchIndex.java
index 37d4fe0da..aba09efd2 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/BuildHtmlSearchIndex.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/BuildHtmlSearchIndex.java
@@ -44,6 +44,7 @@ public class BuildHtmlSearchIndex extends PerformanceTestCase {
return new TestSuite(BuildHtmlSearchIndex.class);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
TocManager tocManager = HelpPlugin.getTocManager();
@@ -58,6 +59,7 @@ public class BuildHtmlSearchIndex extends PerformanceTestCase {
analyzerDesc = new AnalyzerDescriptor("en-us");
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
TocManager tocManager = HelpPlugin.getTocManager();
@@ -145,6 +147,7 @@ public class BuildHtmlSearchIndex extends PerformanceTestCase {
}
private static class TestTocFileProvider extends TocFileProvider {
+ @Override
protected TocFile[] getTocFiles(String locale) {
String id = UserAssistanceTestPlugin.getPluginId();
String nl = Platform.getNL();
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/HelpServerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/HelpServerTest.java
index 9d7e71e04..2e612e34e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/HelpServerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/HelpServerTest.java
@@ -31,10 +31,12 @@ public class HelpServerTest extends PerformanceTestCase {
return new TestSuite(HelpServerTest.class);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
}
+ @Override
protected void tearDown() throws Exception {
LoadServletUtil.stopServer();
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/IndexAssemblePerformanceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/IndexAssemblePerformanceTest.java
index e5701f92a..e4dbe6afd 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/IndexAssemblePerformanceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/IndexAssemblePerformanceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,6 +40,7 @@ public class IndexAssemblePerformanceTest extends PerformanceTestCase {
return new TestSuite(IndexAssemblePerformanceTest.class);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
}
@@ -72,8 +73,7 @@ public class IndexAssemblePerformanceTest extends PerformanceTestCase {
IndexContribution b = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/performance/index/index2.xml", "en"));
IndexContribution c = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/performance/index/index3.xml", "en"));
IndexAssembler assembler = new IndexAssembler();
- @SuppressWarnings("unchecked")
- List contributions = new ArrayList(Arrays.asList(new Object[] { a, b, c }));
+ List<IndexContribution> contributions = new ArrayList<IndexContribution>(Arrays.asList(a, b, c));
Index assembled = assembler.assemble(contributions, Platform.getNL());
assertEquals(100, assembled.getChildren().length);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/LowIterationHelpServerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/LowIterationHelpServerTest.java
index a9ec5c998..447e339a9 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/LowIterationHelpServerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/LowIterationHelpServerTest.java
@@ -31,10 +31,12 @@ public class LowIterationHelpServerTest extends PerformanceTestCase {
return new TestSuite(LowIterationHelpServerTest.class);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
}
+ @Override
protected void tearDown() throws Exception {
LoadServletUtil.stopServer();
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/OpenHelpTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/OpenHelpTest.java
index dfc112785..4a6ba51b3 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/OpenHelpTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/OpenHelpTest.java
@@ -48,6 +48,7 @@ public class OpenHelpTest extends PerformanceTestCase {
return new TestSuite(OpenHelpTest.class);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
TocManager tocManager = HelpPlugin.getTocManager();
@@ -61,6 +62,7 @@ public class OpenHelpTest extends PerformanceTestCase {
indexManager.clearCache();
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
TocManager tocManager = HelpPlugin.getTocManager();
@@ -109,6 +111,7 @@ public class OpenHelpTest extends PerformanceTestCase {
final boolean[] done = new boolean[] { false };
final String url = "http://" + WebappManager.getHost() + ":" + WebappManager.getPort() + "/help/index.jsp";
browser.addLocationListener(new LocationAdapter() {
+ @Override
public void changed(LocationEvent event) {
if (url.equals(event.location)) {
done[0] = true;
@@ -141,6 +144,7 @@ public class OpenHelpTest extends PerformanceTestCase {
}
private static class TestTocFileProvider extends TocFileProvider {
+ @Override
protected TocFile[] getTocFiles(String locale) {
String id = UserAssistanceTestPlugin.getPluginId();
String nl = Platform.getNL();
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/TocAssemblePerformanceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/TocAssemblePerformanceTest.java
index c125887de..6fcac6c90 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/TocAssemblePerformanceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/TocAssemblePerformanceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -39,6 +39,7 @@ public class TocAssemblePerformanceTest extends PerformanceTestCase {
return new TestSuite(TocAssemblePerformanceTest.class);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
}
@@ -48,7 +49,6 @@ public class TocAssemblePerformanceTest extends PerformanceTestCase {
return parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), tocFile, true, "en", null, null));
}
- @SuppressWarnings("unchecked")
public void assembleToc() throws Exception {
TocFileParser parser = new TocFileParser();
List<TocContribution> contributions = new ArrayList<TocContribution>();
@@ -69,8 +69,8 @@ public class TocAssemblePerformanceTest extends PerformanceTestCase {
private int countTopics(ITopic[] topics) {
int result = topics.length;
- for (int i = 0; i < topics.length; i++) {
- result = result + countTopics(topics[i].getSubtopics());
+ for (ITopic topic : topics) {
+ result = result + countTopics(topic.getSubtopics());
}
return result;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/BookmarksTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/BookmarksTest.java
index 4eb5ea0a5..fded5519c 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/BookmarksTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/BookmarksTest.java
@@ -38,6 +38,7 @@ public class BookmarksTest extends TestCase {
public Object arg;
public int eventCount = 0;
+ @Override
public void update(Observable o, Object arg) {
++eventCount;
this.o = o;
@@ -53,6 +54,7 @@ public class BookmarksTest extends TestCase {
private BookmarkManager manager;
private BookmarkObserver observer;
+ @Override
protected void setUp() throws Exception {
manager = new BookmarkManager();
manager.removeAllBookmarks();
@@ -60,6 +62,7 @@ public class BookmarksTest extends TestCase {
manager.addObserver(observer);
}
+ @Override
protected void tearDown() throws Exception {
manager = null;
observer = null;
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/HelpDataTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/HelpDataTest.java
index 045ee09c2..914795c85 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/HelpDataTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/HelpDataTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,15 +20,13 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.junit.Assert;
-
-import org.eclipse.help.internal.HelpData;
-import org.eclipse.help.internal.HelpPlugin;
-import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
-
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.help.internal.HelpData;
+import org.eclipse.help.internal.HelpPlugin;
+import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
+import org.junit.Assert;
/*
* Tests the help data ordering of tocs and hiding tocs, indexes, etc.
@@ -53,6 +51,7 @@ public class HelpDataTest extends TestCase {
private String ignoredIndexesPreference;
+ @Override
protected void setUp() throws Exception {
baseTocsPreference = Platform.getPreferencesService().getString
(HelpPlugin.PLUGIN_ID, HelpPlugin.BASE_TOCS_KEY, "", null);
@@ -65,6 +64,7 @@ public class HelpDataTest extends TestCase {
setIgnoredIndexes("");
}
+ @Override
protected void tearDown() throws Exception {
setBaseTocs(baseTocsPreference);
setIgnoredTocs(ignoredTocsPreference);
@@ -87,14 +87,11 @@ public class HelpDataTest extends TestCase {
}
public void testHelpData() {
- for (int i=0;i<TEST_DATA.length;++i) {
- String[][] entry = (String[][])TEST_DATA[i];
+ for (String[][] entry : TEST_DATA) {
String file = entry[0][0];
- List expectedTocOrder = Arrays.asList(entry[1]);
- @SuppressWarnings("unchecked")
- Set expectedHiddenTocs = new HashSet(Arrays.asList(entry[2]));
- @SuppressWarnings("unchecked")
- Set expectedHiddenIndexes = new HashSet(Arrays.asList(entry[3]));
+ List<String> expectedTocOrder = Arrays.asList(entry[1]);
+ Set<String> expectedHiddenTocs = new HashSet<String>(Arrays.asList(entry[2]));
+ Set<String> expectedHiddenIndexes = new HashSet<String>(Arrays.asList(entry[3]));
URL url = UserAssistanceTestPlugin.getDefault().getBundle().getEntry(file);
HelpData data = new HelpData(url);
Assert.assertEquals("Did not get the expected toc order from help data file " + file, expectedTocOrder, data.getTocOrder());
@@ -114,7 +111,7 @@ public class HelpDataTest extends TestCase {
public void testNullUrlWithBaseTocs() {
HelpData data = new HelpData(null);
setBaseTocs("/a/b.xml,/c/d.xml");
- List tocOrder = data.getTocOrder();
+ List<?> tocOrder = data.getTocOrder();
assertEquals(2, tocOrder.size());
assertEquals("/a/b.xml", tocOrder.get(0));
assertEquals("/c/d.xml", tocOrder.get(1));
@@ -127,7 +124,7 @@ public class HelpDataTest extends TestCase {
HelpData data = new HelpData(null);
setIgnoredTocs("/a/b.xml,/c/d.xml");
assertEquals(0, data.getTocOrder().size());
- Set hiddenTocs = data.getHiddenTocs();
+ Set<?> hiddenTocs = data.getHiddenTocs();
assertEquals(2, hiddenTocs.size());
assertTrue(hiddenTocs.contains("/a/b.xml"));
assertTrue(hiddenTocs.contains("/c/d.xml"));
@@ -140,7 +137,7 @@ public class HelpDataTest extends TestCase {
setIgnoredIndexes("/a/b.xml,/c/d.xml");
assertEquals(0, data.getTocOrder().size());
assertEquals(0, data.getHiddenTocs().size());
- Set hiddenIndexes = data.getHiddenIndexes();
+ Set<?> hiddenIndexes = data.getHiddenIndexes();
assertEquals(2, hiddenIndexes.size());
assertTrue(hiddenIndexes.contains("/a/b.xml"));
assertTrue(hiddenIndexes.contains("/c/d.xml"));
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java
index 0dd7bea7d..c0a415ecf 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 IBM Corporation and others.
+ * Copyright (c) 2006, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,10 +20,9 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.junit.Assert;
-
import org.eclipse.help.internal.util.ProductPreferences;
import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
+import org.junit.Assert;
/*
* Tests the products preferences utility
@@ -145,24 +144,23 @@ public class ProductPreferencesTest extends TestCase {
}
public void testGetOrderedList() {
- for (int i=0;i<GET_ORDERED_LIST_DATA.length;++i) {
- String[] data = GET_ORDERED_LIST_DATA[i];
- List items = ProductPreferences.tokenize(data[0]);
- List expectedOrder = ProductPreferences.tokenize(data[1]);
- List primaryOrdering = ProductPreferences.tokenize(data[2]);
- List[] secondaryOrderings = new List[data.length - 3];
+ for (String[] data : GET_ORDERED_LIST_DATA) {
+ List<String> items = ProductPreferences.tokenize(data[0]);
+ List<String> expectedOrder = ProductPreferences.tokenize(data[1]);
+ List<String> primaryOrdering = ProductPreferences.tokenize(data[2]);
+ @SuppressWarnings("unchecked")
+ List<String>[] secondaryOrderings = (List<String>[]) new List<?>[data.length - 3];
for (int j=0;j<secondaryOrderings.length;++j) {
secondaryOrderings[j] = ProductPreferences.tokenize(data[j + 3]);
}
- List actualOrder = ProductPreferences.getOrderedList(items, primaryOrdering, secondaryOrderings, null);
+ List<String> actualOrder = ProductPreferences.getOrderedList(items, primaryOrdering, secondaryOrderings, null);
Assert.assertEquals("Items in list were not ordered as expected", expectedOrder, actualOrder);
}
}
public void testGetPropertiesFile() {
- for (int i=0;i<GET_PROPERTIES_FILE_DATA.length;++i) {
- String[] data = GET_PROPERTIES_FILE_DATA[i];
+ for (String[] data : GET_PROPERTIES_FILE_DATA) {
String path = "data/help/preferences/" + data[0];
Properties properties = ProductPreferences.loadPropertiesFile(UserAssistanceTestPlugin.getDefault().getBundle().getSymbolicName(), path);
@@ -173,18 +171,16 @@ public class ProductPreferencesTest extends TestCase {
StringTokenizer tok = new StringTokenizer(data[j], "=");
String key = tok.nextToken();
String expectedValue = tok.nextToken();
- String actualValue = (String)properties.getProperty(key);
+ String actualValue = properties.getProperty(key);
Assert.assertEquals("One of the properties files' keys did not match the expected value: file=" + path + ", key=" + key, expectedValue, actualValue);
}
}
}
public void testGetValue() {
- for (int i=0;i<GET_VALUE_DATA.length;++i) {
- String[] data = GET_VALUE_DATA[i];
+ for (String[] data : GET_VALUE_DATA) {
String key = data[0];
- @SuppressWarnings("unchecked")
- Set allowableValues = new HashSet(ProductPreferences.tokenize(data[1]));
+ Set<String> allowableValues = new HashSet<String>(ProductPreferences.tokenize(data[1]));
Properties primary = ProductPreferences.loadPropertiesFile(UserAssistanceTestPlugin.getDefault().getBundle().getSymbolicName(), "data/help/preferences/" + data[2]);
Properties[] secondary = new Properties[data.length - 3];
for (int j=0;j<secondary.length;++j) {
@@ -202,10 +198,9 @@ public class ProductPreferencesTest extends TestCase {
}
public void testTokenize() {
- for (int i=0;i<TOKENIZE_DATA.length;++i) {
- String[] data = TOKENIZE_DATA[i];
+ for (String[] data : TOKENIZE_DATA) {
String input = data[0];
- List output = ProductPreferences.tokenize(input);
+ List<String> output = ProductPreferences.tokenize(input);
Assert.assertNotNull("The tokenized output was unexpectedly null for: " + input, output);
Assert.assertEquals("The number of tokens did not match the expected result for: " + input, data.length - 1, output.size());
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ContentServletTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ContentServletTest.java
index 1ad0dd1be..b6aa0acb6 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ContentServletTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ContentServletTest.java
@@ -21,12 +21,14 @@ public class ContentServletTest extends TestCase {
private static final String UA_TESTS = "org.eclipse.ua.tests";
private int mode;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(mode);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ContextServletTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ContextServletTest.java
index 16bb41b58..f6d22f2f9 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ContextServletTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ContextServletTest.java
@@ -39,12 +39,14 @@ public class ContextServletTest extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(mode);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/GetContentUsingRemoteHelp.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/GetContentUsingRemoteHelp.java
index f806b9326..57d3958dc 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/GetContentUsingRemoteHelp.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/GetContentUsingRemoteHelp.java
@@ -40,6 +40,7 @@ public class GetContentUsingRemoteHelp extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
@@ -50,6 +51,7 @@ public class GetContentUsingRemoteHelp extends TestCase {
HelpPlugin.getTocManager().getTocs("en");
}
+ @Override
protected void tearDown() throws Exception {
RemotePreferenceStore.restorePreferences();
BaseHelpSystem.setMode(mode);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/GetContextUsingRemoteHelp.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/GetContextUsingRemoteHelp.java
index 2a6cc2dce..b4154052f 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/GetContextUsingRemoteHelp.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/GetContextUsingRemoteHelp.java
@@ -23,6 +23,7 @@ public class GetContextUsingRemoteHelp extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
RemotePreferenceStore.savePreferences();
mode = BaseHelpSystem.getMode();
@@ -30,6 +31,7 @@ public class GetContextUsingRemoteHelp extends TestCase {
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
RemotePreferenceStore.restorePreferences();
BaseHelpSystem.setMode(mode);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/IndexServletTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/IndexServletTest.java
index 2f4c41d79..3e9f66a9b 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/IndexServletTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/IndexServletTest.java
@@ -34,12 +34,14 @@ public class IndexServletTest extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(mode);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/JettyTestServer.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/JettyTestServer.java
index e09bbeb21..c1c58b5d0 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/JettyTestServer.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/JettyTestServer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,10 +20,12 @@ import org.osgi.framework.ServiceReference;
public class JettyTestServer extends JettyHelpServer {
+ @Override
protected String getOtherInfo() {
return "org.eclipse.ua.tests";
}
+ @Override
protected int getPortParameter() {
return AUTO_SELECT_JETTY_PORT;
}
@@ -32,6 +34,7 @@ public class JettyTestServer extends JettyHelpServer {
* Ensures that the bundle with the specified name and the highest available
* version is started and reads the port number
*/
+ @Override
protected void checkBundle() throws InvalidSyntaxException, BundleException {
Bundle bundle = Platform.getBundle("org.eclipse.equinox.http.registry"); //$NON-NLS-1$if (bundle != null) {
if (bundle.getState() == Bundle.RESOLVED) {
@@ -39,7 +42,7 @@ public class JettyTestServer extends JettyHelpServer {
}
if (port == -1) {
// Jetty selected a port number for us
- ServiceReference[] reference = bundle.getBundleContext().getServiceReferences("org.osgi.service.http.HttpService", "(other.info=" + getOtherInfo() + ')'); //$NON-NLS-1$ //$NON-NLS-2$
+ ServiceReference<?>[] reference = bundle.getBundleContext().getServiceReferences("org.osgi.service.http.HttpService", "(other.info=" + getOtherInfo() + ')'); //$NON-NLS-1$ //$NON-NLS-2$
Object assignedPort = reference[reference.length - 1].getProperty("http.port"); //$NON-NLS-1$
port = Integer.parseInt((String)assignedPort);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadIndexUsingRemoteHelp.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadIndexUsingRemoteHelp.java
index 7715a6982..4c33b7993 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadIndexUsingRemoteHelp.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadIndexUsingRemoteHelp.java
@@ -25,12 +25,14 @@ public class LoadIndexUsingRemoteHelp extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
RemotePreferenceStore.savePreferences();
mode = BaseHelpSystem.getMode();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
RemotePreferenceStore.restorePreferences();
BaseHelpSystem.setMode(mode);
@@ -72,9 +74,9 @@ public class LoadIndexUsingRemoteHelp extends TestCase {
private IIndexEntry[] matchingEntries(IIndex index, String keyword) {
List<IIndexEntry> matches = new ArrayList<IIndexEntry>();
IIndexEntry[] entries = index.getEntries();
- for (int i = 0; i < entries.length; i++) {
- if (keyword.equals(entries[i].getKeyword())) {
- matches.add(entries[i]);
+ for (IIndexEntry entrie : entries) {
+ if (keyword.equals(entrie.getKeyword())) {
+ matches.add(entrie);
}
}
return matches.toArray(new IIndexEntry[matches.size()]);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadTocUsingRemoteHelp.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadTocUsingRemoteHelp.java
index 764102076..44bb38ac6 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadTocUsingRemoteHelp.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadTocUsingRemoteHelp.java
@@ -21,11 +21,13 @@ public class LoadTocUsingRemoteHelp extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
RemotePreferenceStore.savePreferences();
mode = BaseHelpSystem.getMode();
}
+ @Override
protected void tearDown() throws Exception {
RemotePreferenceStore.restorePreferences();
BaseHelpSystem.setMode(mode);
@@ -80,8 +82,8 @@ public class LoadTocUsingRemoteHelp extends TestCase {
*/
private int matchingTocs(Toc[] tocs, String label) {
int result = 0;
- for (int i = 0; i < tocs.length; i++) {
- if (label.equals(tocs[i].getLabel())) {
+ for (Toc toc : tocs) {
+ if (label.equals(toc.getLabel())) {
result += 1;
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockContentServlet.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockContentServlet.java
index b07248ee7..87683db5a 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockContentServlet.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockContentServlet.java
@@ -29,6 +29,7 @@ public class MockContentServlet extends HttpServlet {
* Return a create page based on the path and locale unless the path
* starts with "/invalid" in which case return an I/O error
*/
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String locale = UrlUtil.getLocale(req, resp);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockContextServlet.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockContextServlet.java
index 49100a4fb..795e56e26 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockContextServlet.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockContextServlet.java
@@ -21,6 +21,7 @@ public class MockContextServlet extends ContextServlet {
private static final String ORG_ECLIPSE_UA_TESTS_TEST = "org.eclipse.ua.tests.test";
private static final long serialVersionUID = 3615294041471900830L;
+ @Override
protected IContext getContext(String locale, String id) {
if (id.startsWith(ORG_ECLIPSE_UA_TESTS_TEST)) {
String suffix = id.substring(ORG_ECLIPSE_UA_TESTS_TEST.length());
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockIndexServlet.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockIndexServlet.java
index 6f7d67605..299166c85 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockIndexServlet.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockIndexServlet.java
@@ -30,6 +30,7 @@ public class MockIndexServlet extends IndexServlet {
private static final long serialVersionUID = -930969620357059313L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String locale = UrlUtil.getLocale(req, resp);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockSearchServlet.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockSearchServlet.java
index e38d6227c..7e13964ca 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockSearchServlet.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockSearchServlet.java
@@ -28,6 +28,7 @@ public class MockSearchServlet extends HttpServlet {
private static final long serialVersionUID = -5115067950875335923L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String phrase = req.getParameter("phrase");
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockTocServlet.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockTocServlet.java
index d9f1b211d..70ff37ea7 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockTocServlet.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockTocServlet.java
@@ -29,6 +29,7 @@ public class MockTocServlet extends TocServlet {
private static final long serialVersionUID = 2934062693291854845L;
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String locale = UrlUtil.getLocale(req, resp);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchServletTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchServletTest.java
index e8219d8dc..01857aae7 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchServletTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchServletTest.java
@@ -38,12 +38,14 @@ public class ParallelSearchServletTest extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(mode);
}
@@ -57,6 +59,7 @@ public class ParallelSearchServletTest extends TestCase {
this.expectedHits = expectedHits;
}
+ @Override
public String runTest() throws Exception {
Node[] hits = getSearchHitsFromServlet(phrase);
if (hits.length != expectedHits) {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchUsingRemote.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchUsingRemote.java
index e8eaa315c..5d4ab8ef5 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchUsingRemote.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchUsingRemote.java
@@ -22,6 +22,7 @@ public class ParallelSearchUsingRemote extends TestCase {
private class Searcher implements ParallelTestSupport.ITestCase {
private int count = 0;
+ @Override
public String runTest() throws Exception {
count++;
return SearchTestUtils.searchForExpectedResults
@@ -37,11 +38,13 @@ public class ParallelSearchUsingRemote extends TestCase {
new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" }
};
+ @Override
protected void setUp() throws Exception {
RemotePreferenceStore.savePreferences();
mode = BaseHelpSystem.getMode();
}
+ @Override
protected void tearDown() throws Exception {
RemotePreferenceStore.restorePreferences();
BaseHelpSystem.setMode(mode);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemotePreferenceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemotePreferenceTest.java
index 59320f1fd..e33874ea1 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemotePreferenceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemotePreferenceTest.java
@@ -27,10 +27,12 @@ public class RemotePreferenceTest extends TestCase {
prefs.put(name, value);
}
+ @Override
protected void setUp() throws Exception {
RemotePreferenceStore.savePreferences();
}
+ @Override
protected void tearDown() throws Exception {
RemotePreferenceStore.restorePreferences();
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchIndexCreation.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchIndexCreation.java
index e9f9c3fde..9bb23b494 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchIndexCreation.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchIndexCreation.java
@@ -27,6 +27,7 @@ public class SearchIndexCreation extends TestCase {
private int mode;
private AnalyzerDescriptor analyzerDesc;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
@@ -38,6 +39,7 @@ public class SearchIndexCreation extends TestCase {
analyzerDesc = new AnalyzerDescriptor("en-us");
}
+ @Override
protected void tearDown() throws Exception {
RemotePreferenceStore.restorePreferences();
BaseHelpSystem.setMode(mode);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchServletTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchServletTest.java
index 4cc36c1dc..b724b326a 100755
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchServletTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchServletTest.java
@@ -38,12 +38,14 @@ public class SearchServletTest extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(mode);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchUsingRemoteHelp.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchUsingRemoteHelp.java
index 017a457df..cf1296749 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchUsingRemoteHelp.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchUsingRemoteHelp.java
@@ -20,11 +20,13 @@ public class SearchUsingRemoteHelp extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
RemotePreferenceStore.savePreferences();
mode = BaseHelpSystem.getMode();
}
+ @Override
protected void tearDown() throws Exception {
RemotePreferenceStore.restorePreferences();
BaseHelpSystem.setMode(mode);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TocManagerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TocManagerTest.java
index 31b829c01..d9f9ac50e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TocManagerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TocManagerTest.java
@@ -24,6 +24,7 @@ public class TocManagerTest extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
@@ -31,6 +32,7 @@ public class TocManagerTest extends TestCase {
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(mode);
RemotePreferenceStore.restorePreferences();
@@ -59,13 +61,12 @@ public class TocManagerTest extends TestCase {
RemotePreferenceStore.setMockLocalPriority();
HelpPlugin.getTocManager().clearCache();
AbstractTocProvider [] tocProviders = HelpPlugin.getTocManager().getTocProviders();
- for(int i=0;i<tocProviders.length;i++)
- {
- if(tocProviders[i] instanceof TocFileProvider)
- localPriority = tocProviders[i].getPriority();
+ for (AbstractTocProvider tocProvider : tocProviders) {
+ if(tocProvider instanceof TocFileProvider)
+ localPriority = tocProvider.getPriority();
- if(tocProviders[i] instanceof RemoteTocProvider)
- remotePriority = tocProviders[i].getPriority();
+ if(tocProvider instanceof RemoteTocProvider)
+ remotePriority = tocProvider.getPriority();
}
assertTrue(localPriority<remotePriority);
@@ -79,13 +80,12 @@ public class TocManagerTest extends TestCase {
int localPriority=0,remotePriority=0;
AbstractTocProvider [] tocProviders = HelpPlugin.getTocManager().getTocProviders();
- for(int i=0;i<tocProviders.length;i++)
- {
- if(tocProviders[i] instanceof TocFileProvider)
- localPriority = tocProviders[i].getPriority();
+ for (AbstractTocProvider tocProvider : tocProviders) {
+ if(tocProvider instanceof TocFileProvider)
+ localPriority = tocProvider.getPriority();
- if(tocProviders[i] instanceof RemoteTocProvider)
- remotePriority = tocProviders[i].getPriority();
+ if(tocProvider instanceof RemoteTocProvider)
+ remotePriority = tocProvider.getPriority();
}
assertTrue(remotePriority<localPriority);
@@ -95,12 +95,11 @@ public class TocManagerTest extends TestCase {
{
HashSet<String> contributionsFound = new HashSet<String>();
- for(int i=0;i<tocContributions.length;i++)
- {
- if(contributionsFound.contains(tocContributions[i].getId()))
+ for (TocContribution tocContribution : tocContributions) {
+ if(contributionsFound.contains(tocContribution.getId()))
return true;
else
- contributionsFound.add(tocContributions[i].getId());
+ contributionsFound.add(tocContribution.getId());
}
return false;
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TocServletTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TocServletTest.java
index bd1fe780a..3ff00b139 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TocServletTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TocServletTest.java
@@ -34,12 +34,14 @@ public class TocServletTest extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(mode);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/MockScope.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/MockScope.java
index 9409b0901..d05fd1175 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/MockScope.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/MockScope.java
@@ -33,22 +33,27 @@ public class MockScope extends AbstractHelpScope {
this.isHierarchical = isHierarchical;
}
+ @Override
public boolean inScope(IToc toc) {
return testForInScope(toc.getLabel());
}
+ @Override
public boolean inScope(ITopic topic) {
return testForInScope(topic.getLabel());
}
+ @Override
public boolean inScope(IIndexEntry entry) {
return testForInScope(entry.getKeyword());
}
+ @Override
public boolean inScope(IIndexSee see) {
return true;
}
+ @Override
public String getName(Locale locale) {
return null;
}
@@ -57,6 +62,7 @@ public class MockScope extends AbstractHelpScope {
return label.indexOf(letter) >= 0;
}
+ @Override
public boolean isHierarchicalScope() {
return isHierarchical;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AnalyzerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AnalyzerTest.java
index d07469784..12a76cd62 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AnalyzerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AnalyzerTest.java
@@ -89,8 +89,7 @@ public class AnalyzerTest extends TestCase {
private void checkAnalyzer(String language, String analyzerKind) {
AnalyzerDescriptor an = new AnalyzerDescriptor(language);
- for (int i = 0; i < supportedLanguages.length; i++) {
- String nextLocale = supportedLanguages[i];
+ for (String nextLocale : supportedLanguages) {
AnalyzerDescriptor expected = new AnalyzerDescriptor(nextLocale);
String analyzerClassName = expected.getAnalyzerClassName();
if (nextLocale.equals(analyzerKind)) {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java
index ace37d534..73ab02490 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java
@@ -151,8 +151,8 @@ public class ExtraDirTest extends TestCase {
SearchResults collector = new SearchResults(workingSets, 500, Platform.getNL());
BaseHelpSystem.getSearchManager().search(query, collector, new NullProgressMonitor());
SearchHit[] hits = collector.getSearchHits();
- for (int j=0;j<hits.length;++j) {
- String href = hits[j].getHref();
+ for (SearchHit hit : hits) {
+ String href = hit.getHref();
// ignore query params
int index = href.indexOf('?');
if (index != -1) {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/InfocenterWorkingSetManagerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/InfocenterWorkingSetManagerTest.java
index 5a370475c..34e8c314e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/InfocenterWorkingSetManagerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/InfocenterWorkingSetManagerTest.java
@@ -278,8 +278,8 @@ public class InfocenterWorkingSetManagerTest extends TestCase {
private int cookieLength(Cookie[] cookies) {
int total = 0;
- for (int i = 0; i < cookies.length; i++) {
- total += cookies[i].getValue().length();
+ for (Cookie cookie : cookies) {
+ total += cookie.getValue().length();
}
return total;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockSearchParticipant.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockSearchParticipant.java
index fd4464fd4..aef84f639 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockSearchParticipant.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockSearchParticipant.java
@@ -26,6 +26,7 @@ public class MockSearchParticipant extends SearchParticipant {
private static final String DOC_1 = "/org.eclipse.ua.tests/participant1.xml";
private static final String DOC_2 = "/org.eclipse.ua.tests/participant2.xml";
+ @Override
public Set<String> getAllDocuments(String locale) {
HashSet<String> set = new HashSet<String>();
set.add(DOC_1);
@@ -33,6 +34,7 @@ public class MockSearchParticipant extends SearchParticipant {
return set;
}
+ @Override
public IStatus addDocument(IHelpSearchIndex index, String pluginId,
String name, URL url, String id, ISearchDocument doc) {
boolean isDoc1 = url.getPath().equals(DOC_1) ;
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockSearchParticipantXML.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockSearchParticipantXML.java
index 42cbb9532..0f3d552f6 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockSearchParticipantXML.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MockSearchParticipantXML.java
@@ -22,6 +22,7 @@ public class MockSearchParticipantXML extends SearchParticipantXML {
public static final String DOC_1 = "/org.eclipse.ua.tests/data/help/search/participant_xml_1.xml";
public static final String DOC_2 = "/org.eclipse.ua.tests/data/help/search/participant_xml_2.xml";
+ @Override
public Set<String> getAllDocuments(String locale) {
HashSet<String> set = new HashSet<String>();
set.add(DOC_1 + "?id=xml1" + "?id=xml2");
@@ -29,12 +30,14 @@ public class MockSearchParticipantXML extends SearchParticipantXML {
return set;
}
+ @Override
public Set<String> getContributingPlugins() {
Set<String> result = new HashSet<String>();
result.add("org.eclipse.ua.tests");
return result;
}
+ @Override
protected void handleStartElement(String name, Attributes attributes,
IParsedXMLContent data) {
if ("participant".equalsIgnoreCase(name)) {
@@ -46,9 +49,11 @@ public class MockSearchParticipantXML extends SearchParticipantXML {
}
}
+ @Override
protected void handleEndElement(String name, IParsedXMLContent data) {
}
+ @Override
protected void handleText(String text, IParsedXMLContent data) {
String top = getTopElement();
if ("text".equalsIgnoreCase(top)) {
@@ -56,6 +61,7 @@ public class MockSearchParticipantXML extends SearchParticipantXML {
}
}
+ @Override
public boolean open(String id) {
System.out.println("Open " + id);
return true;
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java
index 2cca0fb46..300fd3839 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java
@@ -53,8 +53,8 @@ public class SearchTestUtils {
SearchHit[] hits;
hits = getSearchHits(searchWord, nl);
- for (int j=0;j<hits.length;++j) {
- String href = hits[j].getHref();
+ for (SearchHit hit : hits) {
+ String href = hit.getHref();
// ignore query params
int index = href.indexOf('?');
if (index != -1) {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/UATestContentExtensionProvider.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/UATestContentExtensionProvider.java
index b97166cfe..2113a57f8 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/UATestContentExtensionProvider.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/UATestContentExtensionProvider.java
@@ -25,24 +25,29 @@ public class UATestContentExtensionProvider extends
// TODO Auto-generated constructor stub
extension = new IContentExtension() {
+ @Override
public boolean isEnabled(IEvaluationContext context) {
// TODO Auto-generated method stub
return true;
}
+ @Override
public IUAElement[] getChildren() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public int getType() {
return REPLACEMENT;
}
+ @Override
public String getPath() {
return "org.eclipse.ua.tests/data/help/search/test6.xhtml#test6_paragraph_to_replace2";
}
+ @Override
public String getContent() {
return "/org.eclipse.ua.tests/data/help/search/testProvider.xhtml";
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/WorkingSetManagerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/WorkingSetManagerTest.java
index 7f9f36107..0a55e3cf6 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/WorkingSetManagerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/WorkingSetManagerTest.java
@@ -32,24 +32,26 @@ public class WorkingSetManagerTest extends TestCase {
private WorkingSet[] workingSets;
+ @Override
protected void setUp() throws Exception {
WorkingSetManager manager = new WorkingSetManager();
manager.restoreState();
workingSets = manager.getWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- manager.removeWorkingSet(workingSets[i]);
+ for (WorkingSet workingSet : workingSets) {
+ manager.removeWorkingSet(workingSet);
}
manager.saveState();
}
+ @Override
protected void tearDown() throws Exception {
WorkingSetManager manager = new WorkingSetManager();
WorkingSet[] wsetsToRemove = manager.getWorkingSets();
- for (int i = 0; i < wsetsToRemove.length; i++) {
- manager.removeWorkingSet(wsetsToRemove[i]);
+ for (WorkingSet element : wsetsToRemove) {
+ manager.removeWorkingSet(element);
}
- for (int i = 0; i < workingSets.length; i++) {
- manager.addWorkingSet(workingSets[i]);
+ for (WorkingSet workingSet : workingSets) {
+ manager.addWorkingSet(workingSet);
}
manager.saveState();
}
@@ -113,8 +115,8 @@ public class WorkingSetManagerTest extends TestCase {
WorkingSetScope scope = new WorkingSetScope("test", mgr, "scope");
for (int i = 1; i < tocs.length; i++) {
ITopic[] topics = tocs[i].getTopics();
- for (int t = 0; t < topics.length; t++) {
- assertFalse(scope.inScope(topics[t]));
+ for (ITopic topic : topics) {
+ assertFalse(scope.inScope(topic));
}
}
};
@@ -129,8 +131,8 @@ public class WorkingSetManagerTest extends TestCase {
mgr.addWorkingSet(wset);
WorkingSetScope scope = new WorkingSetScope("test", mgr, "scope");
ITopic[] topics = tocs[0].getTopics();
- for (int t = 0; t < topics.length; t++) {
- assertTrue(scope.inScope(topics[t]));
+ for (ITopic topic : topics) {
+ assertTrue(scope.inScope(topic));
}
};
@@ -168,8 +170,8 @@ public class WorkingSetManagerTest extends TestCase {
mgr.saveState();
WorkingSetScope scope = new WorkingSetScope("test1", mgr, "scope");
Toc[] tocs = HelpPlugin.getTocManager().getTocs(Platform.getNL());
- for (int i = 0; i < tocs.length; i++) {
- assertTrue(scope.inScope(tocs[i]));
+ for (Toc toc : tocs) {
+ assertTrue(scope.inScope(toc));
}
}
@@ -178,10 +180,10 @@ public class WorkingSetManagerTest extends TestCase {
createWsetWithAllTocs(mgr, "test1a");
WorkingSetScope scope = new WorkingSetScope("test1a", mgr, "scope");
Toc[] tocs = HelpPlugin.getTocManager().getTocs(Platform.getNL());
- for (int i = 0; i < tocs.length; i++) {;
- ITopic[] topics = tocs[i].getTopics();
- for (int j = 0; j < topics.length; j++) {
- assertTrue(scope.inScope(topics[j]));
+ for (Toc toc : tocs) {;
+ ITopic[] topics = toc.getTopics();
+ for (ITopic topic : topics) {
+ assertTrue(scope.inScope(topic));
}
}
}
@@ -191,12 +193,12 @@ public class WorkingSetManagerTest extends TestCase {
createWsetWithAllTocs(mgr, "test1b");
WorkingSetScope scope = new WorkingSetScope("test1b", mgr, "scope");
Toc[] tocs = HelpPlugin.getTocManager().getTocs(Platform.getNL());
- for (int i = 0; i < tocs.length; i++) {;
- ITopic[] topics = tocs[i].getTopics();
- for (int j = 0; j < topics.length; j++) {
- ITopic[] subtopics = topics[j].getSubtopics();
- for (int k = 0; k < subtopics.length; k++) {
- assertTrue(scope.inScope(subtopics[k]));
+ for (Toc toc : tocs) {;
+ ITopic[] topics = toc.getTopics();
+ for (ITopic topic : topics) {
+ ITopic[] subtopics = topic.getSubtopics();
+ for (ITopic subtopic : subtopics) {
+ assertTrue(scope.inScope(subtopic));
}
}
}
@@ -206,8 +208,8 @@ public class WorkingSetManagerTest extends TestCase {
WorkingSet wset = new WorkingSet(name);
List<AdaptableToc> tocList = new ArrayList<AdaptableToc>();
Toc[] tocs = HelpPlugin.getTocManager().getTocs(Platform.getNL());
- for (int i = 0; i < tocs.length; i++) {
- tocList.add(mgr.getAdaptableToc(tocs[i].getHref()));
+ for (Toc toc : tocs) {
+ tocList.add(mgr.getAdaptableToc(toc.getHref()));
}
wset.setElements(tocList.toArray(new AdaptableToc[0]));
mgr.addWorkingSet(wset);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/EnabledTopicTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/EnabledTopicTest.java
index fc60f8a21..c49f8a089 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/EnabledTopicTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/EnabledTopicTest.java
@@ -37,23 +37,28 @@ public class EnabledTopicTest extends TestCase {
this.isEnabled = isEnabled;
}
+ @Override
public ITopic[] getSubtopics() {
return children.toArray(new ITopic[children.size()]);
}
+ @Override
public IUAElement[] getChildren() {
return getSubtopics();
}
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return isEnabled;
}
+ @Override
public String getHref() {
return "http://www.eclipse.org";
}
+ @Override
public String getLabel() {
return label;
}
@@ -69,6 +74,7 @@ public class EnabledTopicTest extends TestCase {
super(label, true);
}
+ @Override
public String getHref() {
return null;
}
@@ -86,6 +92,7 @@ public class EnabledTopicTest extends TestCase {
this.keyword = keyword;
}
+ @Override
public String getKeyword() {
return keyword;
}
@@ -98,14 +105,17 @@ public class EnabledTopicTest extends TestCase {
topics.add(topic);
}
+ @Override
public IIndexEntry[] getSubentries() {
return subEntries.toArray(new IIndexEntry[subEntries.size()]);
}
+ @Override
public ITopic[] getTopics() {
return topics.toArray(new ITopic[topics.size()]);
}
+ @Override
public synchronized IUAElement[] getChildren() {
List<IUAElement> all = new ArrayList<IUAElement>();
all.addAll(subEntries);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/HelpData.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/HelpData.java
index 7810c588d..afdf61675 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/HelpData.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/HelpData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,28 +19,28 @@ import org.eclipse.help.internal.util.ProductPreferences;
public class HelpData extends TestCase {
public void testHelpDataInPlugin() {
- List result = ProductPreferences.getTocOrdering("org.eclipse.ua.tests", "data/help/toc/helpData.xml", "");
+ List<String> result = ProductPreferences.getTocOrdering("org.eclipse.ua.tests", "data/help/toc/helpData.xml", "");
assertEquals(2, result.size());
assertEquals("/org.eclipse.platform.doc.user/toc.xml", result.get(0));
assertEquals("/org.eclipse.platform.doc.isv/toc.xml", result.get(1));
}
public void testPluginsRoot() {
- List result = ProductPreferences.getTocOrdering("org.eclipse.sdk", "PLUGINS_ROOT/org.eclipse.ua.tests/data/help/toc/helpData.xml", "");
+ List<String> result = ProductPreferences.getTocOrdering("org.eclipse.sdk", "PLUGINS_ROOT/org.eclipse.ua.tests/data/help/toc/helpData.xml", "");
assertEquals(2, result.size());
assertEquals("/org.eclipse.platform.doc.user/toc.xml", result.get(0));
assertEquals("/org.eclipse.platform.doc.isv/toc.xml", result.get(1));
}
public void testHelpDataOverridesBaseTocs() {
- List result = ProductPreferences.getTocOrdering("org.eclipse.ua.tests", "data/help/toc/helpData.xml", "org.eclipse.help");
+ List<String> result = ProductPreferences.getTocOrdering("org.eclipse.ua.tests", "data/help/toc/helpData.xml", "org.eclipse.help");
assertEquals(2, result.size());
assertEquals("/org.eclipse.platform.doc.user/toc.xml", result.get(0));
assertEquals("/org.eclipse.platform.doc.isv/toc.xml", result.get(1));
}
public void testBaseTocs() {
- List result = ProductPreferences.getTocOrdering("", "", "/org.eclipse.help/toc.xml,/org.eclipse.test/toc.xml");
+ List<String> result = ProductPreferences.getTocOrdering("", "", "/org.eclipse.help/toc.xml,/org.eclipse.test/toc.xml");
assertEquals(2, result.size());
assertEquals("/org.eclipse.help/toc.xml", result.get(0));
assertEquals("/org.eclipse.test/toc.xml", result.get(1));
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java
index 21e4d4d82..3922f314c 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation and others.
+ * Copyright (c) 2006, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -37,7 +37,6 @@ public class TocAssemblerTest extends TestCase {
return new TestSuite(TocAssemblerTest.class);
}
- @SuppressWarnings("unchecked")
public void testAssemble() throws Exception {
TocFileParser parser = new TocFileParser();
TocContribution b = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/b.xml", true, "en", null, null));
@@ -45,11 +44,11 @@ public class TocAssemblerTest extends TestCase {
TocContribution result_b_c = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/result_b_c.xml", true, "en", null, null));
TocAssembler assembler = new TocAssembler();
- List contributions = new ArrayList(Arrays.asList(new Object[] { b, c }));
+ List<TocContribution> contributions = new ArrayList<TocContribution>(Arrays.asList(b, c));
contributions = assembler.assemble(contributions);
assertEquals(1, contributions.size());
String expected = serialize(result_b_c);
- String actual = serialize((TocContribution)contributions.get(0));
+ String actual = serialize(contributions.get(0));
XMLUtil.assertXMLEquals("Assembled TOC did not match expected result", expected, actual);
TocContribution a = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/a.xml", true, "en", null, null));
@@ -58,12 +57,12 @@ public class TocAssemblerTest extends TestCase {
TocContribution d = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/d.xml", false, "en", null, null));
TocContribution result_a_b_c_d = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/result_a_b_c_d.xml", true, "en", null, null));
- contributions = new ArrayList(Arrays.asList(new Object[] { a, b, c, d }));
+ contributions = new ArrayList<TocContribution>(Arrays.asList(a, b, c, d));
contributions = assembler.assemble(contributions);
assertEquals(1, contributions.size());
expected = serialize(result_a_b_c_d);
- actual = serialize((TocContribution)contributions.get(0));
+ actual = serialize(contributions.get(0));
XMLUtil.assertXMLEquals("Assembled TOC did not match expected result", expected, actual);
}
@@ -74,8 +73,7 @@ public class TocAssemblerTest extends TestCase {
TocContribution linkTo3 = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/linkTo3.xml", true, "en", null, null));
TocAssembler assembler = new TocAssembler();
- @SuppressWarnings("unchecked")
- List contributions = new ArrayList(Arrays.asList(new Object[] { linkTo1, linkTo2, linkTo3 }));
+ List<TocContribution> contributions = new ArrayList<TocContribution>(Arrays.asList(linkTo1, linkTo2, linkTo3));
contributions = assembler.assemble(contributions);
assertEquals(3, contributions.size());
}
@@ -85,10 +83,9 @@ public class TocAssemblerTest extends TestCase {
TocContribution b = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/b.xml", true, "en", null, null));
TocContribution c = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/c.xml", true, "en", null, null));
TocAssembler assembler = new TocAssembler();
- @SuppressWarnings("unchecked")
- List contributions = new ArrayList(Arrays.asList(new Object[] { b, c }));
+ List<TocContribution> contributions = new ArrayList<TocContribution>(Arrays.asList(b, c));
contributions = assembler.assemble(contributions);
- IToc toc =((TocContribution)contributions.get(0)).getToc();
+ IToc toc =contributions.get(0).getToc();
assertNotNull(toc.getTopic("/org.eclipse.ua.tests/B_topic3.html"));
assertNotNull(toc.getTopic("/org.eclipse.ua.tests/C_topic.html"));
assertNull(toc.getTopic("/org.eclipse.ua.tests/D_topic.html"));
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocProviderTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocProviderTest.java
index faf82f25d..9464b2851 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocProviderTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocProviderTest.java
@@ -33,16 +33,15 @@ public class TocProviderTest extends TestCase {
public void testTocProvider() throws Exception {
IToc[] tocs = HelpPlugin.getTocManager().getTocs("en");
IToc uaToc = null;
- for (int i = 0; i < tocs.length; i++) {
- if ("User Assistance Tests".equals(tocs[i].getLabel())) {
- uaToc = tocs[i];
+ for (IToc toc : tocs) {
+ if ("User Assistance Tests".equals(toc.getLabel())) {
+ uaToc = toc;
}
}
assertNotNull("User Assistance Tests not found", uaToc);
ITopic[] children = uaToc.getTopics();
int generatedParentTopics = 0;
- for (int i = 0; i < children.length; i++) {
- ITopic child = children[i];
+ for (ITopic child : children) {
if ("Generated Parent".equals(child.getLabel())) {
generatedParentTopics++;
assertEquals(4, child.getSubtopics().length);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocSortingTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocSortingTest.java
index f9f7e9451..8604b4587 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocSortingTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocSortingTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -47,26 +47,32 @@ public class TocSortingTest extends TestCase {
this.label = label;
}
+ @Override
public ITopic getTopic(String href) {
return null;
}
+ @Override
public ITopic[] getTopics() {
return new ITopic[0];
}
+ @Override
public IUAElement[] getChildren() {
return new IUAElement[0];
}
+ @Override
public boolean isEnabled(IEvaluationContext context) {
return true;
}
+ @Override
public String getHref() {
return null;
}
+ @Override
public String getLabel() {
return label;
}
@@ -85,39 +91,48 @@ public class TocSortingTest extends TestCase {
this.toc = new Toc(name);
}
+ @Override
public String getCategoryId() {
return categoryId;
}
+ @Override
public String getContributorId() {
return "org.eclipse.ua.tests";
}
+ @Override
public String[] getExtraDocuments() {
return new String[0];
}
+ @Override
public String getId() {
return id;
}
+ @Override
public String getLinkTo() {
return null;
}
+ @Override
public String getLocale() {
return "en";
}
+ @Override
public IToc getToc() {
return toc;
}
+ @Override
public boolean isPrimary() {
return true;
}
}
+ @Override
protected void setUp() throws Exception {
helpDataPreference = Platform.getPreferencesService().getString
(HelpPlugin.HELP_DATA_KEY, HelpPlugin.HELP_DATA_KEY, "", null);
@@ -129,6 +144,7 @@ public class TocSortingTest extends TestCase {
setBaseTocs("");
}
+ @Override
protected void tearDown() throws Exception {
setHelpData(helpDataPreference);
setBaseTocs(baseTocsPreference);
@@ -148,8 +164,8 @@ public class TocSortingTest extends TestCase {
private String toString(ITocContribution[] tocs) {
String result = "";
- for (int i = 0; i < tocs.length; i++) {
- result += tocs[i].getToc().getLabel();
+ for (ITocContribution toc : tocs) {
+ result += toc.getToc().getLabel();
}
return result;
}
@@ -260,19 +276,19 @@ public class TocSortingTest extends TestCase {
}
public void testNoProductNoHelpData() {
- List ordering = ProductPreferences.getTocOrdering(null, "", "/a/b.xml,/c/d.xml");
+ List<String> ordering = ProductPreferences.getTocOrdering(null, "", "/a/b.xml,/c/d.xml");
assertEquals(2, ordering.size());
assertEquals("/a/b.xml", ordering.get(0));
assertEquals("/c/d.xml", ordering.get(1));
}
public void testNoProductWithHelpData() {
- List ordering = ProductPreferences.getTocOrdering(null, "helpData.xml", "/a/b.xml,/c/d.xml");
+ List<String> ordering = ProductPreferences.getTocOrdering(null, "helpData.xml", "/a/b.xml,/c/d.xml");
assertNull(ordering);
}
public void testNoProductWithPluginsRoot() {
- List ordering = ProductPreferences.getTocOrdering(null, ORDERED_XML, "/a/b.xml,/c/d.xml");
+ List<String> ordering = ProductPreferences.getTocOrdering(null, ORDERED_XML, "/a/b.xml,/c/d.xml");
assertEquals(3, ordering.size());
assertEquals("/x/toc.xml", ordering.get(0));
assertEquals("/d/toc.xml", ordering.get(1));
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/UaTestTocProvider.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/UaTestTocProvider.java
index 71d66603e..30fc5e18e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/UaTestTocProvider.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/UaTestTocProvider.java
@@ -25,34 +25,42 @@ public class UaTestTocProvider extends AbstractTocProvider {
private class TocContribution implements ITocContribution {
+ @Override
public String getCategoryId() {
return null;
}
+ @Override
public String getContributorId() {
return "org.eclipse.ua.tests";
}
+ @Override
public String[] getExtraDocuments() {
return new String[0];
}
+ @Override
public String getId() {
return "generatedToc";
}
+ @Override
public String getLinkTo() {
return "PLUGINS_ROOT/org.eclipse.ua.tests/data/help/toc/root.xml#generatedContent";
}
+ @Override
public String getLocale() {
return null;
}
+ @Override
public IToc getToc() {
return toc;
}
+ @Override
public boolean isPrimary() {
return false;
}
@@ -74,6 +82,7 @@ public class UaTestTocProvider extends AbstractTocProvider {
contributions = new ITocContribution[] { contribution };
}
+ @Override
public ITocContribution[] getTocContributions(String locale) {
return contributions;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/LoadTestServlet.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/LoadTestServlet.java
index 90ad1bfb6..6380c427e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/LoadTestServlet.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/LoadTestServlet.java
@@ -30,6 +30,7 @@ public class LoadTestServlet extends HttpServlet {
private static final String XHTML_2 = "</title>\n <style type = \"text/css\"> td { padding-right : 10px; }</style></head>\n<body>\n"; //$NON-NLS-1$
private static final String XHTML_3 = "</body>\n</html>"; //$NON-NLS-1$
+ @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ParallelTestSupport.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ParallelTestSupport.java
index 39b2b7cbe..02c1de407 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ParallelTestSupport.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ParallelTestSupport.java
@@ -83,6 +83,7 @@ public class ParallelTestSupport {
public String failureReason = null;
+ @Override
public void run() {
for (int j = 0; j <= repetitions; j++) {
try {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ProducerSerializerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ProducerSerializerTest.java
index 19e13d9cb..09c4837c7 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ProducerSerializerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ProducerSerializerTest.java
@@ -53,13 +53,13 @@ public class ProducerSerializerTest extends TestCase {
public void testGenerateOutput() throws Exception {
IToc[] tocs = HelpSystem.getTocs();
- for (int i=0;i<tocs.length;++i) {
+ for (IToc toc : tocs) {
// only look for content in data/help/producer
- if (tocs[i].getHref().indexOf("data/help/producer/") != -1) {
- ITopic[] topics = tocs[i].getTopics();
+ if (toc.getHref().indexOf("data/help/producer/") != -1) {
+ ITopic[] topics = toc.getTopics();
// only goes one level deep - don't need subtopics here
- for (int j=0;j<topics.length;++j) {
- String href = topics[j].getHref();
+ for (ITopic topic : topics) {
+ String href = topic.getHref();
String pluginRoot = UserAssistanceTestPlugin.getDefault().getBundle().getLocation().substring("update@".length());
String relativePath = href.substring(href.indexOf('/', 1));
String absolutePath = pluginRoot + relativePath;
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/TocModelSerializer.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/TocModelSerializer.java
index f83ef4de1..ac65faf26 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/TocModelSerializer.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/TocModelSerializer.java
@@ -34,8 +34,8 @@ public class TocModelSerializer {
buf.append(indent + " href=\"" + toc.getHref() + "\">\n");
ITopic[] topics = toc.getTopics();
- for (int i=0;i<topics.length;++i) {
- buf.append(serializeAux(topics[i], indent + " "));
+ for (ITopic topic : topics) {
+ buf.append(serializeAux(topic, indent + " "));
}
buf.append(indent + "</toc>");
@@ -52,8 +52,8 @@ public class TocModelSerializer {
buf.append(indent + " href=\"" + topic.getHref() + "\">\n");
ITopic[] subtopics = topic.getSubtopics();
- for (int i=0;i<subtopics.length;++i) {
- buf.append(serializeAux(subtopics[i], indent + " "));
+ for (ITopic subtopic : subtopics) {
+ buf.append(serializeAux(subtopic, indent + " "));
}
buf.append(indent + "</topic>\n");
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/TocModelSerializerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/TocModelSerializerTest.java
index 7bfeef4be..77cd5173f 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/TocModelSerializerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/TocModelSerializerTest.java
@@ -56,6 +56,7 @@ public class TocModelSerializerTest extends TestCase {
* Ensure that org.eclipse.help.ui is started. It contributes extra content
* filtering that is used by this test. See UIContentFilterProcessor.
*/
+ @Override
protected void setUp() throws Exception {
HelpUIPlugin.getDefault();
}
@@ -91,18 +92,18 @@ public class TocModelSerializerTest extends TestCase {
Collection<TocFile> tocFiles = new ArrayList<TocFile>();
IExtensionPoint xpt = Platform.getExtensionRegistry().getExtensionPoint(HelpPlugin.PLUGIN_ID, "toc");
IExtension[] extensions = xpt.getExtensions();
- for (int i=0;i<extensions.length;i++) {
- String pluginId = extensions[i].getContributor().getName();
+ for (IExtension extension : extensions) {
+ String pluginId = extension.getContributor().getName();
if (pluginId.equals("org.eclipse.ua.tests")) {
- IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
- for (int j=0;j<configElements.length;j++) {
- if (configElements[j].getName().equals("toc")) {
+ IConfigurationElement[] configElements = extension.getConfigurationElements();
+ for (IConfigurationElement configElement : configElements) {
+ if (configElement.getName().equals("toc")) {
// only get files in data/help/toc/
- String href = configElements[j].getAttribute("file"); //$NON-NLS-1$
+ String href = configElement.getAttribute("file"); //$NON-NLS-1$
if (href.startsWith("data/help/toc/")) {
- boolean isPrimary = "true".equals(configElements[j].getAttribute("primary")); //$NON-NLS-1$
- String extraDir = configElements[j].getAttribute("extradir"); //$NON-NLS-1$
- String categoryId = configElements[j].getAttribute("category"); //$NON-NLS-1$
+ boolean isPrimary = "true".equals(configElement.getAttribute("primary")); //$NON-NLS-1$
+ String extraDir = configElement.getAttribute("extradir"); //$NON-NLS-1$
+ String categoryId = configElement.getAttribute("category"); //$NON-NLS-1$
tocFiles.add(new TocFile(pluginId, href, isPrimary, Platform.getNL(), extraDir, categoryId));
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ChildLinkInsertion.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ChildLinkInsertion.java
index de041e194..6c432a487 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ChildLinkInsertion.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ChildLinkInsertion.java
@@ -32,6 +32,7 @@ public class ChildLinkInsertion extends TestCase {
super(out, req, prefix);
}
+ @Override
protected void insertBasedOnKeyword(int index) throws IOException {
if (index == 0 ) {
out.write("<LINKS>".getBytes()); //$NON-NLS-1$
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilter.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilter.java
index 54ed83cb4..e1cda2bc3 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilter.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilter.java
@@ -23,6 +23,7 @@ import org.eclipse.help.webapp.IFilter;
public class CommentFilter implements IFilter {
+ @Override
public OutputStream filter(HttpServletRequest req, OutputStream out) {
return new OutFilter(out);
}
@@ -36,6 +37,7 @@ public class CommentFilter implements IFilter {
this.out = out;
}
+ @Override
public void write(int b) throws IOException {
if (!preambleWritten) {
preambleWritten = true;
@@ -45,6 +47,7 @@ public class CommentFilter implements IFilter {
out.write(b);
}
+ @Override
public void close() throws IOException {
String comment = "<!-- post " + getCommentText() + " -->";
out.write(comment.getBytes());
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterOne.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterOne.java
index 7f3a3ebd3..749806300 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterOne.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterOne.java
@@ -16,7 +16,8 @@ package org.eclipse.ua.tests.help.webapp;
*/
public class CommentFilterOne extends CommentFilter {
- protected String getCommentText() {
+ @Override
+ protected String getCommentText() {
return "1";
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterThree.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterThree.java
index 5a2ddca28..c8053a396 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterThree.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterThree.java
@@ -17,7 +17,8 @@ package org.eclipse.ua.tests.help.webapp;
public class CommentFilterThree extends CommentFilter {
- protected String getCommentText() {
+ @Override
+ protected String getCommentText() {
return "3";
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterTwo.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterTwo.java
index db629f4a9..a39edcec7 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterTwo.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterTwo.java
@@ -17,7 +17,8 @@ package org.eclipse.ua.tests.help.webapp;
public class CommentFilterTwo extends CommentFilter {
- protected String getCommentText() {
+ @Override
+ protected String getCommentText() {
return "2";
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterExtensionTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterExtensionTest.java
index 7787eb13a..21cd3ba50 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterExtensionTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterExtensionTest.java
@@ -25,6 +25,7 @@ import junit.framework.TestCase;
*/
public class FilterExtensionTest extends TestCase {
+ @Override
protected void tearDown() throws Exception {
ExtraFilters.setFilters(new PrioritizedFilter[0]);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerBinding.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerBinding.java
index a859cf1b8..7cbbd09be 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerBinding.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerBinding.java
@@ -34,10 +34,12 @@ public class HelpServerBinding extends TestCase {
// To enable these tests for local testing set testUsingIP to true.
private final boolean testUsingIP = false;
+ @Override
protected void setUp() throws Exception {
previousMode = BaseHelpSystem.getMode();
}
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(previousMode);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java
index 5505663b1..f4dc47b6e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java
@@ -34,6 +34,7 @@ public class HelpServerInterrupt extends TestCase {
private Exception exception = null;
+ @Override
public synchronized void run() {
try {
WebappManager.start("help");
@@ -47,6 +48,7 @@ public class HelpServerInterrupt extends TestCase {
}
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/LocaleTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/LocaleTest.java
index 189145942..bf0242814 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/LocaleTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/LocaleTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,12 +17,11 @@ import javax.servlet.http.Cookie;
import junit.framework.TestCase;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.help.internal.base.BaseHelpSystem;
import org.eclipse.help.internal.util.ProductPreferences;
import org.eclipse.help.internal.webapp.data.UrlUtil;
-import org.eclipse.core.runtime.Platform;
-
/**
* Tests for locale related code in UrlUtil
*/
@@ -30,10 +29,12 @@ public class LocaleTest extends TestCase {
private int mode;
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(mode);
}
+ @Override
protected void setUp() throws Exception {
mode = BaseHelpSystem.getMode();
}
@@ -46,7 +47,6 @@ public class LocaleTest extends TestCase {
assertEquals("ab-cd______ef", UrlUtil.cleanLocale("ab-cd\n\r_\"\'_ef"));
}
- @SuppressWarnings("unchecked")
public void testForced_Locale() {
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
MockServletRequest req = new MockServletRequest();
@@ -56,7 +56,6 @@ public class LocaleTest extends TestCase {
assertEquals("es", locale);
}
- @SuppressWarnings("unchecked")
public void testForcedLangOverridesCookies() {
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
MockServletRequest req = new MockServletRequest();
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletRequest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletRequest.java
index 1d8aa67a7..e9431bf4d 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletRequest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletRequest.java
@@ -51,15 +51,18 @@ public class MockServletRequest implements HttpServletRequest {
}
+ @Override
public String getAuthType() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getContextPath() {
return "/help";
}
+ @Override
public Cookie[] getCookies() {
return cookies;
}
@@ -68,36 +71,43 @@ public class MockServletRequest implements HttpServletRequest {
this.cookies = cookies;
}
+ @Override
public long getDateHeader(String arg0) {
// TODO Auto-generated method stub
return 0;
}
+ @Override
public String getHeader(String arg0) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public Enumeration<String> getHeaderNames() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public Enumeration<String> getHeaders(String arg0) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public int getIntHeader(String arg0) {
// TODO Auto-generated method stub
return 0;
}
+ @Override
public String getMethod() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getPathInfo() {
return pathInfo;
}
@@ -106,125 +116,150 @@ public class MockServletRequest implements HttpServletRequest {
this.pathInfo = info;
}
+ @Override
public String getPathTranslated() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getQueryString() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getRemoteUser() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getRequestURI() {
return "/help/context.jsp";
}
+ @Override
public StringBuffer getRequestURL() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getRequestedSessionId() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getServletPath() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public HttpSession getSession() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public HttpSession getSession(boolean arg0) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public Principal getUserPrincipal() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public boolean isRequestedSessionIdFromCookie() {
// TODO Auto-generated method stub
return false;
}
+ @Override
public boolean isRequestedSessionIdFromURL() {
// TODO Auto-generated method stub
return false;
}
+ @Override
public boolean isRequestedSessionIdFromUrl() {
// TODO Auto-generated method stub
return false;
}
+ @Override
public boolean isRequestedSessionIdValid() {
// TODO Auto-generated method stub
return false;
}
+ @Override
public boolean isUserInRole(String arg0) {
// TODO Auto-generated method stub
return false;
}
+ @Override
public Object getAttribute(String arg0) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public Enumeration<String> getAttributeNames() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getCharacterEncoding() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public int getContentLength() {
// TODO Auto-generated method stub
return 0;
}
+ @Override
public String getContentType() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public ServletInputStream getInputStream() throws IOException {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getLocalAddr() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getLocalName() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public int getLocalPort() {
// TODO Auto-generated method stub
return 0;
}
+ @Override
public Locale getLocale() {
return locale;
}
@@ -234,173 +269,207 @@ public class MockServletRequest implements HttpServletRequest {
}
+ @Override
public Enumeration<Locale> getLocales() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getParameter(String arg0) {
String[] values= parameterMap.get(arg0);
return values != null ? parameterMap.get(arg0)[0] : null;
}
+ @Override
public Map<String, String[]> getParameterMap() {
return parameterMap;
}
+ @Override
public Enumeration<String> getParameterNames() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String[] getParameterValues(String arg0) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getProtocol() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public BufferedReader getReader() throws IOException {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getRealPath(String arg0) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getRemoteAddr() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getRemoteHost() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public int getRemotePort() {
// TODO Auto-generated method stub
return 0;
}
+ @Override
public RequestDispatcher getRequestDispatcher(String arg0) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getScheme() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String getServerName() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public int getServerPort() {
// TODO Auto-generated method stub
return 0;
}
+ @Override
public boolean isSecure() {
// TODO Auto-generated method stub
return false;
}
+ @Override
public void removeAttribute(String arg0) {
// TODO Auto-generated method stub
}
+ @Override
public void setAttribute(String arg0, Object arg1) {
// TODO Auto-generated method stub
}
+ @Override
public void setCharacterEncoding(String arg0)
throws UnsupportedEncodingException {
// TODO Auto-generated method stub
}
+ @Override
public ServletContext getServletContext() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public AsyncContext startAsync() throws IllegalStateException {
// TODO Auto-generated method stub
return null;
}
+ @Override
public AsyncContext startAsync(ServletRequest servletRequest,
ServletResponse servletResponse) throws IllegalStateException {
// TODO Auto-generated method stub
return null;
}
+ @Override
public boolean isAsyncStarted() {
// TODO Auto-generated method stub
return false;
}
+ @Override
public boolean isAsyncSupported() {
// TODO Auto-generated method stub
return false;
}
+ @Override
public AsyncContext getAsyncContext() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public DispatcherType getDispatcherType() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public boolean authenticate(HttpServletResponse response)
throws IOException, ServletException {
// TODO Auto-generated method stub
return false;
}
+ @Override
public void login(String username, String password) throws ServletException {
// TODO Auto-generated method stub
}
+ @Override
public void logout() throws ServletException {
// TODO Auto-generated method stub
}
+ @Override
public Collection<Part> getParts() throws IOException, ServletException {
// TODO Auto-generated method stub
return null;
}
+ @Override
public Part getPart(String name) throws IOException, ServletException {
// TODO Auto-generated method stub
return null;
}
+ @Override
public long getContentLengthLong() {
// TODO Auto-generated method stub
return 0;
}
+ @Override
public String changeSessionId() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public <T extends HttpUpgradeHandler> T upgrade(Class<T> handlerClass) throws IOException, ServletException {
// TODO Auto-generated method stub
return null;
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletResponse.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletResponse.java
index 9bddaf858..caccca667 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletResponse.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/MockServletResponse.java
@@ -31,65 +31,81 @@ public class MockServletResponse implements HttpServletResponse {
private List<Cookie> cookies = new ArrayList<Cookie>();
private String illegalCharactersFound = "";
+ @Override
public String getCharacterEncoding() {
return null;
}
+ @Override
public String getContentType() {
return null;
}
+ @Override
public ServletOutputStream getOutputStream() throws IOException {
return null;
}
+ @Override
public PrintWriter getWriter() throws IOException {
return null;
}
+ @Override
public void setCharacterEncoding(String charset) {
}
+ @Override
public void setContentLength(int len) {
}
+ @Override
public void setContentType(String type) {
}
+ @Override
public void setBufferSize(int size) {
}
+ @Override
public int getBufferSize() {
return 0;
}
+ @Override
public void flushBuffer() throws IOException {
}
+ @Override
public void resetBuffer() {
}
+ @Override
public boolean isCommitted() {
return false;
}
+ @Override
public void reset() {
}
+ @Override
public void setLocale(Locale loc) {
}
+ @Override
public Locale getLocale() {
return null;
}
+ @Override
public void addCookie(Cookie cookie) {
checkForIllegalCharacters(cookie.getValue());
// Replace if it already exists, otherwise set
@@ -119,81 +135,97 @@ public class MockServletResponse implements HttpServletResponse {
return cookies.toArray(new Cookie[cookies.size()]);
}
+ @Override
public boolean containsHeader(String name) {
// TODO Auto-generated method stub
return false;
}
+ @Override
public String encodeURL(String url) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String encodeRedirectURL(String url) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String encodeUrl(String url) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public String encodeRedirectUrl(String url) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public void sendError(int sc, String msg) throws IOException {
// TODO Auto-generated method stub
}
+ @Override
public void sendError(int sc) throws IOException {
// TODO Auto-generated method stub
}
+ @Override
public void sendRedirect(String location) throws IOException {
// TODO Auto-generated method stub
}
+ @Override
public void setDateHeader(String name, long date) {
// TODO Auto-generated method stub
}
+ @Override
public void addDateHeader(String name, long date) {
// TODO Auto-generated method stub
}
+ @Override
public void setHeader(String name, String value) {
// TODO Auto-generated method stub
}
+ @Override
public void addHeader(String name, String value) {
// TODO Auto-generated method stub
}
+ @Override
public void setIntHeader(String name, int value) {
// TODO Auto-generated method stub
}
+ @Override
public void addIntHeader(String name, int value) {
// TODO Auto-generated method stub
}
+ @Override
public void setStatus(int sc) {
// TODO Auto-generated method stub
}
+ @Override
public void setStatus(int sc, String sm) {
// TODO Auto-generated method stub
@@ -203,26 +235,31 @@ public class MockServletResponse implements HttpServletResponse {
return illegalCharactersFound;
}
+ @Override
public int getStatus() {
// TODO Auto-generated method stub
return 0;
}
+ @Override
public String getHeader(String name) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public Collection<String> getHeaders(String name) {
// TODO Auto-generated method stub
return null;
}
+ @Override
public Collection<String> getHeaderNames() {
// TODO Auto-generated method stub
return null;
}
+ @Override
public void setContentLengthLong(long len) {
// TODO Auto-generated method stub
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ParallelServerAccessTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ParallelServerAccessTest.java
index 5d9eb5a04..23c60442e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ParallelServerAccessTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ParallelServerAccessTest.java
@@ -36,10 +36,12 @@ public class ParallelServerAccessTest extends TestCase {
return new TestSuite(ParallelServerAccessTest.class);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
}
+ @Override
protected void tearDown() throws Exception {
LoadServletUtil.stopServer();
}
@@ -91,6 +93,7 @@ public class ParallelServerAccessTest extends TestCase {
public Exception exception;
+ @Override
public void run() {
for (int j = 0; j <= 100; j++) {
try {
@@ -113,6 +116,7 @@ public class ParallelServerAccessTest extends TestCase {
this.actual = actual;
}
+ @Override
public String getMessage() {
return "Expected: " + expected +" Actual: " + actual;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/RestrictedTopicParameter.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/RestrictedTopicParameter.java
index a4390aac9..dd486b4eb 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/RestrictedTopicParameter.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/RestrictedTopicParameter.java
@@ -30,6 +30,7 @@ public class RestrictedTopicParameter extends TestCase {
private boolean restrictTopic;
private int helpMode;
+ @Override
protected void setUp() throws Exception {
restrictTopic = Platform.getPreferencesService().getBoolean
(HelpBasePlugin.PLUGIN_ID, RESTRICT_TOPIC,
@@ -37,6 +38,7 @@ public class RestrictedTopicParameter extends TestCase {
helpMode = BaseHelpSystem.getMode();
}
+ @Override
protected void tearDown() throws Exception {
setRestrictTopic(restrictTopic);
BaseHelpSystem.setMode(helpMode);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/TocZipTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/TocZipTest.java
index f1c66018a..f5407f333 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/TocZipTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/TocZipTest.java
@@ -28,6 +28,7 @@ import org.eclipse.help.internal.server.WebappManager;
*/
public class TocZipTest extends TestCase {
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/AdvancedSearchServiceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/AdvancedSearchServiceTest.java
index 36d288891..9e55ba6ef 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/AdvancedSearchServiceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/AdvancedSearchServiceTest.java
@@ -20,6 +20,7 @@ import org.w3c.dom.Node;
public class AdvancedSearchServiceTest extends SearchServletTest {
+ @Override
protected Node[] getSearchHitsFromServlet(String searchWord)
throws Exception {
int port = WebappManager.getPort();
@@ -27,6 +28,7 @@ public class AdvancedSearchServiceTest extends SearchServletTest {
return makeServletCall(url);
}
+ @Override
protected Node[] getSearchHitsUsingLocale(String searchWord, String locale)
throws Exception {
int port = WebappManager.getPort();
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ContentServiceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ContentServiceTest.java
index 96264b8dc..0df5b7759 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ContentServiceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ContentServiceTest.java
@@ -18,6 +18,7 @@ public class ContentServiceTest extends ContentServletTest {
private static final String UA_TESTS = "org.eclipse.ua.tests";
+ @Override
public void testSimpleContent() throws Exception {
final String path = "/data/help/index/topic1.html";
String remoteContent = ServicesTestUtils.getRemoteContent(UA_TESTS, path, "en");
@@ -25,6 +26,7 @@ public class ContentServiceTest extends ContentServletTest {
assertEquals(remoteContent, localContent);
}
+ @Override
public void testFilteredContent() throws Exception {
final String path = "/data/help/manual/filter.xhtml";
String remoteContent = ServicesTestUtils.getRemoteContent(UA_TESTS, path, "en");
@@ -32,6 +34,7 @@ public class ContentServiceTest extends ContentServletTest {
assertEquals(remoteContent, localContent);
}
+ @Override
public void testContentInEnLocale() throws Exception {
final String path = "/data/help/search/testnl1.xhtml";
String remoteContent = ServicesTestUtils.getRemoteContent(UA_TESTS, path, "en");
@@ -39,6 +42,7 @@ public class ContentServiceTest extends ContentServletTest {
assertEquals(remoteContent, localContent);
}
+ @Override
public void testContentInDeLocale() throws Exception {
final String path = "/data/help/search/testnl1.xhtml";
String remoteContent = ServicesTestUtils.getRemoteContent(UA_TESTS, path, "de");
@@ -48,6 +52,7 @@ public class ContentServiceTest extends ContentServletTest {
assertFalse(remoteContent.equals(enLocalContent));
}
+ @Override
public void testRemoteContentNotFound() throws Exception {
try {
ServicesTestUtils.getRemoteContent(UA_TESTS, "/no/such/path.html", "en");
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ContextServiceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ContextServiceTest.java
index 08d681832..1a428734a 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ContextServiceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ContextServiceTest.java
@@ -19,6 +19,7 @@ import org.w3c.dom.Element;
public class ContextServiceTest extends ContextServletTest {
+ @Override
protected Element[] getContextsFromServlet(String phrase)
throws Exception {
int port = WebappManager.getPort();
@@ -27,6 +28,7 @@ public class ContextServiceTest extends ContextServletTest {
return makeServletCall(url);
}
+ @Override
protected Element[] getContextsUsingLocale(String phrase, String locale)
throws Exception {
int port = WebappManager.getPort();
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ExtensionServiceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ExtensionServiceTest.java
index 0000efc5c..a28701a73 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ExtensionServiceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ExtensionServiceTest.java
@@ -34,12 +34,14 @@ public class ExtensionServiceTest extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(mode);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/IndexFragmentServiceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/IndexFragmentServiceTest.java
index e488d07b3..e6841ee13 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/IndexFragmentServiceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/IndexFragmentServiceTest.java
@@ -30,12 +30,14 @@ public class IndexFragmentServiceTest extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(mode);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/IndexServiceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/IndexServiceTest.java
index 29589fee6..33b2e8474 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/IndexServiceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/IndexServiceTest.java
@@ -25,6 +25,7 @@ import org.xml.sax.InputSource;
public class IndexServiceTest extends IndexServletTest {
+ @Override
protected Node getIndexContributions( String locale)
throws Exception {
int port = WebappManager.getPort();
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/SearchServiceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/SearchServiceTest.java
index 8965169a5..ad0660559 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/SearchServiceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/SearchServiceTest.java
@@ -20,6 +20,7 @@ import org.w3c.dom.Node;
public class SearchServiceTest extends SearchServletTest {
+ @Override
protected Node[] getSearchHitsFromServlet(String phrase)
throws Exception {
int port = WebappManager.getPort();
@@ -27,6 +28,7 @@ public class SearchServiceTest extends SearchServletTest {
return makeServletCall(url);
}
+ @Override
protected Node[] getSearchHitsUsingLocale(String phrase, String locale)
throws Exception {
int port = WebappManager.getPort();
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocFragmentServiceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocFragmentServiceTest.java
index 68e7a61c9..8fa0bbd77 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocFragmentServiceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocFragmentServiceTest.java
@@ -36,12 +36,14 @@ public class TocFragmentServiceTest extends TestCase {
private int mode;
+ @Override
protected void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
mode = BaseHelpSystem.getMode();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
+ @Override
protected void tearDown() throws Exception {
BaseHelpSystem.setMode(mode);
}
@@ -98,9 +100,9 @@ public class TocFragmentServiceTest extends TestCase {
private int findUATopicIndex(String title, String locale) {
int index = -1;
Toc[] tocs = HelpPlugin.getTocManager().getTocs(locale);
- for (int i = 0; i < tocs.length; i++) {
- if ("/org.eclipse.ua.tests/data/help/toc/root.xml".equals(tocs[i].getHref())) {
- ITopic[] topics = tocs[i].getTopics();
+ for (Toc toc : tocs) {
+ if ("/org.eclipse.ua.tests/data/help/toc/root.xml".equals(toc.getHref())) {
+ ITopic[] topics = toc.getTopics();
for (int j = 0; j < topics.length; j++) {
if (title.equals(topics[j].getLabel())) {
index = j;
@@ -152,7 +154,7 @@ public class TocFragmentServiceTest extends TestCase {
}
}
}
- return (Element[]) results.toArray(new Element[results.size()]);
+ return results.toArray(new Element[results.size()]);
}
/*
@@ -180,7 +182,7 @@ public class TocFragmentServiceTest extends TestCase {
}
}
}
- return (Element[]) results.toArray(new Element[results.size()]);
+ return results.toArray(new Element[results.size()]);
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocServiceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocServiceTest.java
index 6f905bd07..2aee7d79a 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocServiceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocServiceTest.java
@@ -25,6 +25,7 @@ import org.xml.sax.InputSource;
public class TocServiceTest extends TocServletTest {
+ @Override
protected Node getTocContributions( String locale)
throws Exception {
int port = WebappManager.getPort();
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestFrame.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestFrame.java
index bf07d3b5e..cb1ff86a4 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestFrame.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestFrame.java
@@ -17,22 +17,27 @@ import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
public class TestFrame extends AbstractFrame {
+ @Override
public String getName() {
return "testFrame";
}
+ @Override
public String getURL() {
return "/titlesearch/jsp/advanced/testFrame.jsp";
}
+ @Override
public int getLocation() {
return AbstractFrame.BELOW_CONTENT;
}
+ @Override
public String getSize() {
return "24";
}
+ @Override
public boolean isVisible() {
return Platform.getPreferencesService().getBoolean
(UserAssistanceTestPlugin.getPluginId(), "extraFrame", false, null);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestHelpToolbarFrame.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestHelpToolbarFrame.java
index 593c21460..2dbc46910 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestHelpToolbarFrame.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestHelpToolbarFrame.java
@@ -17,26 +17,32 @@ import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
public class TestHelpToolbarFrame extends AbstractFrame {
+ @Override
public String getName() {
return "testHelpToolbarFrame";
}
+ @Override
public String getURL() {
return "/titlesearch/jsp/advanced/testHelpToolbarFrame.jsp";
}
+ @Override
public int getLocation() {
return AbstractFrame.HELP_TOOLBAR;
}
+ @Override
public String getSize() {
return "*";
}
- public String getFrameAttributes() {
+ @Override
+ public String getFrameAttributes() {
return "\"marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"no\""; //$NON-NLS-1$
}
+ @Override
public boolean isVisible() {
return Platform.getPreferencesService().getBoolean
(UserAssistanceTestPlugin.getPluginId(), "extraFrame", false, null);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchButton.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchButton.java
index 69a1072a7..3b5914b92 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchButton.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchButton.java
@@ -19,18 +19,22 @@ import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
public class TitleSearchButton extends AbstractButton {
+ @Override
public String getAction() {
return "toggleTitleView";
}
+ @Override
public String getId() {
return "tsearch";
}
+ @Override
public String getImageURL() {
return "/titlesearch/icons/sample3.gif";
}
+ @Override
public String getTooltip(Locale locale) {
if ("es".equals(locale.getLanguage())) {
return "Muestre busque en titulos";
@@ -38,10 +42,12 @@ public class TitleSearchButton extends AbstractButton {
return "Show Search Topic Title";
}
+ @Override
public String getJavaScriptURL() {
return "/titlesearch/script/titlesearch.js";
}
+ @Override
public boolean isAddedToToolbar(String toolbarName) {
boolean addButton = Platform.getPreferencesService().getBoolean
(UserAssistanceTestPlugin.getPluginId(), "extraButton", false, null);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchData.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchData.java
index f6514570f..88d67d180 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchData.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchData.java
@@ -41,10 +41,10 @@ public SearchResult[] getSearchResults() {
results = new ArrayList<SearchResult>();
searchTerm = request.getParameter("searchWord");
IToc[] tocs = getTocs();
- for (int i = 0; i < tocs.length; i++) {
- ITopic[] topics = tocs[i].getTopics();
- for (int t = 0; t < topics.length; t++) {
- searchTopic(topics[t]);
+ for (IToc toc : tocs) {
+ ITopic[] topics = toc.getTopics();
+ for (ITopic topic : topics) {
+ searchTopic(topic);
}
}
return results.toArray(new SearchResult[results.size()]);
@@ -59,8 +59,8 @@ private void searchTopic(ITopic topic) {
results.add(result);
}
ITopic[] topics = topic.getSubtopics();
- for (int t = 0; t < topics.length; t++) {
- searchTopic(topics[t]);
+ for (ITopic topic2 : topics) {
+ searchTopic(topic2);
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchView.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchView.java
index 48e36ce41..6446f48a1 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchView.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchView.java
@@ -19,18 +19,22 @@ import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
public class TitleSearchView extends AbstractView {
+ @Override
public String getImageURL() {
return "/titlesearch/icons/sample3.gif";
}
+ @Override
public char getKey() {
return 0;
}
+ @Override
public String getName() {
return "titlesearch";
}
+ @Override
public String getTitle(Locale locale) {
if ("es".equals(locale.getLanguage())) {
return "Busque en titulos";
@@ -38,19 +42,23 @@ public class TitleSearchView extends AbstractView {
return "Search Topic Title";
}
+ @Override
public String getURL() {
return "/titlesearch/jsp/advanced/";
}
+ @Override
public String getBasicURL() {
return "/titlesearch/jsp/basic/";
}
+ @Override
public boolean isVisible() {
return Platform.getPreferencesService().getBoolean
(UserAssistanceTestPlugin.getPluginId(), "extraView", false, null);
}
+ @Override
public boolean isVisibleBasic() {
return Platform.getPreferencesService().getBoolean
(UserAssistanceTestPlugin.getPluginId(), "extraView", false, null);
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 9f1cdb198..a22e4848b 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
@@ -90,8 +90,8 @@ public class ExtensionReorderingTest extends TestCase {
private String toString(int[] order) {
String result = "";
- for (int i = 0; i < order.length; i++) {
- result = result + order[i];
+ for (int element : order) {
+ result = result + element;
}
return result;
}
@@ -149,12 +149,12 @@ public class ExtensionReorderingTest extends TestCase {
// find all configs with given attribute and attribute value.
Vector<IConfigurationElement> elements = new Vector<IConfigurationElement>();
- for (int i = 0; i < configElements.length; i++) {
- String currentAttributeValue = configElements[i]
+ for (IConfigurationElement configElement : configElements) {
+ String currentAttributeValue = configElement
.getAttribute(attributeName);
if (currentAttributeValue != null
&& currentAttributeValue.equals(attributeValue))
- elements.add(configElements[i]);
+ elements.add(configElement);
}
// now return array.
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java
index 841a792eb..1c99fcd17 100644
--- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/contentdetect/ContentDetectorTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,7 +18,6 @@ import junit.framework.Test;
import junit.framework.TestCase;
import org.eclipse.test.OrderedTestSuite;
-
import org.eclipse.ui.internal.intro.impl.model.ExtensionMap;
import org.eclipse.ui.internal.intro.universal.contentdetect.ContentDetectHelper;
import org.eclipse.ui.internal.intro.universal.contentdetect.ContentDetector;
@@ -62,8 +61,7 @@ public class ContentDetectorTest extends TestCase {
contributors.add("two");
contributors.add("three");
helper.saveContributors(contributors);
- @SuppressWarnings("unchecked")
- Set<String> savedContributors = helper.getContributors();
+ Set<?> savedContributors = helper.getContributors();
assertTrue(savedContributors.size() == 3);
assertTrue(savedContributors.contains("one"));
assertTrue(savedContributors.contains("two"));
@@ -81,7 +79,7 @@ public class ContentDetectorTest extends TestCase {
previous.add("five");
previous.add("two");
previous.add("one");
- Set newContributors = helper.findNewContributors(contributors, previous);
+ Set<?> newContributors = helper.findNewContributors(contributors, previous);
assertTrue(newContributors.size() == 2);
assertTrue(newContributors.contains("four"));
assertTrue(newContributors.contains("three"));
@@ -94,7 +92,7 @@ public class ContentDetectorTest extends TestCase {
assertEquals(ContentDetectHelper.NO_STATE, helper.getExtensionCount());
ContentDetector detector = new ContentDetector();
assertFalse(detector.isNewContentAvailable());
- Set newContent = ContentDetector.getNewContributors();
+ Set<?> newContent = ContentDetector.getNewContributors();
assertTrue(newContent == null || newContent.size() == 0);
String firstContribution = (String) helper.getContributors().iterator().next();
assertFalse(ContentDetector.isNew(firstContribution));
@@ -113,9 +111,8 @@ public class ContentDetectorTest extends TestCase {
assertFalse(detector.isNewContentAvailable());
// Make the first extension appear new
helper.saveExtensionCount(extensionCount - 1);
- @SuppressWarnings("unchecked")
- Set<String> contributors = helper.getContributors();
- String firstContribution = contributors.iterator().next();
+ Set<?> contributors = helper.getContributors();
+ String firstContribution = (String) contributors.iterator().next();
String copyOfFirstContribution = "" + firstContribution;
contributors.remove(firstContribution);
helper.saveContributors(contributors);
@@ -159,6 +156,7 @@ public class ContentDetectorTest extends TestCase {
assertNull(map.getStartPage());
}
+ @Override
protected void finalize() throws Throwable {
// Delete state files so that if we start Eclipse we don't see all content as new
ContentDetectHelper helper = new ContentDetectHelper();
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/parser/ValidTest.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/parser/ValidTest.java
index d39e3b636..bc571d3dc 100644
--- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/parser/ValidTest.java
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/parser/ValidTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,25 +13,23 @@ package org.eclipse.ua.tests.intro.parser;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
+import java.util.Map.Entry;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.junit.Assert;
-import org.osgi.framework.Bundle;
-
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.help.ui.internal.HelpUIPlugin;
import org.eclipse.ua.tests.intro.util.IntroModelSerializer;
import org.eclipse.ua.tests.intro.util.IntroModelSerializerTest;
import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
import org.eclipse.ua.tests.util.FileUtil;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-
import org.eclipse.ui.internal.intro.impl.model.IntroModelRoot;
import org.eclipse.ui.internal.intro.impl.model.loader.ExtensionPointManager;
+import org.junit.Assert;
+import org.osgi.framework.Bundle;
/*
* Tests the intro parser on valid intro content.
@@ -49,6 +47,7 @@ public class ValidTest extends TestCase {
* Ensure that org.eclipse.help.ui is started. It contributes extra content
* filtering that is used by this test. See UIContentFilterProcessor.
*/
+ @Override
protected void setUp() throws Exception {
HelpUIPlugin.getDefault();
}
@@ -81,13 +80,13 @@ public class ValidTest extends TestCase {
*/
private void singleConfigTest(String configId) throws IOException {
IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.ui.intro.config");
- for (int i=0;i<elements.length;++i) {
+ for (IConfigurationElement element : elements) {
/*
* Only use the ones from this test plugin.
*/
- if (elements[i].getDeclaringExtension().getContributor().getName().equals(UserAssistanceTestPlugin.getDefault().getBundle().getSymbolicName())) {
- String content = elements[i].getAttribute("content");
- String id = elements[i].getAttribute("id");
+ if (element.getDeclaringExtension().getContributor().getName().equals(UserAssistanceTestPlugin.getDefault().getBundle().getSymbolicName())) {
+ String content = element.getAttribute("content");
+ String id = element.getAttribute("id");
if (id.equals(configId)) {
for (int x = 0; x < 10; x++) {
// Perform 10 times to better detect intermittent ordering bugs
@@ -100,14 +99,14 @@ public class ValidTest extends TestCase {
String actual = serializer.toString();
Assert.assertEquals("The model parsed for intro did not match the expected result for: " + id, expected, actual);
- Map map = IntroModelSerializerTest.getXHTMLFiles(model);
- Iterator iter = map.entrySet().iterator();
+ Map<String, String> map = IntroModelSerializerTest.getXHTMLFiles(model);
+ Iterator<Entry<String, String>> iter = map.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
- String relativePath = (String)entry.getKey();
+ Entry<String, String> entry = iter.next();
+ String relativePath = entry.getKey();
expected = FileUtil.getContents(bundle, FileUtil.getResultFile(relativePath));
- actual = (String)entry.getValue();
+ actual = entry.getValue();
Assert.assertEquals("The XHTML generated for intro did not match the expected result for: " + relativePath, expected, actual);
}
}
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 3173e8ff9..3637c142c 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
@@ -36,6 +36,7 @@ public class OpenIntroTest extends PerformanceTestCase {
/* (non-Javadoc)
* @see org.eclipse.test.performance.PerformanceTestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
closeIntro();
@@ -47,6 +48,7 @@ public class OpenIntroTest extends PerformanceTestCase {
/* (non-Javadoc)
* @see org.eclipse.test.performance.PerformanceTestCase#tearDown()
*/
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
closeIntro();
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 8f449f3dc..3b8a1ea2e 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation and others.
+ * Copyright (c) 2004, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -104,29 +104,28 @@ public class IntroModelSerializer {
printPageStyles(rootPage, text);
}
- @SuppressWarnings("unchecked")
private void printPageStyles(AbstractIntroPage page, StringBuffer text) {
text.append("\n\tpage styles are = "); //$NON-NLS-1$
String[] styles = page.getStyles();
- for (int i = 0; i < styles.length; i++)
- text.append(filterURL(styles[i] + "\n\t\t\t")); //$NON-NLS-1$
+ 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$
- final Hashtable altStylesHashtable = page.getAltStyles();
+ final Hashtable<String, Bundle> altStylesHashtable = page.getAltStyles();
if (altStylesHashtable == null)
return;
- Set set = altStylesHashtable.keySet();
+ Set<String> set = altStylesHashtable.keySet();
String[] sorted = new String[set.size()];
set.toArray(sorted);
for (int i=0;i<sorted.length;++i) {
- Bundle bundle = (Bundle) altStylesHashtable.get(sorted[i]);
+ Bundle bundle = altStylesHashtable.get(sorted[i]);
sorted[i] = filterURL(sorted[i]) + " from " + bundle.getSymbolicName(); //$NON-NLS-1$
}
Arrays.sort(sorted);
- for (int i=0;i<sorted.length;++i) {
- text.append(sorted[i] + "\n\t\t"); //$NON-NLS-1$
+ for (String element : sorted) {
+ text.append(element + "\n\t\t"); //$NON-NLS-1$
}
}
@@ -142,41 +141,41 @@ public class IntroModelSerializer {
StringBuffer text, String indent) {
AbstractIntroElement[] children = container.getChildren();
- for (int i = 0; i < children.length; i++) {
- int childType = children[i].getType();
+ for (AbstractIntroElement element : children) {
+ int childType = element.getType();
switch (childType) {
case AbstractIntroElement.ELEMENT:
text.append("SHOULD NEVER BE HERE"); //$NON-NLS-1$
break;
case AbstractIntroElement.GROUP:
- printGroup(text, (IntroGroup) children[i], indent);
+ printGroup(text, (IntroGroup) element, indent);
break;
case AbstractIntroElement.LINK:
- printLink(text, (IntroLink) children[i], indent);
+ printLink(text, (IntroLink) element, indent);
break;
case AbstractIntroElement.TEXT:
- printText(text, (IntroText) children[i], indent);
+ printText(text, (IntroText) element, indent);
break;
case AbstractIntroElement.IMAGE:
- printImage(text, (IntroImage) children[i], indent);
+ printImage(text, (IntroImage) element, indent);
break;
case AbstractIntroElement.HTML:
- printHtml(text, (IntroHTML) children[i], indent);
+ printHtml(text, (IntroHTML) element, indent);
break;
case AbstractIntroElement.INCLUDE:
- printInclude(text, (IntroInclude) children[i], indent);
+ printInclude(text, (IntroInclude) element, indent);
break;
case AbstractIntroElement.HEAD:
- printHead(text, (IntroHead) children[i], indent);
+ printHead(text, (IntroHead) element, indent);
break;
case AbstractIntroElement.PAGE_TITLE:
- printPageTitle(text, (IntroPageTitle) children[i], indent);
+ printPageTitle(text, (IntroPageTitle) element, indent);
break;
case AbstractIntroElement.ANCHOR:
- printAnchor(text, (IntroAnchor) children[i], indent);
+ printAnchor(text, (IntroAnchor) element, indent);
break;
case AbstractIntroElement.CONTENT_PROVIDER:
- printContentProvidor(text, (IntroContentProvider) children[i],
+ printContentProvidor(text, (IntroContentProvider) element,
indent);
break;
@@ -272,15 +271,15 @@ public class IntroModelSerializer {
* @param text
*/
private void printPages(IntroPage[] pages, StringBuffer text) {
- for (int i = 0; i < pages.length; i++) {
- text.append("\n\nPAGE id = " + pages[i].getId()); //$NON-NLS-1$
+ for (IntroPage page : pages) {
+ text.append("\n\nPAGE id = " + page.getId()); //$NON-NLS-1$
text.append("\n----------"); //$NON-NLS-1$
- text.append("\n\ttitle = " + pages[i].getTitle()); //$NON-NLS-1$
- text.append("\n\tstyle = " + filterURL(pages[i].getStyle())); //$NON-NLS-1$
- text.append("\n\talt-style = " + filterURL(pages[i].getAltStyle())); //$NON-NLS-1$
- text.append("\n\tstyle-id = " + pages[i].getStyleId()); //$NON-NLS-1$
- printPageStyles(pages[i], text);
- printPageChildren(pages[i], text);
+ text.append("\n\ttitle = " + page.getTitle()); //$NON-NLS-1$
+ text.append("\n\tstyle = " + filterURL(page.getStyle())); //$NON-NLS-1$
+ text.append("\n\talt-style = " + filterURL(page.getAltStyle())); //$NON-NLS-1$
+ text.append("\n\tstyle-id = " + page.getStyleId()); //$NON-NLS-1$
+ printPageStyles(page, text);
+ printPageChildren(page, text);
}
}
@@ -353,7 +352,8 @@ public class IntroModelSerializer {
/**
* @return Returns the textUI.
*/
- public String toString() {
+ @Override
+ public String toString() {
return buffer.toString();
}
}
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializerTest.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializerTest.java
index 417505d8b..0a167ac0a 100644
--- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializerTest.java
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializerTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -69,6 +69,7 @@ public class IntroModelSerializerTest extends TestCase {
* content filtering that is used by this test. See
* UIContentFilterProcessor.
*/
+ @Override
protected void setUp() throws Exception {
HelpUIPlugin.getDefault();
}
@@ -78,14 +79,14 @@ public class IntroModelSerializerTest extends TestCase {
* Serialize the test intros.
*/
IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.ui.intro.config");
- for (int i=0;i<elements.length;++i) {
+ for (IConfigurationElement element : elements) {
/*
* Only use the ones from this test plugin.
*/
- if (elements[i].getDeclaringExtension().getContributor().getName().equals(UserAssistanceTestPlugin.getDefault().getBundle().getSymbolicName())) {
+ if (element.getDeclaringExtension().getContributor().getName().equals(UserAssistanceTestPlugin.getDefault().getBundle().getSymbolicName())) {
String pluginRoot = UserAssistanceTestPlugin.getDefault().getBundle().getLocation().substring("update@".length());
- String content = elements[i].getAttribute("content");
- String id = elements[i].getAttribute("id");
+ String content = element.getAttribute("content");
+ String id = element.getAttribute("id");
/*
* First do the intro XML files.
@@ -102,13 +103,13 @@ public class IntroModelSerializerTest extends TestCase {
* Now do the intro XHTML files. Find all the XHTML files
* referenced from the model.
*/
- Map map = getXHTMLFiles(model);
- Iterator iter = map.entrySet().iterator();
+ Map<String, String> map = getXHTMLFiles(model);
+ Iterator<Map.Entry<String, String>> iter = map.entrySet().iterator();
while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
+ Map.Entry<String, String> entry = iter.next();
file = FileUtil.getResultFile(pluginRoot + entry.getKey());
out = new PrintWriter(new FileOutputStream(file));
- out.print((String)entry.getValue());
+ out.print(entry.getValue());
out.close();
}
}
@@ -121,18 +122,17 @@ public class IntroModelSerializerTest extends TestCase {
* mapping of filenames relative to the test plugin to Strings, the
* contents of the XHTML files.
*/
- @SuppressWarnings("unchecked")
- public static Map getXHTMLFiles(IntroModelRoot model) {
- Map map = new HashMap();
+ public static Map<String, String> getXHTMLFiles(IntroModelRoot model) {
+ Map<String, String> map = new HashMap<String, String>();
Collection<AbstractIntroPage> pages = new ArrayList<AbstractIntroPage>();
IntroHomePage home = model.getRootPage();
if (home.isXHTMLPage()) {
pages.add(home);
}
IntroPage[] otherPages = model.getPages();
- for (int i=0;i<otherPages.length;++i) {
- if (otherPages[i].isXHTMLPage()) {
- pages.add(otherPages[i]);
+ for (IntroPage otherPage : otherPages) {
+ if (otherPage.isXHTMLPage()) {
+ pages.add(otherPage);
}
}
Iterator<AbstractIntroPage> iter = pages.iterator();
@@ -140,6 +140,7 @@ public class IntroModelSerializerTest extends TestCase {
AbstractIntroPage page = iter.next();
BrowserIntroPartImplementation impl = new BrowserIntroPartImplementation();
String xhtml = impl.generateXHTMLPage(page, new IIntroContentProviderSite() {
+ @Override
public void reflow(IIntroContentProvider provider, boolean incremental) {
// dummy site
}

Back to the top