Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java10
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java16
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/IHelpBaseConstants.java4
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/MissingContentManager.java32
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/HttpsUtility.java4
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/PreferenceFileHandler.java16
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteContextProvider.java2
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteIC.java62
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteTocProvider.java6
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/CriteriaHelpScope.java2
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/ScopeUtils.java6
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/WorkingSetScope.java6
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/util/CriteriaUtilities.java34
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IndexUtils.java2
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java2
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/protocols/HelpURLConnection.java24
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java2
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/LimitedSizeCharArrayWriter.java16
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/LocalSearchManager.java2
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java6
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java2
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java2
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java6
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/XHTMLSearchParticipant.java42
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/search/federated/IndexerJob.java4
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/server/JettyHelpServer.java2
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/server/WebappManager.java20
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/validation/TocValidator.java2
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/server/HelpServer.java6
-rw-r--r--org.eclipse.help.base/src_ant/org/eclipse/help/internal/base/ant/BuildHelpIndex.java4
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/RootScopePage.java4
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ContextHelpDialog.java4
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java14
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DynamicHelpAction.java14
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ExecuteCommandAction.java8
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.java8
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/SearchAction.java14
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/embedded/EmbeddedBrowser.java2
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/embedded/EmbeddedBrowserAdapter.java4
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/handlers/ShowIndexHandler.java8
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentPreferencePage.java8
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpPreferencePage.java34
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICButtons.java8
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICDialog.java2
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICTable.java30
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpCriteriaContentProvider.java2
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/InfoCenterSearchScopeFactory.java46
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/LocalHelpPage.java24
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/LocalSearchScopeFactory.java18
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/WebSearchScopeFactory.java18
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/FontUtils.java2
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BrowserPart.java10
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java44
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpSorter.java6
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineTypeDescriptor.java2
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineTypeWizardPage.java2
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/FederatedSearchSorter.java12
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpView.java26
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HyperlinkTreePart.java6
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexPart.java2
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/LocalScopeDialog.java10
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/MissingContentPart.java12
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RelatedTopicsPart.java30
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RenameDialog.java36
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java16
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopePreferenceManager.java32
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSelectPart.java4
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSetDialog.java144
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchPart.java2
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchResultsPart.java14
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SeeAlsoPart.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/StatusProducer.java16
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/CookiesData.java14
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/EnabledTopicUtils.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/IconFinder.java8
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/LayoutData.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/PrintData.java30
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/RequestScope.java22
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ScopeSavingSearchData.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java32
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServerState.java6
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServletResources.java4
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TocData.java120
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ToolbarData.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/TopicFinder.java26
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/UrlUtil.java52
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/View.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/WorkingSetData.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AboutService.java14
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/service/AdvancedSearchService.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/BreadcrumbsFilter.java4
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ChildLinkInserter.java16
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/CookieUtil.java14
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/EclipseConnector.java62
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ExtraFilters.java2
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FilterHTMLHeadAndBodyOutputStream.java10
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/FramesetFilter.java4
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java50
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InfocenterWorkingSetManager.java6
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/InjectionFilter.java4
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/NavServlet.java28
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootFilter.java4
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PluginsRootResolvingStream.java194
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/PreferenceWriter.java64
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/ServletPrintWriter.java100
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/TocFragmentServlet.java74
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractButton.java192
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractFrame.java66
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractView.java104
-rw-r--r--org.eclipse.help/src/org/eclipse/help/ICriterionDefinition.java36
-rw-r--r--org.eclipse.help/src/org/eclipse/help/ICriterionValueDefinition.java24
-rw-r--r--org.eclipse.help/src/org/eclipse/help/IIndexEntry.java36
-rw-r--r--org.eclipse.help/src/org/eclipse/help/IIndexEntry2.java12
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/CachedEntityResolver.java36
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/HelpData.java16
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/UAElement.java30
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/Context.java8
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java16
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionDocumentReader.java2
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFile.java56
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFileParser.java12
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFileProvider.java18
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionManager.java4
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/criteria/CriterionResource.java4
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/dynamic/DocumentReader.java2
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/dynamic/DocumentWriter.java34
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/entityresolver/LocalEntityResolver.java20
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java12
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java8
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexDocumentReader.java2
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexFile.java56
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileParser.java4
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java18
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java4
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexSee.java8
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java10
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java2
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java2
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java4
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocSorter.java2
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TopicSorter.java4
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java8
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java2
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java2
-rw-r--r--org.eclipse.ua.tests.doc/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.ua.tests.doc/pom.xml2
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckLinkAction.java6
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/CheckTocAction.java12
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/actions/LoadTocAction.java22
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/dialogs/SelectTocDialog.java2
-rw-r--r--org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/OnLoadFilter.java70
-rw-r--r--org.eclipse.ua.tests/base/org/eclipse/ua/tests/AllPerformanceTests.java2
-rw-r--r--org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/UATestContentProducer.java2
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestCompositeParser.java4
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestMarkupParser.java4
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestPersistence.java142
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestSuccessors.java2
-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/TestCommandExecution.java12
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCategories.java2
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestCheatSheetCollection.java16
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/other/TestStatePersistence.java40
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/InvalidCheatsheet.java4
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/NoError.java4
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/ParseFromString.java8
-rw-r--r--org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/util/MockTaskEditor.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/ParseTocWithCriteria.java110
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/criteria/TestCriteriaProvider.java58
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java30
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ConcurrentTocAccess.java20
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextMergeTest.java18
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextTest.java130
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/DocumentReaderTest.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/EntityResolutionTest.java42
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexEntryTest.java42
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/IndexSeeTest.java64
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/TocObjectTest.java32
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/TopicTest.java12
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UAElementTest.java10
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionDefinition.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UserCriterionValueDefinition.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/performance/HelpServerTest.java12
-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.java12
-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/HelpDataTest.java18
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ContentServletTest.java10
-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.java62
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/GetContextUsingRemoteHelp.java8
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/IndexServletTest.java22
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadIndexUsingRemoteHelp.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/LoadTocUsingRemoteHelp.java10
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockContentServlet.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockSearchServlet.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/MockTocServlet.java10
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchServletTest.java14
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/ParallelSearchUsingRemote.java8
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemotePreferenceStore.java54
-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.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/SearchUsingRemoteHelp.java24
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TestServerManager.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TocServletTest.java44
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/IntersectionTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/UnionTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/AnalyzerTest.java106
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/BasicTest.java64
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/EncodedCharacterSearch.java32
-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.java32
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LocaleTest.java160
-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.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/WildcardTest.java62
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/WorkingSetManagerTest.java18
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/EnabledTopicTest.java36
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/HelpData.java24
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocSortingTest.java10
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TopicFinderTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/DocumentCreator.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/LoadTestServlet.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ParallelTestSupport.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ChildLinkInsertion.java56
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterOne.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterThree.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/CommentFilterTwo.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterExtensionTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterTest.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerBinding.java20
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/ParallelServerAccessTest.java10
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/PluginsRootReplacement.java22
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/RestrictedTopicParameter.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/UrlCoderTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/UrlUtilsTests.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ContentServiceTest.java10
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/ExtensionServiceTest.java10
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocFragmentServiceTest.java18
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TestFrame.java2
-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.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webextension/TitleSearchView.java4
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/anchors/ExtensionReorderingTest.java118
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java8
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java560
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/ICheatSheetEvent.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatsheetSearchParticipant.java14
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java8
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ConfirmRestartDialog.java2
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ResetTaskAction.java2
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/RestartAllAction.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/SkipAction.java2
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java8
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeLabelProvider.java28
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/AbstractTask.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java16
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java34
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetSaveHelper.java30
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/SuccesorTaskFinder.java28
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskChoiceCompletionStrategy.java20
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java6
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskGroup.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskSetCompletionStrategy.java22
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskStateUtilities.java16
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java36
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/EditableTaskParseStrategy.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ICompositeCheatsheetTags.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java2
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/TaskGroupParseStrategy.java6
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java86
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java26
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java2
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java10
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java6
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java24
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java12
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IncompatibleSiblingChecker.java28
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java68
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java2
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java20
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/TrayStateManager.java4
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetManager.java36
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java10
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java58
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java52
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java28
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java16
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java24
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java16
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IUniversalIntroConstants.java88
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java76
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/Messages.java12
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java212
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java2
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java16
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java6
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java422
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java220
-rw-r--r--org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java8
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/FontSelection.java32
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IIntroConstants.java68
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IntroPlugin.java276
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/Messages.java70
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLUtil.java292
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IIntroHTMLConstants.java126
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java8
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractBaseIntroElement.java134
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroContainer.java1210
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroElement.java832
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroIdElement.java50
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java1652
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPartImplementation.java676
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractTextElement.java58
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/ExtensionMap.java2
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/History.java482
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroAnchor.java20
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroContentProvider.java60
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java380
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroGroup.java190
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHTML.java214
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHead.java100
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHomePage.java68
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroImage.java84
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroInclude.java78
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroInjectedIFrame.java26
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java296
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarShortcut.java128
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLink.java154
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java1626
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPage.java18
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPageTitle.java26
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java2
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSearchParticipant.java22
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSeparator.java14
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroStandbyContentPart.java64
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroText.java94
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroURLAction.java60
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/BaseExtensionPointManager.java460
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ExtensionPointManager.java170
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/IntroContentParser.java300
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ModelLoaderUtil.java302
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/SharedConfigExtensionsManager.java166
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java1046
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURLParser.java316
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/ShowHelpURLHandler.java208
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/BundleUtil.java484
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/FindSupport.java58
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/ModelUtil.java798
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/viewer/IntroModelContentProvider.java84
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/viewer/IntroModelLabelProvider.java192
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/EmptyStandbyContentPart.java92
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java770
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java1296
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartLocationListener.java260
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/FormIntroPartImplementation.java946
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/TextIntroPartImplementation.java66
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageContentForm.java230
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageForm.java262
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageFormWithNavigation.java178
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java970
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageWidgetFactory.java854
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/RootPageForm.java518
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/SharedStyleManager.java400
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/DialogUtil.java242
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/ImageUtil.java290
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java652
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Log.java220
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/StringUtil.java14
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Util.java336
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/CustomizableIntroPart.java658
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroAction.java16
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroContentProvider.java84
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroContentProviderSite.java30
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroURL.java40
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroXHTMLContentProvider.java56
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IStandbyContentPart.java162
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroURLFactory.java74
-rw-r--r--org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/AlwaysWelcomeCheckbox.java20
384 files changed, 15782 insertions, 15782 deletions
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java
index caddf429d..2e26d18d1 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/BaseHelpSystem.java
@@ -173,9 +173,9 @@ public final class BaseHelpSystem {
}
/*
- * Assigns the provider responsible for providing help
- * document content.
- */
+ * Assigns the provider responsible for providing help
+ * document content.
+ */
HelpPlugin.getDefault().setHelpProvider(new HelpProvider());
}
@@ -197,7 +197,7 @@ public final class BaseHelpSystem {
public static URL resolve(String href, boolean documentOnly) {
String url = null;
if (href == null || href.contains("://") //$NON-NLS-1$
- || isFileProtocol(href))
+ || isFileProtocol(href))
url = href;
else {
BaseHelpSystem.ensureWebappRunning();
@@ -217,7 +217,7 @@ public final class BaseHelpSystem {
public static URL resolve(String href, String servlet) {
String url = null;
if (href == null || href.contains("://") //$NON-NLS-1$
- || isFileProtocol(href)) {
+ || isFileProtocol(href)) {
url = href;
}
else {
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java
index 28ebfd10d..9e7276255 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/HelpDisplay.java
@@ -301,13 +301,13 @@ public class HelpDisplay {
}
private static AbstractHelpDisplay getHelpDisplay() {
- if (helpDisplay == null) {
- createHelpDisplay();
- }
- if (helpDisplay == null) {
- helpDisplay = new DefaultDisplay();
- }
- return helpDisplay;
- }
+ if (helpDisplay == null) {
+ createHelpDisplay();
+ }
+ if (helpDisplay == null) {
+ helpDisplay = new DefaultDisplay();
+ }
+ return helpDisplay;
+ }
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/IHelpBaseConstants.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/IHelpBaseConstants.java
index ca8f01418..8a3bd7b1b 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/IHelpBaseConstants.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/IHelpBaseConstants.java
@@ -38,6 +38,6 @@ public interface IHelpBaseConstants {
String P_KEY_REMOTE_HELP_ICEnabled = "remoteHelpICEnabled"; //$NON-NLS-1$
String P_KEY_SHOW_SEARCH_DESCRIPTION = "showSearchDescription"; //$NON-NLS-1$
String P_KEY_SHOW_SEARCH_CATEGORIES = "showSearchCategories"; //$NON-NLS-1$
- String P_SHOW_BREADCRUMBS = "showBreadcrumbs"; //$NON-NLS-1$
- String P_PAGE_NOT_FOUND = "page_not_found"; //$NON-NLS-1$
+ String P_SHOW_BREADCRUMBS = "showBreadcrumbs"; //$NON-NLS-1$
+ String P_PAGE_NOT_FOUND = "page_not_found"; //$NON-NLS-1$
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/MissingContentManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/MissingContentManager.java
index b3711396a..fc9d47ada 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/MissingContentManager.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/MissingContentManager.java
@@ -76,7 +76,7 @@ public class MissingContentManager {
private static MissingContentManager instance;
private List<Placeholder> placeholders;
- private Set<String> bundlesToIgnore; // A set of bundles the user does not want to see reference to
+ private Set<String> bundlesToIgnore; // A set of bundles the user does not want to see reference to
public static MissingContentManager getInstance() {
if ( instance == null ) {
@@ -89,13 +89,13 @@ public class MissingContentManager {
* Read the extension registry
*/
private MissingContentManager() {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
placeholders = new ArrayList<>();
bundlesToIgnore = new HashSet<>();
- if ( BaseHelpSystem.getMode() == BaseHelpSystem.MODE_INFOCENTER ) {
- return; // Placeholders are not shown for infocenters
- }
- // Read the placeholders from the extension registry
+ if ( BaseHelpSystem.getMode() == BaseHelpSystem.MODE_INFOCENTER ) {
+ return; // Placeholders are not shown for infocenters
+ }
+ // Read the placeholders from the extension registry
IConfigurationElement[] elements = registry
.getConfigurationElementsFor(EXTENSION_POINT_ID_TOC);
for (int i = 0; i < elements.length; ++i) {
@@ -127,7 +127,7 @@ public class MissingContentManager {
}
/**
- * Called when a page cannot be found
+ * Called when a page cannot be found
* @param path the path of the page that could not be loaded
* @return a place holder page if defined, otherwise an error page
*/
@@ -136,9 +136,9 @@ public class MissingContentManager {
Placeholder placeholder = iter.next();
if (path.startsWith(placeholder.path) && Platform.getBundle(placeholder.bundle) == null) {
if ( showPlaceholderPage) {
- return placeholder.placeholderPage;
+ return placeholder.placeholderPage;
} else {
- return "/org.eclipse.help.webapp/" + MISSING_TOPIC_PATH + path.substring(HELP_PROTOCOL.length()); //$NON-NLS-1$
+ return "/org.eclipse.help.webapp/" + MISSING_TOPIC_PATH + path.substring(HELP_PROTOCOL.length()); //$NON-NLS-1$
}
}
}
@@ -166,10 +166,10 @@ public class MissingContentManager {
public String getHelpMissingPage(boolean isHelpView) {
Placeholder[] unresolvedPlaceHolders = getUnresolvedPlaceholders();
if (unresolvedPlaceHolders.length == 0) {
- return null;
+ return null;
} else {
- String suffix = isHelpView ? MISSING_BOOKS_HELP_VIEW_HREF : MISSING_BOOKS_HREF;
- return "/org.eclipse.help.webapp" + '/'+ suffix; //$NON-NLS-1$
+ String suffix = isHelpView ? MISSING_BOOKS_HELP_VIEW_HREF : MISSING_BOOKS_HREF;
+ return "/org.eclipse.help.webapp" + '/'+ suffix; //$NON-NLS-1$
}
}
@@ -178,7 +178,7 @@ public class MissingContentManager {
*/
public String getRemoteHelpUnavailablePage(boolean isHelpView) {
if ( BaseHelpSystem.getMode()!=BaseHelpSystem.MODE_INFOCENTER ) {
- String suffix = isHelpView ? REMOTE_STATUS_HELP_VIEW_HREF : REMOTE_STATUS_HREF;
+ String suffix = isHelpView ? REMOTE_STATUS_HELP_VIEW_HREF : REMOTE_STATUS_HREF;
return "/org.eclipse.help.webapp/" + suffix; //$NON-NLS-1$
}
return null;
@@ -191,9 +191,9 @@ public class MissingContentManager {
Placeholder ph = iter.next();
String bundle = ph.bundle;
if (bundle != null && !bundlesToIgnore.contains(bundle) ) {
- if (Platform.getBundle(bundle) == null ) {
- unresolved.add(ph);
- }
+ if (Platform.getBundle(bundle) == null ) {
+ unresolved.add(ph);
+ }
}
}
return unresolved.toArray(new Placeholder[unresolved.size()]);
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/HttpsUtility.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/HttpsUtility.java
index 2b7f61cd8..a0054d779 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/HttpsUtility.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/HttpsUtility.java
@@ -61,10 +61,10 @@ public class HttpsUtility {
try {
URL url = new URL(thisProtocol, thisHost, Integer.valueOf(thisPort) .intValue(),
thisPath + PATH_TOC + '?' + PARAM_LANG + '=' + locale);
- return getHttpsStream(url);
+ return getHttpsStream(url);
} catch (Exception e) {
e.printStackTrace();
- return null;
+ return null;
}
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/PreferenceFileHandler.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/PreferenceFileHandler.java
index e20ac63f2..0d9e25eb6 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/PreferenceFileHandler.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/PreferenceFileHandler.java
@@ -47,17 +47,17 @@ public class PreferenceFileHandler {
// TODO: Decide if comma is a good delimiter, or if we should use a different delimiter.
namePreference = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_NAME, "", null); //$NON-NLS-1$
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_NAME, "", null); //$NON-NLS-1$
hostPreference = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_REMOTE_HELP_HOST, "", null); //$NON-NLS-1$
+ (HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_REMOTE_HELP_HOST, "", null); //$NON-NLS-1$
pathPreference = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_REMOTE_HELP_PATH, "", null); //$NON-NLS-1$
+ (HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_REMOTE_HELP_PATH, "", null); //$NON-NLS-1$
protocolPreference = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_REMOTE_HELP_PROTOCOL, "", null); //$NON-NLS-1$
+ (HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_REMOTE_HELP_PROTOCOL, "", null); //$NON-NLS-1$
portPreference = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_REMOTE_HELP_PORT, "", null); //$NON-NLS-1$
+ (HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_REMOTE_HELP_PORT, "", null); //$NON-NLS-1$
icEnabledPreference =Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_REMOTE_HELP_ICEnabled, "", null); //$NON-NLS-1$
+ (HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_REMOTE_HELP_ICEnabled, "", null); //$NON-NLS-1$
//Get host array first, and initialize values
if(hostPreference.length()==0)
@@ -230,10 +230,10 @@ public class PreferenceFileHandler {
public static int getEmbeddedHelpOption() {
boolean isRemoteOn = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ON, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ON, false, null);
boolean isRemotePreferred = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PREFERRED, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PREFERRED, false, null);
if(!isRemoteOn)
{
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteContextProvider.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteContextProvider.java
index 8c08eb891..5e297afed 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteContextProvider.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteContextProvider.java
@@ -52,7 +52,7 @@ public class RemoteContextProvider extends AbstractContextProvider {
if (RemoteHelp.isEnabled()) {
int numICs = host.length; // Total number of hosts
- //Loop through remote InfoCenters and return first CSH match found
+ //Loop through remote InfoCenters and return first CSH match found
URL url=null;
for (int i = 0; i < numICs; i++) {
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteIC.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteIC.java
index c0e1aef52..253efb1ce 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteIC.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteIC.java
@@ -31,22 +31,22 @@ public class RemoteIC {
public RemoteIC(boolean enabled, String name, String host, String path, String port){
- this.enabled = enabled;
- this.name = name;
- this.host = host;
- this.path = path;
- this.port = port;
- this.protocol = PROTOCOL_HTTP;
+ this.enabled = enabled;
+ this.name = name;
+ this.host = host;
+ this.path = path;
+ this.port = port;
+ this.protocol = PROTOCOL_HTTP;
}
public RemoteIC(boolean enabled, String name, String host, String path, String protocol, String port){
- this.enabled = enabled;
- this.name = name;
- this.host = host;
- this.path = path;
- this.protocol = protocol;
- this.port = port;
+ this.enabled = enabled;
+ this.name = name;
+ this.host = host;
+ this.path = path;
+ this.protocol = protocol;
+ this.port = port;
}
public String getHost() {
@@ -100,24 +100,24 @@ public class RemoteIC {
//I added this method, which overrides the original "equal" method in the class Object
- @Override
+ @Override
public boolean equals(Object anotherObject)throws ClassCastException {
- if (!(anotherObject instanceof RemoteIC))
- return false;
- if ( !(((RemoteIC) anotherObject).getName().equals(this.getName())))
- return false;
- if ( !(((RemoteIC) anotherObject).getHost().equals(this.getHost())))
- return false;
- if ( !(((RemoteIC) anotherObject).getPath().equals(this.getPath())))
- return false;
- if ( !(((RemoteIC) anotherObject).getProtocol().equals(this.getProtocol())))
- return false;
- if ( !(((RemoteIC) anotherObject).getPort().equals(this.getPort())))
- return false;
- if ( !(((RemoteIC) anotherObject).isEnabled()==this.isEnabled()))
- return false;
-
- //if we made it here, the the objects are the same
- return true;
- }
+ if (!(anotherObject instanceof RemoteIC))
+ return false;
+ if ( !(((RemoteIC) anotherObject).getName().equals(this.getName())))
+ return false;
+ if ( !(((RemoteIC) anotherObject).getHost().equals(this.getHost())))
+ return false;
+ if ( !(((RemoteIC) anotherObject).getPath().equals(this.getPath())))
+ return false;
+ if ( !(((RemoteIC) anotherObject).getProtocol().equals(this.getProtocol())))
+ return false;
+ if ( !(((RemoteIC) anotherObject).getPort().equals(this.getPort())))
+ return false;
+ if ( !(((RemoteIC) anotherObject).isEnabled()==this.isEnabled()))
+ return false;
+
+ //if we made it here, the the objects are the same
+ return true;
+ }
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteTocProvider.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteTocProvider.java
index b57b27235..bf2026582 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteTocProvider.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteTocProvider.java
@@ -116,9 +116,9 @@ public class RemoteTocProvider extends AbstractTocProvider {
currentContributions.length);
}
} catch (Throwable t) {
- String msg = "Internal error while reading TOC contents from remote server"; //$NON-NLS-1$
- HelpBasePlugin.logError(msg, t);
- RemoteHelp.setError(t);
+ String msg = "Internal error while reading TOC contents from remote server"; //$NON-NLS-1$
+ HelpBasePlugin.logError(msg, t);
+ RemoteHelp.setError(t);
} finally {
if (in != null) {
try {
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/CriteriaHelpScope.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/CriteriaHelpScope.java
index 2eb418478..e71b86007 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/CriteriaHelpScope.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/CriteriaHelpScope.java
@@ -106,7 +106,7 @@ public class CriteriaHelpScope extends AbstractHelpScope {
private Map<String, Set<String>> getCriteriaInfo(ICriteria[] criteria) {
Map<String, Set<String>> criteriaMap = new HashMap<>();
CriteriaUtilities.addCriteriaToMap(criteriaMap, criteria);
- return criteriaMap;
+ return criteriaMap;
}
@Override
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/ScopeUtils.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/ScopeUtils.java
index 36b81372a..d1fe94604 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/ScopeUtils.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/ScopeUtils.java
@@ -87,7 +87,7 @@ public class ScopeUtils {
}
}
return false;
- }
+ }
/*
* Returns true if one of the children meets the conditions
@@ -101,7 +101,7 @@ public class ScopeUtils {
}
}
return false;
- }
+ }
/*
* Returns true if one of the children meets the conditions
@@ -118,7 +118,7 @@ public class ScopeUtils {
IIndexEntry[] entries = entry.getSubentries();
for (int e = 0; e < entries.length; e++) {
if (showInTree(entries[e], scope)) {
- return true;
+ return true;
}
}
if (entry instanceof IIndexEntry2) {
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/WorkingSetScope.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/WorkingSetScope.java
index 7e0e47488..35f7856d0 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/WorkingSetScope.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/scope/WorkingSetScope.java
@@ -81,7 +81,7 @@ public class WorkingSetScope extends AbstractHelpScope {
if (parent instanceof AdaptableHelpResource) {
adaptable = (AdaptableHelpResource) parent;
} else {
- adaptable = null;
+ adaptable = null;
}
}
}
@@ -132,7 +132,7 @@ public class WorkingSetScope extends AbstractHelpScope {
private Map<String, Set<String>> getCriteriaInfo(ICriteria[] criteria) {
Map<String, Set<String>> criteriaMap = new HashMap<>();
CriteriaUtilities.addCriteriaToMap(criteriaMap, criteria);
- return criteriaMap;
+ return criteriaMap;
}
@Override
@@ -157,7 +157,7 @@ public class WorkingSetScope extends AbstractHelpScope {
return isHrefInScope(topic.getHref());
} else {
if (uae instanceof ITopic) {
- topics.add(uae);
+ topics.add(uae);
}
uae = uae.getParentElement();
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/CriteriaUtilities.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/CriteriaUtilities.java
index f9d0ab20f..9457f60ad 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/CriteriaUtilities.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/CriteriaUtilities.java
@@ -25,22 +25,22 @@ import org.eclipse.help.internal.criteria.CriterionResource;
public class CriteriaUtilities {
- public static List<String> getCriteriaValues(String rawValues) {
+ public static List<String> getCriteriaValues(String rawValues) {
List<String> result = new ArrayList<>();
- if (rawValues != null) {
- String[] values = rawValues.split(","); //$NON-NLS-1$
- for(int j = 0; j < values.length; ++j){
- String value = values[j].trim();
- if (value.length() > 0) {
- result.add(value);
- }
- }
- }
+ if (rawValues != null) {
+ String[] values = rawValues.split(","); //$NON-NLS-1$
+ for(int j = 0; j < values.length; ++j){
+ String value = values[j].trim();
+ if (value.length() > 0) {
+ result.add(value);
+ }
+ }
+ }
return result;
- }
+ }
- public static void addCriteriaToMap(Map<String, Set<String>> map, ICriteria[] criteria) {
- for (int i = 0; i < criteria.length; ++i) {
+ public static void addCriteriaToMap(Map<String, Set<String>> map, ICriteria[] criteria) {
+ for (int i = 0; i < criteria.length; ++i) {
ICriteria criterion = criteria[i];
String name = criterion.getName();
List<String> values = CriteriaUtilities.getCriteriaValues(criterion.getValue());
@@ -54,10 +54,10 @@ public class CriteriaUtilities {
map.put(name, existingValueSet);
}
}
- }
+ }
- public static void addCriteriaToMap(Map<String, Set<String>> map, CriterionResource[] criteria) {
- for(int i = 0; i < criteria.length; ++ i){
+ public static void addCriteriaToMap(Map<String, Set<String>> map, CriterionResource[] criteria) {
+ for(int i = 0; i < criteria.length; ++ i){
CriterionResource criterion = criteria[i];
String criterionName = criterion.getCriterionName();
List<String> criterionValues = criterion.getCriterionValues();
@@ -68,6 +68,6 @@ public class CriteriaUtilities {
existedValueSet.addAll(criterionValues);
map.put(criterionName, existedValueSet);
}
- }
+ }
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IndexUtils.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IndexUtils.java
index 8996fea14..abf61446c 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IndexUtils.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/util/IndexUtils.java
@@ -49,7 +49,7 @@ public class IndexUtils {
String entryKeyword = indexEntry.getKeyword();
if (path[depth].equals(entryKeyword)) {
if (path.length == depth + 1) {
- return new IIndexEntry[] { indexEntry };
+ return new IIndexEntry[] { indexEntry };
}
IIndexEntry[] targets = findSeeTargets(indexEntry, see, depth + 1);
IIndexEntry[] result = new IIndexEntry[targets.length + 1];
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java
index c6b5124ce..90f1b30fb 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/browser/CustomBrowser.java
@@ -37,7 +37,7 @@ public class CustomBrowser implements IBrowser {
@Override
public void displayURL(String url) throws Exception {
String path = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, CustomBrowser.CUSTOM_BROWSER_PATH_KEY, "", null); //$NON-NLS-1$
+ (HelpBasePlugin.PLUGIN_ID, CustomBrowser.CUSTOM_BROWSER_PATH_KEY, "", null); //$NON-NLS-1$
String[] command = prepareCommand(path, url);
try {
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/protocols/HelpURLConnection.java b/org.eclipse.help.base/src/org/eclipse/help/internal/protocols/HelpURLConnection.java
index 04f17582f..b4bcaa094 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/protocols/HelpURLConnection.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/protocols/HelpURLConnection.java
@@ -87,7 +87,7 @@ public class HelpURLConnection extends URLConnection {
public HelpURLConnection(URL url, boolean localOnly) {
super(url);
- this.localOnly = localOnly;
+ this.localOnly = localOnly;
String urlFile = url.getFile();
// Strip off everything before and including the PLUGINS_ROOT
@@ -136,16 +136,16 @@ public class HelpURLConnection extends URLConnection {
if (plugin != null && (helpOption==PreferenceFileHandler.LOCAL_HELP_ONLY || helpOption==PreferenceFileHandler.LOCAL_HELP_PRIORITY)) {
in = getLocalHelp(plugin);
}
- if (in == null && (helpOption==PreferenceFileHandler.LOCAL_HELP_PRIORITY || helpOption==PreferenceFileHandler.REMOTE_HELP_PRIORITY)) {
-
- in = openFromRemoteServer(getHref(), getLocale());
- if( in != null ){
- in = new RemoteHelpInputStream(in);
- }
- if(in==null && plugin!=null && helpOption==PreferenceFileHandler.REMOTE_HELP_PRIORITY)
- {
- in = getLocalHelp(plugin);
- }
+ if (in == null && (helpOption==PreferenceFileHandler.LOCAL_HELP_PRIORITY || helpOption==PreferenceFileHandler.REMOTE_HELP_PRIORITY)) {
+
+ in = openFromRemoteServer(getHref(), getLocale());
+ if( in != null ){
+ in = new RemoteHelpInputStream(in);
+ }
+ if(in==null && plugin!=null && helpOption==PreferenceFileHandler.REMOTE_HELP_PRIORITY)
+ {
+ in = getLocalHelp(plugin);
+ }
}
if (in == null) {
throw new IOException("Resource not found."); //$NON-NLS-1$
@@ -405,7 +405,7 @@ public class HelpURLConnection extends URLConnection {
if (remoteURL == null) {
in = tryOpeningAllServers(pathSuffix);
} else {
- in = openRemoteStream(remoteURL, pathSuffix);
+ in = openRemoteStream(remoteURL, pathSuffix);
}
return in;
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java
index cdc550ec8..6948153ba 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/Analyzer_en.java
@@ -58,7 +58,7 @@ public final class Analyzer_en extends Analyzer {
if ( stopWords == null ) {
stopWords = new HashSet<>();
for (int i = 0; i < STOP_WORDS.length; i++) {
- stopWords.add(STOP_WORDS[i]);
+ stopWords.add(STOP_WORDS[i]);
}
}
return stopWords;
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/LimitedSizeCharArrayWriter.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/LimitedSizeCharArrayWriter.java
index deca309ce..5dad1d9d9 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/LimitedSizeCharArrayWriter.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/LimitedSizeCharArrayWriter.java
@@ -29,7 +29,7 @@ public class LimitedSizeCharArrayWriter extends CharArrayWriter {
@Override
public void write(char[] c, int off, int len) {
- size += len;
+ size += len;
super.write(c, off, len);
}
@@ -37,23 +37,23 @@ public class LimitedSizeCharArrayWriter extends CharArrayWriter {
public void write(char[] cbuf) throws IOException {
size += cbuf.length;
if (size < maxSize) {
- super.write(cbuf);
+ super.write(cbuf);
}
}
@Override
public void write(String str, int off, int len) {
- size += len;
- if (size < maxSize) {
- super.write(str, off, len);
- }
+ size += len;
+ if (size < maxSize) {
+ super.write(str, off, len);
+ }
}
@Override
public void write(int c) {
size += 1;
if (size < maxSize) {
- super.write(c);
+ super.write(c);
}
}
@@ -61,7 +61,7 @@ public class LimitedSizeCharArrayWriter extends CharArrayWriter {
public void write(String str) throws IOException {
size += str.length();
if (size < maxSize) {
- super.write(str);
+ super.write(str);
}
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/LocalSearchManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/LocalSearchManager.java
index a46cf4b8e..c03c2f3ec 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/LocalSearchManager.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/LocalSearchManager.java
@@ -365,7 +365,7 @@ public class LocalSearchManager {
HashSet<String> set = new HashSet<>();
addSearchBindings(set);
// must ask global search participants directly
- SearchParticipant[] gps = getGlobalParticipants();
+ SearchParticipant[] gps = getGlobalParticipants();
for (int i = 0; i < gps.length; i++) {
Set<String> ids;
try {
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java
index b90bc3fae..6b32c1e99 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/QueryBuilder.java
@@ -400,7 +400,7 @@ public class QueryBuilder {
}
} else {
fields = new String[fieldNames.size() + 2];
- boosts = new float[fieldNames.size() + 2];
+ boosts = new float[fieldNames.size() + 2];
Iterator<String> fieldNamesIt = fieldNames.iterator();
for (int i = 0; i < fieldNames.size(); i++) {
fields[i] = fieldNamesIt.next();
@@ -408,8 +408,8 @@ public class QueryBuilder {
}
fields[fieldNames.size()] = "contents"; //$NON-NLS-1$
boosts[fieldNames.size()] = 1.0f;
- fields[fieldNames.size()+1] = "title"; //$NON-NLS-1$
- boosts[fieldNames.size()+1] = 1.0f;
+ fields[fieldNames.size()+1] = "title"; //$NON-NLS-1$
+ boosts[fieldNames.size()+1] = 1.0f;
}
Query query = getLuceneQuery(fields, boosts);
query = improveRankingForUnqotedPhrase(query, fields, boosts);
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
index 107076697..688dc54fa 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
@@ -1045,7 +1045,7 @@ public class SearchIndex implements IHelpSearchIndex {
}
if (raf != null ) {
try {
- raf.close();
+ raf.close();
} catch (IOException ioe) {
}
raf = null;
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java
index 7f4635e66..0f0eb89dd 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchProgressMonitor.java
@@ -51,7 +51,7 @@ public class SearchProgressMonitor implements IProgressMonitor {
@Override
public void addQTCException(QueryTooComplexException exception) throws QueryTooComplexException {
- throw exception;
+ throw exception;
}
};
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java
index 8e96555ef..720a0b832 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchResults.java
@@ -193,8 +193,8 @@ public class SearchResults implements ISearchHitCollector {
if (scope == null) {
return null;
}
- String href = scope.getHref();
- IToc toc=scope.getAdapter(IToc.class);
+ String href = scope.getHref();
+ IToc toc=scope.getAdapter(IToc.class);
if (toc != null){
href=toc.getTopic(null).getHref();
}
@@ -245,7 +245,7 @@ public class SearchResults implements ISearchHitCollector {
if (toc != null) {
foundInToc = true;
if (filter == null || filter.inScope(toc)) {
- return toc;
+ return toc;
}
}
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/XHTMLSearchParticipant.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/XHTMLSearchParticipant.java
index 59af0879a..1114fa05d 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/XHTMLSearchParticipant.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/XHTMLSearchParticipant.java
@@ -42,27 +42,27 @@ public class XHTMLSearchParticipant extends SearchParticipantXML {
@Override
protected void handleStartElement(String name, Attributes attributes, IParsedXMLContent data) {
- title = null;
- if (META_TAG.equalsIgnoreCase(name)) {
- String nameAttribute = attributes.getValue(NAME_ATTRIBUTE);
- if (DESCRIPTION.equalsIgnoreCase(nameAttribute)) {
- String descriptionAttribute = attributes.getValue(CONTENT_ATTRIBUTE);
- if (descriptionAttribute != null) {
- hasDescriptionMetaTag = true;
- data.addToSummary(descriptionAttribute);
- data.addText(" "); //$NON-NLS-1$
- data.addText(descriptionAttribute);
- data.addText(" "); //$NON-NLS-1$
- }
- } else if (KEYWORDS.equalsIgnoreCase(nameAttribute)) {
- String keywordsAttribute = attributes.getValue(CONTENT_ATTRIBUTE);
- if (keywordsAttribute != null) {
- data.addText(" "); //$NON-NLS-1$
- data.addText(keywordsAttribute);
- data.addText(" "); //$NON-NLS-1$
- }
- }
- }
+ title = null;
+ if (META_TAG.equalsIgnoreCase(name)) {
+ String nameAttribute = attributes.getValue(NAME_ATTRIBUTE);
+ if (DESCRIPTION.equalsIgnoreCase(nameAttribute)) {
+ String descriptionAttribute = attributes.getValue(CONTENT_ATTRIBUTE);
+ if (descriptionAttribute != null) {
+ hasDescriptionMetaTag = true;
+ data.addToSummary(descriptionAttribute);
+ data.addText(" "); //$NON-NLS-1$
+ data.addText(descriptionAttribute);
+ data.addText(" "); //$NON-NLS-1$
+ }
+ } else if (KEYWORDS.equalsIgnoreCase(nameAttribute)) {
+ String keywordsAttribute = attributes.getValue(CONTENT_ATTRIBUTE);
+ if (keywordsAttribute != null) {
+ data.addText(" "); //$NON-NLS-1$
+ data.addText(keywordsAttribute);
+ data.addText(" "); //$NON-NLS-1$
+ }
+ }
+ }
}
@Override
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/search/federated/IndexerJob.java b/org.eclipse.help.base/src/org/eclipse/help/internal/search/federated/IndexerJob.java
index 432b8f41e..055c7e2b3 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/search/federated/IndexerJob.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/search/federated/IndexerJob.java
@@ -30,12 +30,12 @@ public class IndexerJob extends Job {
try {
long start = System.currentTimeMillis();
if (HelpPlugin.DEBUG_SEARCH) {
- System.out.println("Start to update search index"); //$NON-NLS-1$
+ System.out.println("Start to update search index"); //$NON-NLS-1$
}
BaseHelpSystem.getLocalSearchManager().ensureIndexUpdated(monitor, index);
long stop = System.currentTimeMillis();
if (HelpPlugin.DEBUG_SEARCH) {
- System.out.println("Milliseconds to update search index = = " + (stop - start)); //$NON-NLS-1$
+ System.out.println("Milliseconds to update search index = = " + (stop - start)); //$NON-NLS-1$
}
return Status.OK_STATUS;
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/server/JettyHelpServer.java b/org.eclipse.help.base/src/org/eclipse/help/internal/server/JettyHelpServer.java
index c492a3bbe..1056b765a 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/server/JettyHelpServer.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/server/JettyHelpServer.java
@@ -232,7 +232,7 @@ public class JettyHelpServer extends HelpServer {
return true;
}
String host = HelpBasePlugin.getBundleContext().getProperty("server_host"); //$NON-NLS-1$
- return host != null && host.trim().length() > 0;
+ return host != null && host.trim().length() > 0;
}
}
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/server/WebappManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/server/WebappManager.java
index 9b4e9b8ad..5b56bf03f 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/server/WebappManager.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/server/WebappManager.java
@@ -27,15 +27,15 @@ public class WebappManager {
private static final String SERVER_EXTENSION_ID = "org.eclipse.help.base.server"; //$NON-NLS-1$
private static final String SERVER_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
- private static HelpServer getHelpServer() {
- if (server == null) {
- createWebappServer();
- }
- if (server == null) {
- server = new JettyHelpServer();
- }
- return server;
- }
+ private static HelpServer getHelpServer() {
+ if (server == null) {
+ createWebappServer();
+ }
+ if (server == null) {
+ server = new JettyHelpServer();
+ }
+ return server;
+ }
public static void start(String webappName) throws Exception {
getHelpServer().start(webappName);
@@ -50,7 +50,7 @@ public class WebappManager {
}
public static String getHost() {
- return getHelpServer().getHost();
+ return getHelpServer().getHost();
}
private static void createWebappServer() {
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/validation/TocValidator.java b/org.eclipse.help.base/src/org/eclipse/help/internal/validation/TocValidator.java
index 8569c365e..339b5d7be 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/validation/TocValidator.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/validation/TocValidator.java
@@ -54,7 +54,7 @@ public class TocValidator {
}
public static abstract class Filter {
- abstract public boolean isIncluded(String href);
+ abstract public boolean isIncluded(String href);
}
public static class PassThroughFilter extends Filter {
diff --git a/org.eclipse.help.base/src/org/eclipse/help/server/HelpServer.java b/org.eclipse.help.base/src/org/eclipse/help/server/HelpServer.java
index 601ac5654..a43bac8b3 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/server/HelpServer.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/server/HelpServer.java
@@ -44,13 +44,13 @@ public abstract class HelpServer {
* @param webappName the name of a running web application
* @throws CoreException If there was any error during stopping.
*/
- public abstract void stop(String webappName) throws CoreException ;
+ public abstract void stop(String webappName) throws CoreException ;
/**
* Returns the port number the app server listens on
* @return integer port number, 0 if server not started
*/
- public abstract int getPort();
+ public abstract int getPort();
/**
@@ -59,5 +59,5 @@ public abstract class HelpServer {
* @return String representation of host name of IP, null if server not
* started yet
*/
- public abstract String getHost();
+ public abstract String getHost();
}
diff --git a/org.eclipse.help.base/src_ant/org/eclipse/help/internal/base/ant/BuildHelpIndex.java b/org.eclipse.help.base/src_ant/org/eclipse/help/internal/base/ant/BuildHelpIndex.java
index d13c6a150..2c1cde11f 100644
--- a/org.eclipse.help.base/src_ant/org/eclipse/help/internal/base/ant/BuildHelpIndex.java
+++ b/org.eclipse.help.base/src_ant/org/eclipse/help/internal/base/ant/BuildHelpIndex.java
@@ -59,8 +59,8 @@ public class BuildHelpIndex extends Task {
builder.setDestination(target);
IProgressMonitor monitor = (IProgressMonitor) getProject()
.getReferences().get(AntCorePlugin.ECLIPSE_PROGRESS_MONITOR);
- if (monitor == null)
- monitor = new NullProgressMonitor();
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
try {
builder.execute(monitor);
} catch (CoreException e) {
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/RootScopePage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/RootScopePage.java
index 807e8c54f..50a076504 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/RootScopePage.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/RootScopePage.java
@@ -85,8 +85,8 @@ public abstract class RootScopePage extends PreferencePage implements
@Override
protected final Control createContents(Composite parent) {
initializeDefaults(getPreferenceStore());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- "org.eclipse.help.ui.searchScope"); //$NON-NLS-1$
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+ "org.eclipse.help.ui.searchScope"); //$NON-NLS-1$
contentContainer = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
GridData gd;
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ContextHelpDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ContextHelpDialog.java
index 46b0569fe..a697da616 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ContextHelpDialog.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ContextHelpDialog.java
@@ -224,8 +224,8 @@ public class ContextHelpDialog {
}
if (styledText == null && context.getText() != null) {
styledText = context.getText();
- styledText= styledText.replaceAll("<b>","<@#\\$b>"); //$NON-NLS-1$ //$NON-NLS-2$
- styledText= styledText.replaceAll("</b>", "</@#\\$b>"); //$NON-NLS-1$ //$NON-NLS-2$
+ styledText= styledText.replaceAll("<b>","<@#\\$b>"); //$NON-NLS-1$ //$NON-NLS-2$
+ styledText= styledText.replaceAll("</b>", "</@#\\$b>"); //$NON-NLS-1$ //$NON-NLS-2$
}
if (styledText == null) { // no description found in context objects.
styledText = Messages.ContextHelpPart_noDescription;
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java
index b99562e26..af046ffe2 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DefaultHelpUI.java
@@ -197,7 +197,7 @@ public class DefaultHelpUI extends AbstractHelpUI {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
boolean searchFromBrowser = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SEARCH_FROM_BROWSER, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SEARCH_FROM_BROWSER, false, null);
if (searchFromBrowser) {
String parameters = "tab=search"; //$NON-NLS-1$
if (expression != null) {
@@ -239,9 +239,9 @@ public class DefaultHelpUI extends AbstractHelpUI {
public static void showIndex() {
HelpView helpView = getHelpView();
- if (helpView != null) {
- helpView.showIndex();
- }
+ if (helpView != null) {
+ helpView.showIndex();
+ }
}
private static HelpView getHelpView() {
@@ -310,9 +310,9 @@ public class DefaultHelpUI extends AbstractHelpUI {
if (context == null)
return;
boolean winfopop = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_WINDOW_INFOPOP, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_WINDOW_INFOPOP, false, null);
boolean dinfopop = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_DIALOG_INFOPOP, false, null) || FontUtils.isFontTooLargeForTray();
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_DIALOG_INFOPOP, false, null) || FontUtils.isFontTooLargeForTray();
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
Shell activeShell = getActiveShell();
@@ -333,7 +333,7 @@ public class DefaultHelpUI extends AbstractHelpUI {
IHelpResource[] topics = context.getRelatedTopics();
boolean isSingleChoiceWithoutDescription = contextText == null && topics.length == 1;
String openMode = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_HELP_VIEW_OPEN_MODE, IHelpBaseConstants.P_IN_PLACE, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_HELP_VIEW_OPEN_MODE, IHelpBaseConstants.P_IN_PLACE, null);
if (isSingleChoiceWithoutDescription && IHelpBaseConstants.P_IN_EDITOR.equals(openMode)) {
showInWorkbenchBrowser(topics[0].getHref(), true);
} else if (isSingleChoiceWithoutDescription && IHelpBaseConstants.P_IN_BROWSER.equals(openMode)) {
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DynamicHelpAction.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DynamicHelpAction.java
index 6d1ce5077..df4a4895b 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DynamicHelpAction.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/DynamicHelpAction.java
@@ -21,23 +21,23 @@ import org.eclipse.ui.PlatformUI;
public class DynamicHelpAction implements IWorkbenchWindowActionDelegate {
- public DynamicHelpAction() {
- }
+ public DynamicHelpAction() {
+ }
@Override
public void dispose() {
- }
+ }
@Override
public void init(IWorkbenchWindow window) {
- }
+ }
@Override
public void run(IAction action) {
- PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp();
- }
+ PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp();
+ }
@Override
public void selectionChanged(IAction action, ISelection selection) {
- }
+ }
} \ No newline at end of file
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ExecuteCommandAction.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ExecuteCommandAction.java
index 714408a02..fb7157231 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ExecuteCommandAction.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/ExecuteCommandAction.java
@@ -131,10 +131,10 @@ public class ExecuteCommandAction implements ILiveHelpAction {
IWorkbench wb = PlatformUI.getWorkbench();
if (wb != null) {
Object serviceObject = wb.getAdapter(IHandlerService.class);
- if (serviceObject != null) {
- IHandlerService service = (IHandlerService)serviceObject;
- return service;
- }
+ if (serviceObject != null) {
+ IHandlerService service = (IHandlerService)serviceObject;
+ return service;
+ }
}
return null;
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.java
index d57eef200..249a676d6 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HelpUIResources.java
@@ -153,10 +153,10 @@ public class HelpUIResources {
IConfigurationElement[] configElements = extensionsFound[i].getConfigurationElements();
for(int j=0; j < configElements.length; j++){
- if (configElements[j].getName().equals(TOC_ICON_ELEMENT)){
- IConfigurationElement iconElem = configElements[j];
- String attrs[] = iconElem.getAttributeNames();
- String contributorID = iconElem.getContributor().getName();
+ if (configElements[j].getName().equals(TOC_ICON_ELEMENT)){
+ IConfigurationElement iconElem = configElements[j];
+ String attrs[] = iconElem.getAttributeNames();
+ String contributorID = iconElem.getContributor().getName();
for (int k=0; k < attrs.length; k++){
if(attrs[k].equals(OPEN_ICON_PATH))
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/SearchAction.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/SearchAction.java
index 8a4f3c273..ff6f5accc 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/SearchAction.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/SearchAction.java
@@ -21,23 +21,23 @@ import org.eclipse.ui.PlatformUI;
public class SearchAction implements IWorkbenchWindowActionDelegate {
- public SearchAction() {
- }
+ public SearchAction() {
+ }
@Override
public void dispose() {
- }
+ }
@Override
public void init(IWorkbenchWindow window) {
- }
+ }
@Override
public void run(IAction action) {
- PlatformUI.getWorkbench().getHelpSystem().displaySearch();
- }
+ PlatformUI.getWorkbench().getHelpSystem().displaySearch();
+ }
@Override
public void selectionChanged(IAction action, ISelection selection) {
- }
+ }
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/embedded/EmbeddedBrowser.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/embedded/EmbeddedBrowser.java
index 8799fc392..bd00246ef 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/embedded/EmbeddedBrowser.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/embedded/EmbeddedBrowser.java
@@ -392,7 +392,7 @@ public class EmbeddedBrowser {
private static String getWindowTitle() {
if (Platform.getPreferencesService().getBoolean(HelpUIPlugin.PLUGIN_ID, "windowTitlePrefix", false, null)) { //$NON-NLS-1$
return NLS.bind(Messages.browserTitle, BaseHelpSystem
- .getProductName());
+ .getProductName());
}
return BaseHelpSystem.getProductName();
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/embedded/EmbeddedBrowserAdapter.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/embedded/EmbeddedBrowserAdapter.java
index 0df793897..d815416ab 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/embedded/EmbeddedBrowserAdapter.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/browser/embedded/EmbeddedBrowserAdapter.java
@@ -72,8 +72,8 @@ public class EmbeddedBrowserAdapter implements IBrowser, IBrowserCloseListener{
/* only attempt to use a second thread if the Browser's native renderer is IE */
boolean useUIThread2 = BaseHelpSystem.getMode() == BaseHelpSystem.MODE_WORKBENCH
&& Constants.OS_WIN32.equalsIgnoreCase(Platform.getOS())
- && !Constants.WS_WPF.equalsIgnoreCase(SWT.getPlatform())
- && "ie".equalsIgnoreCase(browserType); //$NON-NLS-1$
+ && !Constants.WS_WPF.equalsIgnoreCase(SWT.getPlatform())
+ && "ie".equalsIgnoreCase(browserType); //$NON-NLS-1$
if (useUIThread2) {
if (secondThread == null) {
secondThread = new UIThread2();
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/handlers/ShowIndexHandler.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/handlers/ShowIndexHandler.java
index f0ba180a3..d149636d2 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/handlers/ShowIndexHandler.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/handlers/ShowIndexHandler.java
@@ -34,10 +34,10 @@ public class ShowIndexHandler extends AbstractHandler {
* Currently returns true, could be controlled by a preference
* in the future
*/
- private boolean isOpenInHelpView() {
- boolean searchFromBrowser =
- Platform.getPreferencesService().getBoolean(HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_SEARCH_FROM_BROWSER, false, null);
- return !searchFromBrowser;
+ private boolean isOpenInHelpView() {
+ boolean searchFromBrowser =
+ Platform.getPreferencesService().getBoolean(HelpBasePlugin.PLUGIN_ID,IHelpBaseConstants.P_KEY_SEARCH_FROM_BROWSER, false, null);
+ return !searchFromBrowser;
}
@Override
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentPreferencePage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentPreferencePage.java
index 082731d75..2418bd47e 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentPreferencePage.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpContentPreferencePage.java
@@ -122,7 +122,7 @@ public class HelpContentPreferencePage extends PreferencePage implements
List<IC> ics = table.getICs();
ICPreferences.setICs(ics);
- RemoteHelp.notifyPreferenceChange();
+ RemoteHelp.notifyPreferenceChange();
return super.performOk();
}
@@ -137,7 +137,7 @@ public class HelpContentPreferencePage extends PreferencePage implements
searchLocalHelpOnly.addListener(SWT.Selection, changeListener);
boolean isRemoteOn = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ON, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ON, false, null);
searchLocalHelpOnly.setSelection(!isRemoteOn);
Dialog.applyDialogFont(searchLocalHelpOnly);
@@ -149,9 +149,9 @@ public class HelpContentPreferencePage extends PreferencePage implements
searchLocalHelpFirst.addListener(SWT.Selection, changeListener);
boolean isRemoteOn = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ON, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ON, false, null);
boolean isRemotePreferred = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PREFERRED, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PREFERRED, false, null);
searchLocalHelpFirst.setSelection(isRemoteOn && !isRemotePreferred);
Dialog.applyDialogFont(searchLocalHelpFirst);
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpPreferencePage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpPreferencePage.java
index 54a8c7e65..b62b908e4 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpPreferencePage.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/HelpPreferencePage.java
@@ -121,21 +121,21 @@ public class HelpPreferencePage extends PreferencePage implements
searchLocationCombo.add(Messages.HelpPreferencePage_openInBrowser);
searchLocationCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
boolean searchFromBrowser = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SEARCH_FROM_BROWSER, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SEARCH_FROM_BROWSER, false, null);
searchLocationCombo.setText(searchFromBrowser ? Messages.HelpPreferencePage_openInBrowser : Messages.HelpPreferencePage_view);
}
private void createOpenContents(Composite mainComposite) {
if (BrowserManager.getInstance().isEmbeddedBrowserPresent()) {
- Label isExternalLabel = new Label(mainComposite, SWT.NONE);
- isExternalLabel.setText(Messages.HelpPreferencePage_openContents);
- isExternalLabel.setLayoutData(createLabelData());
+ Label isExternalLabel = new Label(mainComposite, SWT.NONE);
+ isExternalLabel.setText(Messages.HelpPreferencePage_openContents);
+ isExternalLabel.setLayoutData(createLabelData());
useExternalCombo = new Combo(mainComposite, SWT.READ_ONLY);
useExternalCombo.add(Messages.HelpPreferencePage_helpBrowser);
useExternalCombo.add(Messages.HelpPreferencePage_externalBrowser);
useExternalCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
boolean useExternal = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_ALWAYS_EXTERNAL_BROWSER, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_ALWAYS_EXTERNAL_BROWSER, false, null);
useExternalCombo.setText(useExternal ? Messages.HelpPreferencePage_externalBrowser : Messages.HelpPreferencePage_helpBrowser);
}
}
@@ -181,7 +181,7 @@ public class HelpPreferencePage extends PreferencePage implements
dialogHelpCombo.add(Messages.HelpPreferencePage_infopop);
dialogHelpCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
boolean dinfopop = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_DIALOG_INFOPOP, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_DIALOG_INFOPOP, false, null);
dialogHelpCombo.setText(dinfopop ? Messages.HelpPreferencePage_infopop : Messages.HelpPreferencePage_tray);
}
@@ -195,7 +195,7 @@ public class HelpPreferencePage extends PreferencePage implements
windowHelpCombo.add(Messages.HelpPreferencePage_infopop);
windowHelpCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
boolean winfopop = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_WINDOW_INFOPOP, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_WINDOW_INFOPOP, false, null);
windowHelpCombo.setText(winfopop ? Messages.HelpPreferencePage_infopop : Messages.HelpPreferencePage_view);
}
@@ -248,9 +248,9 @@ public class HelpPreferencePage extends PreferencePage implements
dialogHelpCombo.setText(dinfopop ? Messages.HelpPreferencePage_infopop : Messages.HelpPreferencePage_tray);
if (openModeCombo !=null) {
- String openMode = defaults.get(
+ String openMode = defaults.get(
IHelpBaseConstants.P_KEY_HELP_VIEW_OPEN_MODE, IHelpBaseConstants.P_IN_PLACE);
- openModeCombo.setText(openModeToString(openMode));
+ openModeCombo.setText(openModeToString(openMode));
}
super.performDefaults();
@@ -288,20 +288,20 @@ public class HelpPreferencePage extends PreferencePage implements
}
private String openModeToString(String openMode) {
- if (IHelpBaseConstants.P_IN_BROWSER.equals(openMode)) {
- return Messages.HelpPreferencePage_openInBrowser;
- } else if (IHelpBaseConstants.P_IN_EDITOR.equals(openMode)) {
- return Messages.HelpPreferencePage_openInEditor;
+ if (IHelpBaseConstants.P_IN_BROWSER.equals(openMode)) {
+ return Messages.HelpPreferencePage_openInBrowser;
+ } else if (IHelpBaseConstants.P_IN_EDITOR.equals(openMode)) {
+ return Messages.HelpPreferencePage_openInEditor;
} else {
return Messages.HelpPreferencePage_openInPlace;
}
}
private String openModeFromString(String openMode) {
- if (Messages.HelpPreferencePage_openInBrowser.equals(openMode)) {
- return IHelpBaseConstants.P_IN_BROWSER;
- } else if (Messages.HelpPreferencePage_openInEditor.equals(openMode)) {
- return IHelpBaseConstants.P_IN_EDITOR;
+ if (Messages.HelpPreferencePage_openInBrowser.equals(openMode)) {
+ return IHelpBaseConstants.P_IN_BROWSER;
+ } else if (Messages.HelpPreferencePage_openInEditor.equals(openMode)) {
+ return IHelpBaseConstants.P_IN_EDITOR;
} else {
return IHelpBaseConstants.P_IN_PLACE;
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICButtons.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICButtons.java
index da9d204b4..578689593 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICButtons.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICButtons.java
@@ -154,10 +154,10 @@ public class ICButtons implements SelectionListener{
}
boolean shouldRemove =
- MessageDialog.openQuestion(
- page.getShell(),
- NLS.bind(Messages.HelpContentBlock_rmvTitle ,""), //$NON-NLS-1$
- NLS.bind(Messages.HelpContentBlock_rmvLabel ,remove));
+ MessageDialog.openQuestion(
+ page.getShell(),
+ NLS.bind(Messages.HelpContentBlock_rmvTitle ,""), //$NON-NLS-1$
+ NLS.bind(Messages.HelpContentBlock_rmvLabel ,remove));
if (shouldRemove)
{
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICDialog.java
index 1734424d0..6708687da 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICDialog.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICDialog.java
@@ -250,7 +250,7 @@ public class ICDialog extends StatusDialog implements Listener, SelectionListene
@Override
public void handleEvent(Event event) {
- updateValidity();
+ updateValidity();
}
@Override
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICTable.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICTable.java
index a34cd3df3..99c7f904f 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICTable.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/preferences/ICTable.java
@@ -96,29 +96,29 @@ public class ICTable {
ColumnLayoutData[] fTableColumnLayouts= {
- new ColumnWeightData(85),
- new ColumnWeightData(165),
- new ColumnWeightData(60)
+ new ColumnWeightData(85),
+ new ColumnWeightData(165),
+ new ColumnWeightData(60)
};
TableColumn column;
tableLayout.addColumnData(fTableColumnLayouts[0]);
- column = new TableColumn(table, SWT.NONE, 0);
- column.setResizable(fTableColumnLayouts[0].resizable);
- column.setText(NAME_COLUMN);
+ column = new TableColumn(table, SWT.NONE, 0);
+ column.setResizable(fTableColumnLayouts[0].resizable);
+ column.setText(NAME_COLUMN);
- tableLayout.addColumnData(fTableColumnLayouts[1]);
- column = new TableColumn(table, SWT.NONE, 1);
- column.setResizable(fTableColumnLayouts[1].resizable);
- column.setText(LOCATION_COLUMN);
+ tableLayout.addColumnData(fTableColumnLayouts[1]);
+ column = new TableColumn(table, SWT.NONE, 1);
+ column.setResizable(fTableColumnLayouts[1].resizable);
+ column.setText(LOCATION_COLUMN);
- tableLayout.addColumnData(fTableColumnLayouts[2]);
- column = new TableColumn(table, SWT.NONE, 2);
- column.setResizable(fTableColumnLayouts[2].resizable);
- column.setText(STATUS_COLUMN);
+ tableLayout.addColumnData(fTableColumnLayouts[2]);
+ column = new TableColumn(table, SWT.NONE, 2);
+ column.setResizable(fTableColumnLayouts[2].resizable);
+ column.setText(STATUS_COLUMN);
- return table;
+ return table;
}
/**
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpCriteriaContentProvider.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpCriteriaContentProvider.java
index dda2fb357..52639d345 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpCriteriaContentProvider.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/HelpCriteriaContentProvider.java
@@ -120,7 +120,7 @@ public class HelpCriteriaContentProvider implements ITreeContentProvider {
CriterionName parentCriterion = (CriterionName) parentElement;
String[] values = BaseHelpSystem.getWorkingSetManager().getCriterionValueIds(parentCriterion.getId());
- CriterionValue[] criterionValues = new CriterionValue[values.length];
+ CriterionValue[] criterionValues = new CriterionValue[values.length];
for (int i = 0; i < values.length; i++) {
criterionValues[i] = new CriterionValue(values[i], parentElement);
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/InfoCenterSearchScopeFactory.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/InfoCenterSearchScopeFactory.java
index 1d4e65bd8..7b0e93b8e 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/InfoCenterSearchScopeFactory.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/InfoCenterSearchScopeFactory.java
@@ -34,32 +34,32 @@ public class InfoCenterSearchScopeFactory implements ISearchScopeFactory {
@Override
public ISearchScope createSearchScope(IPreferenceStore store, String engineId,
Dictionary<String, Object> parameters) {
- String url = getProperty(P_URL, store, engineId, parameters);
- String ssvalue = getProperty(P_SEARCH_SELECTED, store, engineId, parameters);
- boolean searchSelected = ssvalue!=null && ssvalue.equalsIgnoreCase("true"); //$NON-NLS-1$
- String [] tocs=null;
- if (searchSelected) {
- String tvalue = getProperty(P_TOCS, store, engineId, parameters);
- if (tvalue!=null && tvalue.length()>0) {
- StringTokenizer stok = new StringTokenizer(tvalue, TOC_SEPARATOR);
- ArrayList<String> list = new ArrayList<>();
- while (stok.hasMoreTokens()) {
- String toc = stok.nextToken();
- list.add(toc);
- }
- if (list.size()>0)
+ String url = getProperty(P_URL, store, engineId, parameters);
+ String ssvalue = getProperty(P_SEARCH_SELECTED, store, engineId, parameters);
+ boolean searchSelected = ssvalue!=null && ssvalue.equalsIgnoreCase("true"); //$NON-NLS-1$
+ String [] tocs=null;
+ if (searchSelected) {
+ String tvalue = getProperty(P_TOCS, store, engineId, parameters);
+ if (tvalue!=null && tvalue.length()>0) {
+ StringTokenizer stok = new StringTokenizer(tvalue, TOC_SEPARATOR);
+ ArrayList<String> list = new ArrayList<>();
+ while (stok.hasMoreTokens()) {
+ String toc = stok.nextToken();
+ list.add(toc);
+ }
+ if (list.size()>0)
tocs = list.toArray(new String[list.size()]);
- }
- }
- return new InfoCenter.Scope(url, searchSelected, tocs);
- }
+ }
+ }
+ return new InfoCenter.Scope(url, searchSelected, tocs);
+ }
private String getProperty(String key, IPreferenceStore store, String engineId,
Dictionary<String, Object> parameters) {
- // try the store first
- String value = store.getString(engineId+"."+key); //$NON-NLS-1$
- if (value!=null && value.length()>0) return value;
- // try the parameters
+ // try the store first
+ String value = store.getString(engineId+"."+key); //$NON-NLS-1$
+ if (value!=null && value.length()>0) return value;
+ // try the parameters
return (String) parameters.get(key);
- }
+ }
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/LocalHelpPage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/LocalHelpPage.java
index 9cb0e56c4..d7d07de59 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/LocalHelpPage.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/LocalHelpPage.java
@@ -99,7 +99,7 @@ public class LocalHelpPage extends RootScopePage {
public void widgetSelected(SelectionEvent e) {
contentTree.getTree().setEnabled(false);
if (criteriaTree != null) {
- criteriaTree.getTree().setEnabled(false);
+ criteriaTree.getTree().setEnabled(false);
}
}
});
@@ -115,7 +115,7 @@ public class LocalHelpPage extends RootScopePage {
public void widgetSelected(SelectionEvent e) {
contentTree.getTree().setEnabled(true);
if (criteriaTree != null) {
- criteriaTree.getTree().setEnabled(true);
+ criteriaTree.getTree().setEnabled(true);
}
}
@@ -146,7 +146,7 @@ public class LocalHelpPage extends RootScopePage {
| GridData.VERTICAL_ALIGN_CENTER);
gd.horizontalSpan = 2;
criteriaLabel.setLayoutData(gd);
- createCriteriaTree(parent, font);
+ createCriteriaTree(parent, font);
}
initializeCheckedState();
@@ -265,7 +265,7 @@ public class LocalHelpPage extends RootScopePage {
}
void updateParentState(Object child, boolean baseChildState,
- CheckboxTreeViewer tree, ITreeContentProvider contentProvider) {
+ CheckboxTreeViewer tree, ITreeContentProvider contentProvider) {
if (child == null)
return;
@@ -293,7 +293,7 @@ public class LocalHelpPage extends RootScopePage {
void setSubtreeChecked(Object parent, boolean state,
boolean checkExpandedState,
- CheckboxTreeViewer tree, ITreeContentProvider contentProvider) {
+ CheckboxTreeViewer tree, ITreeContentProvider contentProvider) {
Object[] children = contentProvider.getChildren(parent);
for (int i = children.length - 1; i >= 0; i--) {
@@ -310,7 +310,7 @@ public class LocalHelpPage extends RootScopePage {
@SuppressWarnings({ "unchecked", "rawtypes" })
private void findCheckedElements(java.util.List checkedResources, Object parent,
- CheckboxTreeViewer tree, ITreeContentProvider contentProvider) {
+ CheckboxTreeViewer tree, ITreeContentProvider contentProvider) {
Object[] children = contentProvider.getChildren(parent);
for (int i = 0; i < children.length; i++) {
if (tree.getGrayed(children[i]))
@@ -321,7 +321,7 @@ public class LocalHelpPage extends RootScopePage {
}
private CriterionResource[] findCheckedCriteria(Object parent,
- CheckboxTreeViewer tree, ITreeContentProvider contentProvider) {
+ CheckboxTreeViewer tree, ITreeContentProvider contentProvider) {
Object[] children = contentProvider.getChildren(parent);
List<CriterionResource> resources = new ArrayList<>();
for (int i = 0; i < children.length; i++) {
@@ -331,8 +331,8 @@ public class LocalHelpPage extends RootScopePage {
Object[] grandChildren = contentProvider.getChildren(name);
for (int j = 0; j < grandChildren.length; j++) {
if (tree.getChecked(grandChildren[j])) {
- CriterionValue value = (CriterionValue) grandChildren[j];
- resource.addCriterionValue(value.getId());
+ CriterionValue value = (CriterionValue) grandChildren[j];
+ resource.addCriterionValue(value.getId());
}
}
if (resource.getCriterionValues().size() > 0) {
@@ -343,7 +343,7 @@ public class LocalHelpPage extends RootScopePage {
}
void handleCheckStateChange(final CheckStateChangedEvent event,
- final CheckboxTreeViewer tree, final ITreeContentProvider contentProvider) {
+ final CheckboxTreeViewer tree, final ITreeContentProvider contentProvider) {
BusyIndicator.showWhile(getShell().getDisplay(), () -> {
Object element = event.getElement();
boolean state = event.getChecked();
@@ -424,7 +424,7 @@ public class LocalHelpPage extends RootScopePage {
for (Iterator<String> iter = values.iterator(); iter.hasNext();) {
String valueString = iter.next();
CriterionValue value = new CriterionValue(valueString, name);
- criteriaTree.setChecked(value, true);
+ criteriaTree.setChecked(value, true);
updateParentState(value, true, criteriaTree, criteriaTreeContentProvider);
}
}
@@ -436,7 +436,7 @@ public class LocalHelpPage extends RootScopePage {
searchSelected.setSelection(false);
contentTree.setCheckedElements(new Object[0]);
if (criteriaTree != null) {
- criteriaTree.setCheckedElements(new Object[0]);
+ criteriaTree.setCheckedElements(new Object[0]);
}
super.performDefaults();
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/LocalSearchScopeFactory.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/LocalSearchScopeFactory.java
index e3aab0f81..9cf6b9961 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/LocalSearchScopeFactory.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/LocalSearchScopeFactory.java
@@ -26,17 +26,17 @@ import org.eclipse.jface.preference.IPreferenceStore;
* Creates the scope for local search using the help working sets
*/
public class LocalSearchScopeFactory implements ISearchScopeFactory {
- public final static String P_WORKING_SET = "workingSet"; //$NON-NLS-1$
- public final static String P_CAPABILITY_FILTERING = "capabilityFiltering"; //$NON-NLS-1$
+ public final static String P_WORKING_SET = "workingSet"; //$NON-NLS-1$
+ public final static String P_CAPABILITY_FILTERING = "capabilityFiltering"; //$NON-NLS-1$
@Override
public ISearchScope createSearchScope(IPreferenceStore store, String engineId,
Dictionary<String, Object> parameters) {
- String name = store.getString(engineId+"."+P_WORKING_SET); //$NON-NLS-1$
- WorkingSet workingSet = null;
- if (name != null)
- workingSet = BaseHelpSystem.getWorkingSetManager().getWorkingSet(name);
- boolean capabilityFiltering = store.getBoolean(engineId+"."+P_CAPABILITY_FILTERING); //$NON-NLS-1$
- return new LocalHelpScope(workingSet, capabilityFiltering);
- }
+ String name = store.getString(engineId+"."+P_WORKING_SET); //$NON-NLS-1$
+ WorkingSet workingSet = null;
+ if (name != null)
+ workingSet = BaseHelpSystem.getWorkingSetManager().getWorkingSet(name);
+ boolean capabilityFiltering = store.getBoolean(engineId+"."+P_CAPABILITY_FILTERING); //$NON-NLS-1$
+ return new LocalHelpScope(workingSet, capabilityFiltering);
+ }
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/WebSearchScopeFactory.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/WebSearchScopeFactory.java
index ce86bd5d3..863e1db5d 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/WebSearchScopeFactory.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/search/WebSearchScopeFactory.java
@@ -29,16 +29,16 @@ public class WebSearchScopeFactory implements ISearchScopeFactory {
@Override
public ISearchScope createSearchScope(IPreferenceStore store, String engineId,
Dictionary<String, Object> parameters) {
- String urlTemplate = getProperty(store, engineId, parameters);
- return new WebSearch.Scope(urlTemplate);
- }
+ String urlTemplate = getProperty(store, engineId, parameters);
+ return new WebSearch.Scope(urlTemplate);
+ }
private String getProperty(IPreferenceStore store, String engineId,
Dictionary<String, Object> parameters) {
- // try the store first
- String value = store.getString(engineId+"."+P_URL); //$NON-NLS-1$
- if (value!=null && value.length()>0) return value;
- // try the parameters
- return (String)parameters.get(P_URL);
- }
+ // try the store first
+ String value = store.getString(engineId+"."+P_URL); //$NON-NLS-1$
+ if (value!=null && value.length()>0) return value;
+ // try the parameters
+ return (String)parameters.get(P_URL);
+ }
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/FontUtils.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/FontUtils.java
index c2673630d..6acfcba65 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/FontUtils.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/util/FontUtils.java
@@ -44,7 +44,7 @@ public class FontUtils {
String scaleString = percent/100 + "." + (percent % 100) / 10; //$NON-NLS-1$
String os = Platform.getOS();
if (Constants.WS_WIN32.equalsIgnoreCase(os) ||
- Constants.OS_MACOSX.equalsIgnoreCase(os)) {
+ Constants.OS_MACOSX.equalsIgnoreCase(os)) {
return "document.body.style.zoom = " + scaleString; //$NON-NLS-1$
}
return null; // No rescale in Mozilla browsers
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BrowserPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BrowserPart.java
index e9b827508..3556d0c88 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BrowserPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/BrowserPart.java
@@ -56,7 +56,7 @@ public class BrowserPart extends AbstractFormPart implements IHelpPart {
private final static String QUERY = "BrowserPartQuery:"; //$NON-NLS-1$
private final static String HIGHLIGHT_ON = "highlight-on"; //$NON-NLS-1$
private final static String HELP_VIEW_SCALE = "help_view_scale"; //$NON-NLS-1$
- private final static String EMPTY_PAGE = "<html><head></head><body></body></html>"; //$NON-NLS-1$
+ private final static String EMPTY_PAGE = "<html><head></head><body></body></html>"; //$NON-NLS-1$
private ReusableHelpPart parent;
@@ -160,7 +160,7 @@ public class BrowserPart extends AbstractFormPart implements IHelpPart {
}
lastProgress = -1;
if (fontScalePercentage != 100) {
- rescale();
+ rescale();
}
String value = executeQuery("document.title"); //$NON-NLS-1$
BrowserPart.this.title = value != null ? value : "N/A"; //$NON-NLS-1$
@@ -286,7 +286,7 @@ public class BrowserPart extends AbstractFormPart implements IHelpPart {
fontScalePercentage = Platform.getPreferencesService().getInt(HelpBasePlugin.PLUGIN_ID,
HELP_VIEW_SCALE, 100, null);
if (menuManager != null) {
- addMenuActions(menuManager);
+ addMenuActions(menuManager);
}
}
}
@@ -462,8 +462,8 @@ public class BrowserPart extends AbstractFormPart implements IHelpPart {
private void enableButtons() {
if (magnifyAction != null) {
- magnifyAction.setEnabled(fontScalePercentage < SCALE_MAX);
- reduceAction.setEnabled(fontScalePercentage > SCALE_MIN);
+ magnifyAction.setEnabled(fontScalePercentage < SCALE_MAX);
+ reduceAction.setEnabled(fontScalePercentage > SCALE_MIN);
}
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java
index 9f1312005..5125134e2 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpPart.java
@@ -153,7 +153,7 @@ public class ContextHelpPart extends SectionPart implements IHelpPart {
if (href.startsWith(MORE_HREF)) {
doMore(href.substring(MORE_HREF.length()));
} else {
- doOpenLink(e.getHref());
+ doOpenLink(e.getHref());
}
}
@@ -172,12 +172,12 @@ public class ContextHelpPart extends SectionPart implements IHelpPart {
@Override
public void getName(AccessibleEvent e) {
- if (e.childID == ACC.CHILDID_SELF) {
- String currentName = e.result;
- e.result = Messages.ReusableHelpPart_contextHelpPage_name
- + ' ' + getSection().getText()+ ' ' +currentName;
- }
- }
+ if (e.childID == ACC.CHILDID_SELF) {
+ String currentName = e.result;
+ e.result = Messages.ReusableHelpPart_contextHelpPage_name
+ + ' ' + getSection().getText()+ ' ' +currentName;
+ }
+ }
});
}
@@ -279,10 +279,10 @@ public class ContextHelpPart extends SectionPart implements IHelpPart {
if (lastProvider != null) {
String providerSearchExpression = lastProvider.getSearchExpression(lastControl);
if (providerSearchExpression != null) {
- updateSearchExpression(providerSearchExpression, lastControl);
- return;
+ updateSearchExpression(providerSearchExpression, lastControl);
+ return;
}
- }
+ }
if (lastContext instanceof IContext2) {
String title = ((IContext2)lastContext).getTitle();
if (title!=null) {
@@ -312,8 +312,8 @@ public class ContextHelpPart extends SectionPart implements IHelpPart {
lastPart = part;
if (provider!= null && (context==null || ((context instanceof Context) && IWorkbenchHelpContextIds.MISSING.equals(((Context)context).getId())))) {
if (HelpPlugin.DEBUG_CONTEXT) {
- System.out.println("Getting context from provider"); //$NON-NLS-1$
- }
+ System.out.println("Getting context from provider"); //$NON-NLS-1$
+ }
lastContext = provider.getContext(c);
}
updateSearchExpression();
@@ -322,18 +322,18 @@ public class ContextHelpPart extends SectionPart implements IHelpPart {
if (lastContext!=null) {
helpText = formatHelpContext(lastContext);
if (HelpPlugin.DEBUG_CONTEXT) {
- System.out.println("Context Activation, context = " + lastContext.getText()); //$NON-NLS-1$
- }
+ System.out.println("Context Activation, context = " + lastContext.getText()); //$NON-NLS-1$
+ }
} else {
if (HelpPlugin.DEBUG_CONTEXT) {
- System.out.println("Context Activation on control"); //$NON-NLS-1$
- }
+ System.out.println("Context Activation on control"); //$NON-NLS-1$
+ }
helpText = createContextHelp(c);
}
updateTitle(c);
updateDescription(helpText);
if (RelatedTopicsPart.isUseDynamicHelp()) {
- updateDynamicHelp();
+ updateDynamicHelp();
}
}
@@ -394,7 +394,7 @@ public class ContextHelpPart extends SectionPart implements IHelpPart {
if (expression == null) {
searchTerms = computeSearchTerms(c);
} else {
- searchTerms = new String[] { expression };
+ searchTerms = new String[] { expression };
}
}
@@ -404,8 +404,8 @@ public class ContextHelpPart extends SectionPart implements IHelpPart {
if (part != null) {
if (searchTerms != null) {
if (HelpPlugin.DEBUG_CONTEXT) {
- System.out.println("Dynamic help - search for " + searchTerms); //$NON-NLS-1$
- }
+ System.out.println("Dynamic help - search for " + searchTerms); //$NON-NLS-1$
+ }
part.startSearch(buildSearchExpression(searchTerms), lastContext);
}
}
@@ -469,12 +469,12 @@ public class ContextHelpPart extends SectionPart implements IHelpPart {
.getSite().getRegisteredName()));
} else if (part instanceof IEditorPart) {
if (part.getSite() != null && part.getSite().getRegisteredName() != null) {
- searchTerms.add(part.getSite().getRegisteredName());
+ searchTerms.add(part.getSite().getRegisteredName());
}
}
}
/*
- // Searching by perspective seems counterproductive - CG
+ // Searching by perspective seems counterproductive - CG
IPerspectiveDescriptor persp = page.getPerspective();
if (persp != null) {
searchTerms.add(NLS.bind(
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpSorter.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpSorter.java
index b871aa30c..bf1614002 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpSorter.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ContextHelpSorter.java
@@ -36,7 +36,7 @@ public class ContextHelpSorter extends ViewerComparator {
IHelpResource r1 = (IHelpResource) elements[i];
String c1 = context.getCategory(r1);
if (!list.contains(c1)) {
- list.add(c1);
+ list.add(c1);
}
}
super.sort(viewer, elements);
@@ -50,8 +50,8 @@ public class ContextHelpSorter extends ViewerComparator {
if (!(e1 instanceof IHelpResource)) {
return 1;
}
- IHelpResource r1 = (IHelpResource) e1;
- IHelpResource r2 = (IHelpResource) e2;
+ IHelpResource r1 = (IHelpResource) e1;
+ IHelpResource r2 = (IHelpResource) e2;
String c1 = context.getCategory(r1);
String c2 = context.getCategory(r2);
int i1 = list.indexOf(c1);
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineTypeDescriptor.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineTypeDescriptor.java
index 8ff970c0b..37e0f28ea 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineTypeDescriptor.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineTypeDescriptor.java
@@ -126,7 +126,7 @@ public class EngineTypeDescriptor {
}
}
catch (CoreException e) {
- HelpUIPlugin.logError("Scope factory " + fclass + " cannot be instantiated", null); //$NON-NLS-1$ //$NON-NLS-2$
+ HelpUIPlugin.logError("Scope factory " + fclass + " cannot be instantiated", null); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineTypeWizardPage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineTypeWizardPage.java
index 90073bf70..5664871b4 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineTypeWizardPage.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineTypeWizardPage.java
@@ -86,7 +86,7 @@ public class EngineTypeWizardPage extends WizardPage {
public void createControl(Composite parent) {
Font font = parent.getFont();
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- "org.eclipse.help.ui.searchScope"); //$NON-NLS-1$
+ "org.eclipse.help.ui.searchScope"); //$NON-NLS-1$
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/FederatedSearchSorter.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/FederatedSearchSorter.java
index a750051dd..615b2c206 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/FederatedSearchSorter.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/FederatedSearchSorter.java
@@ -35,17 +35,17 @@ public class FederatedSearchSorter extends ViewerComparator {
return 5;
}
}
- return super.category(element);
- }
+ return super.category(element);
+ }
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
- int cat1 = category(e1);
- int cat2 = category(e2);
+ int cat1 = category(e1);
+ int cat2 = category(e2);
- if (cat1 != cat2)
- return cat1 - cat2;
+ if (cat1 != cat2)
+ return cat1 - cat2;
try {
ISearchEngineResult r1 = (ISearchEngineResult) e1;
ISearchEngineResult r2 = (ISearchEngineResult) e2;
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpView.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpView.java
index 31e553dc2..765bc8fde 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpView.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HelpView.java
@@ -75,7 +75,7 @@ public class HelpView extends ViewPart implements IPartListener2,
reusableHelpPart.setDefaultContextHelpText(Messages.HelpView_defaultText);
reusableHelpPart.showPage(getFirstPage());
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
- "org.eclipse.help.ui.helpView"); //$NON-NLS-1$
+ "org.eclipse.help.ui.helpView"); //$NON-NLS-1$
IWorkbenchWindow window = getSite().getPage().getWorkbenchWindow();
if (window == null)
return;
@@ -124,13 +124,13 @@ public class HelpView extends ViewPart implements IPartListener2,
@Override
public void saveState(IMemento memento) {
- if (reusableHelpPart!=null && memento!=null) {
- String pageId = reusableHelpPart.getCurrentPageId();
- if (pageId!=null)
- memento.putString("pageId", pageId); //$NON-NLS-1$
- reusableHelpPart.saveState(memento);
- }
- }
+ if (reusableHelpPart!=null && memento!=null) {
+ String pageId = reusableHelpPart.getCurrentPageId();
+ if (pageId!=null)
+ memento.putString("pageId", pageId); //$NON-NLS-1$
+ reusableHelpPart.saveState(memento);
+ }
+ }
private void handlePartActivation(IWorkbenchPartReference ref) {
if (reusableHelpPart == null)
@@ -157,12 +157,12 @@ public class HelpView extends ViewPart implements IPartListener2,
} else {
if (HelpPlugin.DEBUG_CONTEXT) {
if (c == null) {
- System.out.println("Context: focus control is null " ); //$NON-NLS-1$
+ System.out.println("Context: focus control is null " ); //$NON-NLS-1$
}
if (!c.isVisible()) {
- System.out.println("Context: focus control not visible " ); //$NON-NLS-1$
+ System.out.println("Context: focus control not visible " ); //$NON-NLS-1$
}
- }
+ }
}
}
@@ -238,8 +238,8 @@ public class HelpView extends ViewPart implements IPartListener2,
selectionChanged(null);
} else {
if (HelpPlugin.DEBUG_CONTEXT) {
- System.out.println("Help View: activation of " + partRef.getPartName() + " part"); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ System.out.println("Help View: activation of " + partRef.getPartName() + " part"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
handlePartActivation(partRef);
}
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HyperlinkTreePart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HyperlinkTreePart.java
index 607101e0a..143251a09 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HyperlinkTreePart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HyperlinkTreePart.java
@@ -286,7 +286,7 @@ public abstract class HyperlinkTreePart extends AbstractFormPart implements
public void init(ReusableHelpPart parent, String id, IMemento memento) {
this.parent = parent;
this.id = id;
- refilter();
+ refilter();
}
@Override
@@ -404,7 +404,7 @@ public abstract class HyperlinkTreePart extends AbstractFormPart implements
for (int i = 0; i < engineDescriptors.length; i++) {
final EngineDescriptor ed = engineDescriptors[i];
if (ed.getEngineTypeId().equals("org.eclipse.help.ui.localSearch") //$NON-NLS-1$
- && ed.getEngine() != null) {
+ && ed.getEngine() != null) {
scope = ed.createSearchScope(set.getPreferenceStore());
}
}
@@ -414,7 +414,7 @@ public abstract class HyperlinkTreePart extends AbstractFormPart implements
treeViewer.resetFilters();
if (workingSet != null) {
WorkingSetScope helpScope = new WorkingSetScope(workingSet, set.getName());
- treeViewer.addFilter(new ScopeFilter(helpScope));
+ treeViewer.addFilter(new ScopeFilter(helpScope));
}
treeViewer.refresh();
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexPart.java
index 1b40bdf8b..2c1bc1a4c 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/IndexPart.java
@@ -228,7 +228,7 @@ public class IndexPart extends HyperlinkTreePart implements IHelpUIConstants {
IHelpResource[] topics = entry.getTopics();
IIndexEntry[] subentries = entry.getSubentries();
IIndexSee[] sees = entry instanceof IIndexEntry2 ? ((IIndexEntry2)entry).getSees() :
- new IIndexSee[0];
+ new IIndexSee[0];
if (topics.length <= 1 && subentries.length == 0 && sees.length == 0) {
// Entries with only one topic do not show children
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/LocalScopeDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/LocalScopeDialog.java
index 8f9266a76..256c35d6b 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/LocalScopeDialog.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/LocalScopeDialog.java
@@ -55,11 +55,11 @@ public class LocalScopeDialog extends TrayDialog {
}
String id = localSearchDesc.getEngineTypeId();
localHelpPage = localSearchDesc.createRootPage(scopeSet.getName());
- localHelpPage.setTitle(localSearchDesc.getLabel() + '_' + id);
- localHelpPage.setImageDescriptor(localSearchDesc.getImageDescriptor());
- localHelpPage.setDescription(localSearchDesc.getDescription());
- localHelpPage.setPreferenceStore(preferenceStore);
- localHelpPage.createControl(parent);
+ localHelpPage.setTitle(localSearchDesc.getLabel() + '_' + id);
+ localHelpPage.setImageDescriptor(localSearchDesc.getImageDescriptor());
+ localHelpPage.setDescription(localSearchDesc.getDescription());
+ localHelpPage.setPreferenceStore(preferenceStore);
+ localHelpPage.createControl(parent);
Control helpPageControl = localHelpPage.getControl();
GridData layoutData = new GridData(GridData.FILL_BOTH);
helpPageControl.setLayoutData(layoutData);
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/MissingContentPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/MissingContentPart.java
index 2725a6aae..aae7f1f63 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/MissingContentPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/MissingContentPart.java
@@ -72,7 +72,7 @@ public class MissingContentPart extends AbstractFormPart implements IHelpPart {
createHelpMissingLink(container, toolkit, Dialog.DLG_IMG_MESSAGE_WARNING, Messages.remoteHelpUnavailable,
MissingContentManager.getInstance().getRemoteHelpUnavailablePage(true), true);
} else if ( isUnresolvedPlaceholders) {
- createHelpMissingLink(container, toolkit, Dialog.DLG_IMG_MESSAGE_INFO, Messages.ReusableHelpPart_missingContent,
+ createHelpMissingLink(container, toolkit, Dialog.DLG_IMG_MESSAGE_INFO, Messages.ReusableHelpPart_missingContent,
MissingContentManager.getInstance().getHelpMissingPage(true), false);
}
toolkit.dispose();
@@ -86,7 +86,7 @@ public class MissingContentPart extends AbstractFormPart implements IHelpPart {
paddingData.heightHint = 2;
padding.setLayoutData(paddingData);
toolkit.adapt(padding);
- Image warningImage = JFaceResources.getImage(imageKey);
+ Image warningImage = JFaceResources.getImage(imageKey);
statusLink = toolkit.createImageHyperlink(container, SWT.NULL);
statusLink.setText(linkText);
statusLink.setImage(warningImage);
@@ -96,9 +96,9 @@ public class MissingContentPart extends AbstractFormPart implements IHelpPart {
public void linkActivated(HyperlinkEvent e) {
helpPart.showURL(target);
if ( isRemote ) {
- helpPart.checkRemoteStatus();
+ helpPart.checkRemoteStatus();
} else {
- helpPart.checkPlaceholderStatus();
+ helpPart.checkPlaceholderStatus();
}
}
});
@@ -108,7 +108,7 @@ public class MissingContentPart extends AbstractFormPart implements IHelpPart {
private void disposeLink() {
if (statusLink != null) {
- statusLink.dispose();
+ statusLink.dispose();
}
statusLink = null;
}
@@ -140,7 +140,7 @@ public class MissingContentPart extends AbstractFormPart implements IHelpPart {
@Override
public void setVisible(boolean visible) {
if (container != null) {
- container.setVisible(visible);
+ container.setVisible(visible);
}
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RelatedTopicsPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RelatedTopicsPart.java
index f22e5a09c..7be698d76 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RelatedTopicsPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RelatedTopicsPart.java
@@ -60,7 +60,7 @@ public class RelatedTopicsPart extends AbstractFormPart implements IHelpPart {
hHint, flushCache);
Point botSize = dynamicHelpPart == null ? new Point(0, 0) :
- dynamicHelpPart.getControl().computeSize(wHint,
+ dynamicHelpPart.getControl().computeSize(wHint,
hHint, flushCache);
Point size = new Point(0, 0);
size.x = Math.max(topSize.x, botSize.x);
@@ -74,13 +74,13 @@ public class RelatedTopicsPart extends AbstractFormPart implements IHelpPart {
Point topSize = contextHelpPart.getControl().computeSize(
carea.width, SWT.DEFAULT, flushCache);
Point botSize = dynamicHelpPart == null ? new Point(0, 0) :
- dynamicHelpPart.getControl().computeSize(
+ dynamicHelpPart.getControl().computeSize(
carea.width, SWT.DEFAULT, flushCache);
int y = VSPACE;
contextHelpPart.getControl().setBounds(0, y, carea.width, topSize.y);
y += topSize.y + VSPACE;
if (dynamicHelpPart != null) {
- dynamicHelpPart.getControl().setBounds(0, y, carea.width, botSize.y);
+ dynamicHelpPart.getControl().setBounds(0, y, carea.width, botSize.y);
}
}
@@ -116,7 +116,7 @@ public class RelatedTopicsPart extends AbstractFormPart implements IHelpPart {
contextHelpPart = new ContextHelpPart(form.getBody(), toolkit);
if (isUseDynamicHelp()) {
dynamicHelpPart = new DynamicHelpPart(form.getBody(), toolkit);
- }
+ }
}
@Override
@@ -126,8 +126,8 @@ public class RelatedTopicsPart extends AbstractFormPart implements IHelpPart {
contextHelpPart.init(parent, IHelpUIConstants.HV_CONTEXT_HELP, memento);
mform.addPart(contextHelpPart);
if (isUseDynamicHelp()) {
- dynamicHelpPart.init(parent, IHelpUIConstants.HV_SEARCH_RESULT, memento);
- mform.addPart(dynamicHelpPart);
+ dynamicHelpPart.init(parent, IHelpUIConstants.HV_SEARCH_RESULT, memento);
+ mform.addPart(dynamicHelpPart);
}
mform.initialize();
}
@@ -184,7 +184,7 @@ public class RelatedTopicsPart extends AbstractFormPart implements IHelpPart {
public void stop() {
contextHelpPart.stop();
if (dynamicHelpPart != null) {
- dynamicHelpPart.stop();
+ dynamicHelpPart.stop();
}
}
@@ -225,14 +225,14 @@ public class RelatedTopicsPart extends AbstractFormPart implements IHelpPart {
}
public static boolean isUseDynamicHelp() {
- if (!dynamicHelpPreferenceRead) {
- dynamicHelpPreferenceRead = true;
- // Preference created in case anyone complains about the removal of
- // the dynamic help section. This is not API, not documented and may
- // be removed in a future release.
- useDynamicHelp =
- Platform.getPreferencesService().getBoolean(HelpBasePlugin.PLUGIN_ID, "show_dynamic_help", false, null); //$NON-NLS-1$
- }
+ if (!dynamicHelpPreferenceRead) {
+ dynamicHelpPreferenceRead = true;
+ // Preference created in case anyone complains about the removal of
+ // the dynamic help section. This is not API, not documented and may
+ // be removed in a future release.
+ useDynamicHelp =
+ Platform.getPreferencesService().getBoolean(HelpBasePlugin.PLUGIN_ID, "show_dynamic_help", false, null); //$NON-NLS-1$
+ }
return useDynamicHelp;
}
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RenameDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RenameDialog.java
index 00d5234d7..35746378b 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RenameDialog.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/RenameDialog.java
@@ -39,11 +39,11 @@ public class RenameDialog extends SelectionStatusDialog {
private IStatus status;
private boolean isCaseSensitive;
- /**
- * Create a new rename dialog instance for the given window.
- * @param shell The parent of the dialog
- * @param oldName Current name of the item being renamed
- */
+ /**
+ * Create a new rename dialog instance for the given window.
+ * @param shell The parent of the dialog
+ * @param oldName Current name of the item being renamed
+ */
public RenameDialog(Shell shell, String oldName) {
super(shell);
this.isCaseSensitive = false;
@@ -51,13 +51,13 @@ public class RenameDialog extends SelectionStatusDialog {
setOldName(oldName);
}
- /**
- * Create a new rename dialog instance for the given window.
- * @param shell The parent of the dialog
- * @param isCaseSensitive Flags whether dialog will perform case sensitive checks against old names
- * @param names Set of names which the user should not be allowed to rename to
- * @param oldName Current name of the item being renamed
- */
+ /**
+ * Create a new rename dialog instance for the given window.
+ * @param shell The parent of the dialog
+ * @param isCaseSensitive Flags whether dialog will perform case sensitive checks against old names
+ * @param names Set of names which the user should not be allowed to rename to
+ * @param oldName Current name of the item being renamed
+ */
public RenameDialog(Shell shell, boolean isCaseSensitive, String[] names, String oldName){
super(shell);
this.isCaseSensitive = isCaseSensitive;
@@ -91,7 +91,7 @@ public class RenameDialog extends SelectionStatusDialog {
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
- layout.marginHeight = layout.marginWidth = 9;
+ layout.marginHeight = layout.marginWidth = 9;
container.setLayout(layout);
GridData gd = new GridData(GridData.FILL_BOTH);
@@ -113,8 +113,8 @@ public class RenameDialog extends SelectionStatusDialog {
public int open() {
text.setText(oldName);
text.selectAll();
- setOkStatus();
- textChanged(oldName, false);
+ setOkStatus();
+ textChanged(oldName, false);
return super.open();
}
@@ -139,7 +139,7 @@ public class RenameDialog extends SelectionStatusDialog {
}
okButton.setEnabled(true);
if (setStatus) {
- setOkStatus();
+ setOkStatus();
}
}
@@ -179,6 +179,6 @@ public class RenameDialog extends SelectionStatusDialog {
@Override
public void setTitle(String title) {
- getShell().setText(title);
- }
+ getShell().setText(title);
+ }
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java
index f4128df83..ec5366ad0 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ReusableHelpPart.java
@@ -331,8 +331,8 @@ public class ReusableHelpPart implements IHelpUIConstants,
subMenuManager = new SubMenuManager(
ReusableHelpPart.this.menuManager);
} else {
- subMenuManager = null;
- }
+ subMenuManager = null;
+ }
}
}
@@ -352,7 +352,7 @@ public class ReusableHelpPart implements IHelpUIConstants,
try {
((SubToolBarManager) subToolBarManager).disposeManager();
if (subMenuManager != null) {
- ((SubMenuManager)subMenuManager).disposeManager();
+ ((SubMenuManager)subMenuManager).disposeManager();
}
} catch (RuntimeException e) {
// Bug 218079
@@ -535,7 +535,7 @@ public class ReusableHelpPart implements IHelpUIConstants,
} else {
((SubToolBarManager) subToolBarManager).setVisible(visible);
if (subMenuManager != null) {
- ((SubMenuManager)subMenuManager).setVisible(visible);
+ ((SubMenuManager)subMenuManager).setVisible(visible);
}
ReusableHelpPart.this.toolBarManager.update(true);
getControl().getParent().layout();
@@ -574,8 +574,8 @@ public class ReusableHelpPart implements IHelpUIConstants,
PartRec rec = partRecs.get(focusPart);
String partId = rec.part.getId();
if ( partId != IHelpUIConstants.HV_SEE_ALSO && partId != IHelpUIConstants.HV_MISSING_CONTENT) {
- rec.part.setFocus();
- return;
+ rec.part.setFocus();
+ return;
}
}
}
@@ -1331,9 +1331,9 @@ public class ReusableHelpPart implements IHelpUIConstants,
if (aurl.endsWith("&noframes=true") || aurl.endsWith("?noframes=true")) //$NON-NLS-1$ //$NON-NLS-2$
aurl = aurl.substring(0, aurl.length() - 14);
DefaultHelpUI.showInWorkbenchBrowser(aurl, false);
- */
+ */
- PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(aurl);
+ PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(aurl);
} catch (Exception e) {
HelpUIPlugin.logError("Error opening browser", e); //$NON-NLS-1$
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopePreferenceManager.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopePreferenceManager.java
index 4e02384e2..ec5f9688d 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopePreferenceManager.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopePreferenceManager.java
@@ -35,16 +35,16 @@ public class ScopePreferenceManager extends PreferenceManager implements IHelpUI
@Override
public void createPage() {
- try {
- Object obj = config.createExecutableExtension(IHelpUIConstants.ATT_CLASS);
- IPreferencePage page = (IPreferencePage)obj;
- setPage(page);
- page.setTitle(getLabelText());
- }
- catch (CoreException e) {
- HelpUIPlugin.logError("Unable to create executable extension", e); //$NON-NLS-1$
- }
- }
+ try {
+ Object obj = config.createExecutableExtension(IHelpUIConstants.ATT_CLASS);
+ IPreferencePage page = (IPreferencePage)obj;
+ setPage(page);
+ page.setTitle(getLabelText());
+ }
+ catch (CoreException e) {
+ HelpUIPlugin.logError("Unable to create executable extension", e); //$NON-NLS-1$
+ }
+ }
}
class EnginePreferenceNode extends PreferenceNode {
private EngineDescriptor desc;
@@ -59,12 +59,12 @@ public class ScopePreferenceManager extends PreferenceManager implements IHelpUI
@Override
public void createPage() {
- IPreferencePage page = desc.createRootPage(set.getName());
- setPage(page);
- page.setTitle(desc.getLabel());
- page.setImageDescriptor(desc.getImageDescriptor());
- page.setDescription(desc.getDescription());
- }
+ IPreferencePage page = desc.createRootPage(set.getName());
+ setPage(page);
+ page.setTitle(desc.getLabel());
+ page.setImageDescriptor(desc.getImageDescriptor());
+ page.setDescription(desc.getDescription());
+ }
}
/**
*
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSelectPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSelectPart.java
index 075835844..cf827f6e8 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSelectPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSelectPart.java
@@ -64,7 +64,7 @@ public class ScopeSelectPart extends AbstractFormPart implements IHelpPart {
@Override
public void linkActivated(HyperlinkEvent e) {
- doChangeScopeSet();
+ doChangeScopeSet();
}
});
toolkit.adapt(scopeSetLink, true, true);
@@ -177,7 +177,7 @@ public class ScopeSelectPart extends AbstractFormPart implements IHelpPart {
@Override
public void dispose() {
if (scopeObserver != null) {
- ScopeState.getInstance().getScopeSetManager().deleteObserver(scopeObserver);
+ ScopeState.getInstance().getScopeSetManager().deleteObserver(scopeObserver);
}
super.dispose();
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSetDialog.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSetDialog.java
index 96564822b..f7af292cc 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSetDialog.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/ScopeSetDialog.java
@@ -93,8 +93,8 @@ public class ScopeSetDialog extends TrayDialog {
private ILabelProvider labelProvider;
private Object input;
private TableViewer viewer;
- private int widthInChars = 55;
- private int heightInChars = 15;
+ private int widthInChars = 55;
+ private int heightInChars = 15;
private ScopeSet initialSelection;
private Object[] result;
private boolean localOnly;
@@ -234,65 +234,65 @@ public class ScopeSetDialog extends TrayDialog {
@Override
protected Control createDialogArea(Composite container) {
- Composite innerContainer = (Composite)super.createDialogArea(container);
- createRadioButtons(innerContainer);
- createTable(innerContainer);
- enableTable();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(innerContainer,
+ Composite innerContainer = (Composite)super.createDialogArea(container);
+ createRadioButtons(innerContainer);
+ createTable(innerContainer);
+ enableTable();
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(innerContainer,
"org.eclipse.help.ui.searchScope"); //$NON-NLS-1$
- createEditingButtons(innerContainer);
+ createEditingButtons(innerContainer);
viewer.addSelectionChangedListener(event -> updateButtons());
- ViewerFilter[] filters = { new NonDefaultFilter() };
+ ViewerFilter[] filters = { new NonDefaultFilter() };
viewer.setFilters(filters );
- return innerContainer;
- }
+ return innerContainer;
+ }
private void createRadioButtons(Composite parent) {
boolean showAll = initialSelection != null && initialSelection.isDefault();
showAllRadio = new Button(parent, SWT.RADIO);
- showAllRadio.setText(Messages.ScopeSet_selectAll);
+ showAllRadio.setText(Messages.ScopeSet_selectAll);
- showSelectedRadio = new Button(parent, SWT.RADIO);
- showSelectedRadio.setText(Messages.ScopeSet_selectWorkingSet);
- showAllRadio.addSelectionListener(new ShowAllListener());
- showAllRadio.setSelection(showAll);
- showSelectedRadio.setSelection(!showAll);
+ showSelectedRadio = new Button(parent, SWT.RADIO);
+ showSelectedRadio.setText(Messages.ScopeSet_selectWorkingSet);
+ showAllRadio.addSelectionListener(new ShowAllListener());
+ showAllRadio.setSelection(showAll);
+ showSelectedRadio.setSelection(!showAll);
}
- private void createTable(Composite parent) {
- viewer = new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- viewer.setContentProvider(contentProvider);
- viewer.setLabelProvider(labelProvider);
- viewer.setInput(input);
+ private void createTable(Composite parent) {
+ viewer = new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ viewer.setContentProvider(contentProvider);
+ viewer.setLabelProvider(labelProvider);
+ viewer.setInput(input);
viewer.addDoubleClickListener(event -> okPressed());
- if (initialSelection != null) {
+ if (initialSelection != null) {
viewer.setSelection(new StructuredSelection(initialSelection));
}
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = convertHeightInCharsToPixels(heightInChars);
- gd.widthHint = convertWidthInCharsToPixels(widthInChars);
- Table table = viewer.getTable();
- table.setLayoutData(gd);
- table.setFont(parent.getFont());
- }
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = convertHeightInCharsToPixels(heightInChars);
+ gd.widthHint = convertWidthInCharsToPixels(widthInChars);
+ Table table = viewer.getTable();
+ table.setLayoutData(gd);
+ table.setFont(parent.getFont());
+ }
private void enableTable() {
if (viewer != null) {
- boolean showSelected = showSelectedRadio.getSelection();
+ boolean showSelected = showSelectedRadio.getSelection();
viewer.getTable().setEnabled(showSelected);
- viewer.refresh();
- // Ensure that a scope is selected unless there are no
- // user defined scopes
- if (showSelected && viewer.getSelection().isEmpty()) {
- Object firstElement = viewer.getElementAt(0);
- if ( firstElement != null ) {
- viewer.setSelection(new StructuredSelection(firstElement));
- }
- }
+ viewer.refresh();
+ // Ensure that a scope is selected unless there are no
+ // user defined scopes
+ if (showSelected && viewer.getSelection().isEmpty()) {
+ Object firstElement = viewer.getElementAt(0);
+ if ( firstElement != null ) {
+ viewer.setSelection(new StructuredSelection(firstElement));
+ }
+ }
}
}
- private void createEditingButtons(Composite composite) {
+ private void createEditingButtons(Composite composite) {
Composite buttonComposite= new Composite(composite, SWT.RIGHT);
GridLayout layout= new GridLayout();
layout.numColumns= 2;
@@ -300,12 +300,12 @@ public class ScopeSetDialog extends TrayDialog {
GridData data= new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
data.grabExcessHorizontalSpace= true;
composite.setData(data);
- createButton(buttonComposite, NEW_ID, Messages.ScopeSetDialog_new, false);
- renameButton = createButton(buttonComposite, RENAME_ID, Messages.ScopeSetDialog_rename, false);
- editButton = createButton(buttonComposite, EDIT_ID, Messages.ScopeSetDialog_edit, false);
- removeButton = createButton(buttonComposite, REMOVE_ID, Messages.ScopeSetDialog_remove, false);
- updateButtons();
- }
+ createButton(buttonComposite, NEW_ID, Messages.ScopeSetDialog_new, false);
+ renameButton = createButton(buttonComposite, RENAME_ID, Messages.ScopeSetDialog_rename, false);
+ editButton = createButton(buttonComposite, EDIT_ID, Messages.ScopeSetDialog_edit, false);
+ removeButton = createButton(buttonComposite, REMOVE_ID, Messages.ScopeSetDialog_remove, false);
+ updateButtons();
+ }
public ScopeSet getActiveSet() {
if (result!=null && result.length>0)
@@ -315,22 +315,22 @@ public class ScopeSetDialog extends TrayDialog {
@Override
protected void okPressed() {
- if (operations!=null) {
- for (int i=0; i<operations.size(); i++) {
+ if (operations!=null) {
+ for (int i=0; i<operations.size(); i++) {
PendingOperation operation = operations.get(i);
- operation.commit();
- }
- operations = null;
- }
- if (showAllRadio.getSelection()) {
- setResult(manager.getDefaultScope());
- } else {
- // Build a list of selected children.
+ operation.commit();
+ }
+ operations = null;
+ }
+ if (showAllRadio.getSelection()) {
+ setResult(manager.getDefaultScope());
+ } else {
+ // Build a list of selected children.
IStructuredSelection selection = viewer.getStructuredSelection();
- setResult(selection.toList());
- }
- super.okPressed();
- }
+ setResult(selection.toList());
+ }
+ super.okPressed();
+ }
private void setResult(ScopeSet scope) {
result = new Object[] { scope };
@@ -347,13 +347,13 @@ public class ScopeSetDialog extends TrayDialog {
@Override
protected void cancelPressed() {
- if (operations!=null) {
- for (int i=0; i<operations.size(); i++) {
+ if (operations!=null) {
+ for (int i=0; i<operations.size(); i++) {
PendingOperation operation = operations.get(i);
- operation.cancel();
- }
- operations = null;
- }
+ operation.cancel();
+ }
+ operations = null;
+ }
super.cancelPressed();
}
@@ -394,15 +394,15 @@ public class ScopeSetDialog extends TrayDialog {
Set<String> namesInUse = new HashSet<>();
for (int i=0; i<sets.size(); i++) {
ScopeSet set = sets.get(i);
- namesInUse.add(set.getName().toLowerCase());
- }
+ namesInUse.add(set.getName().toLowerCase());
+ }
for (int i = 1; i < 1000; i++) {
String name = Messages.ScopeSetDialog_defaultName + i;
if (!namesInUse.contains(name.toLowerCase())) {
return name;
}
}
- return ""; //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
}
@@ -415,7 +415,7 @@ public class ScopeSetDialog extends TrayDialog {
PreferenceManager manager = new ScopePreferenceManager(descManager, set);
if (!localOnly) {
- PreferenceDialog dialog = new ScopePreferenceDialog(getShell(), manager, descManager, set.isEditable());
+ PreferenceDialog dialog = new ScopePreferenceDialog(getShell(), manager, descManager, set.isEditable());
dialog.setPreferenceStore(set.getPreferenceStore());
dialog.create();
dialog.getShell().setText(NLS.bind(Messages.ScopePreferenceDialog_wtitle, set.getName()));
@@ -455,7 +455,7 @@ public class ScopeSetDialog extends TrayDialog {
dialog.create();
String dialogTitle = isRename ?
Messages.RenameDialog_wtitle : Messages.NewDialog_wtitle;
- dialog.getShell().setText(dialogTitle);
+ dialog.getShell().setText(dialogTitle);
if (dialog.open()==RenameDialog.OK) {
return dialog.getNewName();
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchPart.java
index eb4aa12d4..ba9bdc580 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchPart.java
@@ -237,7 +237,7 @@ public class SearchPart extends AbstractFormPart implements IHelpPart, IHelpUICo
if (e.character == '\r') {
if (goButton.isEnabled()) {
doSearch(searchWordCombo.getText());
- }
+ }
}
}
});
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchResultsPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchResultsPart.java
index 2cb87c01a..ac23b1fc8 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchResultsPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SearchResultsPart.java
@@ -130,17 +130,17 @@ public class SearchResultsPart extends AbstractFormPart implements IHelpPart {
*/
boolean descOn = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SHOW_SEARCH_DESCRIPTION, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SHOW_SEARCH_DESCRIPTION, false, null);
boolean showCategories = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SHOW_SEARCH_CATEGORIES, false, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SHOW_SEARCH_CATEGORIES, false, null);
showCategoriesAction = new Action() {
@Override
public void run() {
updateResultSections();
- IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID);
- pref.putBoolean(IHelpBaseConstants.P_KEY_SHOW_SEARCH_CATEGORIES, showCategoriesAction.isChecked());
- try {
+ IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID);
+ pref.putBoolean(IHelpBaseConstants.P_KEY_SHOW_SEARCH_CATEGORIES, showCategoriesAction.isChecked());
+ try {
pref.flush();
} catch (BackingStoreException e) {
}
@@ -159,8 +159,8 @@ public class SearchResultsPart extends AbstractFormPart implements IHelpPart {
public void run() {
updateResultSections();
IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID);
- pref.putBoolean(IHelpBaseConstants.P_KEY_SHOW_SEARCH_DESCRIPTION, showDescriptionAction.isChecked());
- try {
+ pref.putBoolean(IHelpBaseConstants.P_KEY_SHOW_SEARCH_DESCRIPTION, showDescriptionAction.isChecked());
+ try {
pref.flush();
} catch (BackingStoreException e) {
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SeeAlsoPart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SeeAlsoPart.java
index 3d90abe4b..9c1e4a50b 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SeeAlsoPart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/SeeAlsoPart.java
@@ -85,7 +85,7 @@ public class SeeAlsoPart extends AbstractFormPart implements IHelpPart {
if (isCurrentPage) {
link.setFont(JFaceResources.getBannerFont());
} else {
- link.setFont(JFaceResources.getDefaultFont());
+ link.setFont(JFaceResources.getDefaultFont());
}
data.exclude = false;
link.setVisible(!data.exclude);
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 15065a4ba..9c63cb3b0 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
@@ -107,11 +107,11 @@ public class StatusProducer implements IHelpContentProducer {
// check to see if a predefined error page exists
// in the preferences
if (href.equalsIgnoreCase(MissingContentManager.MISSING_TOPIC_HREF)){
- String errorPage = Platform.getPreferencesService().getString(
- HelpBasePlugin.PLUGIN_ID,
- "page_not_found", //$NON-NLS-1$
- null,
- null);
+ String errorPage = Platform.getPreferencesService().getString(
+ HelpBasePlugin.PLUGIN_ID,
+ "page_not_found", //$NON-NLS-1$
+ null,
+ null);
if (errorPage != null && errorPage.length() > 0) {
URL helpURL;
@@ -302,7 +302,7 @@ public class StatusProducer implements IHelpContentProducer {
}
pageBuffer.append(tab(3)+ "</ul>\n"); //$NON-NLS-1$
if (isHelpView) {
- pageBuffer.append(tab(3)+"<br/><p>\n"); //$NON-NLS-1$
+ pageBuffer.append(tab(3)+"<br/><p>\n"); //$NON-NLS-1$
pageBuffer.append(tab(4)+ "<a href=helpview:ignoreMissingBooks>"+ //$NON-NLS-1$
WebappResources.getString("ignoreMissingBooks", locale) + "</a>\n"); //$NON-NLS-1$ //$NON-NLS-2$
pageBuffer.append(tab(3)+ "</p>\n"); //$NON-NLS-1$
@@ -310,8 +310,8 @@ public class StatusProducer implements IHelpContentProducer {
pageBuffer.append(tab(3)+"<br/><p>\n"); //$NON-NLS-1$
//pageBuffer.append("<img src=\"PLUGINS_ROOT/org.eclipse.help/command_link.png\"/>"); //$NON-NLS-1$
pageBuffer.append("<a class=\"command-link\"" //$NON-NLS-1$
- + " href='javascript:executeCommand(\"org.eclipse.help.ui.ignoreMissingPlaceholders\")'>" //$NON-NLS-1$
- + WebappResources.getString("ignoreMissingBooks", locale)+"</a>"); //$NON-NLS-1$ //$NON-NLS-2$
+ + " href='javascript:executeCommand(\"org.eclipse.help.ui.ignoreMissingPlaceholders\")'>" //$NON-NLS-1$
+ + WebappResources.getString("ignoreMissingBooks", locale)+"</a>"); //$NON-NLS-1$ //$NON-NLS-2$
pageBuffer.append(tab(3)+ "</p>\n"); //$NON-NLS-1$
}
pageBuffer.append(END_BODY_HTML);
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 9a3a10def..f6e85b443 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
@@ -36,16 +36,16 @@ public class CookiesData extends RequestData {
public boolean isSynchToc() {
Cookie[] cookies = request.getCookies();
if (cookies != null) {
- for (Cookie cookie : cookies) {
- if ("synchToc".equals(cookie.getName())) { //$NON-NLS-1$
- return String.valueOf(true).equals(cookie.getValue());
- }
- }
+ for (Cookie cookie : cookies) {
+ if ("synchToc".equals(cookie.getName())) { //$NON-NLS-1$
+ return String.valueOf(true).equals(cookie.getValue());
+ }
+ }
}
boolean isSynchToc = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, "advanced.syncDefault", false, null); //$NON-NLS-1$
+ (HelpBasePlugin.PLUGIN_ID, "advanced.syncDefault", false, null); //$NON-NLS-1$
CookieUtil.setCookieValue("synchToc", Boolean.toString(isSynchToc), request, response); //$NON-NLS-1$
return isSynchToc;
- }
+ }
}
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 9554f24b7..616c8dbad 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
@@ -64,7 +64,7 @@ public class EnabledTopicUtils {
*/
public static boolean isEnabled(IToc toc) {
if (!HelpBasePlugin.getActivitySupport().isEnabled(toc.getHref()) ||
- UAContentFilter.isFiltered(toc, HelpEvaluationContext.getContext())) {
+ UAContentFilter.isFiltered(toc, HelpEvaluationContext.getContext())) {
return false;
}
// A toc is enabled only if at least one subtopic is enabled
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 a0b9330ac..2983782ea 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
@@ -84,10 +84,10 @@ public class IconFinder {
String suffix;
switch(type){
- case 0:suffix = OPEN;break;
- case 1:suffix = CLOSED;break;
- case 2:suffix = LEAF;break;
- default: suffix = OPEN; break;
+ case 0:suffix = OPEN;break;
+ case 1:suffix = CLOSED;break;
+ case 2:suffix = LEAF;break;
+ default: suffix = OPEN; break;
}
String result = lookupImagePath(iconId + suffix);
if (result != null) {
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 a10db3e44..e66c37eae 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
@@ -221,7 +221,7 @@ public class LayoutData extends RequestData {
BundleContext bundleContext = HelpWebappPlugin.getContext();
ServiceReference<?> ref = bundleContext.getServiceReference(BundleLocalization.class.getName());
BundleLocalization localization = (BundleLocalization) bundleContext.getService(ref);
- return localization.getLocalization(bundle, locale).getString(resource);
+ return localization.getLocalization(bundle, locale).getString(resource);
} catch (Exception e) {
// Fall through
}
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 0bfecd227..5e5eedf6f 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
@@ -164,10 +164,10 @@ public class PrintData extends RequestData {
public void generateResources(Writer out) throws IOException, ServletException {
// check resource allocation
if (!getConnection()) {
- RequestDispatcher rd = context.getRequestDispatcher("/advanced/printError.jsp"); //$NON-NLS-1$
- request.setAttribute("msg", "noConnection"); //$NON-NLS-1$ //$NON-NLS-2$
- rd.forward(request, response);
- return;
+ RequestDispatcher rd = context.getRequestDispatcher("/advanced/printError.jsp"); //$NON-NLS-1$
+ request.setAttribute("msg", "noConnection"); //$NON-NLS-1$ //$NON-NLS-2$
+ rd.forward(request, response);
+ return;
}
@@ -196,17 +196,17 @@ public class PrintData extends RequestData {
}
}
- private static synchronized boolean getConnection() {
- if (allowedConnections > 0) {
- allowedConnections--;
- return true;
- }
- return false;
- }
-
- private static synchronized void releaseConnection() {
- allowedConnections++;
- }
+ private static synchronized boolean getConnection() {
+ if (allowedConnections > 0) {
+ allowedConnections--;
+ return true;
+ }
+ return false;
+ }
+
+ private static synchronized void releaseConnection() {
+ allowedConnections++;
+ }
/*
* Calculate the amount of topics to print in one request
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 d841f57e3..539fea155 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
@@ -144,7 +144,7 @@ public class RequestScope {
}
} else {
IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID);
- pref.put(IHelpBaseConstants.P_KEY_HELP_SCOPE, scope);
+ pref.put(IHelpBaseConstants.P_KEY_HELP_SCOPE, scope);
try {
pref.flush();
} catch (BackingStoreException e) {
@@ -171,12 +171,12 @@ public class RequestScope {
private static String getScopeFromPreferences() {
String scope = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_HELP_SCOPE, null, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_HELP_SCOPE, null, null);
return scope;
}
public static boolean filterBySearchScope(HttpServletRequest request) {
- return true;
+ return true;
}
public static boolean getFlag(HttpServletRequest request, String flagName ) {
@@ -185,26 +185,26 @@ public class RequestScope {
value = getValueFromCookies(request, flagName);
} else {
value = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, flagName + "Webapp", null, null); //$NON-NLS-1$
+ (HelpBasePlugin.PLUGIN_ID, flagName + "Webapp", null, null); //$NON-NLS-1$
}
if (value == null) {
return Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, flagName, false, null);
+ (HelpBasePlugin.PLUGIN_ID, flagName, false, null);
}
return "true".equalsIgnoreCase(value); //$NON-NLS-1$
}
public static void setFlag(HttpServletRequest request,
- HttpServletResponse response,
- String flagName,
- boolean value)
+ HttpServletResponse response,
+ String flagName,
+ boolean value)
{
if (HelpSystem.isShared()) {
- CookieUtil.setCookieValueWithoutPath(flagName, Boolean.toString(value), request, response);
+ CookieUtil.setCookieValueWithoutPath(flagName, Boolean.toString(value), request, response);
} else {
IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpBasePlugin.PLUGIN_ID);
- pref.putBoolean(flagName + "Webapp", value ); //$NON-NLS-1$
- try {
+ pref.putBoolean(flagName + "Webapp", value ); //$NON-NLS-1$
+ try {
pref.flush();
} catch (BackingStoreException e) {
}
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 33b7e2bad..fd8a667d3 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
@@ -27,7 +27,7 @@ public class ScopeSavingSearchData extends SearchData {
@Override
protected boolean canSaveScope() {
- return true;
+ 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 a4bdbb86c..b41de42b9 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
@@ -113,7 +113,7 @@ public class SearchData extends ActivitiesData {
if (isScopeRequest()) {
workingSetName = request.getParameter("workingSet"); //$NON-NLS-1$
if ( canSaveScope() ) {
- saveWorkingSet(workingSetName);
+ saveWorkingSet(workingSetName);
}
}
@@ -122,7 +122,7 @@ public class SearchData extends ActivitiesData {
}
protected boolean canSaveScope() {
- // Scope is only saved from scopeState.jsp
+ // Scope is only saved from scopeState.jsp
// This prevents cookies from being saved with a /advanced path
return false;
}
@@ -329,15 +329,15 @@ public class SearchData extends ActivitiesData {
public boolean isShowDescriptions() {
Cookie[] cookies = request.getCookies();
if (cookies != null) {
- for (Cookie cookie : cookies) {
- if ("showDescriptions".equals(cookie.getName())) { //$NON-NLS-1$
- return String.valueOf(true).equals(cookie.getValue());
- }
- }
+ for (Cookie cookie : cookies) {
+ if ("showDescriptions".equals(cookie.getName())) { //$NON-NLS-1$
+ return String.valueOf(true).equals(cookie.getValue());
+ }
+ }
}
// get default from preferences
return Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SHOW_SEARCH_DESCRIPTION, true, null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_SHOW_SEARCH_DESCRIPTION, true, null);
}
/**
@@ -398,7 +398,7 @@ public class SearchData extends ActivitiesData {
if (workingSetName != null && workingSetName.length() != 0)
return workingSetName;
- if (isSearchRequest()) {
+ if (isSearchRequest()) {
workingSetName = request.getParameter("scope"); //$NON-NLS-1$
// if we have already set the working set, then use it.
if (workingSetName == null) {
@@ -617,22 +617,22 @@ public class SearchData extends ActivitiesData {
}
public String getNotFoundMessage() {
- String scope = getScope();
- if (scope.equals(ServletResources.getString("All", request))) { //$NON-NLS-1$
- return ServletResources.getString("Nothing_found", request); //$NON-NLS-1$
+ String scope = getScope();
+ if (scope.equals(ServletResources.getString("All", request))) { //$NON-NLS-1$
+ return ServletResources.getString("Nothing_found", request); //$NON-NLS-1$
} else {
- return NLS.bind(ServletResources.getString("Nothing_found_in_scope", request), scope); //$NON-NLS-1$
+ return NLS.bind(ServletResources.getString("Nothing_found_in_scope", request), scope); //$NON-NLS-1$
}
}
public String getScopeActiveMessage() {
- String scope = getScope();
+ String scope = getScope();
return NLS.bind(ServletResources.getString("activeScope", request), scope); //$NON-NLS-1$
}
public String getMatchesInScopeMessage() {
- String scope = getScope();
- return NLS.bind(ServletResources.getString("matchesInScope", request), "" + getResultsCount(), scope); //$NON-NLS-1$ //$NON-NLS-2$
+ String scope = getScope();
+ return NLS.bind(ServletResources.getString("matchesInScope", request), "" + getResultsCount(), scope); //$NON-NLS-1$ //$NON-NLS-2$
}
public String getPreProcessorResults()
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServerState.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServerState.java
index ecda6ba0d..fd6fe284c 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServerState.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServerState.java
@@ -27,9 +27,9 @@ public class ServerState {
* situation where the Webapp is run without being launched on the built in server
* in which case we set the mode to infocenter.
*/
- public static void webappStarted(ServletContext context, HttpServletRequest request,
+ public static void webappStarted(ServletContext context, HttpServletRequest request,
HttpServletResponse response) {
- BaseHelpSystem.checkMode();
- }
+ BaseHelpSystem.checkMode();
+ }
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServletResources.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServletResources.java
index 6fd6b3887..7166ff0c0 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServletResources.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/ServletResources.java
@@ -138,8 +138,8 @@ public class ServletResources {
}
int amp = property.indexOf('&');
if (amp <0 || amp >= property.length() - 1) {
- return null;
- }
+ return null;
+ }
return ("" + property.charAt(amp +1)).toLowerCase(Locale.ENGLISH); //$NON-NLS-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 7230c0d89..46d140341 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
@@ -233,7 +233,7 @@ public class TocData extends ActivitiesData {
TopicFinder finder = new TopicFinder("/nav/" + completePath, tocs, scope); //$NON-NLS-1$
topicPath = finder.getTopicPath();
selectedToc = finder.getSelectedToc();
- numericPath = finder.getNumericPath();
+ numericPath = finder.getNumericPath();
} else {
// toc not specified as parameter
// try obtaining the TOC from the topic
@@ -258,7 +258,7 @@ public class TocData extends ActivitiesData {
}
}
if (selectedToc != -1) {
- topicPath = decodePath(path, tocs[selectedToc], scope);
+ topicPath = decodePath(path, tocs[selectedToc], scope);
}
} else {
selectedToc = -1;
@@ -336,49 +336,49 @@ public class TocData extends ActivitiesData {
return childTopics;
}
private void generateTopicLinks(ITopic topic, Writer w, int indent) {
- String topicHref = topic.getHref();
- try {
- if (indent == 0)
- w.write("<b>"); //$NON-NLS-1$
- for (int tab = 0; tab < indent; tab++) {
- w.write("&nbsp;&nbsp;"); //$NON-NLS-1$
- }
- if (topicHref != null && topicHref.length() > 0) {
- w.write("<a href=\""); //$NON-NLS-1$
- if ('/' == topicHref.charAt(0)) {
- w.write("topic"); //$NON-NLS-1$
- }
- w.write(topicHref);
- w.write("\">"); //$NON-NLS-1$
- w.write(UrlUtil.htmlEncode(topic.getLabel()));
- w.write("</a>"); //$NON-NLS-1$
- } else {
- w.write(UrlUtil.htmlEncode(topic.getLabel()));
- }
- w.write("<br>\n"); //$NON-NLS-1$
- if (indent == 0)
- w.write("</b>"); //$NON-NLS-1$
- } catch (IOException ioe) {
- }
- ITopic[] topics = topic.getSubtopics();
- for (ITopic topic2 : topics) {
- generateTopicLinks(topic2, w, indent + 1);
- }
- }
-
- public void generateLinks(Writer out) {
- for (IToc toc : tocs) {
- ITopic tocTopic = toc.getTopic(null);
- generateTopicLinks(tocTopic, out, 0);
- ITopic[] topics = toc.getTopics();
- for (ITopic topic : topics) {
- generateTopicLinks(topic, out, 1);
- }
- }
-
- }
-
- public ITopic[] getTopicPathFromRootPath(IToc toc) {
+ String topicHref = topic.getHref();
+ try {
+ if (indent == 0)
+ w.write("<b>"); //$NON-NLS-1$
+ for (int tab = 0; tab < indent; tab++) {
+ w.write("&nbsp;&nbsp;"); //$NON-NLS-1$
+ }
+ if (topicHref != null && topicHref.length() > 0) {
+ w.write("<a href=\""); //$NON-NLS-1$
+ if ('/' == topicHref.charAt(0)) {
+ w.write("topic"); //$NON-NLS-1$
+ }
+ w.write(topicHref);
+ w.write("\">"); //$NON-NLS-1$
+ w.write(UrlUtil.htmlEncode(topic.getLabel()));
+ w.write("</a>"); //$NON-NLS-1$
+ } else {
+ w.write(UrlUtil.htmlEncode(topic.getLabel()));
+ }
+ w.write("<br>\n"); //$NON-NLS-1$
+ if (indent == 0)
+ w.write("</b>"); //$NON-NLS-1$
+ } catch (IOException ioe) {
+ }
+ ITopic[] topics = topic.getSubtopics();
+ for (ITopic topic2 : topics) {
+ generateTopicLinks(topic2, w, indent + 1);
+ }
+ }
+
+ public void generateLinks(Writer out) {
+ for (IToc toc : tocs) {
+ ITopic tocTopic = toc.getTopic(null);
+ generateTopicLinks(tocTopic, out, 0);
+ ITopic[] topics = toc.getTopics();
+ for (ITopic topic : topics) {
+ generateTopicLinks(topic, out, 1);
+ }
+ }
+
+ }
+
+ public ITopic[] getTopicPathFromRootPath(IToc toc) {
ITopic[] topicPath;
// Determine the topicPath from the path passed in as a parameter
int[] rootPath = getRootPath();
@@ -400,23 +400,23 @@ public class TocData extends ActivitiesData {
return topicPath;
}
- public ITopic[] getTopicPath() {
- return topicPath;
- }
+ public ITopic[] getTopicPath() {
+ return topicPath;
+ }
- public int[] getRootPath() {
- return rootPath;
- }
+ public int[] getRootPath() {
+ return rootPath;
+ }
- public String getTopicHref() {
- return topicHref;
- }
+ public String getTopicHref() {
+ return topicHref;
+ }
- public String getNumericPath() {
- return numericPath;
- }
+ public String getNumericPath() {
+ return numericPath;
+ }
- public boolean isExpandPath() {
- return expandPathParam != null;
- }
+ public boolean isExpandPath() {
+ return expandPathParam != null;
+ }
}
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 abc6b9507..3e0cc15d1 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
@@ -131,7 +131,7 @@ public class ToolbarData extends RequestData {
toolbarName = request.getParameter("toolbar"); //$NON-NLS-1$
}
if (button.isAddedToToolbar(toolbarName)) {
- extensionButtons.add(button);
+ extensionButtons.add(button);
}
}
}
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 476a0e151..cc01fa593 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
@@ -62,10 +62,10 @@ public class TopicFinder {
}
// if there was an anchor, search again without it
} while (foundTopicPath == null && index != -1);
- } else {
- selectedToc = -1;
+ } else {
+ selectedToc = -1;
foundTopicPath = null;
- }
+ }
}
public ITopic[] getTopicPathFromNav(String nav) {
@@ -90,22 +90,22 @@ public class TopicFinder {
}
}
- public ITopic[] getTopicPath() {
+ public ITopic[] getTopicPath() {
return foundTopicPath;
}
- public int getSelectedToc() {
- return selectedToc;
- }
+ public int getSelectedToc() {
+ return selectedToc;
+ }
- public String getNumericPath() {
- return numericPath;
- }
+ public String getNumericPath() {
+ return numericPath;
+ }
/*
- * Finds a path of ITopics in the given IToc to the given topic. If the
- * toc doesn't contain the topic, returns null.
- */
+ * Finds a path of ITopics in the given IToc to the given topic. If the
+ * toc doesn't contain the topic, returns null.
+ */
private ITopic[] getTopicPathInToc(ITopic topicToFind, IToc toc) {
if (topicToFind.getLabel().equals(toc.getLabel())) {
return new ITopic[0];
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 727b94c39..b24570c43 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
@@ -205,9 +205,9 @@ public class UrlUtil {
}
if (new WebappPreferences().isRestrictTopicParameter()) {
- if (path.contains(":/")) { //$NON-NLS-1$
- return false;
- }
+ if (path.contains(":/")) { //$NON-NLS-1$
+ return false;
+ }
}
return true;
}
@@ -261,14 +261,14 @@ public class UrlUtil {
}
public static boolean isBot(HttpServletRequest request) {
- String agent = request.getHeader("User-Agent"); //$NON-NLS-1$
- if (agent==null)
- return false;
- agent=agent.toLowerCase(Locale.ENGLISH);
+ String agent = request.getHeader("User-Agent"); //$NON-NLS-1$
+ if (agent==null)
+ return false;
+ agent=agent.toLowerCase(Locale.ENGLISH);
// sample substring Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
return agent.contains("bot") || agent.contains("crawl")//$NON-NLS-1$ //$NON-NLS-2$
- || request.getParameter("bot") != null;//$NON-NLS-1$
- }
+ || request.getParameter("bot") != null;//$NON-NLS-1$
+ }
public static boolean isGecko(HttpServletRequest request) {
String agent = request.getHeader("User-Agent"); //$NON-NLS-1$
@@ -277,7 +277,7 @@ public class UrlUtil {
public static boolean isGecko(String agent) {
if (agent==null)
- return false;
+ return false;
agent=agent.toLowerCase(Locale.ENGLISH);
// sample substring Gecko/20020508
if (agent.contains("like gecko")) { //$NON-NLS-1$
@@ -293,7 +293,7 @@ public class UrlUtil {
public static boolean isIE(String agent) {
if (agent==null)
- return false;
+ return false;
agent=agent.toLowerCase(Locale.ENGLISH);
// When accessing with Bobby identified Bobby return 5.5 to allow
@@ -313,7 +313,7 @@ public class UrlUtil {
public static String getIEVersion(String agent) {
if (agent==null)
- return "0"; //$NON-NLS-1$
+ return "0"; //$NON-NLS-1$
agent=agent.toLowerCase(Locale.ENGLISH);
// When accessing with Bobby identified Bobby return 5.5 to allow
@@ -339,7 +339,7 @@ public class UrlUtil {
public static boolean isKonqueror(String agent) {
if (agent==null)
- return false;
+ return false;
agent=agent.toLowerCase(Locale.ENGLISH);
return agent.contains("konqueror"); //$NON-NLS-1$
}
@@ -357,7 +357,7 @@ public class UrlUtil {
public static boolean isMozilla(String agent) {
if (agent==null)
- return false;
+ return false;
agent=agent.toLowerCase(Locale.ENGLISH);
return agent.contains("mozilla/5"); //$NON-NLS-1$
}
@@ -369,7 +369,7 @@ public class UrlUtil {
public static String getMozillaVersion(String agent) {
if (agent==null)
- return "0"; //$NON-NLS-1$
+ return "0"; //$NON-NLS-1$
agent=agent.toLowerCase(Locale.ENGLISH);
if (!agent.contains("mozilla/5")) //$NON-NLS-1$
return "0"; //$NON-NLS-1$
@@ -389,14 +389,14 @@ public class UrlUtil {
public static boolean isOpera(String agent) {
if (agent==null)
- return false;
+ return false;
agent=agent.toLowerCase(Locale.ENGLISH);
return agent.contains("opera"); //$NON-NLS-1$
}
public static String getOperaVersion(String agent) {
if (agent==null)
- return "0"; //$NON-NLS-1$
+ return "0"; //$NON-NLS-1$
agent=agent.toLowerCase(Locale.ENGLISH);
final String OperaPrefix = "opera/"; //$NON-NLS-1$
int start = agent.indexOf(OperaPrefix) + OperaPrefix.length();
@@ -415,7 +415,7 @@ public class UrlUtil {
public static boolean isSafari(String agent) {
if (agent==null)
- return false;
+ return false;
agent=agent.toLowerCase(Locale.ENGLISH);
return agent.contains("safari/"); //$NON-NLS-1$
}
@@ -428,7 +428,7 @@ public class UrlUtil {
public static String getSafariVersion(String agent) {
String version = "0"; //$NON-NLS-1$
if (agent==null)
- return version;
+ return version;
agent=agent.toLowerCase(Locale.ENGLISH);
Matcher m = safariPattern.matcher(agent);
boolean matched = m.find();
@@ -580,12 +580,12 @@ public class UrlUtil {
// check if locale was passed earlier in this session
Cookie[] cookies = request.getCookies();
if (cookies != null) {
- for (Cookie cookie : cookies) {
- if ("lang".equals(cookie.getName())) { //$NON-NLS-1$
- forcedLocale = cookie.getValue();
- break;
- }
- }
+ for (Cookie cookie : cookies) {
+ if ("lang".equals(cookie.getName())) { //$NON-NLS-1$
+ forcedLocale = cookie.getValue();
+ break;
+ }
+ }
}
}
@@ -651,7 +651,7 @@ public class UrlUtil {
// if no locales from command line, get them from preferences
if (infocenterLocales.isEmpty()) {
String preferredLocales = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, ("locales"), "", null); //$NON-NLS-1$ //$NON-NLS-2$
+ (HelpBasePlugin.PLUGIN_ID, ("locales"), "", null); //$NON-NLS-1$ //$NON-NLS-2$
StringTokenizer tokenizer = new StringTokenizer(preferredLocales,
" ,\t"); //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
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 014540b55..4966ec1a8 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
@@ -19,7 +19,7 @@ import org.eclipse.help.internal.webapp.WebappResources;
import org.eclipse.help.webapp.AbstractView ;
public class View extends AbstractView {
- public static char NO_SHORTCUT = (char)0;
+ public static char NO_SHORTCUT = (char)0;
private String name;
private String url;
private String imageURL;
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 5aa3c3d81..8b5e6731a 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
@@ -195,7 +195,7 @@ public class WorkingSetData extends RequestData {
return name;
}
}
- return ""; //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
}
public boolean isCriteriaScopeEnabled(){
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 2e72397fc..3bb7be752 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
@@ -187,17 +187,17 @@ public class AboutService extends AboutServlet {
Bundle[] bundles = HelpWebappPlugin.getContext().getBundles();
for (Bundle bundle : bundles) {
- plugins.add(pluginDetails(bundle));
- }
+ plugins.add(pluginDetails(bundle));
+ }
- Comparator<PluginDetails> pluginComparator = new PluginComparator(sortColumn);
+ Comparator<PluginDetails> pluginComparator = new PluginComparator(sortColumn);
Collections.sort(plugins, pluginComparator );
String[] headerColumns = new String[]{
- "provider", //$NON-NLS-1$
- "pluginName", //$NON-NLS-1$
- "version", //$NON-NLS-1$
- "pluginId" //$NON-NLS-1$
+ "provider", //$NON-NLS-1$
+ "pluginName", //$NON-NLS-1$
+ "version", //$NON-NLS-1$
+ "pluginId" //$NON-NLS-1$
};
for (String headerColumn : headerColumns) {
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 5e264fc32..2c167c56b 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
@@ -127,7 +127,7 @@ public class AdvancedSearchService extends HttpServlet {
}
}
- // Call after the catch.
+ // Call after the catch.
// An empty JSON is created if any Exception is thrown
// Else returns the complete JSON
return searchParser.toJSON();
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 e6690b960..532e8c654 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
@@ -73,7 +73,7 @@ public class BreadcrumbsFilter implements IFilter {
if (pathParam != null && pathParam.length() > 0) {
breadcrumbPath = "/nav/" + pathParam; //$NON-NLS-1$
} else {
- breadcrumbPath= servletPath + pathInfo;
+ breadcrumbPath= servletPath + pathInfo;
}
int[] path = UrlUtil.getTopicPath(breadcrumbPath, locale );
if (path != null && path.length > 1) {
@@ -83,7 +83,7 @@ public class BreadcrumbsFilter implements IFilter {
String bodyContent = getBodyContent(path,
backpath, isNarrow, locale);
String headContent = HEAD_CONTENT1 + backpath + HEAD_CONTENT2 + backpath +
- HEAD_CONTENT3;
+ HEAD_CONTENT3;
return new FilterHTMLHeadAndBodyOutputStream(out, headContent
.getBytes(StandardCharsets.US_ASCII), bodyContent);
}
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 eb73ee878..c3231ac00 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
@@ -47,11 +47,11 @@ public class ChildLinkInserter {
public void addContents(String encoding) throws IOException {
String path = req.getParameter(TocData.COMPLETE_PATH_PARAM);
- ITopic[] subtopics = getSubtopics();
- if (subtopics.length == 0) {
- return;
- }
- StringBuilder links = new StringBuilder("\n<ul class=\"childlinks\">\n"); //$NON-NLS-1$
+ ITopic[] subtopics = getSubtopics();
+ if (subtopics.length == 0) {
+ return;
+ }
+ StringBuilder links = new StringBuilder("\n<ul class=\"childlinks\">\n"); //$NON-NLS-1$
for (int i=0;i<subtopics.length;++i) {
if (ScopeUtils.showInTree(subtopics[i], scope)) {
links.append("\n<li><a href=\""); //$NON-NLS-1$
@@ -66,7 +66,7 @@ public class ChildLinkInserter {
else {
href = XMLGenerator.xmlEscape(href);
if (path != null && path.length() > 0) {
- href = TocFragmentServlet.fixupHref(href, path + '_' + i);
+ href = TocFragmentServlet.fixupHref(href, path + '_' + i);
}
}
links.append(getBackpath(req.getPathInfo()));
@@ -78,9 +78,9 @@ public class ChildLinkInserter {
String linkString = links.toString();
try {
if (encoding != null) {
- out.write(linkString.getBytes(encoding));
+ out.write(linkString.getBytes(encoding));
} else {
- out.write(linkString.getBytes(StandardCharsets.UTF_8));
+ out.write(linkString.getBytes(StandardCharsets.UTF_8));
}
} catch (UnsupportedEncodingException e) {
out.write(linkString.getBytes());
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 d04ec18fe..f208dcf2a 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
@@ -103,8 +103,8 @@ public class CookieUtil {
Cookie cookie = new Cookie(name, ""); //$NON-NLS-1$
String requestURI = request.getRequestURI();
if (!(requestURI.startsWith(cookiePath) && requestURI.indexOf('/', cookiePath.length() + 1) == -1)) {
- cookie.setPath(cookiePath);
- }
+ cookie.setPath(cookiePath);
+ }
cookie.setMaxAge(0);
response.addCookie(cookie);
}
@@ -115,11 +115,11 @@ public class CookieUtil {
HashSet<String> cookiesToDelete = new HashSet<>();
if (cookies != null) {
for (Cookie cookie : cookies) {
- String name = cookie.getName();
- if (isObsoleteCookie(name) || cookiesToKeep.contains(name)) {
- cookiesToDelete.add(name);
- }
- cookiesToKeep.add(name);
+ String name = cookie.getName();
+ if (isObsoleteCookie(name) || cookiesToKeep.contains(name)) {
+ cookiesToDelete.add(name);
+ }
+ cookiesToKeep.add(name);
}
for (String name : cookiesToDelete) {
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 e7aaf9bb1..dc44545ce 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
@@ -67,9 +67,9 @@ public class EclipseConnector {
private ServletContext context;
private static INotFoundCallout notFoundCallout = null; // For JUnit Testing
- public EclipseConnector(ServletContext context) {
+ public EclipseConnector(ServletContext context) {
this.context= context;
- }
+ }
public void transfer(HttpServletRequest req, HttpServletResponse resp)
@@ -86,7 +86,7 @@ public class EclipseConnector {
try {
- //System.out.println("Transfer " + url); //$NON-NLS-1$
+ //System.out.println("Transfer " + url); //$NON-NLS-1$
// Redirect if the request includes PLUGINS_ROOT and is not a content request
int index = url.lastIndexOf(HelpURLConnection.PLUGINS_ROOT);
if (index!= -1 && !url.contains("content/" + HelpURLConnection.PLUGINS_ROOT)) { //$NON-NLS-1$
@@ -125,39 +125,39 @@ public class EclipseConnector {
try {
is = con.getInputStream();
} catch (IOException ioe) {
- pageNotFound = true;
- if (notFoundCallout != null) {
- notFoundCallout.notFound(url);
- }
-
- boolean isRTopicPath = isRTopicPath(req.getServletPath());
-
- if (requiresErrorPage(lowerCaseuRL) && !isRTopicPath) {
-
- String errorPage = null;
- if (RemoteStatusData.isAnyRemoteHelpUnavailable()) {
- errorPage = '/'+HelpWebappPlugin.PLUGIN_ID+'/'+ MissingContentManager.MISSING_TOPIC_HREF;
- } else {
- errorPage = MissingContentManager.getInstance().getPageNotFoundPage(url, false);
- }
- if (errorPage != null && errorPage.length() > 0) {
+ pageNotFound = true;
+ if (notFoundCallout != null) {
+ notFoundCallout.notFound(url);
+ }
+
+ boolean isRTopicPath = isRTopicPath(req.getServletPath());
+
+ if (requiresErrorPage(lowerCaseuRL) && !isRTopicPath) {
+
+ String errorPage = null;
+ if (RemoteStatusData.isAnyRemoteHelpUnavailable()) {
+ errorPage = '/'+HelpWebappPlugin.PLUGIN_ID+'/'+ MissingContentManager.MISSING_TOPIC_HREF;
+ } else {
+ errorPage = MissingContentManager.getInstance().getPageNotFoundPage(url, false);
+ }
+ if (errorPage != null && errorPage.length() > 0) {
con = createConnection(req, resp, "help:" + errorPage); //$NON-NLS-1$
resp.setContentType("text/html"); //$NON-NLS-1$
try {
- is = con.getInputStream();
+ is = con.getInputStream();
} catch (IOException ioe2) {
// Cannot open error page
- resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
} else {
// Error page not defined
- resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
} else {
// Non HTML file
- resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
}
@@ -202,7 +202,7 @@ public class EclipseConnector {
transferContent(is, out);
try {
- out.close();
+ out.close();
} catch (IOException ioe) {
// Bug 314324 - do not report an error
}
@@ -229,7 +229,7 @@ public class EclipseConnector {
}
if (!contentType.startsWith("text")) { //$NON-NLS-1$
return false;
- }
+ }
if (contentType.equals("text/css")) { //$NON-NLS-1$
return false;
}
@@ -273,12 +273,12 @@ public class EclipseConnector {
private boolean useMimeType(HttpServletRequest req, String mimeType) {
if ( mimeType == null ) {
- return false;
- }
- if (mimeType.equals("application/xhtml+xml") && !UrlUtil.isMozilla(req)) { //$NON-NLS-1$
- return false;
- }
- return true;
+ return false;
+ }
+ if (mimeType.equals("application/xhtml+xml") && !UrlUtil.isMozilla(req)) { //$NON-NLS-1$
+ return false;
+ }
+ return true;
}
/**
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 ce150b5c3..d27623afe 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
@@ -36,7 +36,7 @@ public class ExtraFilters implements IFilter {
public ExtraFilters() {
if (filters == null) {
- readFilters();
+ readFilters();
}
}
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 8a765ab39..a183499e8 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
@@ -199,8 +199,8 @@ public class FilterHTMLHeadAndBodyOutputStream extends FilterOutputStream {
String bodyRecoded = new String(bodyBytes, encoding);
if (bodyRecoded.equals(bodyContent)) {
out.write('\n');
- out.write(bodyBytes);
- out.write('\n');
+ out.write(bodyBytes);
+ out.write('\n');
} else {
// Some characters could not be encoded
// Write one character at a time using an entity if necessary
@@ -213,11 +213,11 @@ public class FilterHTMLHeadAndBodyOutputStream extends FilterOutputStream {
out.write(codedChar);
} else {
int value = bodyContent.charAt(i);
- String code = "&#" + value + ';'; //$NON-NLS-1$
- out.write(code.getBytes());
+ String code = "&#" + value + ';'; //$NON-NLS-1$
+ out.write(code.getBytes());
}
}
- out.write('\n');
+ out.write('\n');
}
}
areaState = STATE_DONE;
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 66672330b..4024abfea 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
@@ -29,8 +29,8 @@ import org.eclipse.help.webapp.IFilter;
*/
public class FramesetFilter implements IFilter {
private static final String scriptPart1 = "<script type=\"text/javascript\">\nif( self == top ){" //$NON-NLS-1$
- + "\n var anchorParam = location.hash.length > 0 ? '" //$NON-NLS-1$
- + UrlUtil.JavaScriptEncode("&") + "anchor=' + location.hash.substr(1) : '';" //$NON-NLS-1$ //$NON-NLS-2$
+ + "\n var anchorParam = location.hash.length > 0 ? '" //$NON-NLS-1$
+ + UrlUtil.JavaScriptEncode("&") + "anchor=' + location.hash.substr(1) : '';" //$NON-NLS-1$ //$NON-NLS-2$
+ "\n window.location.replace( \""; //$NON-NLS-1$
private static final String scriptPart3 = "\" + anchorParam);\n}\n</script>"; //$NON-NLS-1$
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 6b974628d..4655447f2 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
@@ -89,7 +89,7 @@ public class IndexFragmentServlet extends HttpServlet {
sizeParameter = req.getParameter(SIZE);
if (sizeParameter != null) {
try {
- size = Integer.parseInt(sizeParameter);
+ size = Integer.parseInt(sizeParameter);
} catch (NumberFormatException n) {
}
}
@@ -98,7 +98,7 @@ public class IndexFragmentServlet extends HttpServlet {
entryParameter = req.getParameter(ENTRY);
if (entryParameter != null) {
try {
- entry = Integer.parseInt(entryParameter);
+ entry = Integer.parseInt(entryParameter);
} catch (NumberFormatException n) {
}
}
@@ -226,10 +226,10 @@ public class IndexFragmentServlet extends HttpServlet {
}
int nextEntry = 0;
while (nextEntry < entries.length) {
- String keyword = entries[nextEntry].getKeyword().toLowerCase();
+ String keyword = entries[nextEntry].getKeyword().toLowerCase();
if (keyword != null) {
if (compare(startParameter, keyword) <= 0) {
- break;
+ break;
}
}
nextEntry++;
@@ -241,9 +241,9 @@ public class IndexFragmentServlet extends HttpServlet {
while (nextEntry < entries.length) {
int entrySize = enabledEntryCount(entries[nextEntry]);
if (remaining == size || remaining > entrySize) {
- entryList.add(Integer.valueOf(nextEntry));
- setFlags(nextEntry);
- remaining -= entrySize;
+ entryList.add(Integer.valueOf(nextEntry));
+ setFlags(nextEntry);
+ remaining -= entrySize;
} else {
break;
}
@@ -257,10 +257,10 @@ public class IndexFragmentServlet extends HttpServlet {
while (nextEntry >= 0) {
int entrySize = enabledEntryCount(entries[nextEntry]);
if (remaining == size || remaining > entrySize) {
- entryList.add(0, Integer.valueOf(nextEntry));
+ entryList.add(0, Integer.valueOf(nextEntry));
- setFlags(nextEntry);
- remaining -= entrySize;
+ setFlags(nextEntry);
+ remaining -= entrySize;
} else {
break;
}
@@ -284,10 +284,10 @@ public class IndexFragmentServlet extends HttpServlet {
return 0;
}
int count = 1;
- int topicCount = enabledTopicCount(entry);
+ int topicCount = enabledTopicCount(entry);
IIndexEntry[] subentries = entry.getSubentries();
- int subentryCount = 0;
+ int subentryCount = 0;
for (IIndexEntry subentrie : subentries) {
count += enabledEntryCount(subentrie);
}
@@ -305,17 +305,17 @@ public class IndexFragmentServlet extends HttpServlet {
}
count += subentryCount;
count += seeCount;
- return count;
+ return count;
}
private int enabledTopicCount(IIndexEntry entry) {
int topicCount = 0;
- ITopic[] topics = entry.getTopics();
- for (ITopic topic : topics) {
- if (scope.inScope(topic)) {
- topicCount++;
- }
- }
+ ITopic[] topics = entry.getTopics();
+ for (ITopic topic : topics) {
+ if (scope.inScope(topic)) {
+ topicCount++;
+ }
+ }
return topicCount;
}
@@ -353,8 +353,8 @@ public class IndexFragmentServlet extends HttpServlet {
String href;
if (singleTopic) {
href = UrlUtil.getHelpURL((topics[0]).getHref());
- buf.append('\n' + " href=\"" + //$NON-NLS-1$
- XMLGenerator.xmlEscape(href) + "\""); //$NON-NLS-1$
+ buf.append('\n' + " href=\"" + //$NON-NLS-1$
+ XMLGenerator.xmlEscape(href) + "\""); //$NON-NLS-1$
}
buf.append(">\n"); //$NON-NLS-1$
@@ -403,8 +403,8 @@ public class IndexFragmentServlet extends HttpServlet {
}
private void generateSees(IIndexSee[] sees) {
- for (IIndexSee see : sees) {
- 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
@@ -428,8 +428,8 @@ public class IndexFragmentServlet extends HttpServlet {
+ XMLGenerator.xmlEscape(href) + "\""); //$NON-NLS-1$
buf.append(">\n"); //$NON-NLS-1$
buf.append("</node>\n"); //$NON-NLS-1$
- }
- }
+ }
+ }
}
}
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 857148aaf..d220d6d8a 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
@@ -180,7 +180,7 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
if (suffixStart > 0) {
previousToc = decodedName.substring(0, suffixStart);
} else if (suffixStart == 0) {
- decodedName = previousToc + decodedName;
+ decodedName = previousToc + decodedName;
}
elements[e] = getAdaptableTopic(decodedName);
}
@@ -211,14 +211,14 @@ public class InfocenterWorkingSetManager implements IHelpWorkingSetManager {
continue;
}
String name = URLCoder.decode(nameAndCriteria[0]);
- List<CriterionResource> criteriaResource = new ArrayList<>();
+ List<CriterionResource> criteriaResource = new ArrayList<>();
for (int j = 1; j < nameAndCriteria.length; ++j) {
String criterion = nameAndCriteria[j];
String[] keyAndValue = criterion.split("#", -1); //$NON-NLS-1$
if(keyAndValue.length != 2)
continue;
String key = URLCoder.decode(keyAndValue[0]);
- String value = URLCoder.decode(keyAndValue[1]);
+ String value = URLCoder.decode(keyAndValue[1]);
String[] criterionValues = value.split(",", -1); //$NON-NLS-1$
if(criterionValues.length < 1)
continue;
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 2bff3b92d..e9f4e53fd 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
@@ -80,8 +80,8 @@ public class InjectionFilter implements IFilter {
}
boolean enabled = isUnfiltered || isNav
- || HelpBasePlugin.getActivitySupport().isRoleEnabled(pathInfo)
- || isRemote;
+ || HelpBasePlugin.getActivitySupport().isRoleEnabled(pathInfo)
+ || isRemote;
if ("/ntopic".equals(req.getServletPath())) { //$NON-NLS-1$
addNarrow = true;
CssUtil.addCssFiles(NARROW_CSS, cssIncludes);
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 b2a913226..ba611fa1b 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
@@ -84,25 +84,25 @@ public class NavServlet extends HttpServlet {
private void showPageNotFoundPage(HttpServletRequest req,
HttpServletResponse resp) {
String errorPage = MissingContentManager.getInstance().getPageNotFoundPage(req.getServletPath(), false);
- if (errorPage != null && errorPage.length() > 0) {
- String href = req.getRequestURL().toString();
- int navIndex = href.indexOf("/nav"); //$NON-NLS-1$
- if (navIndex >= 0 ) {
- href = href.substring(0, navIndex);
- href += "/nftopic"; //$NON-NLS-1$
- if (errorPage.charAt(0) != '/') {
- href += '/';
- }
- href += errorPage;
- try {
+ if (errorPage != null && errorPage.length() > 0) {
+ String href = req.getRequestURL().toString();
+ int navIndex = href.indexOf("/nav"); //$NON-NLS-1$
+ if (navIndex >= 0 ) {
+ href = href.substring(0, navIndex);
+ href += "/nftopic"; //$NON-NLS-1$
+ if (errorPage.charAt(0) != '/') {
+ href += '/';
+ }
+ href += errorPage;
+ try {
resp.sendRedirect(href);
return;
} catch (IOException e) {
// Fall through
}
- }
- }
- resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+ resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
protected Locale getLocale (HttpServletRequest req, HttpServletResponse resp) {
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 12cebd93c..299d4cadd 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
@@ -27,11 +27,11 @@ import org.eclipse.help.webapp.IFilter;
*/
public class PluginsRootFilter implements IFilter {
- @Override
+ @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));
+ return new PluginsRootResolvingStream(out, req, pathPrefix.substring(0, pathPrefix.length() - 3));
}
return out;
}
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 b977ed1d7..4385c83d7 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
@@ -48,7 +48,7 @@ public class PluginsRootResolvingStream extends OutputStream {
private String pathPrefix;
private StringBuilder tag;
private ByteArrayOutputStream metaTagBuffer;
- private boolean tagRead;
+ private boolean tagRead;
private HttpServletRequest req;
private String charset;
@@ -61,17 +61,17 @@ public class PluginsRootResolvingStream extends OutputStream {
@Override
public void write(int b) throws IOException {
switch(state) {
- case INITIAL_STATE:
- if (b == '<') {
- state = IN_TAG;
- charsMatched = 0;
- tag = new StringBuilder();
- tagRead = false;
- } else {
- out.write(b);
- }
- break;
- case IN_TAG:
+ case INITIAL_STATE:
+ if (b == '<') {
+ state = IN_TAG;
+ charsMatched = 0;
+ tag = new StringBuilder();
+ tagRead = false;
+ } else {
+ out.write(b);
+ }
+ break;
+ case IN_TAG:
if (charsMatched == 0) {
if (b == '!') {
state = MAY_BE_INCLUDE;
@@ -86,96 +86,96 @@ public class PluginsRootResolvingStream extends OutputStream {
out.write('<');
}
}
- if (b == '>') {
- state = INITIAL_STATE;
- } else if (b == '"') {
- state = IN_QUOTE;
- charsMatched = 0;
- } else {
- charsMatched++;
- if (!tagRead) {
- if (b >= 0 && b < 128 && tag.length() < 20) {
- // ASCII
- char c = (char)b;
- if (Character.isLetter(c)) {
- tag.append(c);
- } else if (Character.isWhitespace(c)) {
- tagRead = true;
- if (tag.toString().equalsIgnoreCase("meta")) { //$NON-NLS-1$
- state = IN_METATAG;
- metaTagBuffer = new ByteArrayOutputStream(7);
- metaTagBuffer.write("<meta ".getBytes()); //$NON-NLS-1$
- }
- } else {
- tag.append(c);
- }
- }
- }
- }
- out.write(b);
- break;
- case IN_QUOTE_NOT_PLUGINS_ROOT:
- if (b == '>') {
- state = INITIAL_STATE;
- } else if (b == '"') {
- state = IN_TAG;
- charsMatched = 1;
- }
- out.write(b);
- break;
- case IN_QUOTE:
- // In a quote which may start with PLUGINS_ROOT
- if (b == PLUGINS_ROOT.charAt(charsMatched)) {
- charsMatched++;
- if (charsMatched == PLUGINS_ROOT.length()) {
- out.write(pathPrefix.getBytes());
- state = IN_QUOTE_NOT_PLUGINS_ROOT;
- }
- } else {
- // We just discovered that this is not "PLUGINS_ROOT/
- // flush out the characters
- state = IN_QUOTE_NOT_PLUGINS_ROOT;
- flushPluginsRootCharacters();
- out.write(b);
- }
- break;
- case MAY_BE_INCLUDE:
- // Compare against all possible keywords
- boolean canStillMatch = false;
- int perfectMatch = -1;
- for (int i = 0; i < keywords.length; i++) {
- if (possibleKeywordMatches[i]) {
- if (keywords[i].charAt(charsMatched) == b) {
- canStillMatch = true;
- lastKeywordMatch = i;
- if (keywords[i].length() == charsMatched + 1) {
- perfectMatch = i;
- }
- } else {
- possibleKeywordMatches[i] = false;
- }
- }
- }
- if (perfectMatch != -1) {
- insertBasedOnKeyword(perfectMatch);
- state=INITIAL_STATE;
- } else if (canStillMatch) {
- charsMatched++;
- } else {
- state = INITIAL_STATE;
- flushKeywordCharacters();
- out.write(b);
- }
- break;
- case IN_METATAG:
- out.write(b);
- metaTagBuffer.write(b);
+ if (b == '>') {
+ state = INITIAL_STATE;
+ } else if (b == '"') {
+ state = IN_QUOTE;
+ charsMatched = 0;
+ } else {
+ charsMatched++;
+ if (!tagRead) {
+ if (b >= 0 && b < 128 && tag.length() < 20) {
+ // ASCII
+ char c = (char)b;
+ if (Character.isLetter(c)) {
+ tag.append(c);
+ } else if (Character.isWhitespace(c)) {
+ tagRead = true;
+ if (tag.toString().equalsIgnoreCase("meta")) { //$NON-NLS-1$
+ state = IN_METATAG;
+ metaTagBuffer = new ByteArrayOutputStream(7);
+ metaTagBuffer.write("<meta ".getBytes()); //$NON-NLS-1$
+ }
+ } else {
+ tag.append(c);
+ }
+ }
+ }
+ }
+ out.write(b);
+ break;
+ case IN_QUOTE_NOT_PLUGINS_ROOT:
+ if (b == '>') {
+ state = INITIAL_STATE;
+ } else if (b == '"') {
+ state = IN_TAG;
+ charsMatched = 1;
+ }
+ out.write(b);
+ break;
+ case IN_QUOTE:
+ // In a quote which may start with PLUGINS_ROOT
+ if (b == PLUGINS_ROOT.charAt(charsMatched)) {
+ charsMatched++;
+ if (charsMatched == PLUGINS_ROOT.length()) {
+ out.write(pathPrefix.getBytes());
+ state = IN_QUOTE_NOT_PLUGINS_ROOT;
+ }
+ } else {
+ // We just discovered that this is not "PLUGINS_ROOT/
+ // flush out the characters
+ state = IN_QUOTE_NOT_PLUGINS_ROOT;
+ flushPluginsRootCharacters();
+ out.write(b);
+ }
+ break;
+ case MAY_BE_INCLUDE:
+ // Compare against all possible keywords
+ boolean canStillMatch = false;
+ int perfectMatch = -1;
+ for (int i = 0; i < keywords.length; i++) {
+ if (possibleKeywordMatches[i]) {
+ if (keywords[i].charAt(charsMatched) == b) {
+ canStillMatch = true;
+ lastKeywordMatch = i;
+ if (keywords[i].length() == charsMatched + 1) {
+ perfectMatch = i;
+ }
+ } else {
+ possibleKeywordMatches[i] = false;
+ }
+ }
+ }
+ if (perfectMatch != -1) {
+ insertBasedOnKeyword(perfectMatch);
+ state=INITIAL_STATE;
+ } else if (canStillMatch) {
+ charsMatched++;
+ } else {
+ state = INITIAL_STATE;
+ flushKeywordCharacters();
+ out.write(b);
+ }
+ break;
+ case IN_METATAG:
+ out.write(b);
+ metaTagBuffer.write(b);
if (b=='>') {
parseMetaTag(metaTagBuffer);
metaTagBuffer = null;
state = INITIAL_STATE;
}
- break;
+ break;
default:
out.write(b);
}
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 584902b5a..c41ddbd25 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
@@ -53,49 +53,49 @@ public class PreferenceWriter {
private void writePreference(String plugin) {
try {
- IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(plugin);
+ IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(plugin);
Set<String> keySet = new HashSet<>();
- prefs = DefaultScope.INSTANCE.getNode(plugin);
+ prefs = DefaultScope.INSTANCE.getNode(plugin);
keySet.addAll(Arrays.asList(prefs.keys()));
String[] allKeys = keySet.toArray(new String[keySet.size()]);
if (allKeys.length > 0) {
- Arrays.sort(allKeys);
+ Arrays.sort(allKeys);
- if (!isXML) {
- buf.append("\n<h3>"); //$NON-NLS-1$
- buf.append(plugin);
- buf.append("</h3>\n"); //$NON-NLS-1$
- buf.append("<table>"); //$NON-NLS-1$
- } else {
+ if (!isXML) {
+ buf.append("\n<h3>"); //$NON-NLS-1$
+ buf.append(plugin);
+ buf.append("</h3>\n"); //$NON-NLS-1$
+ buf.append("<table>"); //$NON-NLS-1$
+ } else {
buf.append("\n <plugin\n title=\""); //$NON-NLS-1$
buf.append(XMLGenerator.xmlEscape(plugin));
buf.append("\">"); //$NON-NLS-1$
- }
- for (String key : allKeys) {
- String value = Platform.getPreferencesService().getString
- (plugin, key, "", null); //$NON-NLS-1$
- if (!isXML) {
- buf.append("\n <tr>\n"); //$NON-NLS-1$
- buf.append(" <td>"); //$NON-NLS-1$
- buf.append(UrlUtil.htmlEncode(key));
- buf.append("</td>\n <td>"); //$NON-NLS-1$
+ }
+ for (String key : allKeys) {
+ String value = Platform.getPreferencesService().getString
+ (plugin, key, "", null); //$NON-NLS-1$
+ if (!isXML) {
+ buf.append("\n <tr>\n"); //$NON-NLS-1$
+ buf.append(" <td>"); //$NON-NLS-1$
+ buf.append(UrlUtil.htmlEncode(key));
+ buf.append("</td>\n <td>"); //$NON-NLS-1$
buf.append(UrlUtil.htmlEncode(value));
buf.append("</td>\n </tr>"); //$NON-NLS-1$
- } else {
- buf.append("\n <"); //$NON-NLS-1$
- buf.append(key);
- buf.append(">"); //$NON-NLS-1$
+ } else {
+ buf.append("\n <"); //$NON-NLS-1$
+ buf.append(key);
+ buf.append(">"); //$NON-NLS-1$
buf.append(value);
- buf.append("</"); //$NON-NLS-1$
- buf.append(key);
- buf.append(">"); //$NON-NLS-1$
- }
- }
- if (!isXML) {
- buf.append("\n</table>"); //$NON-NLS-1$
- } else {
- buf.append("\n </plugin>"); //$NON-NLS-1$
- }
+ buf.append("</"); //$NON-NLS-1$
+ buf.append(key);
+ buf.append(">"); //$NON-NLS-1$
+ }
+ }
+ if (!isXML) {
+ buf.append("\n</table>"); //$NON-NLS-1$
+ } else {
+ buf.append("\n </plugin>"); //$NON-NLS-1$
+ }
}
} catch (BackingStoreException e) {
buf.append(WebappResources.getString("badPreferences", locale)); //$NON-NLS-1$
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 92d842d8f..291163cd5 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
@@ -25,66 +25,66 @@ public class ServletPrintWriter extends PrintWriter{
buffer = new StringBuilder();
}
- /**
- * Writes a single character.
- * @param c int specifying a character to be written.
- */
- @Override
+ /**
+ * Writes a single character.
+ * @param c int specifying a character to be written.
+ */
+ @Override
public void write(int c) {
- synchronized (lock) {
- buffer.append((char)(c));
- }
- }
+ synchronized (lock) {
+ buffer.append((char)(c));
+ }
+ }
- /**
- * Writes A Portion of an array of characters.
- * @param buf Array of characters
- * @param off Offset from which to start writing characters
- * @param len Number of characters to write
- */
- @Override
+ /**
+ * Writes A Portion of an array of characters.
+ * @param buf Array of characters
+ * @param off Offset from which to start writing characters
+ * @param len Number of characters to write
+ */
+ @Override
public void write(char buf[], int off, int len) {
- synchronized (lock) {
- buffer.append(buf, off, len);
- }
- }
+ synchronized (lock) {
+ buffer.append(buf, off, len);
+ }
+ }
- /**
- * Writes an array of characters. This method cannot be inherited from the
- * Writer class because it must suppress I/O exceptions.
- * @param buf Array of characters to be written
- */
- @Override
+ /**
+ * Writes an array of characters. This method cannot be inherited from the
+ * Writer class because it must suppress I/O exceptions.
+ * @param buf Array of characters to be written
+ */
+ @Override
public void write(char buf[]) {
- write(buf, 0, buf.length);
- }
+ write(buf, 0, buf.length);
+ }
- /**
- * Writes a portion of a string.
- * @param s A String
- * @param off Offset from which to start writing characters
- * @param len Number of characters to write
- */
- @Override
+ /**
+ * Writes a portion of a string.
+ * @param s A String
+ * @param off Offset from which to start writing characters
+ * @param len Number of characters to write
+ */
+ @Override
public void write(String s, int off, int len) {
- synchronized (lock) {
- buffer.append(s.toCharArray(), off, off+len);
- }
- }
+ synchronized (lock) {
+ buffer.append(s.toCharArray(), off, off+len);
+ }
+ }
- /**
- * Writes a string. This method cannot be inherited from the Writer class
- * because it must suppress I/O exceptions.
- * @param s String to be written
- */
- @Override
+ /**
+ * Writes a string. This method cannot be inherited from the Writer class
+ * because it must suppress I/O exceptions.
+ * @param s String to be written
+ */
+ @Override
public void write(String s) {
write(s, 0, s.length());
- }
+ }
- @Override
+ @Override
public String toString()
- {
- return buffer.toString();
- }
+ {
+ return buffer.toString();
+ }
}
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 c9712eeb5..99f95b800 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
@@ -59,9 +59,9 @@ public class TocFragmentServlet extends HttpServlet {
throws ServletException, IOException {
String locale = UrlUtil.getLocale(req, resp);
req.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
- resp.setHeader("Cache-Control","no-cache"); //$NON-NLS-1$//$NON-NLS-2$
- resp.setHeader("Pragma","no-cache"); //$NON-NLS-1$ //$NON-NLS-2$
- resp.setDateHeader ("Expires", 0); //$NON-NLS-1$
+ resp.setHeader("Cache-Control","no-cache"); //$NON-NLS-1$//$NON-NLS-2$
+ resp.setHeader("Pragma","no-cache"); //$NON-NLS-1$ //$NON-NLS-2$
+ resp.setDateHeader ("Expires", 0); //$NON-NLS-1$
TocData data = new TocData(this.getServletContext(), req, resp);
readParameters(req);
@@ -120,7 +120,7 @@ public class TocFragmentServlet extends HttpServlet {
} else if (requestKind == REQUEST_SHOW_IN_TOC) {
generateNumericPath();
} else {
- serializeTocs();
+ serializeTocs();
}
buf.append("</tree_data>\n"); //$NON-NLS-1$
return buf.toString();
@@ -129,9 +129,9 @@ public class TocFragmentServlet extends HttpServlet {
private void generateNumericPath() {
int selectedToc = tocData.getSelectedToc();
- if (selectedToc < 0) {
- addError(WebappResources.getString("CannotSync", locale)); //$NON-NLS-1$
- } else {
+ if (selectedToc < 0) {
+ addError(WebappResources.getString("CannotSync", locale)); //$NON-NLS-1$
+ } else {
// Count the number of enabled tocs
int enabled = 0;
for (int i = 0; i <= selectedToc; i++) {
@@ -139,38 +139,38 @@ public class TocFragmentServlet extends HttpServlet {
enabled++;
}
}
- String fullNumericPath = "" + (enabled - 1); //$NON-NLS-1$
- String numericPath = tocData.getNumericPath();
+ String fullNumericPath = "" + (enabled - 1); //$NON-NLS-1$
+ String numericPath = tocData.getNumericPath();
if (numericPath != null) {
- fullNumericPath = fullNumericPath + '_' + numericPath;
- }
- buf.append("<numeric_path path=\"" + fullNumericPath + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ fullNumericPath = fullNumericPath + '_' + numericPath;
+ }
+ buf.append("<numeric_path path=\"" + fullNumericPath + "\"/>\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
private void addError(String message) {
if (!isErrorSuppress) {
- buf.append("<error>"); //$NON-NLS-1$
+ buf.append("<error>"); //$NON-NLS-1$
buf.append(XMLGenerator.xmlEscape(message));
buf.append("</error>"); //$NON-NLS-1$
}
}
private void serializeTocs() {
- ITopic[] topicPath = tocData.getTopicPath();
+ ITopic[] topicPath = tocData.getTopicPath();
int selectedToc = tocData.getSelectedToc();
// Iterate over all tocs - if there is a selected toc only generate that
// toc, otherwise generate the root of every toc.
for (int toc=0; toc< tocData.getTocCount(); toc++) {
boolean shouldLoad = requestKind == REQUEST_SHOW_TOCS || toc == selectedToc;
- if (shouldLoad) {
- boolean isSelected = false; // Should this node be selected in the tree
- if (requestKind == REQUEST_SHOW_TOCS) {
- isSelected = toc == 0;
- } else if (requestKind == REQUEST_SHOW_CHILDREN) {
- isSelected = tocData.getRootPath() == null;
- }
+ if (shouldLoad) {
+ boolean isSelected = false; // Should this node be selected in the tree
+ if (requestKind == REQUEST_SHOW_TOCS) {
+ isSelected = toc == 0;
+ } else if (requestKind == REQUEST_SHOW_CHILDREN) {
+ isSelected = tocData.getRootPath() == null;
+ }
serializeToc(tocData.getTocs()[toc], toc, topicPath, isSelected);
}
}
@@ -217,9 +217,9 @@ public class TocFragmentServlet extends HttpServlet {
}
private void serializeTopic(ITopic topic, ITopic[] topicPath, boolean isSelected, String parentPath) {
- ITopic[] subtopics = topic.getSubtopics();
- boolean isLeaf = !ScopeUtils.hasInScopeDescendent(topic, scope);
- buf.append("<node"); //$NON-NLS-1$
+ ITopic[] subtopics = topic.getSubtopics();
+ boolean isLeaf = !ScopeUtils.hasInScopeDescendent(topic, scope);
+ buf.append("<node"); //$NON-NLS-1$
if (topic.getLabel() != null) {
buf.append('\n' + " title=\"" + XMLGenerator.xmlEscape(topic.getLabel()) + '"'); //$NON-NLS-1$
}
@@ -250,11 +250,11 @@ public class TocFragmentServlet extends HttpServlet {
String icon = ((Toc) toc).getIcon();
if (IconFinder.isIconDefined(icon)) {
- String openIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_OPEN);
+ String openIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_OPEN);
String closedIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_CLOSED);
String imageTags = '\n' + " openImage=\"/"+ openIcon + "\""; //$NON-NLS-1$ //$NON-NLS-2$
if (!openIcon.equals(closedIcon)) {
- imageTags += '\n' + " closedImage=\"/" + closedIcon + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ imageTags += '\n' + " closedImage=\"/" + closedIcon + "\""; //$NON-NLS-1$ //$NON-NLS-2$
}
String altText = IconFinder.getIconAltFromId(icon);
if(altText != null) {
@@ -269,20 +269,20 @@ public class TocFragmentServlet extends HttpServlet {
private String createTopicImageTags(ITopic topic, boolean isLeaf) {
if (topic instanceof Topic) {
String icon = ((Topic) topic).getIcon();
- String altText = IconFinder.getIconAltFromId(icon);
+ String altText = IconFinder.getIconAltFromId(icon);
if (IconFinder.isIconDefined(icon)) {
String imageTags;
if (isLeaf) {
imageTags = '\n' + " openImage=\"/" +IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_LEAF) + "\""; //$NON-NLS-1$//$NON-NLS-2$
} else {
- String openIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_OPEN);
+ String openIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_OPEN);
String closedIcon = IconFinder.getImagePathFromId(icon, IconFinder.TYPEICON_CLOSED);
imageTags = '\n' + " openImage=\"/" + openIcon+ "\""; //$NON-NLS-1$ //$NON-NLS-2$
if (!openIcon.equals(closedIcon)) {
- imageTags += '\n' + " closedImage=\"/" + closedIcon + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ imageTags += '\n' + " closedImage=\"/" + closedIcon + "\""; //$NON-NLS-1$ //$NON-NLS-2$
}
- }
+ }
if(altText != null) {
imageTags += '\n' + " imageAlt=\""+ altText + "\""; //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -305,22 +305,22 @@ public class TocFragmentServlet extends HttpServlet {
if (parentIsSelected && requestKind == REQUEST_SHOW_CHILDREN) {
// Show the children of this node
for (int subtopic = 0; subtopic < childTopics.length; subtopic++) {
- ITopic childTopic = childTopics[subtopic];
- if (ScopeUtils.showInTree(childTopic, scope)) {
- serializeTopic(childTopic, null, false, addSuffix(parentPath, subtopic));
- }
+ ITopic childTopic = childTopics[subtopic];
+ if (ScopeUtils.showInTree(childTopic, scope)) {
+ serializeTopic(childTopic, null, false, addSuffix(parentPath, subtopic));
+ }
}
} else if (topicPath != null) {
for (int subtopic = 0; subtopic < childTopics.length; subtopic++) {
ITopic childTopic = childTopics[subtopic];
- if (ScopeUtils.showInTree(childTopic, scope)) {
+ if (ScopeUtils.showInTree(childTopic, scope)) {
if (topicPath[0].getLabel().equals(childTopic.getLabel())) {
ITopic[] newPath = null;
if (topicPath.length > 1) {
newPath = new ITopic[topicPath.length - 1];
System.arraycopy(topicPath, 1, newPath, 0, topicPath.length - 1);
}
- serializeTopic(childTopic, newPath, topicPath.length == 1, addSuffix(parentPath, subtopic));
+ serializeTopic(childTopic, newPath, topicPath.length == 1, addSuffix(parentPath, subtopic));
} else {
serializeTopic(childTopic, null, false, addSuffix(parentPath, subtopic));
}
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 ce1176231..a83a0e0b6 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
@@ -28,104 +28,104 @@ public abstract class AbstractButton implements Comparable<AbstractButton> {
* generated HTML
* @return a string that consists of alphanumeric characters only with no spaces
*/
- public abstract String getId();
-
- /**
- * @return a URL relative to /help which is the location
- * of the 16x16 image icon which will appear in the tab
- */
- public abstract String getImageURL();
-
- /**
- * A user visible description of the button which will appear in the tooltip
- * @param locale the locale of the client
- * @return the tooltip text to be used in this locale
- */
- public abstract String getTooltip(Locale locale);
-
- /**
- * a JavaScript function which will be called when the button is pressed
- * @return the name of a JavaScript function
- */
- public abstract String getAction();
-
- /**
- * The state of a button which is visible but not depressed
- */
- public final static String BUTTON_OUT = "off"; //$NON-NLS-1$
-
- /**
- * The state of a button which is visible and depressed
- */
- public final static String BUTTON_IN = "on"; //$NON-NLS-1$
-
- /**
- * The state of a button which is hidden
- */
- public final static String BUTTON_HIDDEN = "hidden"; //$NON-NLS-1$
-
- /**
- * Get the state of a button
- * @return one of <code>BUTTON_OUT</code>, <code>BUTTON_IN</code>, or
- * <code>BUTTON_HIDDEN</code>.
- */
- public String getState() {
- return BUTTON_OUT;
- }
-
- /**
- * Get the location of the a javascript file to be included in any
- * jsp file which uses this button
- * @return a URL path, relative to /help or <code>null</code> if there.
- */
- public String getJavaScriptURL() {
- return null;
- }
-
- /**
- * Toolbar name for the content pane, which shows help pages
- */
- public static final String CONTENT_TOOLBAR = "content"; //$NON-NLS-1$
-
- /**
- * Toolbar name for the table of contents
- */
- public static final String TOC_TOOLBAR = "toc"; //$NON-NLS-1$
-
- /**
- * Toolbar name for the keyword index
- */
- public static final String INDEX_TOOLBAR = "index"; //$NON-NLS-1$
-
- /**
- * Toolbar name for search results
- */
- public static final String SEARCH_TOOLBAR = "search"; //$NON-NLS-1$
-
- /**
- * Toolbar name for bookmarks
- */
- public static final String BOOKMARKS_TOOLBAR = "bookmarks"; //$NON-NLS-1$
-
- /**
- * Determines whether this button should be true if the button should be added
- * to particular toolbar
- * @param toolbarName Name of the toolbar.
- * @return true
- */
- public boolean isAddedToToolbar(String toolbarName) {
- return true;
- }
-
- /**
+ public abstract String getId();
+
+ /**
+ * @return a URL relative to /help which is the location
+ * of the 16x16 image icon which will appear in the tab
+ */
+ public abstract String getImageURL();
+
+ /**
+ * A user visible description of the button which will appear in the tooltip
+ * @param locale the locale of the client
+ * @return the tooltip text to be used in this locale
+ */
+ public abstract String getTooltip(Locale locale);
+
+ /**
+ * a JavaScript function which will be called when the button is pressed
+ * @return the name of a JavaScript function
+ */
+ public abstract String getAction();
+
+ /**
+ * The state of a button which is visible but not depressed
+ */
+ public final static String BUTTON_OUT = "off"; //$NON-NLS-1$
+
+ /**
+ * The state of a button which is visible and depressed
+ */
+ public final static String BUTTON_IN = "on"; //$NON-NLS-1$
+
+ /**
+ * The state of a button which is hidden
+ */
+ public final static String BUTTON_HIDDEN = "hidden"; //$NON-NLS-1$
+
+ /**
+ * Get the state of a button
+ * @return one of <code>BUTTON_OUT</code>, <code>BUTTON_IN</code>, or
+ * <code>BUTTON_HIDDEN</code>.
+ */
+ public String getState() {
+ return BUTTON_OUT;
+ }
+
+ /**
+ * Get the location of the a javascript file to be included in any
+ * jsp file which uses this button
+ * @return a URL path, relative to /help or <code>null</code> if there.
+ */
+ public String getJavaScriptURL() {
+ return null;
+ }
+
+ /**
+ * Toolbar name for the content pane, which shows help pages
+ */
+ public static final String CONTENT_TOOLBAR = "content"; //$NON-NLS-1$
+
+ /**
+ * Toolbar name for the table of contents
+ */
+ public static final String TOC_TOOLBAR = "toc"; //$NON-NLS-1$
+
+ /**
+ * Toolbar name for the keyword index
+ */
+ public static final String INDEX_TOOLBAR = "index"; //$NON-NLS-1$
+
+ /**
+ * Toolbar name for search results
+ */
+ public static final String SEARCH_TOOLBAR = "search"; //$NON-NLS-1$
+
+ /**
+ * Toolbar name for bookmarks
+ */
+ public static final String BOOKMARKS_TOOLBAR = "bookmarks"; //$NON-NLS-1$
+
+ /**
+ * Determines whether this button should be true if the button should be added
+ * to particular toolbar
+ * @param toolbarName Name of the toolbar.
+ * @return true
+ */
+ public boolean isAddedToToolbar(String toolbarName) {
+ return true;
+ }
+
+ /**
* @since 3.7
*/
- @Override
+ @Override
final public int compareTo(AbstractButton o) {
- if (o != null) {
- String objectName = o.getId();
+ if (o != null) {
+ String objectName = o.getId();
return (getId().compareTo(objectName));
- }
- return 0;
- }
+ }
+ 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 8496719f7..20dcd4318 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
@@ -38,47 +38,47 @@ public abstract class AbstractFrame implements Comparable<AbstractFrame> {
*
* @return a non translated name which is the name of this frame
*/
- public abstract String getName();
+ public abstract String getName();
- /**
- * @return a URL path, relative to /help which is the
- * location of the jsp files in the advanced presentation
- */
- public abstract String getURL();
+ /**
+ * @return a URL path, relative to /help which is the
+ * location of the jsp files in the advanced presentation
+ */
+ public abstract String getURL();
- /**
- * @return a string which will be used in the rows or cols attribute of a
- * frameset in the html
- */
- public String getSize() {
- return "*"; //$NON-NLS-1$
- }
+ /**
+ * @return a string which will be used in the rows or cols attribute of a
+ * frameset in the html
+ */
+ public String getSize() {
+ return "*"; //$NON-NLS-1$
+ }
- /**
- * @return true if the frame should be shown in the advanced presentation
- */
- public boolean isVisible() {
- return true;
- }
+ /**
+ * @return true if the frame should be shown in the advanced presentation
+ */
+ public boolean isVisible() {
+ return true;
+ }
- /**
- * allows the attributes of this frame other than name and src to be specified
- * @return a list of attributes
- */
- public String getFrameAttributes() {
- return "\"marginwidth=\"1\" marginheight=\"1\" frameborder=\"1\" scrolling=\"no\""; //$NON-NLS-1$
- }
+ /**
+ * allows the attributes of this frame other than name and src to be specified
+ * @return a list of attributes
+ */
+ public String getFrameAttributes() {
+ return "\"marginwidth=\"1\" marginheight=\"1\" frameborder=\"1\" scrolling=\"no\""; //$NON-NLS-1$
+ }
- /**
+ /**
* @since 3.7
*/
- @Override
+ @Override
final public int compareTo(AbstractFrame o) {
- if (o != null) {
- String objectName = o.getName();
+ if (o != null) {
+ String objectName = o.getName();
return (getName().compareTo(objectName));
- }
- return 0;
- }
+ }
+ return 0;
+ }
}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractView.java b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractView.java
index 8e867ed65..5a31b50f2 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractView.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/webapp/AbstractView.java
@@ -30,67 +30,67 @@ public abstract class AbstractView {
* is toc the help system will look for the files tocView.jsp
* and tocToolbar.jsp
*/
- public abstract String getName();
+ public abstract String getName();
- /**
- * @return a URL path, relative to /help which is the
- * location of the jsp files in the advanced presentation
- */
- public abstract String getURL();
+ /**
+ * @return a URL path, relative to /help which is the
+ * location of the jsp files in the advanced presentation
+ */
+ public abstract String getURL();
- /**
- * @return a URL path, relative to /help which is the
- * location of the jsp files in the basic presentation
- * @deprecated Help webapp no longer has basic view.
- */
- @Deprecated
+ /**
+ * @return a URL path, relative to /help which is the
+ * location of the jsp files in the basic presentation
+ * @deprecated Help webapp no longer has basic view.
+ */
+ @Deprecated
public String getBasicURL() {
- return getURL();
- }
+ return getURL();
+ }
- /**
- * @return a URL relative to /help which is the location
- * of the 16x16 image icon which will appear in the tab
- */
- public abstract String getImageURL();
+ /**
+ * @return a URL relative to /help which is the location
+ * of the 16x16 image icon which will appear in the tab
+ */
+ public abstract String getImageURL();
- /**
- * @return a character which can be used as an accesskey to
- * navigate directly to this view, or (char)0 if no
- * acceskey is specified
- */
- public abstract char getKey();
+ /**
+ * @return a character which can be used as an accesskey to
+ * navigate directly to this view, or (char)0 if no
+ * acceskey is specified
+ */
+ public abstract char getKey();
- /**
- * Used to allow for views whose loading is deferred until
- * their contents are visible
- * @return true if this view has deferred loading
- */
- public boolean isDeferred() {
- return false;
- }
+ /**
+ * Used to allow for views whose loading is deferred until
+ * their contents are visible
+ * @return true if this view has deferred loading
+ */
+ public boolean isDeferred() {
+ return false;
+ }
- /**
- * A user visible title for the view which will appear in the tooltip
- * @param locale the locale of the client
- * @return the tooltip text to be used in this locale
- */
- public abstract String getTitle(Locale locale);
+ /**
+ * A user visible title for the view which will appear in the tooltip
+ * @param locale the locale of the client
+ * @return the tooltip text to be used in this locale
+ */
+ public abstract String getTitle(Locale locale);
- /**
- * @return true if the view should be shown in the advanced presentation
- */
- public boolean isVisible() {
- return true;
- }
+ /**
+ * @return true if the view should be shown in the advanced presentation
+ */
+ public boolean isVisible() {
+ return true;
+ }
- /**
- * @return true if the view should be shown in the basic presentation
- * @deprecated Help webapp no longer has basic view.
- */
- @Deprecated
+ /**
+ * @return true if the view should be shown in the basic presentation
+ * @deprecated Help webapp no longer has basic view.
+ */
+ @Deprecated
public boolean isVisibleBasic() {
- return true;
- }
+ return true;
+ }
}
diff --git a/org.eclipse.help/src/org/eclipse/help/ICriterionDefinition.java b/org.eclipse.help/src/org/eclipse/help/ICriterionDefinition.java
index 1b136455b..609480838 100644
--- a/org.eclipse.help/src/org/eclipse/help/ICriterionDefinition.java
+++ b/org.eclipse.help/src/org/eclipse/help/ICriterionDefinition.java
@@ -22,24 +22,24 @@ package org.eclipse.help;
*/
public interface ICriterionDefinition extends IUAElement{
- /**
- * Returns the id that this criterion definition is associated with
- *
- * @return the id
- */
- public String getId();
+ /**
+ * Returns the id that this criterion definition is associated with
+ *
+ * @return the id
+ */
+ public String getId();
- /**
- * Obtains the display name associated with this criterion definition.
- *
- * @return the name
- */
- public String getName();
+ /**
+ * Obtains the display name associated with this criterion definition.
+ *
+ * @return the name
+ */
+ public String getName();
- /**
- * Obtains the criterion value definitions contained in the criterion.
- *
- * @return array of ICriterionValueDefinition
- */
- public ICriterionValueDefinition[] getCriterionValueDefinitions();
+ /**
+ * Obtains the criterion value definitions contained in the criterion.
+ *
+ * @return array of ICriterionValueDefinition
+ */
+ public ICriterionValueDefinition[] getCriterionValueDefinitions();
}
diff --git a/org.eclipse.help/src/org/eclipse/help/ICriterionValueDefinition.java b/org.eclipse.help/src/org/eclipse/help/ICriterionValueDefinition.java
index 7051c73b6..bc859895d 100644
--- a/org.eclipse.help/src/org/eclipse/help/ICriterionValueDefinition.java
+++ b/org.eclipse.help/src/org/eclipse/help/ICriterionValueDefinition.java
@@ -22,17 +22,17 @@ package org.eclipse.help;
*/
public interface ICriterionValueDefinition extends IUAElement {
- /**
- * Returns the id that this criterion value
- *
- * @return the id
- */
- public String getId();
+ /**
+ * Returns the id that this criterion value
+ *
+ * @return the id
+ */
+ public String getId();
- /**
- * Obtains the display name associated with this criterion value.
- *
- * @return the name
- */
- public String getName();
+ /**
+ * Obtains the display name associated with this criterion value.
+ *
+ * @return the name
+ */
+ public String getName();
}
diff --git a/org.eclipse.help/src/org/eclipse/help/IIndexEntry.java b/org.eclipse.help/src/org/eclipse/help/IIndexEntry.java
index fa11800db..6cd378b8f 100644
--- a/org.eclipse.help/src/org/eclipse/help/IIndexEntry.java
+++ b/org.eclipse.help/src/org/eclipse/help/IIndexEntry.java
@@ -22,24 +22,24 @@ package org.eclipse.help;
*/
public interface IIndexEntry extends IUAElement {
- /**
- * Returns the keyword that this entry is associated with
- *
- * @return the keyword
- */
- public String getKeyword();
+ /**
+ * Returns the keyword that this entry is associated with
+ *
+ * @return the keyword
+ */
+ public String getKeyword();
- /**
- * Obtains topics assosiated with this index entry (i.e. keyword).
- *
- * @return array of ITopic
- */
- public ITopic[] getTopics();
+ /**
+ * Obtains topics assosiated with this index entry (i.e. keyword).
+ *
+ * @return array of ITopic
+ */
+ public ITopic[] getTopics();
- /**
- * Obtains the index subentries contained in the entry.
- *
- * @return the index subentries
- */
- public IIndexEntry[] getSubentries();
+ /**
+ * Obtains the index subentries contained in the entry.
+ *
+ * @return the index subentries
+ */
+ public IIndexEntry[] getSubentries();
}
diff --git a/org.eclipse.help/src/org/eclipse/help/IIndexEntry2.java b/org.eclipse.help/src/org/eclipse/help/IIndexEntry2.java
index 9b3c8013e..8bb18c023 100644
--- a/org.eclipse.help/src/org/eclipse/help/IIndexEntry2.java
+++ b/org.eclipse.help/src/org/eclipse/help/IIndexEntry2.java
@@ -20,11 +20,11 @@ package org.eclipse.help;
*/
public interface IIndexEntry2 extends IIndexEntry {
- /**
- * Obtains see references for this entry
- *
- * @return array of ITopic
- */
- public IIndexSee[] getSees();
+ /**
+ * Obtains see references for this entry
+ *
+ * @return array of ITopic
+ */
+ public IIndexSee[] getSees();
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/CachedEntityResolver.java b/org.eclipse.help/src/org/eclipse/help/internal/CachedEntityResolver.java
index 4e6162b86..4e3467b35 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/CachedEntityResolver.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/CachedEntityResolver.java
@@ -34,15 +34,15 @@ public class CachedEntityResolver implements EntityResolver {
@Override
public InputSource resolveEntity(String publicId, String systemId) {
- int index = systemId.lastIndexOf("/"); //$NON-NLS-1$
- File cachedCopy = null;
- if (index != -1) {
- cachedCopy = new File(HelpPlugin.getConfigurationDirectory(), "/DTDs"); //$NON-NLS-1$
- cachedCopy.mkdirs();
- cachedCopy = new File(cachedCopy, systemId.substring(index));
- }
- if (cachedCopy != null) {
- if (!cachedCopy.exists()) {
+ int index = systemId.lastIndexOf("/"); //$NON-NLS-1$
+ File cachedCopy = null;
+ if (index != -1) {
+ cachedCopy = new File(HelpPlugin.getConfigurationDirectory(), "/DTDs"); //$NON-NLS-1$
+ cachedCopy.mkdirs();
+ cachedCopy = new File(cachedCopy, systemId.substring(index));
+ }
+ if (cachedCopy != null) {
+ if (!cachedCopy.exists()) {
try {
URL system = new URL(systemId);
URLConnection sc = system.openConnection();
@@ -57,15 +57,15 @@ public class CachedEntityResolver implements EntityResolver {
}
} catch (IOException e) {
}
- }
- try {
- InputSource is = new InputSource(new FileReader(cachedCopy));
- is.setSystemId(systemId);
- is.setPublicId(publicId);
- return is;
- } catch (FileNotFoundException e) {}
- }
- return new InputSource(new StringReader("")); //$NON-NLS-1$
+ }
+ try {
+ InputSource is = new InputSource(new FileReader(cachedCopy));
+ is.setSystemId(systemId);
+ is.setPublicId(publicId);
+ return is;
+ } catch (FileNotFoundException e) {}
+ }
+ return new InputSource(new StringReader("")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/HelpData.java b/org.eclipse.help/src/org/eclipse/help/internal/HelpData.java
index 0ac32123a..5b14dda0c 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/HelpData.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/HelpData.java
@@ -72,19 +72,19 @@ public class HelpData {
}
String helpDataFile = Platform.getPreferencesService().getString(HelpPlugin.PLUGIN_ID, HelpPlugin.HELP_DATA_KEY, "", null); //$NON-NLS-1$
if (helpDataFile.length() > 0) {
- if (helpDataFile.startsWith(PLUGINS_ROOT_SLASH)) {
- int nextSlash = helpDataFile.indexOf('/', PLUGINS_ROOT_SLASH.length());
- if (nextSlash > 0) {
- pluginId = helpDataFile.substring(PLUGINS_ROOT_SLASH.length(), nextSlash);
- helpDataFile = helpDataFile.substring(nextSlash + 1);
- }
+ if (helpDataFile.startsWith(PLUGINS_ROOT_SLASH)) {
+ int nextSlash = helpDataFile.indexOf('/', PLUGINS_ROOT_SLASH.length());
+ if (nextSlash > 0) {
+ pluginId = helpDataFile.substring(PLUGINS_ROOT_SLASH.length(), nextSlash);
+ helpDataFile = helpDataFile.substring(nextSlash + 1);
+ }
}
}
if (helpDataFile.length() > 0 && pluginId != null) {
Bundle bundle = Platform.getBundle(pluginId);
if (bundle != null) {
- URL helpDataUrl = bundle.getEntry(helpDataFile);
- productHelpData = new HelpData(helpDataUrl);
+ URL helpDataUrl = bundle.getEntry(helpDataFile);
+ productHelpData = new HelpData(helpDataUrl);
}
}
if (productHelpData == null) {
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/UAElement.java b/org.eclipse.help/src/org/eclipse/help/internal/UAElement.java
index 85d4614a0..ef37b0c19 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/UAElement.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/UAElement.java
@@ -52,13 +52,13 @@ public class UAElement implements IUAElement {
protected List<UAElement> children;
private Filter[] filters;
private Expression enablementExpression;
- private IUAElement src;
+ private IUAElement src;
private class Filter {
public Filter(String name, String value, boolean isNegated) {
- this.name = name;
- this.value = value;
- this.isNegated = isNegated;
+ this.name = name;
+ this.value = value;
+ this.isNegated = isNegated;
}
String name;
String value;
@@ -76,9 +76,9 @@ public class UAElement implements IUAElement {
public UAElement(String name, IUAElement src) {
this(name);
if (src instanceof UAElement) {
- copyFilters(src);
+ copyFilters(src);
} else {
- this.src = src;
+ this.src = src;
}
}
@@ -86,11 +86,11 @@ public class UAElement implements IUAElement {
UAElement sourceElement = (UAElement)src;
String filter = sourceElement.getAttribute(ATTRIBUTE_FILTER);
if (filter != null && filter.length() > 0) {
- this.setAttribute(ATTRIBUTE_FILTER, filter);
+ this.setAttribute(ATTRIBUTE_FILTER, filter);
}
filters = sourceElement.getFilterElements();
this.enablementExpression = sourceElement.enablementExpression;
- this.src = sourceElement.src;
+ this.src = sourceElement.src;
}
private Filter[] getFilterElements() {
@@ -237,7 +237,7 @@ public class UAElement implements IUAElement {
importElement(newChild);
element.insertBefore(newChild.element, refChild.element);
newChild.parent = this;
- getChildren();
+ getChildren();
if (children != null) {
int index = children.indexOf(refChild);
if (index < 0) {
@@ -267,19 +267,19 @@ public class UAElement implements IUAElement {
return false;
}
}
- if (enablementExpression != null) {
- try {
+ if (enablementExpression != null) {
+ try {
return enablementExpression.evaluate(context) == EvaluationResult.TRUE;
} catch (CoreException e) {
return false;
}
- }
+ }
return true;
}
public void removeChild(UAElement elementToRemove) {
- element.removeChild(elementToRemove.element);
+ element.removeChild(elementToRemove.element);
elementToRemove.parent = null;
if (children != null) {
@@ -299,11 +299,11 @@ public class UAElement implements IUAElement {
Document ownerDocument = element.getOwnerDocument();
if (!ownerDocument.equals(elementToImport.getOwnerDocument()) ) {
elementToImport = (Element)ownerDocument.importNode(elementToImport, true);
- uaElementToImport.children = null;
+ uaElementToImport.children = null;
} else {
if (elementToImport.getParentNode() != null) {
elementToImport = (Element)ownerDocument.importNode(elementToImport, true);
- uaElementToImport.children = null;
+ uaElementToImport.children = null;
} else {
}
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/Context.java b/org.eclipse.help/src/org/eclipse/help/internal/context/Context.java
index 4766a313d..633cf731c 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/Context.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/context/Context.java
@@ -49,7 +49,7 @@ public class Context extends UAElement implements IContext3 {
}
public void mergeContext(IContext src) {
- String text = src.getText();
+ String text = src.getText();
if (getText() == null || getText().length() == 0) {
setText(text);
}
@@ -149,9 +149,9 @@ public class Context extends UAElement implements IContext3 {
node = node.getNextSibling();
}
if (text != null) {
- Document document = getElement().getOwnerDocument();
- Node description = getElement().appendChild(document.createElement(ELEMENT_DESCRIPTION));
- description.appendChild(document.createTextNode(text));
+ Document document = getElement().getOwnerDocument();
+ Node description = getElement().appendChild(document.createElement(ELEMENT_DESCRIPTION));
+ description.appendChild(document.createTextNode(text));
}
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java
index c6f8a3463..3e8b01766 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java
@@ -103,10 +103,10 @@ public class ContextFileProvider extends AbstractContextProvider {
default:
// Merge the contexts - this is the least common case
Context newContext = new Context(matches.get(0), shortContextId);
- for (int i = 1; i < matches.size(); i++) {
- newContext.mergeContext(matches.get(i));
- }
- return newContext;
+ for (int i = 1; i < matches.size(); i++) {
+ newContext.mergeContext(matches.get(i));
+ }
+ return newContext;
}
}
@@ -197,11 +197,11 @@ public class ContextFileProvider extends AbstractContextProvider {
private Map<String, Context> loadContexts(ContextFile descriptor, String locale) {
// load the file
try (InputStream in = ResourceLocator.openFromPlugin(descriptor.getBundleId(), descriptor.getFile(), locale)) {
- if (in != null) {
+ if (in != null) {
return loadContextsFromInputStream(descriptor, locale, in);
} else {
- throw new FileNotFoundException();
- }
+ throw new FileNotFoundException();
+ }
} catch (Throwable t) {
String msg = "Error reading context-sensitive help file /\"" + getErrorPath(descriptor, locale) + "\" (skipping file)"; //$NON-NLS-1$ //$NON-NLS-2$
HelpPlugin.logError(msg, t);
@@ -238,7 +238,7 @@ public class ContextFileProvider extends AbstractContextProvider {
if (id != null) {
Object existingContext = contexts.get(id);
if (existingContext==null)
- contexts.put(id, context);
+ contexts.put(id, context);
else
{
((Context)existingContext).mergeContext(context);
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionDocumentReader.java b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionDocumentReader.java
index 278a31680..62724014b 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionDocumentReader.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionDocumentReader.java
@@ -46,7 +46,7 @@ public class CriteriaDefinitionDocumentReader extends DocumentReader {
fixCriterionId((Element)node);
}
prune(node);
- node = node.getNextSibling();
+ node = node.getNextSibling();
} else {
node = node.getNextSibling();
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFile.java b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFile.java
index f46a1f25f..43c801dee 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFile.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFile.java
@@ -21,32 +21,32 @@ import org.eclipse.help.internal.util.ResourceLocator;
public class CriteriaDefinitionFile {
- private String pluginId;
- private String file;
- private String locale;
-
- public CriteriaDefinitionFile(String pluginId, String file, String locale) {
- this.pluginId = pluginId;
- this.file = file;
- this.locale = locale;
- }
-
- public String getFile() {
- return file;
- }
-
- public String getLocale() {
- return locale;
- }
-
- public String getPluginId() {
- return pluginId;
- }
-
- public InputStream getInputStream() throws IOException {
- if (pluginId != null)
- return ResourceLocator.openFromPlugin(pluginId, file, locale);
- else
- return new FileInputStream(file);
- }
+ private String pluginId;
+ private String file;
+ private String locale;
+
+ public CriteriaDefinitionFile(String pluginId, String file, String locale) {
+ this.pluginId = pluginId;
+ this.file = file;
+ this.locale = locale;
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public String getLocale() {
+ return locale;
+ }
+
+ public String getPluginId() {
+ return pluginId;
+ }
+
+ public InputStream getInputStream() throws IOException {
+ if (pluginId != null)
+ return ResourceLocator.openFromPlugin(pluginId, file, locale);
+ else
+ return new FileInputStream(file);
+ }
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFileParser.java b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFileParser.java
index 9a1b4ab1a..eedef31fa 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFileParser.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFileParser.java
@@ -26,7 +26,7 @@ public class CriteriaDefinitionFileParser {
private DocumentReader reader;
- public CriteriaDefinitionContribution parse(CriteriaDefinitionFile criteriaDefinitionFile) throws IOException, SAXException, ParserConfigurationException {
+ public CriteriaDefinitionContribution parse(CriteriaDefinitionFile criteriaDefinitionFile) throws IOException, SAXException, ParserConfigurationException {
if (reader == null) {
reader = new CriteriaDefinitionDocumentReader();
}
@@ -34,13 +34,13 @@ public class CriteriaDefinitionFileParser {
if (in != null) {
CriteriaDefinition criteria = (CriteriaDefinition)reader.read(in);
CriteriaDefinitionContribution contrib = new CriteriaDefinitionContribution();
- contrib.setId('/' + criteriaDefinitionFile.getPluginId() + '/' + criteriaDefinitionFile.getFile());
+ contrib.setId('/' + criteriaDefinitionFile.getPluginId() + '/' + criteriaDefinitionFile.getFile());
contrib.setCriteriaDefinition(criteria);
contrib.setLocale(criteriaDefinitionFile.getLocale());
return contrib;
}
- else {
- throw new FileNotFoundException();
- }
- }
+ else {
+ throw new FileNotFoundException();
+ }
+ }
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFileProvider.java
index b2da5d762..7bd8b4e45 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFileProvider.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionFileProvider.java
@@ -49,17 +49,17 @@ public class CriteriaDefinitionFileProvider extends AbstractCriteriaDefinitionPr
StringBuilder buffer = new StringBuilder(ERROR_READING_HELP_CRITERIA_DEFINITION_FILE);
buffer.append(getCriteriaDefinitionFilePath(criteriaDefinitionFile));
buffer.append("\" at line "); //$NON-NLS-1$
- buffer.append(spe.getLineNumber());
- buffer.append(". "); //$NON-NLS-1$
- buffer.append(spe.getMessage());
+ buffer.append(spe.getLineNumber());
+ buffer.append(". "); //$NON-NLS-1$
+ buffer.append(spe.getMessage());
- // Use the contained exception.
- Exception x = spe;
- if (spe.getException() != null)
- x = spe.getException();
- HelpPlugin.logError(buffer.toString(), x);
+ // Use the contained exception.
+ Exception x = spe;
+ if (spe.getException() != null)
+ x = spe.getException();
+ HelpPlugin.logError(buffer.toString(), x);
- }
+ }
catch (Throwable t) {
String msg = ERROR_READING_HELP_CRITERIA_DEFINITION_FILE + getCriteriaDefinitionFilePath(criteriaDefinitionFile) + "\" (skipping file)"; //$NON-NLS-1$
HelpPlugin.logError(msg, t);
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionManager.java b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionManager.java
index 492703591..8eafad296 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriteriaDefinitionManager.java
@@ -47,7 +47,7 @@ public class CriteriaDefinitionManager {
HelpPlugin.getTocManager().getTocs(locale);
long start = System.currentTimeMillis();
if (HelpPlugin.DEBUG_CRITERIA) {
- System.out.println("Start to update criteria definition for locale " + locale); //$NON-NLS-1$
+ System.out.println("Start to update criteria definition for locale " + locale); //$NON-NLS-1$
}
List<CriteriaDefinitionContribution> contributions = new ArrayList<>(
Arrays.asList(readCriteriaDefinitionContributions(locale)));
@@ -56,7 +56,7 @@ public class CriteriaDefinitionManager {
criteriaDefinitionsByLocale.put(locale, criteriaDefinition);
long stop = System.currentTimeMillis();
if (HelpPlugin.DEBUG_CRITERIA) {
- System.out.println("Milliseconds to update criteria definition for locale " + locale + " = " + (stop - start)); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println("Milliseconds to update criteria definition for locale " + locale + " = " + (stop - start)); //$NON-NLS-1$ //$NON-NLS-2$
}
}
return criteriaDefinition;
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriterionResource.java b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriterionResource.java
index ddc017e89..d585a621d 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriterionResource.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/criteria/CriterionResource.java
@@ -86,8 +86,8 @@ public class CriterionResource {
continue outer;
}
}
- CriterionResource criterionResource = new CriterionResource(elementName, values);
- criteriaList.add(criterionResource);
+ CriterionResource criterionResource = new CriterionResource(elementName, values);
+ criteriaList.add(criterionResource);
}
}
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/dynamic/DocumentReader.java b/org.eclipse.help/src/org/eclipse/help/internal/dynamic/DocumentReader.java
index ef39d88ae..2993f2437 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/dynamic/DocumentReader.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/dynamic/DocumentReader.java
@@ -73,7 +73,7 @@ public class DocumentReader {
cachedBuilder = createManagedBuilder();
}
cachedBuilder.inUse = true;
- return cachedBuilder;
+ return cachedBuilder;
}
private ManagedBuilder createManagedBuilder() throws FactoryConfigurationError, ParserConfigurationException {
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/dynamic/DocumentWriter.java b/org.eclipse.help/src/org/eclipse/help/internal/dynamic/DocumentWriter.java
index 9fd270b8e..eee912796 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/dynamic/DocumentWriter.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/dynamic/DocumentWriter.java
@@ -39,17 +39,17 @@ public class DocumentWriter {
}
public String writeString(Element element, boolean xmlDecl) throws TransformerException, TransformerConfigurationException {
- byte[] bytes = writeBytes(element, xmlDecl);
- String encoding = transformer.getOutputProperty(OutputKeys.ENCODING);
- if (encoding == null) {
- encoding = "UTF-8"; //$NON-NLS-1$
- }
- try {
- return new String(bytes, encoding);
- }
- catch (UnsupportedEncodingException e) {
- return new String(bytes);
- }
+ byte[] bytes = writeBytes(element, xmlDecl);
+ String encoding = transformer.getOutputProperty(OutputKeys.ENCODING);
+ if (encoding == null) {
+ encoding = "UTF-8"; //$NON-NLS-1$
+ }
+ try {
+ return new String(bytes, encoding);
+ }
+ catch (UnsupportedEncodingException e) {
+ return new String(bytes);
+ }
}
public byte[] writeBytes(UAElement element, boolean xmlDecl) throws TransformerException, TransformerConfigurationException {
@@ -59,8 +59,8 @@ public class DocumentWriter {
public byte[] writeBytes(Element element, boolean xmlDecl) throws TransformerException, TransformerConfigurationException {
Document document = element.getOwnerDocument();
if (transformer == null) {
- TransformerFactory factory = TransformerFactory.newInstance();
- transformer = factory.newTransformer();
+ TransformerFactory factory = TransformerFactory.newInstance();
+ transformer = factory.newTransformer();
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
}
DocumentType docType = document.getDoctype();
@@ -77,9 +77,9 @@ public class DocumentWriter {
transformer.setOutputProperties(props);
DOMSource source = new DOMSource(element);
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- StreamResult result = new StreamResult(out);
- transformer.transform(source, result);
- return out.toByteArray();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ StreamResult result = new StreamResult(out);
+ transformer.transform(source, result);
+ return out.toByteArray();
}
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/entityresolver/LocalEntityResolver.java b/org.eclipse.help/src/org/eclipse/help/internal/entityresolver/LocalEntityResolver.java
index 070957d4d..8c7f434ae 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/entityresolver/LocalEntityResolver.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/entityresolver/LocalEntityResolver.java
@@ -33,20 +33,20 @@ public class LocalEntityResolver implements EntityResolver {
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
int index = systemId.lastIndexOf("/"); //$NON-NLS-1$
if (index >= 0) {
- Bundle helpBundle = HelpPlugin.getDefault().getBundle();
- String dtdPath = "dtds/internal" + systemId.substring(index); //$NON-NLS-1$
- URL dtdURL = FileLocator.find(helpBundle, new Path(dtdPath), null);
- if (dtdURL != null) {
- InputStream stream = dtdURL.openStream();
- if (stream != null) {
+ Bundle helpBundle = HelpPlugin.getDefault().getBundle();
+ String dtdPath = "dtds/internal" + systemId.substring(index); //$NON-NLS-1$
+ URL dtdURL = FileLocator.find(helpBundle, new Path(dtdPath), null);
+ if (dtdURL != null) {
+ InputStream stream = dtdURL.openStream();
+ if (stream != null) {
InputSource is = new InputSource(stream);
- is.setSystemId(systemId);
- is.setPublicId(publicId);
+ is.setSystemId(systemId);
+ is.setPublicId(publicId);
return is;
}
- }
+ }
}
- return new InputSource(new StringReader("")); //$NON-NLS-1$
+ return new InputSource(new StringReader("")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java
index b4beb61ef..e14a375cb 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/extension/ContentExtensionFileParser.java
@@ -47,10 +47,10 @@ public class ContentExtensionFileParser extends DefaultHandler {
/*
* Parses the specified content extension XML file into model elements.
*/
- public ContentExtension[] parse(Bundle bundle, String path) throws IOException, SAXException, ParserConfigurationException {
- if (reader == null) {
- reader = new DocumentReader();
- }
+ public ContentExtension[] parse(Bundle bundle, String path) throws IOException, SAXException, ParserConfigurationException {
+ if (reader == null) {
+ reader = new DocumentReader();
+ }
URL url= FileLocator.find(bundle, new Path(path), null);
if (url != null) {
InputStream in = url.openStream();
@@ -64,12 +64,12 @@ public class ContentExtensionFileParser extends DefaultHandler {
IUAElement[] children = extension.getChildren();
ContentExtension[] result = new ContentExtension[children.length];
System.arraycopy(children, 0, result, 0, children.length);
- return result;
+ return result;
}
else {
throw new FileNotFoundException();
}
- }
+ }
private Map<String, String[]> getRequiredAttributes() {
if (requiredAttributes == null) {
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java
index 490a3a711..c7b5d6930 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexAssembler.java
@@ -221,7 +221,7 @@ public class IndexAssembler {
}
String title = element.getAttribute("title"); //$NON-NLS-1$
if (title != null) {
- topic.setLabel(title);
+ topic.setLabel(title);
}
}
return UNHANDLED;
@@ -240,9 +240,9 @@ public class IndexAssembler {
int c1 = getCategory(o1);
int c2 = getCategory(o2);
if (c1 == c2) {
- if (o1 instanceof IndexSee) {
- return ((IndexSee)o1).compareTo(o2);
- }
+ if (o1 instanceof IndexSee) {
+ return ((IndexSee)o1).compareTo(o2);
+ }
// same type of object; compare alphabetically
String s1 = getLabel(o1);
String s2 = getLabel(o2);
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexDocumentReader.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexDocumentReader.java
index a35976f73..f5d831456 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexDocumentReader.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexDocumentReader.java
@@ -42,7 +42,7 @@ public class IndexDocumentReader extends DocumentReader {
fixTopicAttributes((Element)node);
}
prune(node);
- node = node.getNextSibling();
+ node = node.getNextSibling();
} else {
node = node.getNextSibling();
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFile.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFile.java
index d97febe73..2aca05fa7 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFile.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFile.java
@@ -22,32 +22,32 @@ import org.eclipse.help.internal.util.ResourceLocator;
public class IndexFile {
- private String pluginId;
- private String file;
- private String locale;
-
- public IndexFile(String pluginId, String file, String locale) {
- this.pluginId = pluginId;
- this.file = file;
- this.locale = locale;
- }
-
- public String getFile() {
- return file;
- }
-
- public String getLocale() {
- return locale;
- }
-
- public String getPluginId() {
- return pluginId;
- }
-
- public InputStream getInputStream() throws IOException {
- if (pluginId != null)
- return ResourceLocator.openFromPlugin(pluginId, file, locale);
- else
- return new FileInputStream(file);
- }
+ private String pluginId;
+ private String file;
+ private String locale;
+
+ public IndexFile(String pluginId, String file, String locale) {
+ this.pluginId = pluginId;
+ this.file = file;
+ this.locale = locale;
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public String getLocale() {
+ return locale;
+ }
+
+ public String getPluginId() {
+ return pluginId;
+ }
+
+ public InputStream getInputStream() throws IOException {
+ if (pluginId != null)
+ return ResourceLocator.openFromPlugin(pluginId, file, locale);
+ else
+ return new FileInputStream(file);
+ }
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileParser.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileParser.java
index 94440371c..ccdd18047 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileParser.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileParser.java
@@ -29,7 +29,7 @@ public class IndexFileParser {
private DocumentReader reader;
- public IndexContribution parse(IndexFile indexFile) throws IOException, SAXException, ParserConfigurationException {
+ public IndexContribution parse(IndexFile indexFile) throws IOException, SAXException, ParserConfigurationException {
if (reader == null) {
reader = new IndexDocumentReader();
}
@@ -45,5 +45,5 @@ public class IndexFileParser {
throw new FileNotFoundException();
}
}
- }
+ }
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java
index 5db130a5b..d08483f9a 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java
@@ -49,17 +49,17 @@ public class IndexFileProvider extends AbstractIndexProvider {
StringBuilder buffer = new StringBuilder(ERROR_READING_HELP_KEYWORD_INDEX_FILE);
buffer.append(getIndexFilePath(indexFile));
buffer.append("\" at line "); //$NON-NLS-1$
- buffer.append(spe.getLineNumber());
- buffer.append(". "); //$NON-NLS-1$
- buffer.append(spe.getMessage());
+ buffer.append(spe.getLineNumber());
+ buffer.append(". "); //$NON-NLS-1$
+ buffer.append(spe.getMessage());
- // Use the contained exception.
- Exception x = spe;
- if (spe.getException() != null)
- x = spe.getException();
- HelpPlugin.logError(buffer.toString(), x);
+ // Use the contained exception.
+ Exception x = spe;
+ if (spe.getException() != null)
+ x = spe.getException();
+ HelpPlugin.logError(buffer.toString(), x);
- }
+ }
catch (Throwable t) {
String msg = ERROR_READING_HELP_KEYWORD_INDEX_FILE + getIndexFilePath(indexFile) + "\" (skipping file)"; //$NON-NLS-1$
HelpPlugin.logError(msg, t);
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
index 45e3adcd9..3e189fb6f 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
@@ -53,7 +53,7 @@ public class IndexManager {
HelpPlugin.getTocManager().getTocs(locale); // Ensure Tocs and index not built simultaneously
long start = System.currentTimeMillis();
if (HelpPlugin.DEBUG_INDEX) {
- System.out.println("Start to update keyword index for locale " + locale); //$NON-NLS-1$
+ System.out.println("Start to update keyword index for locale " + locale); //$NON-NLS-1$
}
List<IndexContribution> contributions = new ArrayList<>(Arrays.asList(readIndexContributions(locale)));
filterIndexContributions(contributions);
@@ -62,7 +62,7 @@ public class IndexManager {
indexesByLocale.put(locale, index);
long stop = System.currentTimeMillis();
if (HelpPlugin.DEBUG_INDEX) {
- System.out.println("Milliseconds to update keyword index for locale " + locale + " = " + (stop - start)); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println("Milliseconds to update keyword index for locale " + locale + " = " + (stop - start)); //$NON-NLS-1$ //$NON-NLS-2$
}
}
return index;
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexSee.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexSee.java
index a61729577..b8aef0232 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexSee.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexSee.java
@@ -79,9 +79,9 @@ public class IndexSee extends UAElement implements IIndexSee, Comparable<Object>
if (i >= targetPath.length) {
return 1;
}
- if (getCategory(path[i]) != getCategory(targetPath[i])) {
- return getCategory(path[i]) - getCategory(targetPath[i]);
- }
+ if (getCategory(path[i]) != getCategory(targetPath[i])) {
+ return getCategory(path[i]) - getCategory(targetPath[i]);
+ }
int result = collator.compare(path[i], targetPath[i]);
if (result != 0) {
return result;
@@ -105,7 +105,7 @@ public class IndexSee extends UAElement implements IIndexSee, Comparable<Object>
result += subpaths[i].getKeyword().hashCode();
}
return result;
- }
+ }
@Override
public boolean isSeeAlso() {
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java
index ec267bc47..0cfcff221 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocAssembler.java
@@ -104,15 +104,15 @@ public class TocAssembler {
boolean isLinkedId = linkedContributionIds.containsKey(contrib.getId());
if (!isValidLinkTo && !isLinkedId) {
if (contrib.isPrimary()) {
- books.add(contrib);
- if (HelpPlugin.DEBUG_TOC) {
+ books.add(contrib);
+ if (HelpPlugin.DEBUG_TOC) {
String msg = "Primary Toc Found: " + contrib.getId(); //$NON-NLS-1$
String linkTo = contrib.getLinkTo();
if (linkTo != null) {
msg += " - cannot find link to: "; //$NON-NLS-1$
msg += linkTo;
}
- System.out.println(msg);
+ System.out.println(msg);
}
} else {
if (HelpPlugin.DEBUG_TOC) {
@@ -171,7 +171,7 @@ public class TocAssembler {
try {
String id = contrib.getId();
if (!tocsToFilter.contains(id)) {
- processor.process((Toc)contrib.getToc(), id);
+ processor.process((Toc)contrib.getToc(), id);
}
}
catch (Throwable t) {
@@ -389,7 +389,7 @@ public class TocAssembler {
if (element instanceof Anchor) {
if (tocsToFilter.contains(id)) {
return UNHANDLED;
- }
+ }
Anchor anchor = (Anchor)element;
UAElement parent = anchor.getParentElement();
if (parent != null) {
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java
index 42231918e..5cb49fd22 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileParser.java
@@ -47,5 +47,5 @@ public class TocFileParser extends DefaultHandler {
throw new FileNotFoundException();
}
}
- }
+ }
}
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java
index 6e8a4716f..fe992d1ba 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java
@@ -53,7 +53,7 @@ public class TocFileProvider extends AbstractTocProvider {
if (t instanceof SAXParseException) {
SAXParseException spe = (SAXParseException) t;
locationInfo = " at line " + spe.getLineNumber() //$NON-NLS-1$
- + ", column " + spe.getColumnNumber(); //$NON-NLS-1$
+ + ", column " + spe.getColumnNumber(); //$NON-NLS-1$
}
String pluginId = tocFiles[i].getPluginId();
String file = tocFiles[i].getFile();
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
index a6138c769..d7f9a6631 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
@@ -65,7 +65,7 @@ public class TocManager {
if (tocs == null) {
long start = System.currentTimeMillis();
if (HelpPlugin.DEBUG_TOC) {
- System.out.println("Start to build toc for locale " + locale); //$NON-NLS-1$
+ System.out.println("Start to build toc for locale " + locale); //$NON-NLS-1$
}
Set<String> tocsToFilter = getIgnoredTocContributions();
TocContribution[] raw = getRootTocContributions(locale, tocsToFilter);
@@ -92,7 +92,7 @@ public class TocManager {
tocsByLocale.put(locale, tocs);
long stop = System.currentTimeMillis();
if (HelpPlugin.DEBUG_TOC) {
- System.out.println("Milliseconds to update toc for locale " + locale + " = " + (stop - start)); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println("Milliseconds to update toc for locale " + locale + " = " + (stop - start)); //$NON-NLS-1$ //$NON-NLS-2$
}
}
return tocs;
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocSorter.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocSorter.java
index 1583d1948..46f92a153 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocSorter.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocSorter.java
@@ -80,7 +80,7 @@ public class TocSorter {
}
map.put(key, toc.getToc().getLabel());
}
- return map;
+ return map;
}
/*
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TopicSorter.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TopicSorter.java
index d203cb9fd..333638c97 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TopicSorter.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TopicSorter.java
@@ -35,7 +35,7 @@ public class TopicSorter {
}
if (toc.isSorted()) {
sort(toc, toc.getTopics());
- }
+ }
ITopic[] childTopics = toc.getTopics();
for (int i = 0; i < childTopics.length; i++) {
sortChildren((Topic)childTopics[i]);
@@ -45,7 +45,7 @@ public class TopicSorter {
private void sortChildren(Topic topic) {
if (topic.isSorted()) {
sort(topic, topic.getSubtopics());
- }
+ }
ITopic[] childTopics = topic.getSubtopics();
for (int i = 0; i < childTopics.length; i++) {
sortChildren((Topic)childTopics[i]);
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java b/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java
index 02728b239..3062c59b4 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/util/ProductPreferences.java
@@ -133,7 +133,7 @@ public class ProductPreferences {
int nextSlash = helpDataFile.indexOf('/', PLUGINS_ROOT_SLASH.length());
if (nextSlash > 0) {
helpDataPluginId = helpDataFile.substring(PLUGINS_ROOT_SLASH.length(), nextSlash);
- helpDataPath = helpDataFile.substring(nextSlash + 1);
+ helpDataPath = helpDataFile.substring(nextSlash + 1);
}
}
Bundle bundle = null;
@@ -141,9 +141,9 @@ public class ProductPreferences {
bundle = Platform.getBundle(helpDataPluginId);
}
if (bundle != null) {
- URL helpDataUrl = bundle.getEntry(helpDataPath);
- HelpData helpData = new HelpData(helpDataUrl);
- return helpData.getTocOrder();
+ URL helpDataUrl = bundle.getEntry(helpDataPath);
+ HelpData helpData = new HelpData(helpDataUrl);
+ return helpData.getTocOrder();
}
}
else {
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java b/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java
index f8cf41923..4a57d21e1 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java
@@ -152,7 +152,7 @@ public class ResourceLocator {
return null;
}
- checkForDuplicateExtensionElements(elements);
+ checkForDuplicateExtensionElements(elements);
for (int i = 0; i < elements.length; i++) {
IConfigurationElement element = elements[i];
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java b/org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java
index 97dd70c2e..b94b6d33b 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java
@@ -47,7 +47,7 @@ public class URLCoder {
private static boolean isAlphaNumericOrDot(byte b) {
return (b >= '0' && b <= '9') || (b >= 'a' && b <= 'z') || ( b >= 'A' && b <= 'Z')
- || b == '.';
+ || b == '.';
}
private static byte[] urlDecode(String encodedURL) {
diff --git a/org.eclipse.ua.tests.doc/META-INF/MANIFEST.MF b/org.eclipse.ua.tests.doc/META-INF/MANIFEST.MF
index f4f3d7c6b..3cbb41688 100644
--- a/org.eclipse.ua.tests.doc/META-INF/MANIFEST.MF
+++ b/org.eclipse.ua.tests.doc/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Doc
Bundle-SymbolicName: org.eclipse.ua.tests.doc;singleton:=true
-Bundle-Version: 1.0.600.qualifier
+Bundle-Version: 1.0.700.qualifier
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.equinox.http.registry;bundle-version="1.0.200",
diff --git a/org.eclipse.ua.tests.doc/pom.xml b/org.eclipse.ua.tests.doc/pom.xml
index 781c9dc19..5c24c5d3f 100644
--- a/org.eclipse.ua.tests.doc/pom.xml
+++ b/org.eclipse.ua.tests.doc/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.ua</groupId>
<artifactId>org.eclipse.ua.tests.doc</artifactId>
- <version>1.0.600-SNAPSHOT</version>
+ <version>1.0.700-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
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 37cfd5092..7605b5f36 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
@@ -84,17 +84,17 @@ public class CheckLinkAction implements ILiveHelpAction {
if (!opened) {
String containingPage = links.get(next);
System.out.println("Cannot open link from " + trimPath(containingPage)
- + " to " + trimPath(next));
+ + " to " + trimPath(next));
}
}
//EclipseConnector.setNotFoundCallout(null);
- setPageNotFoundPreference(errorPage);
+ setPageNotFoundPreference(errorPage);
links = new HashMap<>();
System.out.println("End check links");
}
private String trimPath(String next) {
- String result = next;
+ String result = next;
int htIndex = result.indexOf(HELP_TOPIC);
if (htIndex > 0) {
result = result.substring(htIndex + HELP_TOPIC.length());
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 ae6674eb3..62cc9b4f7 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
@@ -32,11 +32,11 @@ public class CheckTocAction implements IWorkbenchWindowActionDelegate {
private IWorkbenchWindow window;
public static List<BrokenLink> errors = new ArrayList<>();
- public static void showErrors() {
- if (errors.size() == 0) {
- reportStatus("No errors detected in load");
- }
- for (int i = 0; i < errors.size(); i++) {
+ public static void showErrors() {
+ if (errors.size() == 0) {
+ reportStatus("No errors detected in load");
+ }
+ for (int i = 0; i < errors.size(); i++) {
BrokenLink link = errors.get(i);
reportStatus("Invalid link in \"" + link.getTocID() + "\": " + link.getHref());
}
@@ -67,7 +67,7 @@ public class CheckTocAction implements IWorkbenchWindowActionDelegate {
return;
}
Toc[] tocsToCheck = dlg.getTocsToCheck();
- checkTocFilesExist(tocsToCheck);
+ checkTocFilesExist(tocsToCheck);
}
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 ec5cd8803..f75f4ca4c 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
@@ -48,7 +48,7 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
private static List<String> errors = new ArrayList<>();
private String lastPage;
- private class MonitorThread extends Thread {
+ private class MonitorThread extends Thread {
String lastHref;
int timesSame = 0;
boolean isComplete = false;
@@ -77,7 +77,7 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
}
}
- public static void showErrors() {
+ public static void showErrors() {
if (errors == null) return;
if (errors.size() == 0) {
reportStatus("Testing complete, no errors found");
@@ -101,7 +101,7 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
@Override
public void notFound(String url) {
if (errors != null) {
- errors.add("Error opening " + lastPage + "\n cannot load " + url);
+ errors.add("Error opening " + lastPage + "\n cannot load " + url);
}
}
}
@@ -183,9 +183,9 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
firstHref = null;
topicList = new ArrayList<>();
for (Toc toc : tocsToCheck) {
- reportStatus("Test level = " + testKind + " testing " + toc.getTocContribution().getId());
- ITopic[] topics = toc.getTopics();
- addTopics(topics);
+ reportStatus("Test level = " + testKind + " testing " + toc.getTocContribution().getId());
+ ITopic[] topics = toc.getTopics();
+ addTopics(topics);
}
lastPage = "No pages read";
LinkProvider linkProvider = new LinkProvider(topicList);
@@ -194,7 +194,7 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
errors = new ArrayList<>();
if (linkProvider.hasNext()) {
firstHref = linkProvider.next();
- PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(firstHref);
+ PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(firstHref);
new MonitorThread().start();
} else {
reportStatus("No pages to check");
@@ -210,10 +210,10 @@ public class LoadTocAction implements IWorkbenchWindowActionDelegate {
private void addTopic(ITopic nextTopic) {
String href = nextTopic.getHref();
if (href != null && !isFiltered(href)) {
- if (firstHref == null) {
- firstHref = href;
- }
- topicList.add(href);
+ if (firstHref == null) {
+ firstHref = href;
+ }
+ topicList.add(href);
}
addTopics(nextTopic.getSubtopics());
}
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 1a72904a3..248ae8d6e 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
@@ -99,7 +99,7 @@ public class SelectTocDialog extends Dialog {
public Toc[] getTocsToCheck() {
ArrayList<Toc> selected = new ArrayList<>();
for (int selectedToc : selectedTocs) {
- selected.add(tocs[selectedToc]);
+ selected.add(tocs[selectedToc]);
}
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/OnLoadFilter.java b/org.eclipse.ua.tests.doc/src/org/eclipse/ua/tests/doc/internal/linkchecker/OnLoadFilter.java
index 895605e78..e5cbdda47 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
@@ -28,7 +28,7 @@ public class OnLoadFilter implements IFilter {
private static long uniqueId = 0;
- private class OutFilter extends OutputStream {
+ private class OutFilter extends OutputStream {
private OutputStream out;
@@ -45,41 +45,41 @@ public class OnLoadFilter implements IFilter {
state = 3;
} else if (state == 3 && (b == 'd' || b == 'D')) {
state = 4;
- } else if (state == 4 && (b == 'y' || b == 'Y')) {
- state = 20;
- out.write(b);
- if (linkProvider.hasNext()) {
- String location = linkProvider.next();
- String onload = getOnloadText(pathPrefix + location, testKind);
- out.write(onload.getBytes());
- //System.out.println("Onload = " + onload);
- } else {
- linkProvider = null;
- String announceComplete = getCompletionText(testKind);
- out.write(announceComplete.getBytes());
- //System.out.println("announceComplete = " + announceComplete);
- }
- } else if (state == 20 && b == '>') {
- state = 21;
- } else if (state == 1 && (b == 'h' || b == 'H')) {
+ } else if (state == 4 && (b == 'y' || b == 'Y')) {
+ state = 20;
+ out.write(b);
+ if (linkProvider.hasNext()) {
+ String location = linkProvider.next();
+ String onload = getOnloadText(pathPrefix + location, testKind);
+ out.write(onload.getBytes());
+ //System.out.println("Onload = " + onload);
+ } else {
+ linkProvider = null;
+ String announceComplete = getCompletionText(testKind);
+ out.write(announceComplete.getBytes());
+ //System.out.println("announceComplete = " + announceComplete);
+ }
+ } else if (state == 20 && b == '>') {
+ state = 21;
+ } else if (state == 1 && (b == 'h' || b == 'H')) {
state = 11;
- } else if (state == 11 && (b == 'e' || b == 'e')) {
+ } else if (state == 11 && (b == 'e' || b == 'e')) {
state = 12;
- } else if (state == 12 && (b == 'a' || b == 'a')) {
+ } else if (state == 12 && (b == 'a' || b == 'a')) {
state = 13;
- } else if (state == 13 && (b == 'm' || b == 'M')) {
+ } else if (state == 13 && (b == 'm' || b == 'M')) {
state = 14;
- } else if (state == 14 && (b == 'e' || b == 'E')) {
+ } else if (state == 14 && (b == 'e' || b == 'E')) {
state = 15;
- } else if (state == 15 && (b == 's' || b == 'S')) {
+ } else if (state == 15 && (b == 's' || b == 'S')) {
state = 16;
- } else if (state == 16 && (b == 'e' || b == 'E')) {
+ } else if (state == 16 && (b == 'e' || b == 'E')) {
state = 17;
- } else if (state == 17 && (b == 't' || b == 'T')) {
+ } else if (state == 17 && (b == 't' || b == 'T')) {
state = 20;
- } else if (state > 0 && state < 20) {
- state = 0;
- }
+ } else if (state > 0 && state < 20) {
+ state = 0;
+ }
}
private String getOnloadText(String location, int testKind) {
@@ -102,7 +102,7 @@ public class OnLoadFilter implements IFilter {
private String getCompletionText(int testKind) {
if (testKind == SelectTocDialog.FOLLOW_LINKS) {
- return " onload = \"ua_test_doc_check_links();\" ";
+ return " onload = \"ua_test_doc_check_links();\" ";
} else {
return " onload = \"ua_test_doc_complete();\" ";
}
@@ -117,7 +117,7 @@ public class OnLoadFilter implements IFilter {
public void write(int b) throws IOException {
updateState(b);
if (state != 20) {
- out.write(b);
+ out.write(b);
}
}
@@ -130,11 +130,11 @@ public class OnLoadFilter implements IFilter {
private int testKind;
- public OnLoadFilter(int testKind) {
- this.testKind = testKind;
- }
+ public OnLoadFilter(int testKind) {
+ this.testKind = testKind;
+ }
- private static Iterator<String> linkProvider;
+ private static Iterator<String> linkProvider;
protected String getCommentText() {
return "comment";
@@ -147,7 +147,7 @@ public class OnLoadFilter implements IFilter {
}
String pathPrefix = FilterUtils.getRelativePathPrefix(req);
if (pathPrefix.length() >= 4) {
- return new OutFilter(out, pathPrefix.substring(0, pathPrefix.length() - 4));
+ return new OutFilter(out, pathPrefix.substring(0, pathPrefix.length() - 4));
}
return new OutFilter(out, "PLUGINS_ROOT");
}
diff --git a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/AllPerformanceTests.java b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/AllPerformanceTests.java
index be483455f..b889a113f 100644
--- a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/AllPerformanceTests.java
+++ b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/AllPerformanceTests.java
@@ -36,7 +36,7 @@ public class AllPerformanceTests extends TestSuite {
*/
public AllPerformanceTests() {
addTest(AllCheatSheetPerformanceTests.suite());
- addTest(AllHelpPerformanceTests.suite());
+ addTest(AllHelpPerformanceTests.suite());
/*
* Disabled due to inability to backport test to 3.2. Internal
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 c86ad2519..9921b6163 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
@@ -42,7 +42,7 @@ public class UATestContentProducer implements IHelpContentProducer {
String result = "<head><title>";
result += filterNonAlpha(URLCoder.decode(title));
result += "</title></head><body>";
- result +=filterNonAlpha(URLCoder.decode(body));
+ result +=filterNonAlpha(URLCoder.decode(body));
result += "</body>";
return new ByteArrayInputStream(result.getBytes());
}
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 7c521db12..d23ba404c 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
@@ -43,12 +43,12 @@ public class TestCompositeParser {
@Before
public void setUp() throws Exception {
- parser = new CompositeCheatSheetParser();
+ parser = new CompositeCheatSheetParser();
}
private CompositeCheatSheetModel parseTestFile(String path) {
URL testURL = ResourceFinder.findFile(UserAssistanceTestPlugin.getDefault(),
- COMPOSITES_FOLDER + path);
+ COMPOSITES_FOLDER + path);
return parser.parseGuide(testURL);
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestMarkupParser.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestMarkupParser.java
index 80b3f8d73..ad109e629 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestMarkupParser.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestMarkupParser.java
@@ -35,7 +35,7 @@ public class TestMarkupParser {
StringReader reader = new StringReader(input);
InputSource source = new InputSource(reader);
- DocumentBuilder documentBuilder = CheatSheetPlugin.getPlugin()
+ DocumentBuilder documentBuilder = CheatSheetPlugin.getPlugin()
.getDocumentBuilder();
try {
return documentBuilder.parse(source);
@@ -84,7 +84,7 @@ public class TestMarkupParser {
@Test
public void testAttributes() {
assertEquals("a<b attr1 = \"true\" attr2 = \"false\">c</b>d<b>e</b>",
- parse("<root>a<b attr1 = \"true\" attr2=\"false\">c</b>d<b>e</b></root>"));
+ parse("<root>a<b attr1 = \"true\" attr2=\"false\">c</b>d<b>e</b></root>"));
}
@Test
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 f251b4f5c..9d2158ec0 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
@@ -78,83 +78,83 @@ public class TestPersistence {
* mementos to different files and keep the contents distinct.
*/
@Test
- public void testMementoSaveMultipleFiles() {
- XMLMemento memento = XMLMemento.createWriteRoot(MEMENTO_TAG);
- memento.putString(KEY, DATA1);
- CheatSheetPlugin cheatSheetPlugin = CheatSheetPlugin.getPlugin();
+ public void testMementoSaveMultipleFiles() {
+ XMLMemento memento = XMLMemento.createWriteRoot(MEMENTO_TAG);
+ memento.putString(KEY, DATA1);
+ CheatSheetPlugin cheatSheetPlugin = CheatSheetPlugin.getPlugin();
IStatus status = cheatSheetPlugin.saveMemento(memento, PATH1);
- assertTrue(status.isOK());
- memento = XMLMemento.createWriteRoot(MEMENTO_TAG);
- memento.putString(KEY, DATA2);
- status = cheatSheetPlugin.saveMemento(memento, PATH2);
- assertTrue(status.isOK());
- memento = cheatSheetPlugin.readMemento(PATH1);
- assertEquals(DATA1, memento.getString(KEY));
- memento = cheatSheetPlugin.readMemento(PATH2);
- assertEquals(DATA2, memento.getString(KEY));
- }
+ assertTrue(status.isOK());
+ memento = XMLMemento.createWriteRoot(MEMENTO_TAG);
+ memento.putString(KEY, DATA2);
+ status = cheatSheetPlugin.saveMemento(memento, PATH2);
+ assertTrue(status.isOK());
+ memento = cheatSheetPlugin.readMemento(PATH1);
+ assertEquals(DATA1, memento.getString(KEY));
+ memento = cheatSheetPlugin.readMemento(PATH2);
+ assertEquals(DATA2, memento.getString(KEY));
+ }
@Test
- public void testSaveTaskState() {
- createCompositeCheatSheet();
- task1.setState(ICompositeCheatSheetTask.IN_PROGRESS);
- task2.setState(ICompositeCheatSheetTask.COMPLETED);
- helper.saveCompositeState(model, null);
-
- createCompositeCheatSheet();
- model.loadState(new Hashtable<String, String>());
- assertEquals(ICompositeCheatSheetTask.IN_PROGRESS, task1.getState());
- assertEquals(ICompositeCheatSheetTask.COMPLETED, task2.getState());
- }
-
- /**
- * Test that each task can save its state in a memento and that state
- * can be restored.
- */
+ public void testSaveTaskState() {
+ createCompositeCheatSheet();
+ task1.setState(ICompositeCheatSheetTask.IN_PROGRESS);
+ task2.setState(ICompositeCheatSheetTask.COMPLETED);
+ helper.saveCompositeState(model, null);
+
+ createCompositeCheatSheet();
+ model.loadState(new Hashtable<String, String>());
+ assertEquals(ICompositeCheatSheetTask.IN_PROGRESS, task1.getState());
+ assertEquals(ICompositeCheatSheetTask.COMPLETED, task2.getState());
+ }
+
+ /**
+ * Test that each task can save its state in a memento and that state
+ * can be restored.
+ */
@Test
- public void testSaveTaskMemento() {
- final String value1 = "13579";
- final String value2 = "AB24";
- createCompositeCheatSheet();
- // Start tasks with no memento
- task1.setState(ICompositeCheatSheetTask.COMPLETED);
- task2.setState(ICompositeCheatSheetTask.IN_PROGRESS);
- editor1.setInput(task1, null);
- editor2.setInput(task2, null);
- assertEquals(MockTaskEditor.NO_MEMENTO, editor1.getValue());
- assertEquals(MockTaskEditor.NO_MEMENTO, editor2.getValue());
-
- // Set the values to save in the memento
- editor1.setValue(value1);
- editor2.setValue(value2);
- task1.setState(ICompositeCheatSheetTask.COMPLETED);
- task2.setState(ICompositeCheatSheetTask.IN_PROGRESS);
- helper.saveCompositeState(model, null);
-
- createCompositeCheatSheet();
- model.loadState(new Hashtable<String, String>());
- editor1.setInput(task1, model.getTaskMemento(task1.getId()));
- editor2.setInput(task2, model.getTaskMemento(task2.getId()));
- assertEquals(value1, editor1.getValue());
- assertEquals(value2, editor2.getValue());
- }
-
- /**
- * Test that layout data is restored
- */
+ public void testSaveTaskMemento() {
+ final String value1 = "13579";
+ final String value2 = "AB24";
+ createCompositeCheatSheet();
+ // Start tasks with no memento
+ task1.setState(ICompositeCheatSheetTask.COMPLETED);
+ task2.setState(ICompositeCheatSheetTask.IN_PROGRESS);
+ editor1.setInput(task1, null);
+ editor2.setInput(task2, null);
+ assertEquals(MockTaskEditor.NO_MEMENTO, editor1.getValue());
+ assertEquals(MockTaskEditor.NO_MEMENTO, editor2.getValue());
+
+ // Set the values to save in the memento
+ editor1.setValue(value1);
+ editor2.setValue(value2);
+ task1.setState(ICompositeCheatSheetTask.COMPLETED);
+ task2.setState(ICompositeCheatSheetTask.IN_PROGRESS);
+ helper.saveCompositeState(model, null);
+
+ createCompositeCheatSheet();
+ model.loadState(new Hashtable<String, String>());
+ editor1.setInput(task1, model.getTaskMemento(task1.getId()));
+ editor2.setInput(task2, model.getTaskMemento(task2.getId()));
+ assertEquals(value1, editor1.getValue());
+ assertEquals(value2, editor2.getValue());
+ }
+
+ /**
+ * Test that layout data is restored
+ */
@Test
- public void testSaveLayoutData() {
- createCompositeCheatSheet();
+ public void testSaveLayoutData() {
+ createCompositeCheatSheet();
Map<String, String> values = new Hashtable<>();
- values.put("One", "1");
- values.put("Two", "2");
- helper.saveCompositeState(model, values);
+ values.put("One", "1");
+ values.put("Two", "2");
+ helper.saveCompositeState(model, values);
Map<String, String> restoredValues = new Hashtable<>();
- createCompositeCheatSheet();
- model.loadState(restoredValues);
- assertEquals(2, restoredValues.size());
- assertEquals("1", values.get("One"));
- assertEquals("2", values.get("Two"));
- }
+ createCompositeCheatSheet();
+ model.loadState(restoredValues);
+ assertEquals(2, restoredValues.size());
+ assertEquals("1", values.get("One"));
+ assertEquals("2", values.get("Two"));
+ }
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestSuccessors.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestSuccessors.java
index 4b44edd24..a26c4d75e 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestSuccessors.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/composite/TestSuccessors.java
@@ -71,7 +71,7 @@ public class TestSuccessors {
SuccesorTaskFinder finder = new SuccesorTaskFinder(task);
ICompositeCheatSheetTask[] successors = finder.getRecommendedSuccessors();
assertEquals(1, successors.length);
- assertEquals(expectedSuccessor, successors[0]);
+ assertEquals(expectedSuccessor, successors[0]);
}
private void assertNoSuccessors(ICompositeCheatSheetTask task) {
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 fc50fd438..d31914609 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
@@ -286,7 +286,7 @@ public class TestTaskEvents {
assertEquals(1, taskMap.getEventCount(task1B));
assertEquals(1, taskMap.getEventCount(group1));
assertEquals(4, taskMap.getTotalEventCount());
- }
+ }
@Test
public void testCompleteChoice() {
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 eef32977f..a78cdb562 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
@@ -39,7 +39,7 @@ public class ActionWithParameters extends Action implements ICheatSheetAction {
@Override
public void run(String[] params, ICheatSheetManager manager) {
ActionEnvironment.setParams(params);
- ActionEnvironment.actionCompleted();
+ ActionEnvironment.actionCompleted();
}
}
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 50bbabae6..fef2863d3 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
@@ -56,8 +56,8 @@ public class TestCommandExecution {
private static final String COMMAND_ID =
"org.eclipse.ui.cheatsheets.tests.command1"; //$NON-NLS-1$
private static final String SERIALIZED_COMMAND = COMMAND_ID + '('
- + PARAM1_ID + '=' + PARAM1_VALUE + ','
- + PARAM2_ID + '=' + PARAM2_VALUE + ')';
+ + PARAM1_ID + '=' + PARAM1_VALUE + ','
+ + PARAM2_ID + '=' + PARAM2_VALUE + ')';
private static final String RETURN_STORE = "retData";
private static final String PARENT_RETURN_STORE = "parent.retData";
@@ -86,10 +86,10 @@ public class TestCommandExecution {
IWorkbench wb = PlatformUI.getWorkbench();
if (wb != null) {
Object serviceObject = wb.getAdapter(IHandlerService.class);
- if (serviceObject != null) {
- IHandlerService service = (IHandlerService)serviceObject;
- return service;
- }
+ if (serviceObject != null) {
+ IHandlerService service = (IHandlerService)serviceObject;
+ return service;
+ }
}
return null;
}
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 c04e00bef..d7ddbd709 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
@@ -42,7 +42,7 @@ public class TestCheatSheetCategories {
CheatSheetRegistryReader.getInstance().getCheatSheets();
CheatSheetCollectionElement testCat = findChildCategory(cheatSheets, TEST_CATEGORY);
assertNotNull("Cannot find category org.eclipse.ua.tests.cheatsheet.cheatSheetsTestCat",
- testCat);
+ testCat);
}
@Test
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 400c3803a..ef7e90e50 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
@@ -51,14 +51,14 @@ public class TestCheatSheetCollection {
c2 = new CheatSheetCollectionElement("p2", "c2Id", "c2", root);
c11 = new CheatSheetCollectionElement("p11", "c11Id", "c11", c1);
c12 = new CheatSheetCollectionElement("p12", "c12Id", "c12", c1);
- root.add(c1);
- root.add(csA);
- root.add(csB);
- root.add(c2);
- c1.add(c11);
- c1.add(c12);
- c2.add(cs2A);
- c12.add(cs12A);
+ root.add(c1);
+ root.add(csA);
+ root.add(csB);
+ root.add(c2);
+ c1.add(c11);
+ c1.add(c12);
+ c2.add(cs2A);
+ c12.add(cs12A);
}
@Test
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 5c8632915..e5089e4fe 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
@@ -44,16 +44,16 @@ public class TestStatePersistence {
private static final String PATH = "ContentPath";
private class PropertySet {
- public String id;
- public int currentItem;
- public int button;
- public String contentPath;
- public List<String> completed;
- public List<String> expanded;
- public List<String> expandRestore;
- public Hashtable<String, String> subItemCompleted;
- public Hashtable<String, String> subItemSkipped;
- public CheatSheetManager manager;
+ public String id;
+ public int currentItem;
+ public int button;
+ public String contentPath;
+ public List<String> completed;
+ public List<String> expanded;
+ public List<String> expandRestore;
+ public Hashtable<String, String> subItemCompleted;
+ public Hashtable<String, String> subItemSkipped;
+ public CheatSheetManager manager;
}
private PropertySet propsToSave;
@@ -92,10 +92,10 @@ public class TestStatePersistence {
propertiesToSave.put(IParserTags.CONTENT_URL, propsToSave.contentPath);
}
if (propsToSave.subItemCompleted.size() > 0) {
- propertiesToSave.put(IParserTags.SUBITEMCOMPLETED, propsToSave.subItemCompleted);
+ propertiesToSave.put(IParserTags.SUBITEMCOMPLETED, propsToSave.subItemCompleted);
}
if (propsToSave.subItemSkipped.size() > 0) {
- propertiesToSave.put(IParserTags.SUBITEMSKIPPED, propsToSave.subItemSkipped);
+ propertiesToSave.put(IParserTags.SUBITEMSKIPPED, propsToSave.subItemSkipped);
}
helper.saveState(propertiesToSave, propsToSave.manager);
}
@@ -109,14 +109,14 @@ public class TestStatePersistence {
result.currentItem = Integer.parseInt(restored.getProperty(IParserTags.CURRENT));
result.completed = (ArrayList<String>) restored.get(IParserTags.COMPLETED);
result.contentPath = (String) restored.get(IParserTags.CONTENT_URL);
- result.expanded = (ArrayList<String>) restored.get(IParserTags.EXPANDED);
- 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<String, String> managerData = (Hashtable<String, String>) restored.get(IParserTags.MANAGERDATA);
+ result.expanded = (ArrayList<String>) restored.get(IParserTags.EXPANDED);
+ 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<String, String> managerData = (Hashtable<String, String>) restored.get(IParserTags.MANAGERDATA);
CheatSheetElement csElement = new CheatSheetElement(id);
- result.manager = new CheatSheetManager(csElement);
- result.manager.setData(managerData);
+ result.manager = new CheatSheetManager(csElement);
+ result.manager.setData(managerData);
return result;
}
@@ -147,7 +147,7 @@ public class TestStatePersistence {
propsToSave.manager.setData(KEY1, VALUE1);
propsToSave.manager.setData(KEY2, VALUE2);
save();
- restore();
+ restore();
assertEquals(VALUE1, restored.manager.getData(KEY1));
assertEquals(VALUE2, restored.manager.getData(KEY2));
}
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 9af304cbe..b5e6bb251 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
@@ -36,12 +36,12 @@ public class InvalidCheatsheet {
@Before
public void setUp() throws Exception {
- parser = new CheatSheetParser();
+ parser = new CheatSheetParser();
}
private ICheatSheet parseTestFile(String path) {
URL testURL = ResourceFinder.findFile(UserAssistanceTestPlugin.getDefault(),
- INVALID_CHEATSHEET_FOLDER + path);
+ INVALID_CHEATSHEET_FOLDER + path);
return parser.parse(testURL, UserAssistanceTestPlugin.getPluginId(), CheatSheetParser.SIMPLE_ONLY);
}
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 0098c3b39..3e87f2eaa 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
@@ -40,12 +40,12 @@ public class NoError {
@Before
public void setUp() throws Exception {
- parser = new CheatSheetParser();
+ parser = new CheatSheetParser();
}
private ICheatSheet parseTestFile(String path) {
URL testURL = ResourceFinder.findFile(UserAssistanceTestPlugin.getDefault(),
- path);
+ path);
return parser.parse(testURL, UserAssistanceTestPlugin.getPluginId(), CheatSheetParser.SIMPLE_ONLY);
}
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/ParseFromString.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/ParseFromString.java
index c7df06c1b..ec5936d0c 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/ParseFromString.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/parser/ParseFromString.java
@@ -35,16 +35,16 @@ public class ParseFromString {
private static final String VALID_CONTENT =
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?> "
- + "<cheatsheet title=\"Title\">"
+ + "<cheatsheet title=\"Title\">"
+ "<intro><description>Simple test</description></intro>"
+ "<item title=\"Item\">"
+ "<description>description</description>"
- + "</item></cheatsheet>";
+ + "</item></cheatsheet>";
// INVALID_CONTENT has no items
private static final String INVALID_CONTENT =
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?> "
- + "<cheatsheet title=\"Title\">"
+ + "<cheatsheet title=\"Title\">"
+ "<intro><description>Simple test</description></intro>"
+ "</cheatsheet>";
@@ -73,7 +73,7 @@ public class ParseFromString {
@Test
public void testUrlParserInput() {
URL testURL = ResourceFinder.findFile(UserAssistanceTestPlugin.getDefault(),
- "data/cheatsheet/valid/HelloWorld.xml");
+ "data/cheatsheet/valid/HelloWorld.xml");
ParserInput input = new ParserInput(testURL, UserAssistanceTestPlugin.getPluginId(), null);
assertNull(input.getXml());
assertTrue(testURL.equals(input.getUrl()));
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 28979f864..ef8a88c0c 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
@@ -43,7 +43,7 @@ public class MockTaskEditor extends TaskEditor {
setValue(NO_MEMENTO);
} else {
setValue(memento.getString(KEY));
- }
+ }
}
@Override
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 2bfb3afa8..64fa6614f 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
@@ -63,18 +63,18 @@ public class ParseTocWithCriteria {
IToc2 toc = parseToc("data/help/criteria/c1.xml");
Map<String, Set<String>> criteria = new HashMap<>();
CriteriaUtilities.addCriteriaToMap(criteria, toc.getCriteria());
- assertEquals(2, criteria.size());
- Set<String> versions = criteria.get("version");
- assertNotNull(versions);
- assertEquals(2, versions.size());
- assertTrue(versions.contains("1.0"));
- assertTrue(versions.contains("2.0"));
-
- Set<String> platforms = criteria.get("platform");
- assertNotNull(platforms);
- assertEquals(2, platforms.size());
- assertTrue(platforms.contains("linux"));
- assertTrue(platforms.contains("win32"));
+ assertEquals(2, criteria.size());
+ Set<String> versions = criteria.get("version");
+ assertNotNull(versions);
+ assertEquals(2, versions.size());
+ assertTrue(versions.contains("1.0"));
+ assertTrue(versions.contains("2.0"));
+
+ Set<String> platforms = criteria.get("platform");
+ assertNotNull(platforms);
+ assertEquals(2, platforms.size());
+ assertTrue(platforms.contains("linux"));
+ assertTrue(platforms.contains("win32"));
}
@Test
@@ -83,18 +83,18 @@ public class ParseTocWithCriteria {
Toc toc = new Toc(toc0);
Map<String, Set<String>> criteria = new HashMap<>();
CriteriaUtilities.addCriteriaToMap(criteria, toc.getCriteria());
- assertEquals(2, criteria.size());
- Set<String> versions = criteria.get("version");
- assertNotNull(versions);
- assertEquals(2, versions.size());
- assertTrue(versions.contains("1.0"));
- assertTrue(versions.contains("2.0"));
-
- Set<String> platforms = criteria.get("platform");
- assertNotNull(platforms);
- assertEquals(2, platforms.size());
- assertTrue(platforms.contains("linux"));
- assertTrue(platforms.contains("win32"));
+ assertEquals(2, criteria.size());
+ Set<String> versions = criteria.get("version");
+ assertNotNull(versions);
+ assertEquals(2, versions.size());
+ assertTrue(versions.contains("1.0"));
+ assertTrue(versions.contains("2.0"));
+
+ Set<String> platforms = criteria.get("platform");
+ assertNotNull(platforms);
+ assertEquals(2, platforms.size());
+ assertTrue(platforms.contains("linux"));
+ assertTrue(platforms.contains("win32"));
}
@Test
@@ -106,23 +106,23 @@ public class ParseTocWithCriteria {
Map<String, Set<String>> criteria = new HashMap<>();
assertTrue(topics[0] instanceof ITopic2);
CriteriaUtilities.addCriteriaToMap(criteria, ((ITopic2)topics[0]).getCriteria());
- assertEquals(2, criteria.size());
- Set<String> versions = criteria.get("version");
- assertNotNull(versions);
- assertEquals(1, versions.size());
- assertTrue(versions.contains("1.0"));
- assertFalse(versions.contains("2.0"));
+ assertEquals(2, criteria.size());
+ Set<String> versions = criteria.get("version");
+ assertNotNull(versions);
+ assertEquals(1, versions.size());
+ assertTrue(versions.contains("1.0"));
+ assertFalse(versions.contains("2.0"));
// Second topic
criteria = new HashMap<>();
assertTrue(topics[1] instanceof ITopic2);
CriteriaUtilities.addCriteriaToMap(criteria, ((ITopic2)topics[1]).getCriteria());
- versions = criteria.get("version");
- assertNotNull(versions);
- assertEquals(1, versions.size());
- assertTrue(versions.contains("2.0"));
- assertFalse(versions.contains("1.0"));
+ versions = criteria.get("version");
+ assertNotNull(versions);
+ assertEquals(1, versions.size());
+ assertTrue(versions.contains("2.0"));
+ assertFalse(versions.contains("1.0"));
}
@Test
@@ -194,11 +194,11 @@ public class ParseTocWithCriteria {
toc.addCriterion(criterion2);
ICriteria[] criteria = toc.getCriteria();
- assertEquals(2, criteria.length);
- assertEquals("version", criteria[0].getName());
- assertEquals("1.0", criteria[0].getValue());
- assertEquals("version", criteria[1].getName());
- assertEquals("2.0", criteria[1].getValue());
+ assertEquals(2, criteria.length);
+ assertEquals("version", criteria[0].getName());
+ assertEquals("1.0", criteria[0].getValue());
+ assertEquals("version", criteria[1].getName());
+ assertEquals("2.0", criteria[1].getValue());
}
@Test
@@ -212,11 +212,11 @@ public class ParseTocWithCriteria {
Toc copy = new Toc(toc);
ICriteria[] criteria = copy.getCriteria();
- assertEquals(2, criteria.length);
- assertEquals("version", criteria[0].getName());
- assertEquals("1.0", criteria[0].getValue());
- assertEquals("version", criteria[1].getName());
- assertEquals("2.0", criteria[1].getValue());
+ assertEquals(2, criteria.length);
+ assertEquals("version", criteria[0].getName());
+ assertEquals("1.0", criteria[0].getValue());
+ assertEquals("version", criteria[1].getName());
+ assertEquals("2.0", criteria[1].getValue());
}
@Test
@@ -230,11 +230,11 @@ public class ParseTocWithCriteria {
Topic copy = new Topic(topic);
ICriteria[] criteria = copy.getCriteria();
- assertEquals(2, criteria.length);
- assertEquals("version", criteria[0].getName());
- assertEquals("1.0", criteria[0].getValue());
- assertEquals("version", criteria[1].getName());
- assertEquals("2.0", criteria[1].getValue());
+ assertEquals(2, criteria.length);
+ assertEquals("version", criteria[0].getName());
+ assertEquals("1.0", criteria[0].getValue());
+ assertEquals("version", criteria[1].getName());
+ assertEquals("2.0", criteria[1].getValue());
}
@Test
@@ -245,11 +245,11 @@ public class ParseTocWithCriteria {
topic.addCriterion(criterion1);
topic.addCriterion(criterion2);
ICriteria[] criteria = topic.getCriteria();
- assertEquals(2, criteria.length);
- assertEquals("version", criteria[0].getName());
- assertEquals("1.0", criteria[0].getValue());
- assertEquals("version", criteria[1].getName());
- assertEquals("2.0", criteria[1].getValue());
+ assertEquals(2, criteria.length);
+ assertEquals("version", criteria[0].getName());
+ assertEquals("1.0", criteria[0].getValue());
+ assertEquals("version", criteria[1].getName());
+ assertEquals("2.0", criteria[1].getValue());
}
@Test
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 f1a3292d5..ddea24dd2 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
@@ -41,17 +41,17 @@ public class TestCriteriaProvider {
Topic copy = new Topic(topic);
ICriteria[] nativeCriteria = copy.getCriteria();
- assertEquals(2, nativeCriteria.length);
- assertEquals("version", nativeCriteria[0].getName());
- assertEquals("1.0", nativeCriteria[0].getValue());
- assertEquals("version", nativeCriteria[1].getName());
- assertEquals("2.0", nativeCriteria[1].getValue());
-
- ICriteria[] allCriteria = CriteriaProviderRegistry.getInstance().getAllCriteria(copy);
- assertTrue(containsCriterion(allCriteria, "version", "2.0"));
- assertTrue(containsCriterion(allCriteria, "version", "1.0"));
- assertTrue(containsCriterion(allCriteria, "containsLetter", "c"));
- assertFalse(containsCriterion(allCriteria, "containsLetter", "k"));
+ assertEquals(2, nativeCriteria.length);
+ assertEquals("version", nativeCriteria[0].getName());
+ assertEquals("1.0", nativeCriteria[0].getValue());
+ assertEquals("version", nativeCriteria[1].getName());
+ assertEquals("2.0", nativeCriteria[1].getValue());
+
+ ICriteria[] allCriteria = CriteriaProviderRegistry.getInstance().getAllCriteria(copy);
+ assertTrue(containsCriterion(allCriteria, "version", "2.0"));
+ assertTrue(containsCriterion(allCriteria, "version", "1.0"));
+ assertTrue(containsCriterion(allCriteria, "containsLetter", "c"));
+ assertFalse(containsCriterion(allCriteria, "containsLetter", "k"));
}
@Test
@@ -65,17 +65,17 @@ public class TestCriteriaProvider {
Toc copy = new Toc(toc);
ICriteria[] nativeCriteria = copy.getCriteria();
- assertEquals(2, nativeCriteria.length);
- assertEquals("version", nativeCriteria[0].getName());
- assertEquals("1.0", nativeCriteria[0].getValue());
- assertEquals("version", nativeCriteria[1].getName());
- assertEquals("2.0", nativeCriteria[1].getValue());
-
- ICriteria[] allCriteria = CriteriaProviderRegistry.getInstance().getAllCriteria(copy);
- assertTrue(containsCriterion(allCriteria, "version", "2.0"));
- assertTrue(containsCriterion(allCriteria, "version", "1.0"));
- assertTrue(containsCriterion(allCriteria, "containsLetter", "c"));
- assertFalse(containsCriterion(allCriteria, "containsLetter", "k"));
+ assertEquals(2, nativeCriteria.length);
+ assertEquals("version", nativeCriteria[0].getName());
+ assertEquals("1.0", nativeCriteria[0].getValue());
+ assertEquals("version", nativeCriteria[1].getName());
+ assertEquals("2.0", nativeCriteria[1].getValue());
+
+ ICriteria[] allCriteria = CriteriaProviderRegistry.getInstance().getAllCriteria(copy);
+ assertTrue(containsCriterion(allCriteria, "version", "2.0"));
+ assertTrue(containsCriterion(allCriteria, "version", "1.0"));
+ assertTrue(containsCriterion(allCriteria, "containsLetter", "c"));
+ assertFalse(containsCriterion(allCriteria, "containsLetter", "k"));
}
@Test
@@ -96,17 +96,17 @@ public class TestCriteriaProvider {
//public void testWorkingSetScope() throws Exception {
// TODO write a test which creates a working set scope based on the
- // criteria which are generated by the criteria provider
+ // criteria which are generated by the criteria provider
//}
private boolean containsCriterion(ICriteria[] allCriteria,
String name, String value) {
- for (ICriteria element : allCriteria) {
- if (element.getName().equals(name) && element.getValue().equals(value)) {
- return true;
- }
- }
- return false;
+ for (ICriteria element : allCriteria) {
+ if (element.getName().equals(name) && element.getValue().equals(value)) {
+ return true;
+ }
+ }
+ return false;
}
}
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 3f67eae98..bd4cc9212 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
@@ -115,8 +115,8 @@ public class DynamicXHTMLProcessorTest {
@Test
public void testValidXML() throws Exception {
- String processed = process("data/help/dynamic/xhtml/emptyAnchor.xhtml");
- XMLUtil.assertParseableXML(processed);
+ String processed = process("data/help/dynamic/xhtml/emptyAnchor.xhtml");
+ XMLUtil.assertParseableXML(processed);
}
}
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 2a69667f9..f5bd8b9a7 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
@@ -64,9 +64,9 @@ public class IndexAssemblerTest {
IndexAssembler assembler = new IndexAssembler();
List<IndexContribution> contributions = new ArrayList<>(Arrays.asList(contrib));
Index index = assembler.assemble(contributions, Platform.getNL());
- IIndexEntry[] children = index.getEntries();
- assertEquals(2,children.length);
- IIndexEntry eclipseEntry = children[0];
+ IIndexEntry[] children = index.getEntries();
+ assertEquals(2,children.length);
+ IIndexEntry eclipseEntry = children[0];
assertEquals("eclipse", eclipseEntry.getKeyword());
IUAElement[] eclipseChildren = eclipseEntry.getChildren();
assertEquals(4, eclipseChildren.length);
@@ -78,11 +78,11 @@ public class IndexAssemblerTest {
IndexSee seeHeliosRelease = (IndexSee) eclipseChildren[3];
assertEquals(0, seeHelios.getSubpathElements().length);
assertEquals(1, seeHeliosRelease.getSubpathElements().length);
- IIndexEntry heliosEntry = children[1];
+ IIndexEntry heliosEntry = children[1];
assertEquals("helios", heliosEntry.getKeyword());
- IIndexSee[] heliosSees = ((IIndexEntry2)heliosEntry).getSees();
- assertEquals(1, heliosSees.length);
- assertEquals("eclipse", heliosSees[0].getKeyword());
+ IIndexSee[] heliosSees = ((IIndexEntry2)heliosEntry).getSees();
+ assertEquals(1, heliosSees.length);
+ assertEquals("eclipse", heliosSees[0].getKeyword());
}
@Test
@@ -92,14 +92,14 @@ public class IndexAssemblerTest {
IndexAssembler assembler = new IndexAssembler();
List<IndexContribution> contributions = new ArrayList<>(Arrays.asList(contrib));
Index index = assembler.assemble(contributions, Platform.getNL());
- IIndexEntry[] children = index.getEntries();
- assertEquals(1,children.length);
- assertEquals("keyword1", children[0].getKeyword());
- ITopic[] topics = children[0].getTopics();
- assertEquals(3, topics.length);
- assertEquals("topic0", topics[0].getLabel());
- assertEquals("topic1", topics[1].getLabel());
- assertEquals("topic2", topics[2].getLabel());
+ IIndexEntry[] children = index.getEntries();
+ assertEquals(1,children.length);
+ assertEquals("keyword1", children[0].getKeyword());
+ ITopic[] topics = children[0].getTopics();
+ assertEquals(3, topics.length);
+ assertEquals("topic0", topics[0].getLabel());
+ assertEquals("topic1", topics[1].getLabel());
+ assertEquals("topic2", topics[2].getLabel());
}
// Replaces white space between ">" and "<" by a single newline
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 a79f0123f..b9f0bed5c 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
@@ -39,10 +39,10 @@ public class ConcurrentTocAccess {
this.dimensions = dimensions;
result = new StringBuilder();
result.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- result.append("<?NLS TYPE=\"org.eclipse.help.toc\"?>\n");
- result.append("<toc label=\"Test Toc\" >\n");
- generateTopics(0);
- result.append("</toc>");
+ result.append("<?NLS TYPE=\"org.eclipse.help.toc\"?>\n");
+ result.append("<toc label=\"Test Toc\" >\n");
+ generateTopics(0);
+ result.append("</toc>");
return result.toString();
}
@@ -73,12 +73,12 @@ public class ConcurrentTocAccess {
@Override
public void run() {
- try {
+ try {
int result = traverseToc(toc);
setLeafCount(result);
} catch (Exception e) {
- setLeafCount(-1);
- this.exception = e;
+ setLeafCount(-1);
+ this.exception = e;
}
}
@@ -119,8 +119,8 @@ public class ConcurrentTocAccess {
}
for (int i = 0; i < numberOfThreads; i++) {
if (visitors[i].isAlive()) {
- complete = false;
- try {
+ complete = false;
+ try {
Thread.sleep(100);
} catch (InterruptedException e) {
fail("Interrupted Exception");
@@ -183,7 +183,7 @@ public class ConcurrentTocAccess {
Toc toc;
Document doc;
try {
- doc = DocumentCreator.createDocument(tocSource);
+ doc = DocumentCreator.createDocument(tocSource);
} catch (Exception e) {
fail("Exception creating TOC");
doc = null;
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextMergeTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextMergeTest.java
index b06a1711a..fff3efc06 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextMergeTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/ContextMergeTest.java
@@ -29,7 +29,7 @@ import org.w3c.dom.Element;
public class ContextMergeTest {
private static final String ENABLEMENT_CHEATSHEETS = "<enablement><with variable=\"platform\">" +
- "<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.cheatsheets\"/>" +
+ "<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.cheatsheets\"/>" +
"</with></enablement>";
private static final String TOPIC_END = "</topic>";
private static final String TOPIC_HEAD_ECLIPSE = "<topic href=\"http://www.eclipse.org\" label=\"enabled\">";
@@ -44,7 +44,7 @@ public class ContextMergeTest {
Context context;
Document doc;
try {
- doc = DocumentCreator.createDocument(contextSource);
+ doc = DocumentCreator.createDocument(contextSource);
} catch (Exception e) {
fail("Caught Exception");
doc = null;
@@ -56,14 +56,14 @@ public class ContextMergeTest {
@Test
public void testContextMerge() {
final String contextSource1 = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_ECLIPSE +
- TOPIC_WITH_ENABLEMENT +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_ECLIPSE +
+ TOPIC_WITH_ENABLEMENT +
+ END_CONTEXT;
final String contextSource2 = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_BUGZILLA +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_BUGZILLA +
+ END_CONTEXT;
Context context1;
Context context2;
context1 = createContext(contextSource1);
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 794090fde..4e75ed120 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
@@ -36,16 +36,16 @@ import org.w3c.dom.Element;
public class ContextTest {
private static final String ENABLEMENT_CHEATSHEETS = "<enablement><with variable=\"platform\">" +
- "<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.cheatsheets\"/>" +
+ "<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.cheatsheets\"/>" +
"</with></enablement>";
private static final String ENABLEMENT_INVALID = "<enablement><with variable=\"platform\">" +
- "<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.invalid\"/>" +
+ "<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.invalid\"/>" +
"</with></enablement>";
private static final String FILTER_OUT = "<filter name = \"plugin\" value = \"org.eclipse.ua.invalid\"/>";
private static final String TOPIC_END = "</topic>";
private static final String TOPIC_HEAD_ECLIPSE = "<topic href=\"http://www.eclipse.org\" label=\"enabled\">";
private final String TOPIC_OLD_FILTER_DISABLED = "<topic filter=\"plugin=org.eclipse.ua.invalid\" href=\"www.eclipse.org\""
- + " label=\"Transformations and transformation configurations\"/>";
+ + " label=\"Transformations and transformation configurations\"/>";
private static final String CONTEXT_DESCRIPTION = "<description>Context Description</description>";
private static final String EMPTY_DESCRIPTION = "<description></description>";
private static final String CONTEXT_HEAD = "<context id=\"viewer\" title=\"Sample View\">";
@@ -54,7 +54,7 @@ public class ContextTest {
private final String TOPIC_WITH_ENABLEMENT = TOPIC_HEAD_ECLIPSE + ENABLEMENT_CHEATSHEETS + TOPIC_END;
private final String TOPIC_DISABLED = TOPIC_HEAD_ECLIPSE + ENABLEMENT_INVALID + TOPIC_END;
private final String TOPIC_FILTER_OUT = TOPIC_HEAD_ECLIPSE + FILTER_OUT + TOPIC_END;
- private final String END_CONTEXT = "</context>";
+ private final String END_CONTEXT = "</context>";
@Before
public void setUp() throws Exception {
@@ -66,7 +66,7 @@ public class ContextTest {
Context context;
Document doc;
try {
- doc = DocumentCreator.createDocument(contextSource);
+ doc = DocumentCreator.createDocument(contextSource);
} catch (Exception e) {
fail("Caught Exception");
doc = null;
@@ -78,9 +78,9 @@ public class ContextTest {
@Test
public void testSimpleContext() {
final String contextSource = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_ECLIPSE +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_ECLIPSE +
+ END_CONTEXT;
Context context;
context = createContext(contextSource);
assertEquals("Sample View", context.getTitle());
@@ -93,9 +93,9 @@ public class ContextTest {
@Test
public void testContextWithEnablement() {
final String contextSource = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_WITH_ENABLEMENT +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_WITH_ENABLEMENT +
+ END_CONTEXT;
Context context;
context = createContext(contextSource);
assertEquals("Sample View", context.getTitle());
@@ -113,9 +113,9 @@ public class ContextTest {
@Test
public void testCopyContext() {
final String contextSource = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_WITH_ENABLEMENT +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_WITH_ENABLEMENT +
+ END_CONTEXT;
Context context = createContext(contextSource);
Context context2 = new Context(context, "new id");
Context context3 = new Context(context2, "new id2");
@@ -152,11 +152,11 @@ public class ContextTest {
@Test
public void testEnablement() {
final String contextSource = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_WITH_ENABLEMENT +
- TOPIC_DISABLED +
- TOPIC_OLD_FILTER_DISABLED +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_WITH_ENABLEMENT +
+ TOPIC_DISABLED +
+ TOPIC_OLD_FILTER_DISABLED +
+ END_CONTEXT;
Context context = createContext(contextSource);
IHelpResource[] related = context.getRelatedTopics();
assertEquals(3, related.length);
@@ -168,10 +168,10 @@ public class ContextTest {
@Test
public void testOldStyleFilteringOfCopies() {
final String contextSource = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_WITH_ENABLEMENT +
- TOPIC_OLD_FILTER_DISABLED +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_WITH_ENABLEMENT +
+ TOPIC_OLD_FILTER_DISABLED +
+ END_CONTEXT;
Context context1 = createContext(contextSource);
Context context2 = new Context(context1, "id");
Context context3 = new Context(context2, "id2");
@@ -195,10 +195,10 @@ public class ContextTest {
@Test
public void testOldStyleFilteringOfCopies2() {
final String contextSource = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_WITH_ENABLEMENT +
- TOPIC_OLD_FILTER_DISABLED +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_WITH_ENABLEMENT +
+ TOPIC_OLD_FILTER_DISABLED +
+ END_CONTEXT;
Context context1 = createContext(contextSource);
Context context2 = new Context(context1, "id");
Context context3 = new Context(context1, "id2");
@@ -222,10 +222,10 @@ public class ContextTest {
@Test
public void testFilteringOfCopies() {
final String contextSource = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_WITH_ENABLEMENT +
- TOPIC_FILTER_OUT +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_WITH_ENABLEMENT +
+ TOPIC_FILTER_OUT +
+ END_CONTEXT;
Context context1 = createContext(contextSource);
Context context2 = new Context(context1, "id");
Context context3 = new Context(context2, "id2");
@@ -248,10 +248,10 @@ public class ContextTest {
@Test
public void testFilteringOfCopies2() {
final String contextSource = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_WITH_ENABLEMENT +
- TOPIC_FILTER_OUT +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_WITH_ENABLEMENT +
+ TOPIC_FILTER_OUT +
+ END_CONTEXT;
Context context1 = createContext(contextSource);
Context context2 = new Context(context1, "id");
Context context3 = new Context(context1, "id2");
@@ -275,10 +275,10 @@ public class ContextTest {
@Test
public void testEnablementOfCopies() {
final String contextSource = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_WITH_ENABLEMENT +
- TOPIC_DISABLED +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_WITH_ENABLEMENT +
+ TOPIC_DISABLED +
+ END_CONTEXT;
Context context1 = createContext(contextSource);
Context context2 = new Context(context1, "id");
Context context3 = new Context(context2, "id2");
@@ -301,10 +301,10 @@ public class ContextTest {
@Test
public void testEnablementOfCopies2() {
final String contextSource = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_WITH_ENABLEMENT +
- TOPIC_DISABLED +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_WITH_ENABLEMENT +
+ TOPIC_DISABLED +
+ END_CONTEXT;
Context context1 = createContext(contextSource);
Context context2 = new Context(context1, "id");
Context context3 = new Context(context1, "id2");
@@ -328,10 +328,10 @@ public class ContextTest {
@Test
public void testEnablementOfCopies3() {
final String contextSource = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_WITH_ENABLEMENT +
- TOPIC_DISABLED +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_WITH_ENABLEMENT +
+ TOPIC_DISABLED +
+ END_CONTEXT;
Context context1 = createContext(contextSource);
Context context2 = new Context(context1, "id");
Context context3 = new Context(context1, "id2");
@@ -360,9 +360,9 @@ public class ContextTest {
@Test
public void testContextWithAttribute() {
final String contextSource = CONTEXT_HEAD_WITH_ATTRIBUTE +
- CONTEXT_DESCRIPTION +
- TOPIC_ECLIPSE +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_ECLIPSE +
+ END_CONTEXT;
Context context;
context = createContext(contextSource);
assertEquals("abc", context.getAttribute("att"));
@@ -371,8 +371,8 @@ public class ContextTest {
@Test
public void testContextWithoutDescription() {
final String contextSource = CONTEXT_HEAD +
- TOPIC_ECLIPSE +
- END_CONTEXT;
+ TOPIC_ECLIPSE +
+ END_CONTEXT;
Context context;
context = createContext(contextSource);
assertNull(context.getText());
@@ -381,9 +381,9 @@ public class ContextTest {
@Test
public void testContextWithEmptyDescription() {
final String contextSource = CONTEXT_HEAD +
- EMPTY_DESCRIPTION +
- TOPIC_ECLIPSE +
- END_CONTEXT;
+ EMPTY_DESCRIPTION +
+ TOPIC_ECLIPSE +
+ END_CONTEXT;
Context context;
context = createContext(contextSource);
assertEquals("", context.getText());
@@ -392,8 +392,8 @@ public class ContextTest {
@Test
public void testContextWithoutDescriptionSelfCatenation() {
final String contextSource = CONTEXT_HEAD +
- TOPIC_ECLIPSE +
- END_CONTEXT;
+ TOPIC_ECLIPSE +
+ END_CONTEXT;
Context context1 = createContext(contextSource);
Context context2 = createContext(contextSource);
context1.mergeContext(context2);
@@ -403,12 +403,12 @@ public class ContextTest {
@Test
public void testContextWithoutDescriptionMixedCatenation() {
final String contextSourceEmpty = CONTEXT_HEAD +
- TOPIC_ECLIPSE +
- END_CONTEXT;
+ TOPIC_ECLIPSE +
+ END_CONTEXT;
final String contextSourceWithDesc = CONTEXT_HEAD +
- CONTEXT_DESCRIPTION +
- TOPIC_ECLIPSE +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_ECLIPSE +
+ END_CONTEXT;
Context context1 = createContext(contextSourceEmpty);
Context context2 = createContext(contextSourceWithDesc);
context1.mergeContext(context2);
@@ -422,9 +422,9 @@ public class ContextTest {
/*
public void testCopyContextWithAttribute() {
final String contextSource = CONTEXT_HEAD_WITH_ATTRIBUTE +
- CONTEXT_DESCRIPTION +
- TOPIC_ECLIPSE +
- END_CONTEXT;
+ CONTEXT_DESCRIPTION +
+ TOPIC_ECLIPSE +
+ END_CONTEXT;
Context context1;
context1 = createContext(contextSource);
Context context2 = new Context(context1, "id");
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 b84709768..8465a2b60 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
@@ -42,7 +42,7 @@ public class DocumentReaderTest {
@Test
public void testDocumentReader() throws IOException, SAXException, ParserConfigurationException {
- DocumentReader docReader = new DocumentReader();
+ DocumentReader docReader = new DocumentReader();
ResourceReader[] resReaders = new ResourceReader[3];
resReaders[0] = new ResourceReader(docReader,"data/help/index/assembler/a.xml");
resReaders[1] = new ResourceReader(docReader,"data/help/index/assembler/b.xml");
@@ -79,7 +79,7 @@ public class DocumentReaderTest {
public void run() {
try {
for (int i = 0; i < 10; i++) {
- readFile(reader, file);
+ readFile(reader, file);
}
status = SUCCESS;
} catch (Exception e) {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/EntityResolutionTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/EntityResolutionTest.java
index 84be0774d..26cabee35 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/EntityResolutionTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/EntityResolutionTest.java
@@ -53,39 +53,39 @@ public class EntityResolutionTest {
}
@Test
- public void testFramset() throws Exception {
- resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd", true);
- }
+ public void testFramset() throws Exception {
+ resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd", true);
+ }
@Test
- public void testFlat() throws Exception {
- resolve("http://www.w3.org/TR/xhtml11/DTD/xhtml11-flat.dtd", true);
- }
+ public void testFlat() throws Exception {
+ resolve("http://www.w3.org/TR/xhtml11/DTD/xhtml11-flat.dtd", true);
+ }
@Test
- public void testStrict() throws Exception {
- resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd", true);
- }
+ public void testStrict() throws Exception {
+ resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd", true);
+ }
@Test
- public void testTransitional() throws Exception {
- resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", true);
- }
+ public void testTransitional() throws Exception {
+ resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", true);
+ }
@Test
- public void testLat1() throws Exception {
- resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent", true);
- }
+ public void testLat1() throws Exception {
+ resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent", true);
+ }
@Test
- public void testSpecial() throws Exception {
- resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent", true);
- }
+ public void testSpecial() throws Exception {
+ resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent", true);
+ }
@Test
- public void testResolveSymbol() throws Exception {
- resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent", true);
- }
+ public void testResolveSymbol() throws Exception {
+ resolve("http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent", true);
+ }
@Test
public void testUnsupportedDtds() throws Exception {
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 f1a3be3b4..e5a9a7836 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
@@ -42,7 +42,7 @@ public class IndexEntryTest {
private static final String INVALID_INSTALLED = "<with variable=\"platform\">" +
"<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.invalid\"/></with>";
private static final String CS_INSTALLED = "<with variable=\"platform\">" +
- "<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.cheatsheets\"/></with>";
+ "<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.cheatsheets\"/></with>";
private static final String ENABLEMENT_CHEATSHEETS = "<enablement>" + CS_INSTALLED + "</enablement>";
private static final String ENABLEMENT_INVALID = "<enablement>" + INVALID_INSTALLED + "</enablement>";
private static final String FILTER_IN = "<filter name = \"plugin\" value = \"org.eclipse.ua.tests\"/>";
@@ -62,13 +62,13 @@ public class IndexEntryTest {
private final String ENTRY_FILTER_OUT = ENTRY_HEAD_ECLIPSE + FILTER_OUT + ENTRY_END;
private final String ENTRY_FILTER_MIXED = ENTRY_HEAD_ECLIPSE + FILTER_IN + FILTER_OUT + ENTRY_END;
private final String ENTRY_OLD_FILTER = "<entry filter=\"plugin=org.eclipse.ua.tests\" "
- + " keyword=\"Transformations and transformation configurations\"/>";
+ + " keyword=\"Transformations and transformation configurations\"/>";
private final String ENTRY_OLD_FILTER_DISABLED = "<entry filter=\"plugin=org.eclipse.ua.invalid\" "
- + " keyword=\"Transformations and transformation configurations\"/>";
+ + " keyword=\"Transformations and transformation configurations\"/>";
private final String ENTRY_OLD_FILTER_IN__NEGATED = "<entry filter=\"plugin!=org.eclipse.ua.tests\" "
- + " keyword=\"Transformations and transformation configurations\"/>";
+ + " keyword=\"Transformations and transformation configurations\"/>";
private final String ENTRY_OLD_FILTER_OUT_NEGATED = "<entry filter=\"plugin!=org.eclipse.ua.invalid\" "
- + " keyword=\"Transformations and transformation configurations\"/>";
+ + " keyword=\"Transformations and transformation configurations\"/>";
private final String ENTRY_WITH_CHILD = ENTRY_HEAD_ECLIPSE + ENTRY_BUGZILLA + ENTRY_END;
private final String ENTRY_WITH_TOPIC = ENTRY_HEAD_ECLIPSE + TOPIC_BUGZILLA + ENTRY_END;
private final String ENTRY_WITH_SEE = ENTRY_HEAD_ECLIPSE + SEE_ALSO_SDK + ENTRY_END;
@@ -82,7 +82,7 @@ public class IndexEntryTest {
IndexEntry element;
Document doc;
try {
- doc = DocumentCreator.createDocument(elementSource);
+ doc = DocumentCreator.createDocument(elementSource);
} catch (Exception e) {
fail("Caught Exception");
doc = null;
@@ -315,15 +315,15 @@ public class IndexEntryTest {
assertEquals(2, subentries.length);
assertEquals(1, sees.length);
assertEquals(3,topics.length);
- assertEquals("jdt", subentries[0].getKeyword());
- assertEquals("compiler", subentries[1].getKeyword());
- assertEquals("label1", topics[0].getLabel());
- assertEquals("label2", topics[1].getLabel());
- assertEquals("label3", topics[2].getLabel());
- assertEquals("href1", topics[0].getHref());
- assertEquals("href2", topics[1].getHref());
- assertEquals("href3", topics[2].getHref());
- assertEquals("beans", sees[0].getKeyword());
+ assertEquals("jdt", subentries[0].getKeyword());
+ assertEquals("compiler", subentries[1].getKeyword());
+ assertEquals("label1", topics[0].getLabel());
+ assertEquals("label2", topics[1].getLabel());
+ assertEquals("label3", topics[2].getLabel());
+ assertEquals("href1", topics[0].getHref());
+ assertEquals("href2", topics[1].getHref());
+ assertEquals("href3", topics[2].getHref());
+ assertEquals("beans", sees[0].getKeyword());
}
private void checkEntryChildEnablement(IIndexEntry2 entry) {
@@ -333,12 +333,12 @@ public class IndexEntryTest {
assertEquals(2, subentries.length);
assertEquals(1, sees.length);
assertEquals(3,topics.length);
- assertTrue(subentries[0].isEnabled(HelpEvaluationContext.getContext()));
- assertFalse(subentries[1].isEnabled(HelpEvaluationContext.getContext()));
- assertTrue(topics[0].isEnabled(HelpEvaluationContext.getContext()));
- assertFalse(topics[1].isEnabled(HelpEvaluationContext.getContext()));
- assertTrue(topics[2].isEnabled(HelpEvaluationContext.getContext()));
- assertTrue(sees[0].isEnabled(HelpEvaluationContext.getContext()));
+ assertTrue(subentries[0].isEnabled(HelpEvaluationContext.getContext()));
+ assertFalse(subentries[1].isEnabled(HelpEvaluationContext.getContext()));
+ assertTrue(topics[0].isEnabled(HelpEvaluationContext.getContext()));
+ assertFalse(topics[1].isEnabled(HelpEvaluationContext.getContext()));
+ assertTrue(topics[2].isEnabled(HelpEvaluationContext.getContext()));
+ assertTrue(sees[0].isEnabled(HelpEvaluationContext.getContext()));
}
private UserIndexEntry createUserEntry() {
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 1c42fbf0d..9b9043dfb 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
@@ -36,7 +36,7 @@ public class IndexSeeTest {
private static final String ECLIPSE = "eclipse";
private static final String SDK = "sdk";
private static final String VIEWS = "views";
- private static final String SEE_END = "</see>";
+ private static final String SEE_END = "</see>";
private static final String SEE_HEAD_ECLIPSE = "<see keyword=\"eclipse\">";
private static final String SEE_ECLIPSE = "<see keyword=\"eclipse\"/>";
private static final String SEE_SDK = "<see keyword=\"sdk\"/>";
@@ -44,11 +44,11 @@ public class IndexSeeTest {
private static final String SUBPATH_VIEWS = "<subpath keyword=\"views\">";
private static final String SUBPATH_END = "</subpath>";
private static final String SEE_ECLIPSE_SDK = SEE_HEAD_ECLIPSE +
- SUBPATH_SDK + SUBPATH_END + SEE_END;
+ SUBPATH_SDK + SUBPATH_END + SEE_END;
private static final String SEE_ECLIPSE_VIEWS = SEE_HEAD_ECLIPSE +
- SUBPATH_SDK + SUBPATH_END + SUBPATH_VIEWS + SUBPATH_END + SEE_END;
+ SUBPATH_SDK + SUBPATH_END + SUBPATH_VIEWS + SUBPATH_END + SEE_END;
private static final String SEE_ECLIPSE_SDK_VIEWS = SEE_HEAD_ECLIPSE +
- SUBPATH_SDK + SUBPATH_END + SUBPATH_VIEWS + SUBPATH_END + SEE_END;
+ SUBPATH_SDK + SUBPATH_END + SUBPATH_VIEWS + SUBPATH_END + SEE_END;
@Before
public void setUp() throws Exception {
@@ -59,7 +59,7 @@ public class IndexSeeTest {
IndexSee element;
Document doc;
try {
- doc = DocumentCreator.createDocument(elementSource);
+ doc = DocumentCreator.createDocument(elementSource);
} catch (Exception e) {
fail("Caught Exception");
doc = null;
@@ -73,7 +73,7 @@ public class IndexSeeTest {
Document doc;
String elementSource = "<see keyword=\"" + keyword + "\" />";
try {
- doc = DocumentCreator.createDocument(elementSource);
+ doc = DocumentCreator.createDocument(elementSource);
} catch (Exception e) {
fail("Caught Exception");
doc = null;
@@ -96,11 +96,11 @@ public class IndexSeeTest {
see1 = createSee(SEE_ECLIPSE);
IndexSee see2 = new IndexSee(see1);
assertEquals(ECLIPSE, see1.getKeyword());
- assertEquals(0, see1.getSubpathElements().length);
+ assertEquals(0, see1.getSubpathElements().length);
assertEquals(ECLIPSE, see1.getKeyword());
assertEquals(ECLIPSE, see2.getKeyword());
- assertEquals(0, see2.getSubpathElements().length);
+ assertEquals(0, see2.getSubpathElements().length);
assertEquals(ECLIPSE, see2.getKeyword());
}
@@ -231,30 +231,30 @@ public class IndexSeeTest {
@Test
public void testUserSee() {
- UserIndexSee u1;
- u1 = createUserSee();
- IndexSee see = new IndexSee(u1);
- checkCreatedSee(see);
+ UserIndexSee u1;
+ u1 = createUserSee();
+ IndexSee see = new IndexSee(u1);
+ checkCreatedSee(see);
}
@Test
public void testCopyUserSee() {
- UserIndexSee u1;
- u1 = createUserSee();
- IndexSee see = new IndexSee(u1);
- IndexSee see2 = new IndexSee(see);
- checkCreatedSee(see);
- checkCreatedSee(see2);
+ UserIndexSee u1;
+ u1 = createUserSee();
+ IndexSee see = new IndexSee(u1);
+ IndexSee see2 = new IndexSee(see);
+ checkCreatedSee(see);
+ checkCreatedSee(see2);
}
@Test
public void testCreateTwiceUserSee() {
- UserIndexSee u1;
- u1 = createUserSee();
- IndexSee see = new IndexSee(u1);
- IndexSee see2 = new IndexSee(u1);
- checkCreatedSee(see);
- checkCreatedSee(see2);
+ UserIndexSee u1;
+ u1 = createUserSee();
+ IndexSee see = new IndexSee(u1);
+ IndexSee see2 = new IndexSee(u1);
+ checkCreatedSee(see);
+ checkCreatedSee(see2);
}
@Test
@@ -299,19 +299,19 @@ public class IndexSeeTest {
private UserIndexSee createUserSee() {
UserIndexSee u1;
u1 = new UserIndexSee("eclipse", false);
- UserIndexSubpath u2 = new UserIndexSubpath("platform");
- UserIndexSubpath u3 = new UserIndexSubpath("ui");
- u1.addSubpath(u2);
- u1.addSubpath(u3);
+ UserIndexSubpath u2 = new UserIndexSubpath("platform");
+ UserIndexSubpath u3 = new UserIndexSubpath("ui");
+ u1.addSubpath(u2);
+ u1.addSubpath(u3);
return u1;
}
private void checkCreatedSee(IndexSee see) {
assertEquals("eclipse", see.getKeyword());
- IIndexSubpath[] subpath = see.getSubpathElements();
- assertEquals(2, subpath.length);
- assertEquals("platform", subpath[0].getKeyword());
- assertEquals("ui", subpath[1].getKeyword());
+ IIndexSubpath[] subpath = see.getSubpathElements();
+ assertEquals(2, subpath.length);
+ assertEquals("platform", subpath[0].getKeyword());
+ assertEquals("ui", subpath[1].getKeyword());
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/TocObjectTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/TocObjectTest.java
index 1eb73186a..c8f1ad608 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/TocObjectTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/TocObjectTest.java
@@ -34,9 +34,9 @@ public class TocObjectTest {
@Test
public void testLookupUnanchoredHref() {
- UserToc utoc = new UserToc(TITLE_1, null, true);
- UserTopic utopic = new UserTopic(TOPIC_LABEL_1, PATH, true);
- utoc.addTopic(utopic);
+ UserToc utoc = new UserToc(TITLE_1, null, true);
+ UserTopic utopic = new UserTopic(TOPIC_LABEL_1, PATH, true);
+ utoc.addTopic(utopic);
Toc toc = new Toc(utoc);
ITopic topic = toc.getTopic(PATH);
assertNotNull(topic);
@@ -45,9 +45,9 @@ public class TocObjectTest {
@Test
public void testLookupAnchoredHrefByAnchor() {
- UserToc utoc = new UserToc(TITLE_1, null, true);
- UserTopic utopic = new UserTopic(TOPIC_LABEL_1, PATH + ANCHOR1, true);
- utoc.addTopic(utopic);
+ UserToc utoc = new UserToc(TITLE_1, null, true);
+ UserTopic utopic = new UserTopic(TOPIC_LABEL_1, PATH + ANCHOR1, true);
+ utoc.addTopic(utopic);
Toc toc = new Toc(utoc);
ITopic topic = toc.getTopic(PATH + ANCHOR1);
assertNotNull(topic);
@@ -56,9 +56,9 @@ public class TocObjectTest {
@Test
public void testLookupAnchoredHref() {
- UserToc utoc = new UserToc(TITLE_1, null, true);
- UserTopic utopic = new UserTopic(TOPIC_LABEL_1, PATH + ANCHOR1, true);
- utoc.addTopic(utopic);
+ UserToc utoc = new UserToc(TITLE_1, null, true);
+ UserTopic utopic = new UserTopic(TOPIC_LABEL_1, PATH + ANCHOR1, true);
+ utoc.addTopic(utopic);
Toc toc = new Toc(utoc);
ITopic topic = toc.getTopic(PATH);
assertNotNull(topic);
@@ -67,13 +67,13 @@ public class TocObjectTest {
@Test
public void testUnanchoredFoundFirst() {
- UserToc utoc = new UserToc(TITLE_1, null, true);
- UserTopic utopic = new UserTopic(TOPIC_LABEL_1, PATH + ANCHOR1, true);
- utoc.addTopic(utopic);
- utopic = new UserTopic(TOPIC_LABEL_2, PATH, true);
- utoc.addTopic(utopic);
- utopic = new UserTopic(TOPIC_LABEL_3, PATH + ANCHOR2, true);
- utoc.addTopic(utopic);
+ UserToc utoc = new UserToc(TITLE_1, null, true);
+ UserTopic utopic = new UserTopic(TOPIC_LABEL_1, PATH + ANCHOR1, true);
+ utoc.addTopic(utopic);
+ utopic = new UserTopic(TOPIC_LABEL_2, PATH, true);
+ utoc.addTopic(utopic);
+ utopic = new UserTopic(TOPIC_LABEL_3, PATH + ANCHOR2, true);
+ utoc.addTopic(utopic);
Toc toc = new Toc(utoc);
ITopic topic = toc.getTopic(PATH);
assertNotNull(topic);
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 a342c84b1..d9def5aea 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
@@ -39,7 +39,7 @@ public class TopicTest {
private static final String INVALID_INSTALLED = "<with variable=\"platform\">" +
"<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.invalid\"/></with>";
private static final String CS_INSTALLED = "<with variable=\"platform\">" +
- "<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.cheatsheets\"/></with>";
+ "<test property=\"org.eclipse.core.runtime.isBundleInstalled\" args=\"org.eclipse.ui.cheatsheets\"/></with>";
private static final String ENABLEMENT_CHEATSHEETS = "<enablement>" + CS_INSTALLED + "</enablement>";
private static final String ENABLEMENT_INVALID = "<enablement>" + INVALID_INSTALLED + "</enablement>";
private static final String FILTER_IN = "<filter name = \"plugin\" value = \"org.eclipse.ua.tests\"/>";
@@ -57,13 +57,13 @@ public class TopicTest {
private final String TOPIC_FILTER_OUT = TOPIC_HEAD_ECLIPSE + FILTER_OUT + TOPIC_END;
private final String TOPIC_FILTER_MIXED = TOPIC_HEAD_ECLIPSE + FILTER_IN + FILTER_OUT + TOPIC_END;
private final String TOPIC_OLD_FILTER = "<topic filter=\"plugin=org.eclipse.ua.tests\" href=\"www.eclipse.org\""
- + " label=\"Transformations and transformation configurations\"/>";
+ + " label=\"Transformations and transformation configurations\"/>";
private final String TOPIC_OLD_FILTER_DISABLED = "<topic filter=\"plugin=org.eclipse.ua.invalid\" href=\"www.eclipse.org\""
- + " label=\"Transformations and transformation configurations\"/>";
+ + " label=\"Transformations and transformation configurations\"/>";
private final String TOPIC_OLD_FILTER_IN__NEGATED = "<topic filter=\"plugin!=org.eclipse.ua.tests\" href=\"www.eclipse.org\""
- + " label=\"Transformations and transformation configurations\"/>";
+ + " label=\"Transformations and transformation configurations\"/>";
private final String TOPIC_OLD_FILTER_OUT_NEGATED = "<topic filter=\"plugin!=org.eclipse.ua.invalid\" href=\"www.eclipse.org\""
- + " label=\"Transformations and transformation configurations\"/>";
+ + " label=\"Transformations and transformation configurations\"/>";
private final String TOPIC_WITH_CHILD = TOPIC_HEAD_ECLIPSE + TOPIC_BUGZILLA + TOPIC_END;
private int mode;
@@ -84,7 +84,7 @@ public class TopicTest {
Topic topic;
Document doc;
try {
- doc = DocumentCreator.createDocument(topicSource);
+ doc = DocumentCreator.createDocument(topicSource);
} catch (Exception e) {
fail("Caught Exception");
doc = null;
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UAElementTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UAElementTest.java
index e4b5f37a1..e6e50e689 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UAElementTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/UAElementTest.java
@@ -43,11 +43,11 @@ public class UAElementTest {
Object topicChildren = element.getChildren(Topic.class);
assertTrue(topicChildren instanceof Topic[]);
assertTrue(((Topic[])topicChildren).length == 0);
- assertNull(element.getParentElement());
- assertNull(element.getAttribute("a1"));
- assertTrue(element.equals(element));
- assertFalse(element.equals(null));
- assertFalse(element.equals("A string"));
+ assertNull(element.getParentElement());
+ assertNull(element.getAttribute("a1"));
+ assertTrue(element.equals(element));
+ assertFalse(element.equals(null));
+ assertFalse(element.equals("A string"));
}
@Test
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 285cab30a..6cfbb85d6 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
@@ -58,7 +58,7 @@ public class UserCriterionDefinition implements ICriterionDefinition {
@Override
public IUAElement[] getChildren() {
- return getCriterionValueDefinitions();
+ return getCriterionValueDefinitions();
}
@Override
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 7d42135bf..dd4af58c7 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
@@ -45,7 +45,7 @@ public class UserCriterionValueDefinition implements ICriterionValueDefinition {
@Override
public IUAElement[] getChildren() {
- return new IUAElement[0];
+ return new IUAElement[0];
}
}
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 fe3026e48..50381f6a4 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
@@ -51,7 +51,7 @@ public class HelpServerTest extends PerformanceTestCase {
for (int i=0; i < 100; ++i) {
boolean warmup = i < 2;
if (!warmup) {
- startMeasuring();
+ startMeasuring();
}
for (int j = 0; j <= 100; j++) {
@@ -59,8 +59,8 @@ public class HelpServerTest extends PerformanceTestCase {
}
if (!warmup) {
- stopMeasuring();
- }
+ stopMeasuring();
+ }
}
commitMeasurements();
@@ -75,14 +75,14 @@ public class HelpServerTest extends PerformanceTestCase {
boolean warmup = i < 2;
LoadServletUtil.stopServer();
if (!warmup) {
- startMeasuring();
+ startMeasuring();
}
LoadServletUtil.startServer();
if (!warmup) {
- stopMeasuring();
- }
+ stopMeasuring();
+ }
}
commitMeasurements();
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 1091be281..588c9fadc 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
@@ -55,14 +55,14 @@ public class IndexAssemblePerformanceTest extends PerformanceTestCase {
for (int i=0; i < 10; ++i) {
boolean warmup = i == 0;
if (!warmup) {
- startMeasuring();
+ startMeasuring();
}
assembleIndex();
if (!warmup) {
- stopMeasuring();
- }
+ stopMeasuring();
+ }
}
commitMeasurements();
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 8b990160a..7b956f5a1 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
@@ -51,7 +51,7 @@ public class LowIterationHelpServerTest extends PerformanceTestCase {
for (int i=0; i < 15; ++i) {
boolean warmup = i < 2;
if (!warmup) {
- startMeasuring();
+ startMeasuring();
}
for (int j = 0; j <= 20; j++) {
@@ -59,8 +59,8 @@ public class LowIterationHelpServerTest extends PerformanceTestCase {
}
if (!warmup) {
- stopMeasuring();
- }
+ stopMeasuring();
+ }
}
commitMeasurements();
@@ -75,14 +75,14 @@ public class LowIterationHelpServerTest extends PerformanceTestCase {
boolean warmup = i < 2;
LoadServletUtil.stopServer();
if (!warmup) {
- startMeasuring();
+ startMeasuring();
}
LoadServletUtil.startServer();
if (!warmup) {
- stopMeasuring();
- }
+ stopMeasuring();
+ }
}
commitMeasurements();
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 4c9549b11..e3efd43d0 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
@@ -85,14 +85,14 @@ public class TocAssemblePerformanceTest extends PerformanceTestCase {
for (int i=0; i < 100; ++i) {
boolean warmup = i < 2;
if (!warmup) {
- startMeasuring();
+ startMeasuring();
}
for (int j = 0; j < 20; j++) {
- assembleToc();
+ assembleToc();
}
if (!warmup) {
- stopMeasuring();
- }
+ stopMeasuring();
+ }
}
commitMeasurements();
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 69ccb706c..1fd25a4f1 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
@@ -52,11 +52,11 @@ public class HelpDataTest {
@Before
public void setUp() throws Exception {
baseTocsPreference = Platform.getPreferencesService().getString
- (HelpPlugin.PLUGIN_ID, HelpPlugin.BASE_TOCS_KEY, "", null);
+ (HelpPlugin.PLUGIN_ID, HelpPlugin.BASE_TOCS_KEY, "", null);
ignoredTocsPreference = Platform.getPreferencesService().getString
- (HelpPlugin.PLUGIN_ID, HelpPlugin.IGNORED_TOCS_KEY, "", null);
+ (HelpPlugin.PLUGIN_ID, HelpPlugin.IGNORED_TOCS_KEY, "", null);
ignoredIndexesPreference = Platform.getPreferencesService().getString
- (HelpPlugin.PLUGIN_ID, HelpPlugin.IGNORED_INDEXES_KEY, "", null);
+ (HelpPlugin.PLUGIN_ID, HelpPlugin.IGNORED_INDEXES_KEY, "", null);
setBaseTocs("");
setIgnoredTocs("");
setIgnoredIndexes("");
@@ -70,18 +70,18 @@ public class HelpDataTest {
}
private void setBaseTocs(String value) {
- IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpPlugin.PLUGIN_ID);
- pref.put(HelpPlugin.BASE_TOCS_KEY, value);
+ IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpPlugin.PLUGIN_ID);
+ pref.put(HelpPlugin.BASE_TOCS_KEY, value);
}
private void setIgnoredTocs(String value) {
- IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpPlugin.PLUGIN_ID);
- pref.put(HelpPlugin.IGNORED_TOCS_KEY, value);
+ IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpPlugin.PLUGIN_ID);
+ pref.put(HelpPlugin.IGNORED_TOCS_KEY, value);
}
private void setIgnoredIndexes(String value) {
- IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpPlugin.PLUGIN_ID);
- pref.put(HelpPlugin.IGNORED_INDEXES_KEY, value);
+ IEclipsePreferences pref = InstanceScope.INSTANCE.getNode(HelpPlugin.PLUGIN_ID);
+ pref.put(HelpPlugin.IGNORED_INDEXES_KEY, value);
}
@Test
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 ca97940fb..bb27b932b 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
@@ -45,7 +45,7 @@ public class ContentServletTest {
final String path = "/data/help/index/topic1.html";
String remoteContent = RemoteTestUtils.getRemoteContent(UA_TESTS, path, "en");
String localContent = RemoteTestUtils.getLocalContent(UA_TESTS, path);
- assertEquals(remoteContent, localContent);
+ assertEquals(remoteContent, localContent);
}
@Test
@@ -53,7 +53,7 @@ public class ContentServletTest {
final String path = "/data/help/manual/filter.xhtml";
String remoteContent = RemoteTestUtils.getRemoteContent(UA_TESTS, path, "en");
String localContent = RemoteTestUtils.getLocalContent(UA_TESTS, path);
- assertEquals(remoteContent, localContent);
+ assertEquals(remoteContent, localContent);
}
@Test
@@ -61,7 +61,7 @@ public class ContentServletTest {
final String path = "/data/help/search/testnl1.xhtml";
String remoteContent = RemoteTestUtils.getRemoteContent(UA_TESTS, path, "en");
String localContent = RemoteTestUtils.getLocalContent(UA_TESTS, path);
- assertEquals(remoteContent, localContent);
+ assertEquals(remoteContent, localContent);
}
@Test
@@ -70,8 +70,8 @@ public class ContentServletTest {
String remoteContent = RemoteTestUtils.getRemoteContent(UA_TESTS, path, "de");
String enLocalContent = RemoteTestUtils.getLocalContent(UA_TESTS, path);
String deLocalContent = RemoteTestUtils.getLocalContent(UA_TESTS, "/nl/de" + path);
- assertEquals(remoteContent, deLocalContent);
- assertFalse(remoteContent.equals(enLocalContent));
+ assertEquals(remoteContent, deLocalContent);
+ assertFalse(remoteContent.equals(enLocalContent));
}
@Test(expected = IOException.class)
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 753030a36..327793835 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
@@ -67,7 +67,7 @@ public class ContextServletTest {
@Test
public void testRemoteContextFoundDe() throws Exception {
Element[] topics = getContextsUsingLocale
- ("org.eclipse.ua.tests.test_cheatsheets", "de");
+ ("org.eclipse.ua.tests.test_cheatsheets", "de");
assertEquals(1, topics.length);
assertEquals("German Context", topics[0].getAttribute("label"));
}
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 c945dccd3..5fcf061dc 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
@@ -37,8 +37,8 @@ public class GetContentUsingRemoteHelp {
@Before
public void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
- mode = BaseHelpSystem.getMode();
- RemotePreferenceStore.savePreferences();
+ mode = BaseHelpSystem.getMode();
+ RemotePreferenceStore.savePreferences();
RemotePreferenceStore.setMockRemoteServer();
RemotePreferenceStore.disableErrorPage();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
@@ -63,8 +63,8 @@ public class GetContentUsingRemoteHelp {
@Test
public void testContentFound() throws Exception {
- final String path = "/data/help/index/topic1.html";
- String remoteContent = getHelpContent("mock.toc", path, "en");
+ final String path = "/data/help/index/topic1.html";
+ String remoteContent = getHelpContent("mock.toc", path, "en");
int port = TestServerManager.getPort(0);
String expectedContent = RemoteTestUtils.createMockContent("mock.toc", path, "en", port);
assertEquals(expectedContent, remoteContent);
@@ -72,8 +72,8 @@ public class GetContentUsingRemoteHelp {
@Test
public void testContentFoundDe() throws Exception {
- final String path = "/data/help/index/topic2.html";
- String remoteContent = getHelpContent("mock.toc", path, "de");
+ final String path = "/data/help/index/topic2.html";
+ String remoteContent = getHelpContent("mock.toc", path, "de");
int port = TestServerManager.getPort(0);
String expectedContent = RemoteTestUtils.createMockContent("mock.toc", path, "de", port);
assertEquals(expectedContent, remoteContent);
@@ -81,8 +81,8 @@ public class GetContentUsingRemoteHelp {
@Test
public void testLocalBeatsRemote() throws Exception {
- final String path = "/doc/help_home.html";
- String plugin = "org.eclipse.help.base";
+ final String path = "/doc/help_home.html";
+ String plugin = "org.eclipse.help.base";
String helpContent = getHelpContent(plugin, path, "en");
String localContent = RemoteTestUtils.getLocalContent(plugin, path);
assertEquals(localContent, helpContent);
@@ -93,8 +93,8 @@ public class GetContentUsingRemoteHelp {
RemotePreferenceStore.setMockRemotePriority();
HelpPlugin.getTocManager().clearCache();
HelpPlugin.getTocManager().getTocs("en");
- final String path = "/doc/help_home.html";
- String plugin = "org.eclipse.help.base";
+ final String path = "/doc/help_home.html";
+ String plugin = "org.eclipse.help.base";
String helpContent = getHelpContent(plugin, path, "en");
int port = TestServerManager.getPort(0);
@@ -109,20 +109,20 @@ public class GetContentUsingRemoteHelp {
HelpPlugin.getTocManager().clearCache();
HelpPlugin.getTocManager().getTocs("en");
//Verify help coming from first one
- final String path = "/doc/help_home.html";
- String plugin = "org.eclipse.help.base";
- String helpContent = GetContentUsingRemoteHelp.getHelpContent(plugin, path, "en");
+ final String path = "/doc/help_home.html";
+ String plugin = "org.eclipse.help.base";
+ String helpContent = GetContentUsingRemoteHelp.getHelpContent(plugin, path, "en");
- //Get remote content from first one in prefs
+ //Get remote content from first one in prefs
- int port0 = TestServerManager.getPort(0);
- String remoteContent0 = RemoteTestUtils.createMockContent(plugin, path, "en", port0);
+ int port0 = TestServerManager.getPort(0);
+ String remoteContent0 = RemoteTestUtils.createMockContent(plugin, path, "en", port0);
- int port1 = TestServerManager.getPort(1);
- String remoteContent1 = RemoteTestUtils.createMockContent(plugin, path, "en", port1);
+ int port1 = TestServerManager.getPort(1);
+ String remoteContent1 = RemoteTestUtils.createMockContent(plugin, path, "en", port1);
- assertEquals(remoteContent0, helpContent);
- assertFalse(remoteContent1.equals(helpContent));
+ assertEquals(remoteContent0, helpContent);
+ assertFalse(remoteContent1.equals(helpContent));
}
@@ -133,21 +133,21 @@ public class GetContentUsingRemoteHelp {
HelpPlugin.getTocManager().clearCache();
HelpPlugin.getTocManager().getTocs("en");
//Verify help coming from first one
- final String path = "/doc/help_home.html";
- String plugin = "org.eclipse.help.base";
- String helpContent = GetContentUsingRemoteHelp.getHelpContent(plugin, path, "en");
+ final String path = "/doc/help_home.html";
+ String plugin = "org.eclipse.help.base";
+ String helpContent = GetContentUsingRemoteHelp.getHelpContent(plugin, path, "en");
- //Get remote content from second in prefs
+ //Get remote content from second in prefs
- int port0 = TestServerManager.getPort(0);
- String remoteContent0 = RemoteTestUtils.createMockContent(plugin, path, "en", port0);
+ int port0 = TestServerManager.getPort(0);
+ String remoteContent0 = RemoteTestUtils.createMockContent(plugin, path, "en", port0);
- int port1 = TestServerManager.getPort(1);
- String remoteContent1 = RemoteTestUtils.createMockContent(plugin, path, "en", port1);
+ int port1 = TestServerManager.getPort(1);
+ String remoteContent1 = RemoteTestUtils.createMockContent(plugin, path, "en", port1);
- assertEquals(remoteContent1, helpContent);
- assertFalse(remoteContent0.equals(helpContent));
+ assertEquals(remoteContent1, helpContent);
+ assertFalse(remoteContent0.equals(helpContent));
}
@@ -157,7 +157,7 @@ public class GetContentUsingRemoteHelp {
HelpPlugin.getTocManager().clearCache();
HelpPlugin.getTocManager().getTocs("en");
final String path = "/data/help/nonlocal.html";
- String plugin = "org.eclipse.help.base";
+ String plugin = "org.eclipse.help.base";
String remoteContent = getHelpContent(plugin, path, "en");
int port = TestServerManager.getPort(0);
String expectedContent = RemoteTestUtils.createMockContent(plugin, path, "en", port);
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 b0818d852..a4c7b1a77 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
@@ -33,8 +33,8 @@ public class GetContextUsingRemoteHelp {
@Before
public void setUp() throws Exception {
- RemotePreferenceStore.savePreferences();
- mode = BaseHelpSystem.getMode();
+ RemotePreferenceStore.savePreferences();
+ mode = BaseHelpSystem.getMode();
RemotePreferenceStore.setMockRemoteServer();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
@@ -57,7 +57,7 @@ public class GetContextUsingRemoteHelp {
assertEquals("context_one_en", title);
RemotePreferenceStore.disableRemoteHelp();
context = HelpPlugin.getContextManager().getContext("org.eclipse.ua.tests.test_one", "en");
- assertNull(context);
+ assertNull(context);
}
@Test
@@ -79,7 +79,7 @@ public class GetContextUsingRemoteHelp {
@Test
public void testContextNotFound() throws Exception {
IContext context = HelpPlugin.getContextManager().getContext("org.eclipse.ua.tests.no_such_ctx", "en");
- assertNull(context);
+ assertNull(context);
}
}
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 a4f2780c1..70fa9941b 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
@@ -56,70 +56,70 @@ public class IndexServletTest {
public void testIndexServletContainsSimpleWord() throws Exception {
Node root = getIndexContributions("en");
Element[] UARoot = findEntryInAllContributions(root, "xyz");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
public void testIndexServletContainsWordWithAccent() throws Exception {
Node root = getIndexContributions("en");
Element[] UARoot = findEntryInAllContributions(root, "\u00E1mbito");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
public void testIndexServletContainsWordWithGt() throws Exception {
Node root = getIndexContributions("en");
Element[] UARoot = findEntryInAllContributions(root, "character >");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
public void testIndexServletContainsWordWithLt() throws Exception {
Node root = getIndexContributions("en");
Element[] UARoot = findEntryInAllContributions(root, "character <");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
public void testIndexServletContainsWordWithAmp() throws Exception {
Node root = getIndexContributions("en");
Element[] UARoot = findEntryInAllContributions(root, "character &");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
public void testIndexServletContainsWordWithQuot() throws Exception {
Node root = getIndexContributions("en");
Element[] UARoot = findEntryInAllContributions(root, "character \"");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
public void testIndexServletContainsWordWithApostrophe() throws Exception {
Node root = getIndexContributions("en");
Element[] UARoot = findEntryInAllContributions(root, "character '");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
public void testDeWordNotInEnIndex() throws Exception {
Node root = getIndexContributions("en");
Element[] UARoot = findEntryInAllContributions(root, "munich");
- assertEquals(0, UARoot.length);
+ assertEquals(0, UARoot.length);
}
@Test
public void testWordInDeIndex() throws Exception {
Node root = getIndexContributions("de");
Element[] UARoot = findEntryInAllContributions(root, "munich");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
public void testWordNotInDeIndex() throws Exception {
Node root = getIndexContributions("de");
Element[] UARoot = findEntryInAllContributions(root, "xyz");
- assertEquals(0, UARoot.length);
+ assertEquals(0, UARoot.length);
}
private Element[] findEntryInAllContributions(Node parent, String keyword) {
@@ -131,7 +131,7 @@ public class IndexServletTest {
Element nextElement = (Element)next;
if ("indexContribution".equals(nextElement.getTagName())) {
findEntryInIndexContribution(nextElement, keyword, results);
- }
+ }
}
}
return results.toArray(new Element[results.size()]);
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 7297180db..56d18699a 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
@@ -33,8 +33,8 @@ public class LoadIndexUsingRemoteHelp {
@Before
public void setUp() throws Exception {
- RemotePreferenceStore.savePreferences();
- mode = BaseHelpSystem.getMode();
+ RemotePreferenceStore.savePreferences();
+ mode = BaseHelpSystem.getMode();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
}
@@ -71,7 +71,7 @@ public class LoadIndexUsingRemoteHelp {
HelpPlugin.getIndexManager().clearCache();
index = HelpPlugin.getIndexManager().getIndex(locale);
// Entry 1 has the same child on each remote server, Entry 2 has different children
- entry1 = matchingEntries(index, "entry1_" + locale);
+ entry1 = matchingEntries(index, "entry1_" + locale);
entry2 = matchingEntries(index, "entry2_" + locale);
assertEquals(1, entry1.length);
assertEquals(1, entry1[0].getTopics().length);
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 6219a48fb..9ea8d9c27 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
@@ -29,8 +29,8 @@ public class LoadTocUsingRemoteHelp {
@Before
public void setUp() throws Exception {
- RemotePreferenceStore.savePreferences();
- mode = BaseHelpSystem.getMode();
+ RemotePreferenceStore.savePreferences();
+ mode = BaseHelpSystem.getMode();
}
@After
@@ -53,7 +53,7 @@ public class LoadTocUsingRemoteHelp {
assertEquals(0, deTocs);
deTocs = matchingTocs(tocs, "Mock Toc 2 de");
assertEquals(0, deTocs);
- RemotePreferenceStore.disableRemoteHelp();
+ RemotePreferenceStore.disableRemoteHelp();
}
@Test
@@ -70,7 +70,7 @@ public class LoadTocUsingRemoteHelp {
assertEquals(1, deTocs);
deTocs = matchingTocs(tocs, "Mock Toc 2 de");
assertEquals(1, deTocs);
- RemotePreferenceStore.disableRemoteHelp();
+ RemotePreferenceStore.disableRemoteHelp();
}
@Test
@@ -83,7 +83,7 @@ public class LoadTocUsingRemoteHelp {
assertEquals(1, enTocs);
int deTocs = matchingTocs(tocs, "Mock Toc de");
assertEquals(0, deTocs);
- RemotePreferenceStore.disableRemoteHelp();
+ RemotePreferenceStore.disableRemoteHelp();
}
/*
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 8f334e8d3..6a5564cf3 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
@@ -46,8 +46,8 @@ public class MockContentServlet extends HttpServlet {
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
} else {
int port = req.getLocalPort();
- String response = RemoteTestUtils.createMockContent(plugin, file, locale, port);
- resp.getWriter().write(response);
+ String response = RemoteTestUtils.createMockContent(plugin, file, locale, port);
+ resp.getWriter().write(response);
}
callcount++;
}
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 f2f9393ff..260243d56 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
@@ -46,8 +46,8 @@ public class MockSearchServlet extends HttpServlet {
0, null, null, null, false);
results.add(hit);
}
- String response = SearchServlet.serialize(results);
- resp.getWriter().write(response);
+ String response = SearchServlet.serialize(results);
+ resp.getWriter().write(response);
}
private boolean isSearchHit(String phrase, String locale) {
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 5df3acbcf..110d75200 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
@@ -46,10 +46,10 @@ public class MockTocServlet extends TocServlet {
UserTopic topic2 = new UserTopic("Topic_" + locale, "http://www.eclipse.org", true);
toc2.addTopic(topic2);
TocContribution contribution2 = createToc(toc2, "mock.toc", locale);
- String response;
+ String response;
try {
response = serialize(new TocContribution[] { contribution1, contribution2 }, locale);
- resp.getWriter().write(response);
+ resp.getWriter().write(response);
} catch (TransformerException e) {
resp.sendError(400);
}
@@ -62,10 +62,10 @@ public class MockTocServlet extends TocServlet {
contribution.setContributorId(id);
contribution.setExtraDocuments(new String[0]);
contribution.setLocale(locale);
- contribution.setPrimary(true);
- contribution.setSubToc(false);
+ contribution.setPrimary(true);
+ contribution.setSubToc(false);
contribution.setId(id);
- contribution.setToc(new Toc(toc));
+ contribution.setToc(new Toc(toc));
return contribution;
}
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 a304a373f..9e927d168 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
@@ -89,24 +89,24 @@ public class ParallelSearchServletTest {
@Test
public void testNotFoundInParallel() {
ParallelTestSupport.testInParallel(new SearchServletTester[]
- { new SearchServletTester("duernfryehd", 0),
- new SearchServletTester("duernfryehd", 0)}, 100);
+ { new SearchServletTester("duernfryehd", 0),
+ new SearchServletTester("duernfryehd", 0)}, 100);
}
@Test
public void testFoundInParallel() {
ParallelTestSupport.testInParallel(new SearchServletTester[]
- { new SearchServletTester("jehcyqpfjs", 1),
- new SearchServletTester("jehcyqpfjs", 1)}, 100);
+ { new SearchServletTester("jehcyqpfjs", 1),
+ new SearchServletTester("jehcyqpfjs", 1)}, 100);
}
@Test
public void testMixedParallelSearches() {
ParallelTestSupport.testInParallel(new SearchServletTester[]
- { new SearchServletTester("jehcyqpfjs", 1),
+ { new SearchServletTester("jehcyqpfjs", 1),
new SearchServletTester("duernfryehd", 0),
- new SearchServletTester("jehcyqpfjs", 1),
- new SearchServletTester("duernfryehd", 0)}, 100);
+ new SearchServletTester("jehcyqpfjs", 1),
+ new SearchServletTester("duernfryehd", 0)}, 100);
}
private Node[] getSearchHitsFromServlet(String phrase)
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 19920e7eb..2450d316f 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
@@ -44,8 +44,8 @@ public class ParallelSearchUsingRemote {
@Before
public void setUp() throws Exception {
- RemotePreferenceStore.savePreferences();
- mode = BaseHelpSystem.getMode();
+ RemotePreferenceStore.savePreferences();
+ mode = BaseHelpSystem.getMode();
}
@After
@@ -59,7 +59,7 @@ public class ParallelSearchUsingRemote {
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
RemotePreferenceStore.setMockRemoteServer();
ParallelTestSupport.testSingleCase(new Searcher(), 100);
- RemotePreferenceStore.disableRemoteHelp();
+ RemotePreferenceStore.disableRemoteHelp();
}
@Test
@@ -71,7 +71,7 @@ public class ParallelSearchUsingRemote {
testCases[i] = new Searcher();
}
ParallelTestSupport.testInParallel(testCases, 100);
- RemotePreferenceStore.disableRemoteHelp();
+ RemotePreferenceStore.disableRemoteHelp();
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemotePreferenceStore.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemotePreferenceStore.java
index 5941a4bbb..dd6592147 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemotePreferenceStore.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemotePreferenceStore.java
@@ -34,36 +34,36 @@ public class RemotePreferenceStore {
private static String pageNotFound;
public static void savePreferences() throws Exception {
- namePreference = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_NAME,
- "", null);
- hostPreference = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_HOST,
- "", null);
+ namePreference = Platform.getPreferencesService().getString
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_NAME,
+ "", null);
+ hostPreference = Platform.getPreferencesService().getString
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_HOST,
+ "", null);
pathPreference = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PATH,
- "", null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PATH,
+ "", null);
protocolPreference = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PROTOCOL,
- "", null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PROTOCOL,
+ "", null);
portPreference = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PORT,
- "", null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PORT,
+ "", null);
icEnabledPreference = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ICEnabled,
- "", null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ICEnabled,
+ "", null);
defaultPort = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_DEFAULT_PORT,
- "", null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_DEFAULT_PORT,
+ "", null);
helpOn = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ON,
- "", null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_ON,
+ "", null);
remoteHelpPreferred = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PREFERRED,
- "", null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_KEY_REMOTE_HELP_PREFERRED,
+ "", null);
pageNotFound = Platform.getPreferencesService().getString
- (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_PAGE_NOT_FOUND,
- "", null);
+ (HelpBasePlugin.PLUGIN_ID, IHelpBaseConstants.P_PAGE_NOT_FOUND,
+ "", null);
}
public static void restorePreferences() throws Exception {
@@ -81,7 +81,7 @@ public class RemotePreferenceStore {
}
public static void setMockRemoteServer() throws Exception {
- TestServerManager.start("ua.test", 0);
+ TestServerManager.start("ua.test", 0);
RemotePreferenceTest.setPreference("remoteHelpOn", "true");
RemotePreferenceTest.setPreference("remoteHelpHost", "localhost");
RemotePreferenceTest.setPreference("remoteHelpPath", "/help");
@@ -94,8 +94,8 @@ public class RemotePreferenceStore {
}
public static void setTwoMockRemoteServers() throws Exception {
- TestServerManager.start("ua.test", 0);
- TestServerManager.start("ua.test2", 1);
+ TestServerManager.start("ua.test", 0);
+ TestServerManager.start("ua.test2", 1);
RemotePreferenceTest.setPreference("remoteHelpOn", "true");
RemotePreferenceTest.setPreference("remoteHelpHost", "localhost,localhost");
RemotePreferenceTest.setPreference("remoteHelpPath", "/help,/help");
@@ -108,8 +108,8 @@ public class RemotePreferenceStore {
RemotePreferenceTest.setPreference("remoteHelpICContributed", "false,false");
}
public static void setTwoMockRemoteServersReversePriority() throws Exception {
- TestServerManager.start("ua.test", 0);
- TestServerManager.start("ua.test2", 1);
+ TestServerManager.start("ua.test", 0);
+ TestServerManager.start("ua.test2", 1);
RemotePreferenceTest.setPreference("remoteHelpOn", "true");
RemotePreferenceTest.setPreference("remoteHelpHost", "localhost,localhost");
RemotePreferenceTest.setPreference("remoteHelpPath", "/help,/help");
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 2bc431b73..81954be6f 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
@@ -35,7 +35,7 @@ public class RemotePreferenceTest {
@Before
public void setUp() throws Exception {
- RemotePreferenceStore.savePreferences();
+ RemotePreferenceStore.savePreferences();
}
@After
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 55b783d58..2ffbecdab 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
@@ -37,8 +37,8 @@ public class SearchIndexCreation {
@Before
public void setUp() throws Exception {
BaseHelpSystem.ensureWebappRunning();
- mode = BaseHelpSystem.getMode();
- RemotePreferenceStore.savePreferences();
+ mode = BaseHelpSystem.getMode();
+ RemotePreferenceStore.savePreferences();
RemotePreferenceStore.setMockRemoteServer();
RemotePreferenceStore.disableErrorPage();
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
@@ -103,7 +103,7 @@ public class SearchIndexCreation {
if (status.getException() != null) {
throw status.getException();
}
- fail(doc + " status = " + status.getMessage());
+ fail(doc + " status = " + status.getMessage());
}
}
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 ec56f4c41..2c5c3b650 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
@@ -26,8 +26,8 @@ public class SearchUsingRemoteHelp {
@Before
public void setUp() throws Exception {
- RemotePreferenceStore.savePreferences();
- mode = BaseHelpSystem.getMode();
+ RemotePreferenceStore.savePreferences();
+ mode = BaseHelpSystem.getMode();
}
@After
@@ -42,8 +42,8 @@ public class SearchUsingRemoteHelp {
RemotePreferenceStore.setMockRemoteServer();
SearchTestUtils.searchOneLocale("endfdsadsads", new String[] { "http://www.eclipse.org" },
"en");
- RemotePreferenceStore.disableRemoteHelp();
- SearchTestUtils.searchOneLocale("endfdsadsads", new String[0], "en");
+ RemotePreferenceStore.disableRemoteHelp();
+ SearchTestUtils.searchOneLocale("endfdsadsads", new String[0], "en");
}
@Test
@@ -52,8 +52,8 @@ public class SearchUsingRemoteHelp {
RemotePreferenceStore.setTwoMockRemoteServers();
SearchTestUtils.searchOneLocale("endfdsadsads", new String[] { "http://www.eclipse.org" },
"en");
- RemotePreferenceStore.disableRemoteHelp();
- SearchTestUtils.searchOneLocale("endfdsadsads", new String[0], "en");
+ RemotePreferenceStore.disableRemoteHelp();
+ SearchTestUtils.searchOneLocale("endfdsadsads", new String[0], "en");
}
@Test
@@ -61,24 +61,24 @@ public class SearchUsingRemoteHelp {
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
RemotePreferenceStore.setMockRemoteServer();
SearchTestUtils.searchOneLocale("dedfdsadsads", new String[] { "http://www.eclipse.org" }, "de");
- RemotePreferenceStore.disableRemoteHelp();
- SearchTestUtils.searchOneLocale("dedfdsadsads", new String[0], "de");
+ RemotePreferenceStore.disableRemoteHelp();
+ SearchTestUtils.searchOneLocale("dedfdsadsads", new String[0], "de");
}
@Test
public void testSearchEnWordInDeLocale() throws Exception {
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
RemotePreferenceStore.setMockRemoteServer();
- SearchTestUtils.searchOneLocale("endfdsadsads", new String[0], "de");
- RemotePreferenceStore.disableRemoteHelp();
+ SearchTestUtils.searchOneLocale("endfdsadsads", new String[0], "de");
+ RemotePreferenceStore.disableRemoteHelp();
}
@Test
public void testSearchDeWordInEnLocale() throws Exception {
BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
RemotePreferenceStore.setMockRemoteServer();
- SearchTestUtils.searchOneLocale("dedfdsadsads", new String[0], "en");
- RemotePreferenceStore.disableRemoteHelp();
+ SearchTestUtils.searchOneLocale("dedfdsadsads", new String[0], "en");
+ RemotePreferenceStore.disableRemoteHelp();
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TestServerManager.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TestServerManager.java
index 1238f983a..2157f06f2 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TestServerManager.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/TestServerManager.java
@@ -41,8 +41,8 @@ public class TestServerManager {
public static void stop(String webappName, int index) throws CoreException {
if (serverRunning[index]) {
- getHelpServer(index).stop(webappName);
- serverRunning[index] = false;
+ getHelpServer(index).stop(webappName);
+ serverRunning[index] = false;
}
}
@@ -51,7 +51,7 @@ public class TestServerManager {
}
public static String getHost(int index) {
- return getHelpServer(index).getHost();
+ return getHelpServer(index).getHost();
}
}
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 90f53d0b4..b7b094b14 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
@@ -56,51 +56,51 @@ public class TocServletTest {
public void testTocServletContainsUAToc() throws Exception {
Node root = getTocContributions("en");
Element[] UARoot = findContributionById(root, "/org.eclipse.ua.tests/data/help/toc/root.xml");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
public void testTocServletContainsFilteredToc() throws Exception {
Node root = getTocContributions("en");
Element[] UARoot = findContributionById(root, "/org.eclipse.ua.tests/data/help/toc/filteredToc/toc.xml");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
public void testTocServletContainsUnlinkedToc() throws Exception {
Node root = getTocContributions("en");
Element[] UARoot = findContributionById(root, "/org.eclipse.ua.tests/data/help/toc/filteredToc/nonPrimaryToc.xml");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
public void testReadEnToc() throws Exception {
Node root = getTocContributions("en");
Element[] uaRoot = findContributionById(root, "/org.eclipse.ua.tests/data/help/search/toc.xml");
- assertEquals(1, uaRoot.length);
- Element[] toc = findChildren(uaRoot[0], "toc", "label", "search");
- assertEquals(1, toc.length);
- Element[] topicSearch = findChildren(toc[0], "topic", "label", "search");
- assertEquals(1, topicSearch.length);
- Element[] topicEn = findChildren(topicSearch[0], "topic", "label", "testen.html");
- assertEquals(1, topicEn.length);
- Element[] topicDe = findChildren(topicSearch[0], "topic", "label", "testde.html");
- assertEquals(0, topicDe.length);
+ assertEquals(1, uaRoot.length);
+ Element[] toc = findChildren(uaRoot[0], "toc", "label", "search");
+ assertEquals(1, toc.length);
+ Element[] topicSearch = findChildren(toc[0], "topic", "label", "search");
+ assertEquals(1, topicSearch.length);
+ Element[] topicEn = findChildren(topicSearch[0], "topic", "label", "testen.html");
+ assertEquals(1, topicEn.length);
+ Element[] topicDe = findChildren(topicSearch[0], "topic", "label", "testde.html");
+ assertEquals(0, topicDe.length);
}
@Test
public void testReadDeToc() throws Exception {
Node root = getTocContributions("de");
Element[] uaRoot = findContributionById(root, "/org.eclipse.ua.tests/data/help/search/toc.xml");
- assertEquals(1, uaRoot.length);
- Element[] toc = findChildren(uaRoot[0], "toc", "label", "search");
- assertEquals(1, toc.length);
- Element[] topicSearch = findChildren(toc[0], "topic", "label", "search");
- assertEquals(1, topicSearch.length);
- Element[] topicEn = findChildren(topicSearch[0], "topic", "label", "testen.html");
- assertEquals(0, topicEn.length);
- Element[] topicDe = findChildren(topicSearch[0], "topic", "label", "testde.html");
- assertEquals(1, topicDe.length);
+ assertEquals(1, uaRoot.length);
+ Element[] toc = findChildren(uaRoot[0], "toc", "label", "search");
+ assertEquals(1, toc.length);
+ Element[] topicSearch = findChildren(toc[0], "topic", "label", "search");
+ assertEquals(1, topicSearch.length);
+ Element[] topicEn = findChildren(topicSearch[0], "topic", "label", "testen.html");
+ assertEquals(0, topicEn.length);
+ Element[] topicDe = findChildren(topicSearch[0], "topic", "label", "testde.html");
+ assertEquals(1, topicDe.length);
}
private Element[] findContributionById(Node root, String id) {
@@ -116,7 +116,7 @@ public class TocServletTest {
Element nextElement = (Element)next;
if ( childKind.equals(nextElement.getTagName()) && attributeValue.equals(nextElement.getAttribute(attributeName))) {
- results.add(next);
+ results.add(next);
}
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/IntersectionTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/IntersectionTest.java
index c4e406d19..53400feaf 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/IntersectionTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/IntersectionTest.java
@@ -26,7 +26,7 @@ public class IntersectionTest {
private AbstractHelpScope createScope(char char1, char char2) {
AbstractHelpScope result = new IntersectionScope(
new AbstractHelpScope[]{new MockScope(char1, true),
- new MockScope(char2, true)});
+ new MockScope(char2, true)});
return result;
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/UnionTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/UnionTest.java
index 592a131c7..b5b5ae746 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/UnionTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/scope/UnionTest.java
@@ -26,7 +26,7 @@ public class UnionTest {
private AbstractHelpScope createScope(char char1, char char2) {
AbstractHelpScope result = new UnionScope(
new AbstractHelpScope[]{new MockScope(char1, true),
- new MockScope(char2, true)});
+ new MockScope(char2, true)});
return result;
}
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 71b83b208..def6b987c 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
@@ -24,90 +24,90 @@ public class AnalyzerTest {
private final String[] supportedLanguages = { "en", "pt", "ja", "zh", "cs", "de", "el", "fr", "nl", "ru", "ar" };
@Test
- public void testEnglishAnalyzer() {
- checkAnalyzer("en", "en");
- }
+ public void testEnglishAnalyzer() {
+ checkAnalyzer("en", "en");
+ }
@Test
- public void testEnglishUsAnalyzer() {
- checkAnalyzer("en_us", "en");
- }
+ public void testEnglishUsAnalyzer() {
+ checkAnalyzer("en_us", "en");
+ }
@Test
- public void testGermanAnalyzer_de() {
- checkAnalyzer("de", "de");
- }
+ public void testGermanAnalyzer_de() {
+ checkAnalyzer("de", "de");
+ }
@Test
- public void testGermanAnalyzer_de_DE() {
- checkAnalyzer("de_DE", "de");
- }
+ public void testGermanAnalyzer_de_DE() {
+ checkAnalyzer("de_DE", "de");
+ }
@Test
- public void testJapaneseAnalyzer() {
- checkAnalyzer("ja", "ja");
- }
+ public void testJapaneseAnalyzer() {
+ checkAnalyzer("ja", "ja");
+ }
@Test
- public void testFrenchAnalyzer() {
- checkAnalyzer("fr", "fr");
- }
+ public void testFrenchAnalyzer() {
+ checkAnalyzer("fr", "fr");
+ }
@Test
- public void testChineseAnalyzer() {
- checkAnalyzer("zh", "zh");
- }
+ public void testChineseAnalyzer() {
+ checkAnalyzer("zh", "zh");
+ }
- // Korean and japanese share an analyzer
+ // Korean and japanese share an analyzer
@Test
- public void testKoreanAnalyzer() {
- checkAnalyzer("ko", "ja");
- }
+ public void testKoreanAnalyzer() {
+ checkAnalyzer("ko", "ja");
+ }
@Test
- public void testRussianAnalyzer() {
- checkAnalyzer("ru", "ru");
- }
+ public void testRussianAnalyzer() {
+ checkAnalyzer("ru", "ru");
+ }
@Test
- public void testGreekAnalyzer() {
- checkAnalyzer("el", "el");
- }
+ public void testGreekAnalyzer() {
+ checkAnalyzer("el", "el");
+ }
- // Uses default
+ // Uses default
@Test
- public void testSpanishAnalyzer() {
- checkAnalyzer("es", "ar");
- }
+ public void testSpanishAnalyzer() {
+ checkAnalyzer("es", "ar");
+ }
@Test
- public void testPortugueseAnalyzer() {
- checkAnalyzer("pt", "pt");
- }
+ public void testPortugueseAnalyzer() {
+ checkAnalyzer("pt", "pt");
+ }
@Test
- public void testDutchAnalyzer() {
- checkAnalyzer("nl", "nl");
- }
+ public void testDutchAnalyzer() {
+ checkAnalyzer("nl", "nl");
+ }
@Test
- public void testCzechAnalyzer() {
- checkAnalyzer("cs", "cs");
- }
+ public void testCzechAnalyzer() {
+ checkAnalyzer("cs", "cs");
+ }
- // Uses default
+ // Uses default
@Test
- public void testArabicAnalyzer() {
- checkAnalyzer("ar", "ar");
- }
+ public void testArabicAnalyzer() {
+ checkAnalyzer("ar", "ar");
+ }
- // Use default
+ // Use default
@Test
- public void testHebrewAnalyzer() {
- checkAnalyzer("il", "ar");
- }
+ public void testHebrewAnalyzer() {
+ checkAnalyzer("il", "ar");
+ }
- private void checkAnalyzer(String language, String analyzerKind) {
+ private void checkAnalyzer(String language, String analyzerKind) {
AnalyzerDescriptor an = new AnalyzerDescriptor(language);
for (String nextLocale : supportedLanguages) {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/BasicTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/BasicTest.java
index 45d8ec7ba..3c3f6aab3 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/BasicTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/BasicTest.java
@@ -24,8 +24,8 @@ public class BasicTest {
// appears in both filtered and unfiltered parts of test1.xhtml
@Test
public void testSearchFilteredAndUnfiltered() {
- SearchTestUtils.searchAllLocales ("vkrhjewiwh", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml"});
- }
+ SearchTestUtils.searchAllLocales ("vkrhjewiwh", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml"});
+ }
// try OR'ing with a word that does't exist.. should find same result
@Test
@@ -60,70 +60,70 @@ public class BasicTest {
// word is in test3.xhtml and also included by test4.xhtml, contributed
// into test5.xhtml as an extension, and replaces a paragraph in test6.xhtml.
@Test
- public void testSearchInclusionAndExtension() {
+ public void testSearchInclusionAndExtension() {
SearchTestUtils.searchAllLocales("fuejnghqjs", new String[] {"/org.eclipse.ua.tests/data/help/search/test3.xhtml", "/org.eclipse.ua.tests/data/help/search/test4.xhtml", "/org.eclipse.ua.tests/data/help/search/test5.xhtml", "/org.eclipse.ua.tests/data/help/search/test6.xhtml" });
}
// only exists in paragraph in test6.xhtml that's replaced by another one
@Test
- public void testSearchInReplacedOut() {
+ public void testSearchInReplacedOut() {
SearchTestUtils.searchAllLocales("bheufnjefa", new String[0] /* no hits*/ );
}
- // Test replacement using ExtensionProvider
+ // Test replacement using ExtensionProvider
@Test
- public void testSearchInReplaceOutUsingProvider() {
- SearchTestUtils.searchAllLocales("ausjduehf", new String[] {"/org.eclipse.ua.tests/data/help/search/test6.xhtml" } );
- }
+ public void testSearchInReplaceOutUsingProvider() {
+ SearchTestUtils.searchAllLocales("ausjduehf", new String[] {"/org.eclipse.ua.tests/data/help/search/test6.xhtml" } );
+ }
- // Test replacement using ExtensionProvider
+ // Test replacement using ExtensionProvider
@Test
- public void testSearchInReplacemenTextUsingProvider() {
- SearchTestUtils.searchAllLocales("bheufnjefb", new String[0] /* no hits*/ );
- }
+ public void testSearchInReplacemenTextUsingProvider() {
+ SearchTestUtils.searchAllLocales("bheufnjefb", new String[0] /* no hits*/ );
+ }
// sanity test to make sure it finds things in XHTML content in .html file
@Test
- public void testSearchXhtmlInHtml() {
+ public void testSearchXhtmlInHtml() {
SearchTestUtils.searchAllLocales("kejehrgaqm", new String[] {"/org.eclipse.ua.tests/data/help/search/test7.html" });
- }
+ }
// same as above, but in a section that should never be filtered
@Test
- public void testSearchXhtmlNeverFiltered() {
+ public void testSearchXhtmlNeverFiltered() {
SearchTestUtils.searchAllLocales("opqmenhfjs", new String[] {"/org.eclipse.ua.tests/data/help/search/test7.html" });
- }
+ }
// only exists in a paragraph in test7.html that should be filtered out
// make sure this works for XHTML content inside .html file
@Test
- public void testSearchFilteredXhtmlInHtml() {
+ public void testSearchFilteredXhtmlInHtml() {
SearchTestUtils.searchAllLocales("hugftnhdtg", new String[] {"/org.eclipse.ua.tests/data/help/search/test7.html" });
- }
+ }
// this doc is listed in TOC several times, using slightly different paths
@Test
- public void testSearchMultipleTocReference() {
+ public void testSearchMultipleTocReference() {
SearchTestUtils.searchAllLocales("rqfedajhtg", new String[] {"/org.eclipse.ua.tests/data/help/search/test9.htm" });
- }
+ }
@Test
- public void testSearchMultipleNonadjacentWords() {
- SearchTestUtils.searchAllLocales("gsdduvfqnh riehguanil", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" } );
- }
+ public void testSearchMultipleNonadjacentWords() {
+ SearchTestUtils.searchAllLocales("gsdduvfqnh riehguanil", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" } );
+ }
@Test
- public void testSearchMultipleNonadjacentExactMatch() {
- SearchTestUtils.searchAllLocales("\"gsdduvfqnh riehguanil\"", new String[0]);
- }
+ public void testSearchMultipleNonadjacentExactMatch() {
+ SearchTestUtils.searchAllLocales("\"gsdduvfqnh riehguanil\"", new String[0]);
+ }
@Test
- public void testSearchMultipleAdjacentExactMatch() {
- SearchTestUtils.searchAllLocales("\"vkrhjewiwh riehguanil\"", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml"});
- }
+ public void testSearchMultipleAdjacentExactMatch() {
+ SearchTestUtils.searchAllLocales("\"vkrhjewiwh riehguanil\"", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml"});
+ }
@Test
- public void testSearchContentProducer() {
- SearchTestUtils.searchAllLocales("egrology", new String[] { "/org.eclipse.ua.tests/generated/Generated+Parent/Parent+page+with+searchable+word+egrology+.html"});
- }
+ public void testSearchContentProducer() {
+ SearchTestUtils.searchAllLocales("egrology", new String[] { "/org.eclipse.ua.tests/generated/Generated+Parent/Parent+page+with+searchable+word+egrology+.html"});
+ }
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/EncodedCharacterSearch.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/EncodedCharacterSearch.java
index 31398d5c3..a2b550832 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/EncodedCharacterSearch.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/EncodedCharacterSearch.java
@@ -17,30 +17,30 @@ import org.junit.Test;
public class EncodedCharacterSearch {
@Test
- public void testIso8859() {
- SearchTestUtils.searchOneLocale("\u00E1guilaxaxcs", new String[] {"/org.eclipse.ua.tests/data/help/search/testnl8859.htm" }, "en");
- }
+ public void testIso8859() {
+ SearchTestUtils.searchOneLocale("\u00E1guilaxaxcs", new String[] {"/org.eclipse.ua.tests/data/help/search/testnl8859.htm" }, "en");
+ }
@Test
- public void testIso8859AccentNotIgnored() {
- SearchTestUtils.searchOneLocale("aguilaxaxcs", new String[0], "en");
- }
+ public void testIso8859AccentNotIgnored() {
+ SearchTestUtils.searchOneLocale("aguilaxaxcs", new String[0], "en");
+ }
@Test
- public void testUtf8Accented() {
- SearchTestUtils.searchOneLocale("acfele\u00F3n", new String[] {"/org.eclipse.ua.tests/data/help/search/testnlUTF8.htm" }, "en");
- }
+ public void testUtf8Accented() {
+ SearchTestUtils.searchOneLocale("acfele\u00F3n", new String[] {"/org.eclipse.ua.tests/data/help/search/testnlUTF8.htm" }, "en");
+ }
@Test
- public void testUtf8Chinese() {
- SearchTestUtils.searchOneLocale("\u8FB2\u66C6\u65B0\u5E74", new String[] {"/org.eclipse.ua.tests/data/help/search/testnlUTF8.htm" }, "en");
- }
+ public void testUtf8Chinese() {
+ SearchTestUtils.searchOneLocale("\u8FB2\u66C6\u65B0\u5E74", new String[] {"/org.eclipse.ua.tests/data/help/search/testnlUTF8.htm" }, "en");
+ }
@Test
- public void testUtf8Hebrew() {
- SearchTestUtils.searchOneLocale("\u05D0\u05B7\u05E1\u05B0\u05D8\u05B0\u05E8\u05D5\u05B9\u05E0\u05D5\u05B9\u05DE"
- + "\u05B0\u05D9\u05B8\u05D4) \u05DC\u05B4\u05E7\u05BC\u05D5\u05BC\u05D9 (\u05D9\u05E8\u05D7 \u05D0\u05D5 \u05E9\u05DE\u05E9", new String[] {"/org.eclipse.ua.tests/data/help/search/testnlUTF8.htm" }, "en");
- }
+ public void testUtf8Hebrew() {
+ SearchTestUtils.searchOneLocale("\u05D0\u05B7\u05E1\u05B0\u05D8\u05B0\u05E8\u05D5\u05B9\u05E0\u05D5\u05B9\u05DE"
+ + "\u05B0\u05D9\u05B8\u05D4) \u05DC\u05B4\u05E7\u05BC\u05D5\u05BC\u05D9 (\u05D9\u05E8\u05D7 \u05D0\u05D5 \u05E9\u05DE\u05E9", new String[] {"/org.eclipse.ua.tests/data/help/search/testnlUTF8.htm" }, "en");
+ }
}
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 c5e239838..254e991b6 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
@@ -47,8 +47,8 @@ public class ExtraDirTest {
@Test
public void testContainingScope()
{
- performSearch("iusazemhdv", "/org.eclipse.ua.tests/data/help/toc/root.xml", "/org.eclipse.ua.tests/data/help/search/test8.htm" );
- }
+ performSearch("iusazemhdv", "/org.eclipse.ua.tests/data/help/toc/root.xml", "/org.eclipse.ua.tests/data/help/search/test8.htm" );
+ }
// try with another toc's search scope; shouldn't find it
@Test
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 62b604396..86495e7a6 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
@@ -39,7 +39,7 @@ public class InfocenterWorkingSetManagerTest {
@Test
public void testIWSMWithToc() throws IOException {
InfocenterWorkingSetManager mgr = new InfocenterWorkingSetManager
- (new MockServletRequest(), new MockServletResponse(), "en");
+ (new MockServletRequest(), new MockServletResponse(), "en");
WorkingSet wset = new WorkingSet("test");
AdaptableToc toc = mgr.getAdaptableToc("/org.eclipse.ua.tests/data/help/toc/root.xml");
assertNotNull(toc);
@@ -90,7 +90,7 @@ public class InfocenterWorkingSetManagerTest {
assertEquals(1, resources.length);
Set<AdaptableTopic> topics = new HashSet<>();
topics.add(topic1);
- assertTrue(topics.contains(resources[0]));
+ assertTrue(topics.contains(resources[0]));
checkCookies(resp);
}
@@ -113,8 +113,8 @@ public class InfocenterWorkingSetManagerTest {
Set<AdaptableTopic> topics = new HashSet<>();
topics.add(topic1);
topics.add(topic3);
- assertTrue(topics.contains(resources[0]));
- assertTrue(topics.contains(resources[1]));
+ assertTrue(topics.contains(resources[0]));
+ assertTrue(topics.contains(resources[1]));
checkCookies(resp);
}
@@ -141,9 +141,9 @@ public class InfocenterWorkingSetManagerTest {
topics.add(topic1);
topics.add(topic3);
topics.add(topic5);
- assertTrue(topics.contains(resources[0]));
- assertTrue(topics.contains(resources[1]));
- assertTrue(topics.contains(resources[2]));
+ assertTrue(topics.contains(resources[0]));
+ assertTrue(topics.contains(resources[1]));
+ assertTrue(topics.contains(resources[2]));
checkCookies(resp);
}
@@ -169,7 +169,7 @@ public class InfocenterWorkingSetManagerTest {
assertEquals(1, resources.length);
Set<AdaptableTopic> topics = new HashSet<>();
topics.add(topic1);
- assertTrue(topics.contains(resources[0]));
+ assertTrue(topics.contains(resources[0]));
checkCookies(resp);
checkCookies(resp2);
}
@@ -198,8 +198,8 @@ public class InfocenterWorkingSetManagerTest {
Set<AdaptableTopic> topics = new HashSet<>();
topics.add(topic1);
topics.add(topic3);
- assertTrue(topics.contains(resources[0]));
- assertTrue(topics.contains(resources[1]));
+ assertTrue(topics.contains(resources[0]));
+ assertTrue(topics.contains(resources[1]));
checkCookies(resp);
checkCookies(resp2);
}
@@ -231,9 +231,9 @@ public class InfocenterWorkingSetManagerTest {
topics.add(topic1);
topics.add(topic3);
topics.add(topic5);
- assertTrue(topics.contains(resources[0]));
- assertTrue(topics.contains(resources[1]));
- assertTrue(topics.contains(resources[2]));
+ assertTrue(topics.contains(resources[0]));
+ assertTrue(topics.contains(resources[1]));
+ assertTrue(topics.contains(resources[2]));
checkCookies(resp);
checkCookies(resp2);
}
@@ -287,7 +287,7 @@ public class InfocenterWorkingSetManagerTest {
int length1 = cookieLength(resp1.getCookies());
int length2 = cookieLength(resp2.getCookies());
- assertEquals(length1 + 4, length2);
+ assertEquals(length1 + 4, length2);
checkCookies(resp1);
checkCookies(resp2);
}
@@ -414,7 +414,7 @@ public class InfocenterWorkingSetManagerTest {
CriterionResource[] criteria = createResourceWithTwoCriteria();
wset.setCriteria(criteria);
mgr.addWorkingSet(wset);
- MockServletRequest req2 = new MockServletRequest();
+ MockServletRequest req2 = new MockServletRequest();
MockServletResponse resp2 = new MockServletResponse();
req2.setCookies(resp.getCookies());
InfocenterWorkingSetManager mgr2 = new InfocenterWorkingSetManager(req2, resp2, "en");
@@ -462,7 +462,7 @@ public class InfocenterWorkingSetManagerTest {
String illegalChars = resp.getIllegalCharatersFound();
if (illegalChars.equals("") || illegalChars.equals("<")) {
return;
- }
+ }
fail("Cookie contains these illegal characters " + illegalChars + '"');
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LocaleTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LocaleTest.java
index 0476daa6d..fa0cc5faf 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LocaleTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/LocaleTest.java
@@ -19,113 +19,113 @@ import org.junit.Test;
public class LocaleTest {
@Test
- public void testSearchWordInDefaultOnly() {
- SearchTestUtils.searchOneLocale("duejrnfjudshebn", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "en");
- SearchTestUtils.searchOneLocale("duejrnfjudshebn", new String[0], "de");
- }
+ public void testSearchWordInDefaultOnly() {
+ SearchTestUtils.searchOneLocale("duejrnfjudshebn", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "en");
+ SearchTestUtils.searchOneLocale("duejrnfjudshebn", new String[0], "de");
+ }
@Test
- public void testSearchWordInNonDefaultOnly() {
- SearchTestUtils.searchOneLocale("dkdskadksak", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "de");
- SearchTestUtils.searchOneLocale("dkdskadksak", new String[0], "en");
- }
+ public void testSearchWordInNonDefaultOnly() {
+ SearchTestUtils.searchOneLocale("dkdskadksak", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "de");
+ SearchTestUtils.searchOneLocale("dkdskadksak", new String[0], "en");
+ }
@Test
- public void testSearchExactMatchInDefaultOnly() {
- SearchTestUtils.searchOneLocale("\"fesaggresgf duejrnfjudshebn\"", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "en");
- SearchTestUtils.searchOneLocale("\"fesaggresgf duejrnfjudshebn\"", new String[0], "de");
- }
+ public void testSearchExactMatchInDefaultOnly() {
+ SearchTestUtils.searchOneLocale("\"fesaggresgf duejrnfjudshebn\"", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "en");
+ SearchTestUtils.searchOneLocale("\"fesaggresgf duejrnfjudshebn\"", new String[0], "de");
+ }
@Test
- public void testSearchExactMatchInNonDefaultOnly() {
- SearchTestUtils.searchOneLocale("\"dkdskadksak redfrewfdsa\"", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "de");
- SearchTestUtils.searchOneLocale("\"dkdskadksak redfrewfdsa\"", new String[0], "en");
- }
+ public void testSearchExactMatchInNonDefaultOnly() {
+ SearchTestUtils.searchOneLocale("\"dkdskadksak redfrewfdsa\"", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "de");
+ SearchTestUtils.searchOneLocale("\"dkdskadksak redfrewfdsa\"", new String[0], "en");
+ }
@Test
- public void testSearchWithWildcardInDefaultOnly() {
- SearchTestUtils.searchOneLocale("duejrnf?udshebn", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "en");
- SearchTestUtils.searchOneLocale("duejrnf?udshebn", new String[0], "de");
- }
+ public void testSearchWithWildcardInDefaultOnly() {
+ SearchTestUtils.searchOneLocale("duejrnf?udshebn", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "en");
+ SearchTestUtils.searchOneLocale("duejrnf?udshebn", new String[0], "de");
+ }
@Test
- public void testSearchWithWildcardInNonDefaultOnly() {
- SearchTestUtils.searchOneLocale("dkd?kadksak", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "de");
- SearchTestUtils.searchOneLocale("dkd?kadksak", new String[0], "en");
- }
+ public void testSearchWithWildcardInNonDefaultOnly() {
+ SearchTestUtils.searchOneLocale("dkd?kadksak", new String[] { "/org.eclipse.ua.tests/data/help/search/testnl1.xhtml"}, "de");
+ SearchTestUtils.searchOneLocale("dkd?kadksak", new String[0], "en");
+ }
@Test
- public void testSearchPageNotInTocForLocale() {
- SearchTestUtils.searchOneLocale("undefgfdsgfds", new String[0], "de");
- SearchTestUtils.searchOneLocale("undefgfdsgfds", new String[0], "en");
- }
+ public void testSearchPageNotInTocForLocale() {
+ SearchTestUtils.searchOneLocale("undefgfdsgfds", new String[0], "de");
+ SearchTestUtils.searchOneLocale("undefgfdsgfds", new String[0], "en");
+ }
@Test
- public void testSearchPageOnlyInDefaultToc() {
- SearchTestUtils.searchOneLocale("idskrekfuej", new String[0], "de");
- SearchTestUtils.searchOneLocale("idskrekfuej", new String[] { "/org.eclipse.ua.tests/data/help/search/test_en.html"}, "en");
- }
+ public void testSearchPageOnlyInDefaultToc() {
+ SearchTestUtils.searchOneLocale("idskrekfuej", new String[0], "de");
+ SearchTestUtils.searchOneLocale("idskrekfuej", new String[] { "/org.eclipse.ua.tests/data/help/search/test_en.html"}, "en");
+ }
@Test
- public void testSearchPageOnlyInLocalToc() {
- SearchTestUtils.searchOneLocale("deuufjfu", new String[0], "en");
- SearchTestUtils.searchOneLocale("deuufjfu", new String[] { "/org.eclipse.ua.tests/data/help/search/test_de.html"}, "de");
- }
+ public void testSearchPageOnlyInLocalToc() {
+ SearchTestUtils.searchOneLocale("deuufjfu", new String[0], "en");
+ SearchTestUtils.searchOneLocale("deuufjfu", new String[] { "/org.eclipse.ua.tests/data/help/search/test_de.html"}, "de");
+ }
@Test
- public void testSearchEnglishStemming_ed() {
- SearchTestUtils.searchOneLocale("udjerufdjd", new String[0], "de");
- SearchTestUtils.searchOneLocale("udjerufdjd", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml"}, "en");
- }
+ public void testSearchEnglishStemming_ed() {
+ SearchTestUtils.searchOneLocale("udjerufdjd", new String[0], "de");
+ SearchTestUtils.searchOneLocale("udjerufdjd", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml"}, "en");
+ }
@Test
- public void testSearchEnglishStemming_ing() {
- SearchTestUtils.searchOneLocale("kjfdskajdfska", new String[0], "de");
- SearchTestUtils.searchOneLocale("kjfdskajdfska", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml"}, "en");
- }
+ public void testSearchEnglishStemming_ing() {
+ SearchTestUtils.searchOneLocale("kjfdskajdfska", new String[0], "de");
+ SearchTestUtils.searchOneLocale("kjfdskajdfska", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml"}, "en");
+ }
- // Prefixes are not matched by stemming
+ // Prefixes are not matched by stemming
@Test
- public void testSearchEnglishStemming_re() {
- SearchTestUtils.searchOneLocale("dhdsahkdshakjd", new String[0], "de");
- SearchTestUtils.searchOneLocale("dhdsahkdshakjd", new String[0], "en");
- }
-
- /**
- * Tests that the stemmer properly removes the German "e" suffix.
- */
+ public void testSearchEnglishStemming_re() {
+ SearchTestUtils.searchOneLocale("dhdsahkdshakjd", new String[0], "de");
+ SearchTestUtils.searchOneLocale("dhdsahkdshakjd", new String[0], "en");
+ }
+
+ /**
+ * Tests that the stemmer properly removes the German "e" suffix.
+ */
@Test
- public void testSearchGermanStemming_e() {
- SearchTestUtils.searchOneLocale("dfskajkfsafaisch", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml"}, "de");
- }
+ public void testSearchGermanStemming_e() {
+ SearchTestUtils.searchOneLocale("dfskajkfsafaisch", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml"}, "de");
+ }
- /**
- * Tests that the stemmer properly removes the German "en" suffix.
- */
+ /**
+ * Tests that the stemmer properly removes the German "en" suffix.
+ */
@Test
- public void testSearchGermanStemming_en() {
- SearchTestUtils.searchOneLocale("kirch", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml"}, "de");
- SearchTestUtils.searchOneLocale("kirch", new String[0], "en");
- }
+ public void testSearchGermanStemming_en() {
+ SearchTestUtils.searchOneLocale("kirch", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml"}, "de");
+ SearchTestUtils.searchOneLocale("kirch", new String[0], "en");
+ }
@Test
- public void testSearchQualifiedNames_en() {
- SearchTestUtils.searchOneLocale("usjenfdj.udjeudj.uejdhehj", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml" },
- "en" );
- SearchTestUtils.searchOneLocale("uejdhehj", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml" },
- "en" );
- }
-
- /*
- * FAILS - see bug Bug 219928
- public void testSearchQualifiedNames_de() {
- SearchTestUtils.searchOneLocale("usjenfdj.udjeudj.uejdhehj", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml" },
- "de" );
- SearchTestUtils.searchOneLocale("uejdhehj", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml" },
- "de" );
- }
-
- */
+ public void testSearchQualifiedNames_en() {
+ SearchTestUtils.searchOneLocale("usjenfdj.udjeudj.uejdhehj", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml" },
+ "en" );
+ SearchTestUtils.searchOneLocale("uejdhehj", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml" },
+ "en" );
+ }
+
+ /*
+ * FAILS - see bug Bug 219928
+ public void testSearchQualifiedNames_de() {
+ SearchTestUtils.searchOneLocale("usjenfdj.udjeudj.uejdhehj", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml" },
+ "de" );
+ SearchTestUtils.searchOneLocale("uejdhehj", new String[] { "/org.eclipse.ua.tests/data/help/search/test10.xhtml" },
+ "de" );
+ }
+
+ */
}
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 6eb7f8a50..ea1ffaca9 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
@@ -45,7 +45,7 @@ public class MockSearchParticipant extends SearchParticipant {
String summary = isDoc1? "Summary1" : "Summary2";
String contents = isDoc1? "jkijkijkk frgeded" : "olhoykk lgktihku";
doc.setTitle(title);
- doc.setSummary(summary);
+ doc.setSummary(summary);
doc.addContents(contents);
return Status.OK_STATUS;
}
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 bdc013688..ccbc8276e 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
@@ -48,7 +48,7 @@ public class MockSearchParticipantXML extends SearchParticipantXML {
}
String summary = attributes.getValue("summary");
if (summary != null) {
- data.addToSummary(summary);
+ data.addToSummary(summary);
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java
index 94b828a3f..01323cc4b 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java
@@ -223,9 +223,9 @@ public class PrebuiltIndexCompatibility {
assertFalse(index1.equals(index2));
}
- /*
- * Verifies that a prebuilt index can be searched
- */
+ /*
+ * Verifies that a prebuilt index can be searched
+ */
private void checkReadable(String indexPath) throws IOException,
CorruptIndexException {
Path path = new Path(indexPath);
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/WildcardTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/WildcardTest.java
index 5bd5da776..02d0a41b0 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/WildcardTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/WildcardTest.java
@@ -17,54 +17,54 @@ import org.junit.Test;
public class WildcardTest {
@Test
- public void testSearchWithStar() {
- SearchTestUtils.searchAllLocales("jehc*qpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
- }
+ public void testSearchWithStar() {
+ SearchTestUtils.searchAllLocales("jehc*qpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
+ }
@Test
- public void testSearchWithTwoStars() {
- SearchTestUtils.searchAllLocales("jehc*qp*js", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
- }
+ public void testSearchWithTwoStars() {
+ SearchTestUtils.searchAllLocales("jehc*qp*js", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
+ }
@Test
- public void testSearchWithStarReplacingThreeChars() {
- SearchTestUtils.searchAllLocales("jehc*fjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
- }
+ public void testSearchWithStarReplacingThreeChars() {
+ SearchTestUtils.searchAllLocales("jehc*fjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
+ }
- // Test that a star does not match spaces
+ // Test that a star does not match spaces
@Test
- public void testSearchWithStarReplacingSpace() {
- SearchTestUtils.searchAllLocales("jehcyqpfjs*vkrhjewiwh", new String[0]);
- }
+ public void testSearchWithStarReplacingSpace() {
+ SearchTestUtils.searchAllLocales("jehcyqpfjs*vkrhjewiwh", new String[0]);
+ }
@Test
- public void testSearchWithQuestionMark() {
- SearchTestUtils.searchAllLocales("jehc?qpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
- }
+ public void testSearchWithQuestionMark() {
+ SearchTestUtils.searchAllLocales("jehc?qpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
+ }
@Test
- public void testSearchWithTwoQuestionMarks() {
- SearchTestUtils.searchAllLocales("j?hc?qpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
- }
+ public void testSearchWithTwoQuestionMarks() {
+ SearchTestUtils.searchAllLocales("j?hc?qpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
+ }
@Test
- public void testSearchQuestionMarkCannotReplaceTwoChars() {
- SearchTestUtils.searchAllLocales("jehc?pfjs", new String[0] );
- }
+ public void testSearchQuestionMarkCannotReplaceTwoChars() {
+ SearchTestUtils.searchAllLocales("jehc?pfjs", new String[0] );
+ }
@Test
- public void testSearchSuccessiveQuestionMarks() {
- SearchTestUtils.searchAllLocales("jehc??pfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" } );
- }
+ public void testSearchSuccessiveQuestionMarks() {
+ SearchTestUtils.searchAllLocales("jehc??pfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" } );
+ }
@Test
- public void testSearchLeadingStar() {
- SearchTestUtils.searchAllLocales("*hcyqpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
- }
+ public void testSearchLeadingStar() {
+ SearchTestUtils.searchAllLocales("*hcyqpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
+ }
@Test
- public void testSearchLeadingQuestionMark() {
- SearchTestUtils.searchAllLocales("?ehcyqpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.xhtml" });
- }
+ public void testSearchLeadingQuestionMark() {
+ SearchTestUtils.searchAllLocales("?ehcyqpfjs", new String[] { "/org.eclipse.ua.tests/data/help/search/test1.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 90e4ec34f..61a726c86 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
@@ -61,7 +61,7 @@ public class WorkingSetManagerTest {
manager.removeWorkingSet(element);
}
for (WorkingSet workingSet : workingSets) {
- manager.addWorkingSet(workingSet);
+ manager.addWorkingSet(workingSet);
}
manager.saveState();
}
@@ -114,7 +114,7 @@ public class WorkingSetManagerTest {
mgr.addWorkingSet(wset);
WorkingSetScope scope = new WorkingSetScope("test", mgr, "scope");
for (int i = 1; i < tocs.length; i++) {
- assertFalse(scope.inScope(tocs[i]));
+ assertFalse(scope.inScope(tocs[i]));
}
}
@@ -130,9 +130,9 @@ public class WorkingSetManagerTest {
WorkingSetScope scope = new WorkingSetScope("test", mgr, "scope");
for (int i = 1; i < tocs.length; i++) {
ITopic[] topics = tocs[i].getTopics();
- for (ITopic topic : topics) {
- assertFalse(scope.inScope(topic));
- }
+ for (ITopic topic : topics) {
+ assertFalse(scope.inScope(topic));
+ }
}
}
@@ -190,7 +190,7 @@ public class WorkingSetManagerTest {
WorkingSetScope scope = new WorkingSetScope("test1", mgr, "scope");
Toc[] tocs = HelpPlugin.getTocManager().getTocs(Platform.getNL());
for (Toc toc : tocs) {
- assertTrue(scope.inScope(toc));
+ assertTrue(scope.inScope(toc));
}
}
@@ -203,7 +203,7 @@ public class WorkingSetManagerTest {
for (Toc toc : tocs) {;
ITopic[] topics = toc.getTopics();
for (ITopic topic : topics) {
- assertTrue(scope.inScope(topic));
+ assertTrue(scope.inScope(topic));
}
}
}
@@ -219,7 +219,7 @@ public class WorkingSetManagerTest {
for (ITopic topic : topics) {
ITopic[] subtopics = topic.getSubtopics();
for (ITopic subtopic : subtopics) {
- assertTrue(scope.inScope(subtopic));
+ assertTrue(scope.inScope(subtopic));
}
}
}
@@ -402,7 +402,7 @@ public class WorkingSetManagerTest {
CriterionResource[] criteria = createResourceWithTwoCriteria();
wset.setCriteria(criteria);
mgr.addWorkingSet(wset);
- mgr.saveState();
+ mgr.saveState();
WorkingSetManager mgr2 = new WorkingSetManager();
WorkingSet[] readWsets = mgr2.getWorkingSets();
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 2e3756d9d..39de08579 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
@@ -136,41 +136,41 @@ public class EnabledTopicTest {
@Test
public void testEnabledTopicsEmptyArray() throws Exception {
- ITopic[] enabled = EnabledTopicUtils.getEnabled(new ITopic[0]);
- assertTrue(enabled.length == 0);
+ ITopic[] enabled = EnabledTopicUtils.getEnabled(new ITopic[0]);
+ assertTrue(enabled.length == 0);
}
@Test
public void testEnabledTopicsAllEnabled() throws Exception {
- ITopic[] topics = new ITopic[2];
- topics[0] = new ETopic("T1", true);
- topics[1] = new ETopic("T2", true);
+ ITopic[] topics = new ITopic[2];
+ topics[0] = new ETopic("T1", true);
+ topics[1] = new ETopic("T2", true);
ITopic[] enabled = EnabledTopicUtils.getEnabled(topics);
- assertTrue(enabled.length == 2);
- assertTrue(topics[0].getLabel().equals("T1"));
- assertTrue(topics[1].getLabel().equals("T2"));
+ assertTrue(enabled.length == 2);
+ assertTrue(topics[0].getLabel().equals("T1"));
+ assertTrue(topics[1].getLabel().equals("T2"));
}
@Test
public void testEnabledTopicsAllDisabled() throws Exception {
ITopic[] topics = new ITopic[2];
- topics[0] = new ETopic("T1", false);
- topics[1] = new ETopic("T2", false);
+ topics[0] = new ETopic("T1", false);
+ topics[1] = new ETopic("T2", false);
ITopic[] enabled = EnabledTopicUtils.getEnabled(topics);
- assertTrue(enabled.length == 0);
+ assertTrue(enabled.length == 0);
}
@Test
public void testEnabledTopicsMix() throws Exception {
ITopic[] topics = new ITopic[4];
- topics[0] = new ETopic("T1", true);
- topics[1] = new ETopic("T2", false);
- topics[2] = new ETopic("T3", true);
- topics[3] = new ETopic("T4", false);
+ topics[0] = new ETopic("T1", true);
+ topics[1] = new ETopic("T2", false);
+ topics[2] = new ETopic("T3", true);
+ topics[3] = new ETopic("T4", false);
ITopic[] enabled = EnabledTopicUtils.getEnabled(topics);
- assertEquals(2, enabled.length);
- assertEquals("T1", enabled[0].getLabel());
- assertEquals("T3", enabled[1].getLabel());
+ assertEquals(2, enabled.length);
+ assertEquals("T1", enabled[0].getLabel());
+ assertEquals("T3", enabled[1].getLabel());
}
@Test
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 86b1afcb6..525d19b8c 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
@@ -24,33 +24,33 @@ public class HelpData {
@Test
public void testHelpDataInPlugin() {
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));
+ 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));
}
@Test
public void testPluginsRoot() {
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));
+ 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));
}
@Test
public void testHelpDataOverridesBaseTocs() {
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));
+ 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));
}
@Test
public void testBaseTocs() {
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));
+ 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/TocSortingTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocSortingTest.java
index 62d95e6c1..03ce7cb34 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
@@ -61,7 +61,7 @@ public class TocSortingTest {
@Override
public ITopic[] getTopics() {
- return new ITopic[0];
+ return new ITopic[0];
}
@Override
@@ -142,9 +142,9 @@ public class TocSortingTest {
@Before
public void setUp() throws Exception {
helpDataPreference = Platform.getPreferencesService().getString
- (HelpPlugin.HELP_DATA_KEY, HelpPlugin.HELP_DATA_KEY, "", null);
+ (HelpPlugin.HELP_DATA_KEY, HelpPlugin.HELP_DATA_KEY, "", null);
baseTocsPreference = Platform.getPreferencesService().getString
- (HelpPlugin.HELP_DATA_KEY, BASE_TOCS, "", null);
+ (HelpPlugin.HELP_DATA_KEY, BASE_TOCS, "", null);
HelpData.clearProductHelpData();
ProductPreferences.resetPrimaryTocOrdering();
setHelpData(EMPTY_XML);
@@ -165,8 +165,8 @@ public class TocSortingTest {
}
private void setBaseTocs(String value) {
- IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(HelpPlugin.PLUGIN_ID);
- prefs.put(BASE_TOCS, value);
+ IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(HelpPlugin.PLUGIN_ID);
+ prefs.put(BASE_TOCS, value);
}
private String toString(ITocContribution[] tocs) {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TopicFinderTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TopicFinderTest.java
index 080df51ef..9fdee391b 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TopicFinderTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TopicFinderTest.java
@@ -158,7 +158,7 @@ public class TopicFinderTest {
TopicFinder finder = new TopicFinder(topic, tocs, new UniversalScope());
int selectedToc = finder.getSelectedToc();
String navPath = "http://127.0.0.1:1936/help/nav/" + selectedToc +
- '_' + index1 + '_' + index2;
+ '_' + index1 + '_' + index2;
TopicFinder finder2 = new TopicFinder(navPath, tocs, new UniversalScope());
assertEquals(selectedToc, finder2.getSelectedToc());
ITopic[] topicPath = finder2.getTopicPath();
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/DocumentCreator.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/DocumentCreator.java
index 72d33252f..325c21330 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/DocumentCreator.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/DocumentCreator.java
@@ -30,10 +30,10 @@ public class DocumentCreator {
StringReader reader = new StringReader(input);
InputSource source = new InputSource(reader);
- DocumentBuilder documentBuilder = CheatSheetPlugin.getPlugin()
+ DocumentBuilder documentBuilder = CheatSheetPlugin.getPlugin()
.getDocumentBuilder();
- return documentBuilder.parse(source);
+ return documentBuilder.parse(source);
}
}
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 a7125072c..7916491da 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
@@ -40,7 +40,7 @@ public class LoadTestServlet extends HttpServlet {
String repeatParam = req.getParameter("repeat");
int repetitions = 200;
- try {
+ try {
repetitions = Integer.parseInt(repeatParam);
} catch (NumberFormatException e) {
}
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 07e57a2ac..cd1d81307 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
@@ -84,7 +84,7 @@ public class ParallelTestSupport {
this.repetitions = repetitions;
}
- public String failureReason = null;
+ public String failureReason = null;
@Override
public void run() {
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 09cd5759e..c5deb0b5a 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
@@ -52,120 +52,120 @@ public class ChildLinkInsertion {
@Test
public void testEmpty() {
- final String input = "";
+ final String input = "";
checkFilter(input, input);
}
@Test
public void testNoMatch() {
- final String input = "<HEAD><HEAD/>";
+ final String input = "<HEAD><HEAD/>";
checkFilter(input, input);
}
@Test
public void testPartialMatch1() {
- final String input = "<A href = \"PLUGINS\"><!--INSTRUCT-->";
+ final String input = "<A href = \"PLUGINS\"><!--INSTRUCT-->";
checkFilter(input, input);
}
@Test
public void testPartialMatch2() {
- final String input = "<A href = \"PLUGINS\"><!A -->";
+ final String input = "<A href = \"PLUGINS\"><!A -->";
checkFilter(input, input);
}
@Test
public void testPartialMatch3() {
- final String input = "<A href = \"PLUGINS\"><!-A -->";
+ final String input = "<A href = \"PLUGINS\"><!-A -->";
checkFilter(input, input);
}
@Test
public void testPartialMatch4() {
- final String input = "<A href = \"PLUGINS\"><!--A-->";
+ final String input = "<A href = \"PLUGINS\"><!--A-->";
checkFilter(input, input);
}
@Test
public void testEndsUnmatched() {
- final String input = "<A><!--INSTR";
+ final String input = "<A><!--INSTR";
checkFilter(input, input);
}
@Test
public void testNotAtStart() {
- final String input = "<A><!-- INSERT_CHILD_LINKS-->";
+ final String input = "<A><!-- INSERT_CHILD_LINKS-->";
checkFilter(input, input);
}
@Test
public void testSpaceBeforeEnd() {
- final String input = "<A><!-- INSERT_CHILD_LINKS -->";
+ final String input = "<A><!-- INSERT_CHILD_LINKS -->";
checkFilter(input, input);
}
@Test
public void testTooManyCharacters_1() {
- final String input = "<A><!--INSERT_CHILD_LINKSS-->";
+ final String input = "<A><!--INSERT_CHILD_LINKSS-->";
checkFilter(input, input);
}
@Test
public void testTooManyCharacters_2() {
- final String input = "<A><!--INSERT_CHILD_LINKS_STYLES-->";
+ final String input = "<A><!--INSERT_CHILD_LINKS_STYLES-->";
checkFilter(input, input);
}
@Test
public void testAtStart() {
- final String input = "<!--INSERT_CHILD_LINKS--><A>";
- final String expected = "<LINKS><A>";
+ final String input = "<!--INSERT_CHILD_LINKS--><A>";
+ final String expected = "<LINKS><A>";
checkFilter(input, expected);
}
@Test
public void testChildStyle() {
- final String input = "<!--INSERT_CHILD_LINK_STYLE--><A>";
- final String expected = "<STYLE><A>";
+ final String input = "<!--INSERT_CHILD_LINK_STYLE--><A>";
+ final String expected = "<STYLE><A>";
checkFilter(input, expected);
}
@Test
public void testDefaultEncoding() {
- final String input = "";
+ final String input = "";
checkEncoding(input, null);
}
@Test
public void testEncodingUtf8() {
- final String input =
- "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
+ final String input =
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
checkEncoding(input, "utf-8");
}
@Test
public void testMetaNoEncoding() {
- final String input =
- "<meta http-equiv=\"Content-Type\" content=\"text/html\">";
+ final String input =
+ "<meta http-equiv=\"Content-Type\" content=\"text/html\">";
checkEncoding(input, null);
}
@Test
public void testMultiMeta() {
- final String input =
- "<meta name=\"test\" content=\"test\">" +
- "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" +
- "<meta name=\"test\" content=\"test\">";
+ final String input =
+ "<meta name=\"test\" content=\"test\">" +
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" +
+ "<meta name=\"test\" content=\"test\">";
checkEncoding(input, "utf-8");
}
@Test
public void testMetaAndInsert() {
- final String metaInfo = "<meta name=\"test\" content=\"test\">" +
- "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
+ final String metaInfo = "<meta name=\"test\" content=\"test\">" +
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
final String input =
- metaInfo + "<!--INSERT_CHILD_LINK_STYLE--><A>";
- final String expected = metaInfo + "<STYLE><A>";
+ metaInfo + "<!--INSERT_CHILD_LINK_STYLE--><A>";
+ final String expected = metaInfo + "<STYLE><A>";
checkFilter(input, expected);
checkEncoding(input, "utf-8");
}
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 834dc655b..b8509f0a0 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
@@ -19,8 +19,8 @@ package org.eclipse.ua.tests.help.webapp;
*/
public class CommentFilterOne extends CommentFilter {
- @Override
+ @Override
protected String getCommentText() {
- return "1";
- }
+ 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 2f1fbfe1e..cad31060d 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
@@ -20,8 +20,8 @@ package org.eclipse.ua.tests.help.webapp;
public class CommentFilterThree extends CommentFilter {
- @Override
+ @Override
protected String getCommentText() {
- return "3";
- }
+ 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 1f39e2be2..c220c32e8 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
@@ -20,8 +20,8 @@ package org.eclipse.ua.tests.help.webapp;
public class CommentFilterTwo extends CommentFilter {
- @Override
+ @Override
protected String getCommentText() {
- return "2";
- }
+ 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 707c08ee9..df05d8bcf 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
@@ -32,7 +32,7 @@ public class FilterExtensionTest {
@After
public void tearDown() throws Exception {
- ExtraFilters.setFilters(new PrioritizedFilter[0]);
+ ExtraFilters.setFilters(new PrioritizedFilter[0]);
}
@Test
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterTest.java
index ef7444356..42aa1e9d3 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterTest.java
@@ -186,13 +186,13 @@ public class FilterTest {
@Test
public void testCharsetUtf8Upper() {
InputStream is = new ByteArrayInputStream(CONTENT_TYPE_UTF8UC.getBytes());
- assertEquals("UTF-8", HTMLDocParser.getCharsetFromHTML(is));
+ assertEquals("UTF-8", HTMLDocParser.getCharsetFromHTML(is));
}
@Test
public void testCharsetISO_8859_UCUpper() {
InputStream is = new ByteArrayInputStream(CONTENT_TYPE_ISO_8859_1_UC.getBytes());
- assertEquals("ISO-8859-1", HTMLDocParser.getCharsetFromHTML(is));
+ assertEquals("ISO-8859-1", HTMLDocParser.getCharsetFromHTML(is));
}
}
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 5d1c7d7bb..509fa5ea2 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
@@ -52,14 +52,14 @@ public class HelpServerBinding {
}
private String getHostIP() throws UnknownHostException {
- InetAddress host = InetAddress.getLocalHost();
- byte[] ipAddr = host.getAddress();
- String result = "" + ipAddr[0];
- for (int i = 1; i < ipAddr.length; i++) {
- result += '.';
- result += ipAddr[i];
- }
- return result;
+ InetAddress host = InetAddress.getLocalHost();
+ byte[] ipAddr = host.getAddress();
+ String result = "" + ipAddr[0];
+ for (int i = 1; i < ipAddr.length; i++) {
+ result += '.';
+ result += ipAddr[i];
+ }
+ return result;
}
@Test
@@ -80,7 +80,7 @@ public class HelpServerBinding {
WebappManager.start("help");
assertTrue(canAccessServer("127.0.0.1"));
if (testUsingIP) {
- assertFalse(canAccessServer(getHostIP()));
+ assertFalse(canAccessServer(getHostIP()));
}
}
@@ -91,7 +91,7 @@ public class HelpServerBinding {
WebappManager.start("help");
assertTrue(canAccessServer("127.0.0.1"));
if (testUsingIP) {
- assertTrue(canAccessServer(getHostIP()));
+ assertTrue(canAccessServer(getHostIP()));
}
}
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 3a438e0cc..9cff567b3 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
@@ -78,7 +78,7 @@ public class HelpServerInterrupt {
fail("Test did not complete within 10 seconds");
}
Thread.sleep(sleepTime);
- } while (starter.isAlive());
+ } while (starter.isAlive());
Exception exception = starter.getException();
if (exception != null) {
throw exception;
@@ -97,7 +97,7 @@ public class HelpServerInterrupt {
}
starter.interrupt();
Thread.sleep(sleepTime);
- } while (starter.isAlive());
+ } while (starter.isAlive());
Exception exception = starter.getException();
if (exception != null) {
throw exception;
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 20dcc8879..4c0fe904a 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
@@ -65,8 +65,8 @@ public class ParallelServerAccessTest {
}
for (int i = 0; i < numberOfThreads && complete; i++) {
if (readers[i].isAlive()) {
- complete = false;
- try {
+ complete = false;
+ try {
Thread.sleep(100);
} catch (InterruptedException e) {
fail("Interrupted Exception");
@@ -140,9 +140,9 @@ public class ParallelServerAccessTest {
}
} while (nextChar != '$');
}
- if (uniqueId != value) {
- throw new UnexpectedValueException(uniqueId, value);
- }
+ if (uniqueId != value) {
+ throw new UnexpectedValueException(uniqueId, value);
+ }
}
private synchronized long getReadOperations() {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/PluginsRootReplacement.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/PluginsRootReplacement.java
index 123dac3ad..46e2b2870 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/PluginsRootReplacement.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/PluginsRootReplacement.java
@@ -36,52 +36,52 @@ import org.junit.Test;
public class PluginsRootReplacement {
@Test
public void testEmpty() {
- final String input = "";
+ final String input = "";
checkFilter(input, input);
}
@Test
public void testNoMatch() {
- final String input = "<HEAD><HEAD/>";
+ final String input = "<HEAD><HEAD/>";
checkFilter(input, input);
}
@Test
public void testPartialMatch() {
- final String input = "<A href = \"PLUGINS\">";
+ final String input = "<A href = \"PLUGINS\">";
checkFilter(input, input);
}
@Test
public void testEndsUnmatched() {
- final String input = "<A href = \"PLUGIN";
+ final String input = "<A href = \"PLUGIN";
checkFilter(input, input);
}
@Test
public void testNotAtStart() {
- final String input = "<A href = \"../PLUGINS_ROOT/plugin/a.html\">";
+ final String input = "<A href = \"../PLUGINS_ROOT/plugin/a.html\">";
checkFilter(input, input);
}
@Test
public void testAtStart() {
- final String input = "<A href = \"PLUGINS_ROOT/plugin/a.html\">";
- final String expected = "<A href = \"../plugin/a.html\">";
+ final String input = "<A href = \"PLUGINS_ROOT/plugin/a.html\">";
+ final String expected = "<A href = \"../plugin/a.html\">";
checkFilter(input, expected);
}
@Test
public void testSecondArg() {
- final String input = "<A alt=\"alt\" href = \"PLUGINS_ROOT/plugin/a.html\">";
- final String expected = "<A alt=\"alt\" href = \"../plugin/a.html\">";
+ final String input = "<A alt=\"alt\" href = \"PLUGINS_ROOT/plugin/a.html\">";
+ final String expected = "<A alt=\"alt\" href = \"../plugin/a.html\">";
checkFilter(input, expected);
}
@Test
public void testMultipleMatches() {
- final String input = "<A href = \"PLUGINS_ROOT/plugin/a.html\"><A href = \"PLUGINS_ROOT/plugin/b.html\">";
- final String expected = "<A href = \"../plugin/a.html\"><A href = \"../plugin/b.html\">";
+ final String input = "<A href = \"PLUGINS_ROOT/plugin/a.html\"><A href = \"PLUGINS_ROOT/plugin/b.html\">";
+ final String expected = "<A href = \"../plugin/a.html\"><A href = \"../plugin/b.html\">";
checkFilter(input, expected);
}
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 0c5665e04..a40f671aa 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
@@ -40,8 +40,8 @@ public class RestrictedTopicParameter {
@Before
public void setUp() throws Exception {
restrictTopic = Platform.getPreferencesService().getBoolean
- (HelpBasePlugin.PLUGIN_ID, RESTRICT_TOPIC,
- false, null);
+ (HelpBasePlugin.PLUGIN_ID, RESTRICT_TOPIC,
+ false, null);
helpMode = BaseHelpSystem.getMode();
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/UrlCoderTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/UrlCoderTest.java
index 2aef8fb22..8546900c8 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/UrlCoderTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/UrlCoderTest.java
@@ -43,7 +43,7 @@ public class UrlCoderTest {
private boolean compactEncodingIsShorter(String value) {
String compactEncoded = URLCoder.compactEncode(value);
String encoded = URLCoder.encode(value);
- return compactEncoded.length() < encoded.length();
+ return compactEncoded.length() < encoded.length();
}
@Test
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/UrlUtilsTests.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/UrlUtilsTests.java
index 5d053b204..8a7e6cd12 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/UrlUtilsTests.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/UrlUtilsTests.java
@@ -58,7 +58,7 @@ public class UrlUtilsTests {
assertEquals(23, path[0]);
assertEquals(4, path[1]);
assertEquals(5, path[2]);
- }
+ }
@Test
public void testRelativePathUnrelated() {
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 2d9666bfc..83f88932a 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
@@ -31,7 +31,7 @@ public class ContentServiceTest extends ContentServletTest {
final String path = "/data/help/index/topic1.html";
String remoteContent = ServicesTestUtils.getRemoteContent(UA_TESTS, path, "en");
String localContent = ServicesTestUtils.getLocalContent(UA_TESTS, path);
- assertEquals(remoteContent, localContent);
+ assertEquals(remoteContent, localContent);
}
@Override
@@ -40,7 +40,7 @@ public class ContentServiceTest extends ContentServletTest {
final String path = "/data/help/manual/filter.xhtml";
String remoteContent = ServicesTestUtils.getRemoteContent(UA_TESTS, path, "en");
String localContent = ServicesTestUtils.getLocalContent(UA_TESTS, path);
- assertEquals(remoteContent, localContent);
+ assertEquals(remoteContent, localContent);
}
@Override
@@ -49,7 +49,7 @@ public class ContentServiceTest extends ContentServletTest {
final String path = "/data/help/search/testnl1.xhtml";
String remoteContent = ServicesTestUtils.getRemoteContent(UA_TESTS, path, "en");
String localContent = ServicesTestUtils.getLocalContent(UA_TESTS, path);
- assertEquals(remoteContent, localContent);
+ assertEquals(remoteContent, localContent);
}
@Override
@@ -59,8 +59,8 @@ public class ContentServiceTest extends ContentServletTest {
String remoteContent = ServicesTestUtils.getRemoteContent(UA_TESTS, path, "de");
String enLocalContent = ServicesTestUtils.getLocalContent(UA_TESTS, path);
String deLocalContent = ServicesTestUtils.getLocalContent(UA_TESTS, "/nl/de" + path);
- assertEquals(remoteContent, deLocalContent);
- assertFalse(remoteContent.equals(enLocalContent));
+ assertEquals(remoteContent, deLocalContent);
+ assertFalse(remoteContent.equals(enLocalContent));
}
@Override
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 d2fadaca8..eab218672 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
@@ -57,7 +57,7 @@ public class ExtensionServiceTest {
Node root = getContentExtensions("en");
Element[] UARoot = findContributionByContent(root,
"/org.eclipse.ua.tests/data/help/dynamic/shared/doc2.xml#element.1");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
@@ -65,7 +65,7 @@ public class ExtensionServiceTest {
Node root = getContentExtensions("en");
Element[] UARoot = findContributionByContent(root,
"/org.eclipse.ua.tests/data/help/dynamic/shared/doc2.xml#element.3");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
@@ -73,7 +73,7 @@ public class ExtensionServiceTest {
Node root = getContentExtensions("en");
Element[] UARoot = findContributionByContent(root,
"/org.eclipse.ua.tests/data/help/dynamic/shared/doc2.xml#element.4");
- assertEquals(0, UARoot.length);
+ assertEquals(0, UARoot.length);
}
@Test
@@ -89,7 +89,7 @@ public class ExtensionServiceTest {
Node root = getContentExtensions("en");
Element[] UARoot = findReplacementByContent(root,
"/org.eclipse.ua.tests/data/help/dynamic/shared/doc2.xml#element.1");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
@@ -134,7 +134,7 @@ public class ExtensionServiceTest {
Element nextElement = (Element)next;
if ( childKind.equals(nextElement.getTagName()) && attributeValue.equals(nextElement.getAttribute(attributeName))) {
- results.add(next);
+ results.add(next);
}
}
}
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 3ce8db5a8..bb79011ac 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
@@ -63,7 +63,7 @@ public class TocFragmentServiceTest {
Node root = getTreeData(url);
Element[] UARoot = findNodeById(root,
"/org.eclipse.ua.tests/data/help/toc/root.xml");
- assertEquals(1, UARoot.length);
+ assertEquals(1, UARoot.length);
}
@Test
@@ -161,7 +161,7 @@ public class TocFragmentServiceTest {
if ( childKind.equals(nextElement.getTagName())
&& attributeValue.equals(nextElement.getAttribute(attributeName))) {
- results.add(next);
+ results.add(next);
}
}
}
@@ -182,13 +182,13 @@ public class TocFragmentServiceTest {
if ( childKind.equals(nextElement.getTagName()) ) {
String href = nextElement.getAttribute("href");
if (href != null) {
- int query = href.indexOf('?');
- if (query >= 0) {
- href = href.substring(0, query);
- }
- if (href.equals (attributeValue)) {
- results.add(next);
- }
+ int query = href.indexOf('?');
+ if (query >= 0) {
+ href = href.substring(0, query);
+ }
+ if (href.equals (attributeValue)) {
+ results.add(next);
+ }
}
}
}
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 37648f319..581538f8f 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
@@ -43,7 +43,7 @@ public class TestFrame extends AbstractFrame {
@Override
public boolean isVisible() {
return Platform.getPreferencesService().getBoolean
- (UserAssistanceTestPlugin.getPluginId(), "extraFrame", false, null);
+ (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 1cacb65cb..917d352b3 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
@@ -40,15 +40,15 @@ public class TestHelpToolbarFrame extends AbstractFrame {
return "*";
}
- @Override
+ @Override
public String getFrameAttributes() {
- return "\"marginwidth=\"0\" marginheight=\"0\" frameborder=\"0\" scrolling=\"no\""; //$NON-NLS-1$
- }
+ 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);
+ (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 6e3d69f3f..aed494884 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
@@ -53,7 +53,7 @@ public class TitleSearchButton extends AbstractButton {
@Override
public boolean isAddedToToolbar(String toolbarName) {
boolean addButton = Platform.getPreferencesService().getBoolean
- (UserAssistanceTestPlugin.getPluginId(), "extraButton", false, null);
+ (UserAssistanceTestPlugin.getPluginId(), "extraButton", false, null);
return (addButton & toolbarName.equals(AbstractButton.CONTENT_TOOLBAR));
}
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 042023dd2..c3af179a1 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
@@ -58,13 +58,13 @@ public class TitleSearchView extends AbstractView {
@Override
public boolean isVisible() {
return Platform.getPreferencesService().getBoolean
- (UserAssistanceTestPlugin.getPluginId(), "extraView", false, null);
+ (UserAssistanceTestPlugin.getPluginId(), "extraView", false, null);
}
@Override
public boolean isVisibleBasic() {
return Platform.getPreferencesService().getBoolean
- (UserAssistanceTestPlugin.getPluginId(), "extraView", false, null);
+ (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 ccadfbe51..3c5b9072a 100644
--- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/anchors/ExtensionReorderingTest.java
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/anchors/ExtensionReorderingTest.java
@@ -69,7 +69,7 @@ public class ExtensionReorderingTest {
/*
* Recursive test to test all permutations of integers 0-4 with no
* repeats.
- * @param next the next element that has not been filled in yet
+ * @param next the next element that has not been filled in yet
*/
private void tryAll(int next) {
for (int value = 0; value < numContributions; value++) {
@@ -89,8 +89,8 @@ public class ExtensionReorderingTest {
if (next + 1 == numContributions) {
count++;
if (count % cycle == 0) {
- testReordering(order);
- count = 0;
+ testReordering(order);
+ count = 0;
}
} else {
tryAll(next + 1);
@@ -126,67 +126,67 @@ public class ExtensionReorderingTest {
}
public void readIntroConfig() {
- IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] configElements = registry
- .getConfigurationElementsFor("org.eclipse.ui.intro.config");
+ IExtensionRegistry registry= Platform.getExtensionRegistry();
+ IConfigurationElement[] configElements = registry
+ .getConfigurationElementsFor("org.eclipse.ui.intro.config");
- config = getConfigurationFromAttribute(
- configElements, "introId", "org.eclipse.ua.tests.intro.anchors");
+ config = getConfigurationFromAttribute(
+ configElements, "introId", "org.eclipse.ua.tests.intro.anchors");
- introConfigExtensions = null;
+ introConfigExtensions = null;
- introConfigExtensions = getIntroConfigExtensions(
- "configId", "org.eclipse.ua.tests.intro.config.anchors");
+ introConfigExtensions = getIntroConfigExtensions(
+ "configId", "org.eclipse.ua.tests.intro.config.anchors");
}
private IConfigurationElement getConfigurationFromAttribute(
- IConfigurationElement[] configElements, String attributeName,
- String attributeValue) {
-
- // find all configs with given attribute and attribute value.
- IConfigurationElement[] filteredConfigElements = getConfigurationsFromAttribute(
- configElements, attributeName, attributeValue);
- // now validate that we got only one.
- IConfigurationElement config = ModelLoaderUtil
- .validateSingleContribution(filteredConfigElements, attributeName);
- return config;
+ IConfigurationElement[] configElements, String attributeName,
+ String attributeValue) {
+
+ // find all configs with given attribute and attribute value.
+ IConfigurationElement[] filteredConfigElements = getConfigurationsFromAttribute(
+ configElements, attributeName, attributeValue);
+ // now validate that we got only one.
+ IConfigurationElement config = ModelLoaderUtil
+ .validateSingleContribution(filteredConfigElements, attributeName);
+ return config;
}
protected IConfigurationElement[] getConfigurationsFromAttribute(
- IConfigurationElement[] configElements, String attributeName,
- String attributeValue) {
+ IConfigurationElement[] configElements, String attributeName,
+ String attributeValue) {
- // find all configs with given attribute and attribute value.
+ // find all configs with given attribute and attribute value.
Vector<IConfigurationElement> elements = new Vector<>();
- for (IConfigurationElement configElement : configElements) {
- String currentAttributeValue = configElement
- .getAttribute(attributeName);
- if (currentAttributeValue != null
- && currentAttributeValue.equals(attributeValue))
- elements.add(configElement);
- }
-
- // now return array.
- IConfigurationElement[] filteredConfigElements = new IConfigurationElement[elements
- .size()];
- elements.copyInto(filteredConfigElements);
-
- return filteredConfigElements;
- }
+ for (IConfigurationElement configElement : configElements) {
+ String currentAttributeValue = configElement
+ .getAttribute(attributeName);
+ if (currentAttributeValue != null
+ && currentAttributeValue.equals(attributeValue))
+ elements.add(configElement);
+ }
+
+ // now return array.
+ IConfigurationElement[] filteredConfigElements = new IConfigurationElement[elements
+ .size()];
+ elements.copyInto(filteredConfigElements);
+
+ return filteredConfigElements;
+ }
protected IConfigurationElement[] getIntroConfigExtensions(
- String attrributeName, String attributeValue) {
+ String attrributeName, String attributeValue) {
IExtensionRegistry registry= Platform.getExtensionRegistry();
- IConfigurationElement[] configExtensionElements = registry
- .getConfigurationElementsFor("org.eclipse.ui.intro.configExtension");
+ IConfigurationElement[] configExtensionElements = registry
+ .getConfigurationElementsFor("org.eclipse.ui.intro.configExtension");
- IConfigurationElement[] configExtensions = getConfigurationsFromAttribute(
- configExtensionElements, attrributeName, attributeValue);
+ IConfigurationElement[] configExtensions = getConfigurationsFromAttribute(
+ configExtensionElements, attrributeName, attributeValue);
- return configExtensions;
- }
+ return configExtensions;
+ }
@Test
public void testOrder123456() {
@@ -216,28 +216,28 @@ public class ExtensionReorderingTest {
AbstractIntroElement p3link = extn1.findChild("page3link");
assertNotNull(p3link);
if (elements >= 4) {
- IntroPage extn4 = (IntroPage) model.findChild("page4");
- assertNotNull(extn4);
+ IntroPage extn4 = (IntroPage) model.findChild("page4");
+ assertNotNull(extn4);
AbstractIntroElement p4link = extn2.findChild("page4link");
assertNotNull(p4link);
- if (elements >= 5) {
- IntroPage extn5 = (IntroPage) model.findChild("page5");
- assertNotNull(extn5);
+ if (elements >= 5) {
+ IntroPage extn5 = (IntroPage) model.findChild("page5");
+ assertNotNull(extn5);
AbstractIntroElement p5link = extn4.findChild("page5link");
AbstractIntroElement p5linkR = extn4.findChild("page5linkR");
if (elements == 5) {
- assertNotNull(p5link);
- assertNull(p5linkR);
+ assertNotNull(p5link);
+ assertNull(p5linkR);
} else {
- assertNull(p5link);
- assertNotNull(p5linkR);
- }
- }
+ assertNull(p5link);
+ assertNotNull(p5linkR);
+ }
+ }
}
if (elements >= 6) {
IntroPage extn6 = (IntroPage) model.findChild("page6");
- assertNotNull(extn6);
- extn6.getChildren();
+ assertNotNull(extn6);
+ extn6.getChildren();
AbstractIntroElement actionlinks = extn6.findChild("action-links");
AbstractIntroElement p5linkR = extn6.findChild("page5linkR");
assertNotNull(actionlinks);
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java
index e06949544..10a305d50 100644
--- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java
@@ -41,8 +41,8 @@ public class OpenIntroTest extends PerformanceTestCase {
super.setUp();
closeIntro();
// test extensions filter by this system property
- System.setProperty("org.eclipse.ua.tests.property.isTesting", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- ExtensionPointManager.getInst().setExtensionFilter(UserAssistanceTestPlugin.getPluginId());
+ System.setProperty("org.eclipse.ua.tests.property.isTesting", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ ExtensionPointManager.getInst().setExtensionFilter(UserAssistanceTestPlugin.getPluginId());
}
@Override
@@ -50,8 +50,8 @@ public class OpenIntroTest extends PerformanceTestCase {
super.tearDown();
closeIntro();
// test extensions filter by this system property
- System.setProperty("org.eclipse.ua.tests.property.isTesting", "false"); //$NON-NLS-1$ //$NON-NLS-2$
- ExtensionPointManager.getInst().setExtensionFilter(null);
+ System.setProperty("org.eclipse.ua.tests.property.isTesting", "false"); //$NON-NLS-1$ //$NON-NLS-2$
+ ExtensionPointManager.getInst().setExtensionFilter(null);
}
public void testOpenIntro() throws Exception {
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java
index ec1d1a200..293b327e7 100644
--- a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/util/IntroModelSerializer.java
@@ -39,324 +39,324 @@ public class IntroModelSerializer {
private StringBuilder buffer;
- public IntroModelSerializer(IntroModelRoot root) {
+ public IntroModelSerializer(IntroModelRoot root) {
this.buffer = new StringBuilder();
- printModelRootInfo(root, buffer);
-
- // Root Page
- IntroHomePage rootPage = root.getRootPage();
- printHomePage(rootPage, buffer);
- printPageChildren(rootPage, buffer);
-
- IntroPage[] pages = root.getPages();
- printPages(pages, buffer);
-
- buffer.append("\n\n"); //$NON-NLS-1$
- printModelFlagTests(root, buffer);
- }
-
- /*
- * Removes any platform/machine-specific paths from the given URL. This is
- * used to remove absolute paths from the serialized model in order to compare
- * results in automated tests.
- */
- private String filterURL(String url) {
- if (url != null && url.startsWith("file:/")) {
- return "file:/" + "<filtered>" + url.substring(url.lastIndexOf('/'));
- }
- return url;
- }
+ printModelRootInfo(root, buffer);
+
+ // Root Page
+ IntroHomePage rootPage = root.getRootPage();
+ printHomePage(rootPage, buffer);
+ printPageChildren(rootPage, buffer);
+
+ IntroPage[] pages = root.getPages();
+ printPages(pages, buffer);
+
+ buffer.append("\n\n"); //$NON-NLS-1$
+ printModelFlagTests(root, buffer);
+ }
+
+ /*
+ * Removes any platform/machine-specific paths from the given URL. This is
+ * used to remove absolute paths from the serialized model in order to compare
+ * results in automated tests.
+ */
+ private String filterURL(String url) {
+ if (url != null && url.startsWith("file:/")) {
+ return "file:/" + "<filtered>" + url.substring(url.lastIndexOf('/'));
+ }
+ return url;
+ }
private void printModelRootInfo(IntroModelRoot model, StringBuilder text) {
- text.append("Intro Model Content:"); //$NON-NLS-1$
- text.append("\n======================"); //$NON-NLS-1$
- text.append("\n\nModel has valid config = " + model.hasValidConfig()); //$NON-NLS-1$
- text.append("\nPresentation type = " //$NON-NLS-1$
- + model.getPresentation().getType());
- text.append("\nHome page id = " //$NON-NLS-1$
- + model.getPresentation().getHomePageId());
- IntroHead headContent = model.getPresentation().getHead();
- if (headContent != null)
- text.append("\nPresentation Shared Head = " + headContent.getSrc()); //$NON-NLS-1$
- text.append("\nNumber of pages (not including Root Page) = " //$NON-NLS-1$
- + model.getPages().length);
- text.append("\nNumber of shared groups = " //$NON-NLS-1$
- + model.getChildrenOfType(AbstractIntroElement.GROUP).length);
- text
- .append("\nNumber of unresolved extensions = " //$NON-NLS-1$
- + model
- .getChildrenOfType(AbstractIntroElement.CONTAINER_EXTENSION).length);
- }
-
- /**
- * @param text
- * @param root
- */
+ text.append("Intro Model Content:"); //$NON-NLS-1$
+ text.append("\n======================"); //$NON-NLS-1$
+ text.append("\n\nModel has valid config = " + model.hasValidConfig()); //$NON-NLS-1$
+ text.append("\nPresentation type = " //$NON-NLS-1$
+ + model.getPresentation().getType());
+ text.append("\nHome page id = " //$NON-NLS-1$
+ + model.getPresentation().getHomePageId());
+ IntroHead headContent = model.getPresentation().getHead();
+ if (headContent != null)
+ text.append("\nPresentation Shared Head = " + headContent.getSrc()); //$NON-NLS-1$
+ text.append("\nNumber of pages (not including Root Page) = " //$NON-NLS-1$
+ + model.getPages().length);
+ text.append("\nNumber of shared groups = " //$NON-NLS-1$
+ + model.getChildrenOfType(AbstractIntroElement.GROUP).length);
+ text
+ .append("\nNumber of unresolved extensions = " //$NON-NLS-1$
+ + model
+ .getChildrenOfType(AbstractIntroElement.CONTAINER_EXTENSION).length);
+ }
+
+ /**
+ * @param text
+ * @param root
+ */
private void printHomePage(AbstractIntroPage rootPage, StringBuilder text) {
- text.append("\n\nHOME PAGE: "); //$NON-NLS-1$
- text.append("\n--------------"); //$NON-NLS-1$
- text
- .append("\n\tis dynamic= " + ((IntroModelRoot) rootPage.getParent()).isDynamic()); //$NON-NLS-1$
-
- text.append("\n\tid = " + rootPage.getId()); //$NON-NLS-1$
- text.append("\n\ttitle = " + rootPage.getTitle()); //$NON-NLS-1$
- text.append("\n\tstyle = " + filterURL(rootPage.getStyle())); //$NON-NLS-1$
- text.append("\n\talt-style = " + filterURL(rootPage.getAltStyle())); //$NON-NLS-1$
- text.append("\n\turl = " + filterURL(rootPage.getUrl())); //$NON-NLS-1$
- text.append("\n\tstyle-id = " + rootPage.getStyleId()); //$NON-NLS-1$
- printPageStyles(rootPage, text);
- }
+ text.append("\n\nHOME PAGE: "); //$NON-NLS-1$
+ text.append("\n--------------"); //$NON-NLS-1$
+ text
+ .append("\n\tis dynamic= " + ((IntroModelRoot) rootPage.getParent()).isDynamic()); //$NON-NLS-1$
+
+ text.append("\n\tid = " + rootPage.getId()); //$NON-NLS-1$
+ text.append("\n\ttitle = " + rootPage.getTitle()); //$NON-NLS-1$
+ text.append("\n\tstyle = " + filterURL(rootPage.getStyle())); //$NON-NLS-1$
+ text.append("\n\talt-style = " + filterURL(rootPage.getAltStyle())); //$NON-NLS-1$
+ text.append("\n\turl = " + filterURL(rootPage.getUrl())); //$NON-NLS-1$
+ text.append("\n\tstyle-id = " + rootPage.getStyleId()); //$NON-NLS-1$
+ printPageStyles(rootPage, text);
+ }
private void printPageStyles(AbstractIntroPage page, StringBuilder text) {
- text.append("\n\tpage styles are = "); //$NON-NLS-1$
- String[] styles = page.getStyles();
- for (String style : styles)
+ text.append("\n\tpage styles are = "); //$NON-NLS-1$
+ String[] styles = page.getStyles();
+ for (String style : styles)
text.append(filterURL(style + "\n\t\t\t")); //$NON-NLS-1$
- text.append("\n\tpage alt-styles are = "); //$NON-NLS-1$
+ text.append("\n\tpage alt-styles are = "); //$NON-NLS-1$
final Map<String, Bundle> altStylesHashtable = page.getAltStyles();
- if (altStylesHashtable == null)
- return;
-
- Set<String> set = altStylesHashtable.keySet();
- String[] sorted = new String[set.size()];
- set.toArray(sorted);
- for (int i=0;i<sorted.length;++i) {
- Bundle bundle = altStylesHashtable.get(sorted[i]);
- sorted[i] = filterURL(sorted[i]) + " from " + bundle.getSymbolicName(); //$NON-NLS-1$
- }
- Arrays.sort(sorted);
-
- for (String element : sorted) {
- text.append(element + "\n\t\t"); //$NON-NLS-1$
- }
- }
+ if (altStylesHashtable == null)
+ return;
+
+ Set<String> set = altStylesHashtable.keySet();
+ String[] sorted = new String[set.size()];
+ set.toArray(sorted);
+ for (int i=0;i<sorted.length;++i) {
+ Bundle bundle = altStylesHashtable.get(sorted[i]);
+ sorted[i] = filterURL(sorted[i]) + " from " + bundle.getSymbolicName(); //$NON-NLS-1$
+ }
+ Arrays.sort(sorted);
+
+ for (String element : sorted) {
+ text.append(element + "\n\t\t"); //$NON-NLS-1$
+ }
+ }
private void printPageChildren(AbstractIntroPage page, StringBuilder text) {
- text.append("\n\tpage children = " + page.getChildren().length); //$NON-NLS-1$
- text.append("\n"); //$NON-NLS-1$
- printContainerChildren(page, text, "\n\t\t"); //$NON-NLS-1$
+ text.append("\n\tpage children = " + page.getChildren().length); //$NON-NLS-1$
+ text.append("\n"); //$NON-NLS-1$
+ printContainerChildren(page, text, "\n\t\t"); //$NON-NLS-1$
- }
+ }
- private void printContainerChildren(AbstractIntroContainer container,
+ private void printContainerChildren(AbstractIntroContainer container,
StringBuilder text, String indent) {
- AbstractIntroElement[] children = container.getChildren();
- 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) element, indent);
- break;
- case AbstractIntroElement.LINK:
- printLink(text, (IntroLink) element, indent);
- break;
- case AbstractIntroElement.TEXT:
- printText(text, (IntroText) element, indent);
- break;
- case AbstractIntroElement.IMAGE:
- printImage(text, (IntroImage) element, indent);
- break;
- case AbstractIntroElement.HTML:
- printHtml(text, (IntroHTML) element, indent);
- break;
- case AbstractIntroElement.INCLUDE:
- printInclude(text, (IntroInclude) element, indent);
- break;
- case AbstractIntroElement.HEAD:
- printHead(text, (IntroHead) element, indent);
- break;
- case AbstractIntroElement.PAGE_TITLE:
- printPageTitle(text, (IntroPageTitle) element, indent);
- break;
- case AbstractIntroElement.ANCHOR:
- printAnchor(text, (IntroAnchor) element, indent);
- break;
- case AbstractIntroElement.CONTENT_PROVIDER:
- printContentProvidor(text, (IntroContentProvider) element,
- indent);
- break;
-
- }
- }
- }
+ AbstractIntroElement[] children = container.getChildren();
+ 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) element, indent);
+ break;
+ case AbstractIntroElement.LINK:
+ printLink(text, (IntroLink) element, indent);
+ break;
+ case AbstractIntroElement.TEXT:
+ printText(text, (IntroText) element, indent);
+ break;
+ case AbstractIntroElement.IMAGE:
+ printImage(text, (IntroImage) element, indent);
+ break;
+ case AbstractIntroElement.HTML:
+ printHtml(text, (IntroHTML) element, indent);
+ break;
+ case AbstractIntroElement.INCLUDE:
+ printInclude(text, (IntroInclude) element, indent);
+ break;
+ case AbstractIntroElement.HEAD:
+ printHead(text, (IntroHead) element, indent);
+ break;
+ case AbstractIntroElement.PAGE_TITLE:
+ printPageTitle(text, (IntroPageTitle) element, indent);
+ break;
+ case AbstractIntroElement.ANCHOR:
+ printAnchor(text, (IntroAnchor) element, indent);
+ break;
+ case AbstractIntroElement.CONTENT_PROVIDER:
+ printContentProvidor(text, (IntroContentProvider) element,
+ indent);
+ break;
+
+ }
+ }
+ }
private void printGroup(StringBuilder text, IntroGroup group, String indent) {
- text.append(indent + "GROUP: id = " + group.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "label = " + group.getLabel()); //$NON-NLS-1$
- text.append(indent + "children = " + group.getChildren().length); //$NON-NLS-1$
- text.append(indent + "style-id = " + group.getStyleId()); //$NON-NLS-1$
- printContainerChildren(group, text, indent + "\t\t"); //$NON-NLS-1$
- }
+ text.append(indent + "GROUP: id = " + group.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "label = " + group.getLabel()); //$NON-NLS-1$
+ text.append(indent + "children = " + group.getChildren().length); //$NON-NLS-1$
+ text.append(indent + "style-id = " + group.getStyleId()); //$NON-NLS-1$
+ printContainerChildren(group, text, indent + "\t\t"); //$NON-NLS-1$
+ }
private void printLink(StringBuilder text, IntroLink link, String indent) {
- text.append(indent + "LINK: id = " + link.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "label = " + link.getLabel()); //$NON-NLS-1$
- text.append(indent + "text = " + link.getText()); //$NON-NLS-1$
- text.append(indent + "url = " + link.getUrl()); //$NON-NLS-1$
- text.append(indent + "style-id = " + link.getStyleId()); //$NON-NLS-1$
- }
+ text.append(indent + "LINK: id = " + link.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "label = " + link.getLabel()); //$NON-NLS-1$
+ text.append(indent + "text = " + link.getText()); //$NON-NLS-1$
+ text.append(indent + "url = " + link.getUrl()); //$NON-NLS-1$
+ text.append(indent + "style-id = " + link.getStyleId()); //$NON-NLS-1$
+ }
private void printText(StringBuilder text, IntroText introText, String indent) {
- text.append(indent + "TEXT: id = " + introText.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "text = " + introText.getText()); //$NON-NLS-1$
- text.append(indent + "style-id = " + introText.getStyleId()); //$NON-NLS-1$
- }
+ text.append(indent + "TEXT: id = " + introText.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "text = " + introText.getText()); //$NON-NLS-1$
+ text.append(indent + "style-id = " + introText.getStyleId()); //$NON-NLS-1$
+ }
private void printImage(StringBuilder text, IntroImage image, String indent) {
- text.append(indent + "IMAGE: id = " + image.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "src = " + image.getSrc()); //$NON-NLS-1$
- text.append(indent + "alt = " + image.getAlt()); //$NON-NLS-1$
- text.append(indent + "style-id = " + image.getStyleId()); //$NON-NLS-1$
- }
+ text.append(indent + "IMAGE: id = " + image.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "src = " + image.getSrc()); //$NON-NLS-1$
+ text.append(indent + "alt = " + image.getAlt()); //$NON-NLS-1$
+ text.append(indent + "style-id = " + image.getStyleId()); //$NON-NLS-1$
+ }
private void printHtml(StringBuilder text, IntroHTML html, String indent) {
- text.append(indent + "HTML: id = " + html.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "src = " + html.getSrc()); //$NON-NLS-1$
- text.append(indent + "isInlined = " + html.isInlined()); //$NON-NLS-1$
- text.append(indent + "style-id = " + html.getStyleId()); //$NON-NLS-1$
- if (html.getIntroImage() != null)
- printImage(text, html.getIntroImage(), indent + "\t\t"); //$NON-NLS-1$
- if (html.getIntroText() != null)
- printText(text, html.getIntroText(), indent + "\t\t"); //$NON-NLS-1$
-
- }
+ text.append(indent + "HTML: id = " + html.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "src = " + html.getSrc()); //$NON-NLS-1$
+ text.append(indent + "isInlined = " + html.isInlined()); //$NON-NLS-1$
+ text.append(indent + "style-id = " + html.getStyleId()); //$NON-NLS-1$
+ if (html.getIntroImage() != null)
+ printImage(text, html.getIntroImage(), indent + "\t\t"); //$NON-NLS-1$
+ if (html.getIntroText() != null)
+ printText(text, html.getIntroText(), indent + "\t\t"); //$NON-NLS-1$
+
+ }
private void printInclude(StringBuilder text, IntroInclude include,
- String indent) {
- text.append(indent + "INCLUDE: configId = " + include.getConfigId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "path = " + include.getPath()); //$NON-NLS-1$
- text.append(indent + "merge-style = " + include.getMergeStyle()); //$NON-NLS-1$
- }
+ String indent) {
+ text.append(indent + "INCLUDE: configId = " + include.getConfigId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "path = " + include.getPath()); //$NON-NLS-1$
+ text.append(indent + "merge-style = " + include.getMergeStyle()); //$NON-NLS-1$
+ }
private void printHead(StringBuilder text, IntroHead head, String indent) {
- text.append(indent + "HEAD: src = " + head.getSrc()); //$NON-NLS-1$
- }
+ text.append(indent + "HEAD: src = " + head.getSrc()); //$NON-NLS-1$
+ }
private void printPageTitle(StringBuilder text, IntroPageTitle title,
- String indent) {
- text.append(indent + "TITLE: id = " + title.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "title = " + title.getTitle()); //$NON-NLS-1$
- text.append(indent + "style-id = " + title.getStyleId()); //$NON-NLS-1$
- }
+ String indent) {
+ text.append(indent + "TITLE: id = " + title.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "title = " + title.getTitle()); //$NON-NLS-1$
+ text.append(indent + "style-id = " + title.getStyleId()); //$NON-NLS-1$
+ }
private void printAnchor(StringBuilder text, IntroAnchor anchor,
- String indent) {
- text.append(indent + "ANCHOR: id = " + anchor.getId()); //$NON-NLS-1$
- }
+ String indent) {
+ text.append(indent + "ANCHOR: id = " + anchor.getId()); //$NON-NLS-1$
+ }
private void printContentProvidor(StringBuilder text,
- IntroContentProvider provider, String indent) {
- text.append(indent + "CONTENT PROVIDER: id = " + provider.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "class = " + provider.getClassName()); //$NON-NLS-1$
- text.append(indent + "pluginId = " + provider.getPluginId()); //$NON-NLS-1$
- if (provider.getIntroText() != null)
- printText(text, provider.getIntroText(), indent + "\t\t"); //$NON-NLS-1$
-
- }
-
- /**
- * Appends a given page's categories to the Text buffer.
- *
- * @param text
- */
+ IntroContentProvider provider, String indent) {
+ text.append(indent + "CONTENT PROVIDER: id = " + provider.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "class = " + provider.getClassName()); //$NON-NLS-1$
+ text.append(indent + "pluginId = " + provider.getPluginId()); //$NON-NLS-1$
+ if (provider.getIntroText() != null)
+ printText(text, provider.getIntroText(), indent + "\t\t"); //$NON-NLS-1$
+
+ }
+
+ /**
+ * Appends a given page's categories to the Text buffer.
+ *
+ * @param text
+ */
private void printPages(IntroPage[] pages, StringBuilder text) {
- for (IntroPage page : pages) {
- text.append("\n\nPAGE id = " + page.getId()); //$NON-NLS-1$
- text.append("\n----------"); //$NON-NLS-1$
- 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);
- }
- }
+ for (IntroPage page : pages) {
+ text.append("\n\nPAGE id = " + page.getId()); //$NON-NLS-1$
+ text.append("\n----------"); //$NON-NLS-1$
+ 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);
+ }
+ }
private void printModelFlagTests(IntroModelRoot model, StringBuilder text) {
- text.append("Model Flag Tests: "); //$NON-NLS-1$
- text.append("\n----------------"); //$NON-NLS-1$
- if (model.getPages().length == 0) {
- text.append("\nNo first page in model\n\n"); //$NON-NLS-1$
- return;
- }
- IntroPage firstPage = model.getPages()[0];
- if ("standby".equals(firstPage.getId())) {
- firstPage = model.getPages()[1];
- }
- text.append("\n\t\tFirst page children are: "); //$NON-NLS-1$
- text
- .append("\n\t\t\tGroups: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.GROUP).length);
- text
- .append("\n\t\t\tLinks: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.LINK).length);
- text
- .append("\n\t\t\tTexts: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.TEXT).length);
- text
- .append("\n\t\t\tHTMLs: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.HTML).length);
- text
- .append("\n\t\t\tImages: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.IMAGE).length);
- text
- .append("\n\t\t\tIncludes: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.INCLUDE).length);
- text
- .append("\n\t\t\tPage Titles: " //$NON-NLS-1$
- + firstPage
- .getChildrenOfType(AbstractIntroElement.PAGE_TITLE).length);
- text
- .append("\n\t\t\tPage Heads: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.HEAD).length);
- text
- .append("\n\t\t\tModel Elements: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.ELEMENT).length);
- text
- .append("\n\t\t\tContainers: " //$NON-NLS-1$
- + firstPage
- .getChildrenOfType(AbstractIntroElement.ABSTRACT_CONTAINER).length);
- text
- .append("\n\t\t\tAll Pages: " //$NON-NLS-1$
- + firstPage
- .getChildrenOfType(AbstractIntroElement.ABSTRACT_PAGE).length);
- text
- .append("\n\t\t\tAnchors: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.ANCHOR).length);
- text
- .append("\n\t\t\tContent providers: " //$NON-NLS-1$
- + firstPage
- .getChildrenOfType(AbstractIntroElement.CONTENT_PROVIDER).length);
- text
- .append("\n\t\t\tElements with Text child(AbstractTextElemets): " //$NON-NLS-1$
- + firstPage
- .getChildrenOfType(AbstractIntroElement.ABSTRACT_TEXT).length);
-
- AbstractIntroElement[] linksAndGroups = (AbstractIntroElement[]) firstPage
- .getChildrenOfType(AbstractIntroElement.GROUP
- | AbstractIntroElement.LINK);
- text.append("\n\t\t\tGroups and Links: " + linksAndGroups.length); //$NON-NLS-1$
- }
-
- /**
- * @return Returns the textUI.
- */
- @Override
+ text.append("Model Flag Tests: "); //$NON-NLS-1$
+ text.append("\n----------------"); //$NON-NLS-1$
+ if (model.getPages().length == 0) {
+ text.append("\nNo first page in model\n\n"); //$NON-NLS-1$
+ return;
+ }
+ IntroPage firstPage = model.getPages()[0];
+ if ("standby".equals(firstPage.getId())) {
+ firstPage = model.getPages()[1];
+ }
+ text.append("\n\t\tFirst page children are: "); //$NON-NLS-1$
+ text
+ .append("\n\t\t\tGroups: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.GROUP).length);
+ text
+ .append("\n\t\t\tLinks: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.LINK).length);
+ text
+ .append("\n\t\t\tTexts: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.TEXT).length);
+ text
+ .append("\n\t\t\tHTMLs: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.HTML).length);
+ text
+ .append("\n\t\t\tImages: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.IMAGE).length);
+ text
+ .append("\n\t\t\tIncludes: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.INCLUDE).length);
+ text
+ .append("\n\t\t\tPage Titles: " //$NON-NLS-1$
+ + firstPage
+ .getChildrenOfType(AbstractIntroElement.PAGE_TITLE).length);
+ text
+ .append("\n\t\t\tPage Heads: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.HEAD).length);
+ text
+ .append("\n\t\t\tModel Elements: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.ELEMENT).length);
+ text
+ .append("\n\t\t\tContainers: " //$NON-NLS-1$
+ + firstPage
+ .getChildrenOfType(AbstractIntroElement.ABSTRACT_CONTAINER).length);
+ text
+ .append("\n\t\t\tAll Pages: " //$NON-NLS-1$
+ + firstPage
+ .getChildrenOfType(AbstractIntroElement.ABSTRACT_PAGE).length);
+ text
+ .append("\n\t\t\tAnchors: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.ANCHOR).length);
+ text
+ .append("\n\t\t\tContent providers: " //$NON-NLS-1$
+ + firstPage
+ .getChildrenOfType(AbstractIntroElement.CONTENT_PROVIDER).length);
+ text
+ .append("\n\t\t\tElements with Text child(AbstractTextElemets): " //$NON-NLS-1$
+ + firstPage
+ .getChildrenOfType(AbstractIntroElement.ABSTRACT_TEXT).length);
+
+ AbstractIntroElement[] linksAndGroups = (AbstractIntroElement[]) firstPage
+ .getChildrenOfType(AbstractIntroElement.GROUP
+ | AbstractIntroElement.LINK);
+ text.append("\n\t\t\tGroups and Links: " + linksAndGroups.length); //$NON-NLS-1$
+ }
+
+ /**
+ * @return Returns the textUI.
+ */
+ @Override
public String toString() {
- return buffer.toString();
- }
+ return buffer.toString();
+ }
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/ICheatSheetEvent.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/ICheatSheetEvent.java
index b7f4df239..6ef8ed059 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/ICheatSheetEvent.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/cheatsheets/ICheatSheetEvent.java
@@ -33,14 +33,14 @@ public interface ICheatSheetEvent {
/**
* Event type constant (value {@value}) indicating that
* the cheat sheet was opened. This is the first event
- * in the life of a running cheat sheet.
+ * in the life of a running cheat sheet.
*/
public static final int CHEATSHEET_OPENED = 0;
/**
* Event type constant (value {@value}) indicating that
* the cheat sheet was closed. This is the last event
- * in the life of a running cheat sheet.
+ * in the life of a running cheat sheet.
*/
public static final int CHEATSHEET_CLOSED = 1;
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java
index c8fc5c47a..2aa5bc648 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/ActionRunner.java
@@ -97,8 +97,8 @@ public class ActionRunner {
if (status.isOK() && listenerFired[0]) {
if (!listenerResult[0]) {
- status =new Status(IStatus.WARNING, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, Messages.ACTION_FAILED, null);
- }
+ status =new Status(IStatus.WARNING, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, IStatus.OK, Messages.ACTION_FAILED, null);
+ }
}
return status;
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatsheetSearchParticipant.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatsheetSearchParticipant.java
index 287820267..312e10633 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatsheetSearchParticipant.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CheatsheetSearchParticipant.java
@@ -76,7 +76,7 @@ public class CheatsheetSearchParticipant extends SearchParticipantXML {
HashSet<String> set = new HashSet<>();
for (IConfigurationElement element : elements) {
if (element.getName().equals(CheatSheetRegistryReader.TAG_CHEATSHEET)) {
- set.add(element.getContributor().getName());
+ set.add(element.getContributor().getName());
}
}
return set;
@@ -93,12 +93,12 @@ public class CheatsheetSearchParticipant extends SearchParticipantXML {
data.setTitle(attributes.getValue(ICompositeCheatsheetTags.NAME));
} else if (name.equals(IParserTags.ITEM)) {
data.addText(attributes.getValue(IParserTags.TITLE));
- } else if (name.equals(IParserTags.SUBITEM)) {
- data.addText(attributes.getValue(IParserTags.LABEL));
- } else if (name.equals(ICompositeCheatsheetTags.TASK )
- || name.equals(ICompositeCheatsheetTags.TASK_GROUP)) {
- data.addText(attributes.getValue(ICompositeCheatsheetTags.NAME));
- }
+ } else if (name.equals(IParserTags.SUBITEM)) {
+ data.addText(attributes.getValue(IParserTags.LABEL));
+ } else if (name.equals(ICompositeCheatsheetTags.TASK )
+ || name.equals(ICompositeCheatsheetTags.TASK_GROUP)) {
+ data.addText(attributes.getValue(ICompositeCheatsheetTags.NAME));
+ }
}
@Override
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java
index a8f2484fb..8dd33fed1 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/CommandRunner.java
@@ -38,9 +38,9 @@ public class CommandRunner {
IWorkbench wb = PlatformUI.getWorkbench();
if (wb != null) {
ICommandService serviceObject = wb.getAdapter(ICommandService.class);
- if (serviceObject != null) {
+ if (serviceObject != null) {
return serviceObject;
- }
+ }
}
return null;
}
@@ -49,9 +49,9 @@ public class CommandRunner {
IWorkbench wb = PlatformUI.getWorkbench();
if (wb != null) {
IHandlerService serviceObject = wb.getAdapter(IHandlerService.class);
- if (serviceObject != null) {
+ if (serviceObject != null) {
return serviceObject;
- }
+ }
}
return null;
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ConfirmRestartDialog.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ConfirmRestartDialog.java
index 853132c26..b1577f825 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ConfirmRestartDialog.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ConfirmRestartDialog.java
@@ -79,7 +79,7 @@ public class ConfirmRestartDialog extends Dialog {
private TreeLabelProvider treeLabelProvider;
protected ConfirmRestartDialog(Shell parentShell, AbstractTask[] restartTasks,
- TreeLabelProvider treeLabelProvider) {
+ TreeLabelProvider treeLabelProvider) {
super(parentShell);
this.tasks = restartTasks;
this.treeLabelProvider = treeLabelProvider;
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ResetTaskAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ResetTaskAction.java
index 9f0f7e449..7768d2276 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ResetTaskAction.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/ResetTaskAction.java
@@ -33,7 +33,7 @@ public class ResetTaskAction extends Action {
private AbstractTask task;
public ResetTaskAction(ICompositeCheatSheetTask task) {
- this.task = (AbstractTask) task;
+ this.task = (AbstractTask) task;
this.setText(Messages.COMPOSITE_MENU_RESET);
IPath path = CheatSheetPlugin.ICONS_PATH.append(CheatSheetPlugin.T_ELCL).append("return_to_start.png");//$NON-NLS-1$
ImageDescriptor restartImage = CheatSheetPlugin.createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), path);
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/RestartAllAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/RestartAllAction.java
index 049389309..fc78617e3 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/RestartAllAction.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/RestartAllAction.java
@@ -29,7 +29,7 @@ public class RestartAllAction extends Action {
private ICompositeCheatSheet model;
public RestartAllAction(ICompositeCheatSheet model) {
- this.model = model;
+ this.model = model;
this.setText(Messages.RESTART_ALL_MENU);
IPath path = CheatSheetPlugin.ICONS_PATH.append(CheatSheetPlugin.T_ELCL).append("restart_all.png");//$NON-NLS-1$
ImageDescriptor restartImage = CheatSheetPlugin.createImageDescriptor(CheatSheetPlugin.getPlugin().getBundle(), path);
@@ -39,7 +39,7 @@ public class RestartAllAction extends Action {
@Override
public void run() {
if (confirmRestart()) {
- ((CompositeCheatSheetModel)model).resetAllTasks(null);
+ ((CompositeCheatSheetModel)model).resetAllTasks(null);
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/SkipAction.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/SkipAction.java
index f5f1a9471..690c2f3c6 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/SkipAction.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/SkipAction.java
@@ -37,7 +37,7 @@ public class SkipAction extends Action {
@Override
public void run() {
- task.setState(ICompositeCheatSheetTask.SKIPPED);
+ task.setState(ICompositeCheatSheetTask.SKIPPED);
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java
index f98dcd45d..3f69ce531 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeExplorerMenu.java
@@ -53,13 +53,13 @@ public class TreeExplorerMenu {
if (selectedTask == null) return;
// Start
- StartAction startAction = new StartAction(selectedTask);
- startAction.setEnabled(TaskStateUtilities.isStartEnabled(selectedTask));
+ StartAction startAction = new StartAction(selectedTask);
+ startAction.setEnabled(TaskStateUtilities.isStartEnabled(selectedTask));
manager.add(startAction);
// Skip
- SkipAction skipAction = new SkipAction(selectedTask);
- skipAction.setEnabled(TaskStateUtilities.isSkipEnabled(selectedTask));
+ SkipAction skipAction = new SkipAction(selectedTask);
+ skipAction.setEnabled(TaskStateUtilities.isSkipEnabled(selectedTask));
manager.add(skipAction);
// Restart
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeLabelProvider.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeLabelProvider.java
index 201aaa701..8df69b103 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeLabelProvider.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/explorer/TreeLabelProvider.java
@@ -72,7 +72,7 @@ public class TreeLabelProvider extends LabelProvider {
if (obj instanceof ICompositeCheatSheetTask) {
result = ((ICompositeCheatSheetTask) obj).getName();
} else {
- result = obj.toString();
+ result = obj.toString();
}
if (result == null) {
result = ""; //$NON-NLS-1$
@@ -98,7 +98,7 @@ public class TreeLabelProvider extends LabelProvider {
if (isBlocked) {
return images.getImage(BLOCKED);
}
- return images.getImage(state);
+ return images.getImage(state);
}
/**
@@ -109,28 +109,28 @@ public class TreeLabelProvider extends LabelProvider {
private ImageSet createImages(String kind) {
ImageSet images = new ImageSet();
ImageDescriptor desc = getPredefinedImageDescriptor(kind, true);
- if (desc == null) {
- desc = TaskEditorManager.getInstance().getImageDescriptor(kind);
- }
+ if (desc == null) {
+ desc = TaskEditorManager.getInstance().getImageDescriptor(kind);
+ }
if (desc != null) {
Image baseImage = desc.createImage();
images.put(ICompositeCheatSheetTask.NOT_STARTED, baseImage);
createImageWithOverlay(ICompositeCheatSheetTask.IN_PROGRESS,
"$nl$/icons/ovr16/task_in_progress.png", //$NON-NLS-1$
- images,
- desc);
+ images,
+ desc);
createImageWithOverlay(ICompositeCheatSheetTask.SKIPPED,
"$nl$/icons/ovr16/task_skipped.png", //$NON-NLS-1$
- images,
- desc);
+ images,
+ desc);
createDisabledImage(kind, BLOCKED,
- images,
- baseImage);
+ images,
+ baseImage);
createImageWithOverlay(ICompositeCheatSheetTask.COMPLETED,
"$nl$/icons/ovr16/task_complete.png", //$NON-NLS-1$
- images,
- desc);
+ images,
+ desc);
}
return images;
@@ -177,7 +177,7 @@ public class TreeLabelProvider extends LabelProvider {
if (desc != null) {
disabledImage = desc.createImage();
} else {
- disabledImage = createGrayedImage(baseImage);
+ disabledImage = createGrayedImage(baseImage);
}
images.put(state, disabledImage);
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/AbstractTask.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/AbstractTask.java
index f37fa9c32..a43bb33da 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/AbstractTask.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/AbstractTask.java
@@ -164,7 +164,7 @@ public abstract class AbstractTask implements ICompositeCheatSheetTask {
* @param state
*/
public void setState(int state) {
- setStateNoNotify(state);
+ setStateNoNotify(state);
model.sendTaskChangeEvents();
}
@@ -177,7 +177,7 @@ public abstract class AbstractTask implements ICompositeCheatSheetTask {
public void setStateNoNotify(int state) {
this.state = state;
if (parent != null) {
- parent.checkState();
+ parent.checkState();
}
model.stateChanged(this);
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java
index d3524b010..c30892fae 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/BlockedTaskFinder.java
@@ -35,8 +35,8 @@ public class BlockedTaskFinder {
*
* This takes several steps.
* <li> If a group is completed, skipped or reset add any non-started children.
- * <li> Determine all successors of tasks whose state has changed that are not in the change set
- * <li> Add the successor and its children to the list if not started
+ * <li> Determine all successors of tasks whose state has changed that are not in the change set
+ * <li> Add the successor and its children to the list if not started
*/
public Set<ICompositeCheatSheetTask> findBlockedTaskChanges(Set<ICompositeCheatSheetTask> stateChangedTasks) {
@@ -50,7 +50,7 @@ public class BlockedTaskFinder {
private void visitChangedTasks() {
for (ICompositeCheatSheetTask nextTask : stateChangedTasks) {
if (nextTask.getState() != ICompositeCheatSheetTask.IN_PROGRESS) {
- findUnstartedChildren(nextTask);
+ findUnstartedChildren(nextTask);
}
}
}
@@ -64,10 +64,10 @@ public class BlockedTaskFinder {
for (ICompositeCheatSheetTask nextChild : children) {
// Ignore if this task has been seen before
if ((!stateChangedTasks.contains(nextChild)) && !impactedTasks.contains(nextChild)) {
- if (nextChild.getState() == ICompositeCheatSheetTask.NOT_STARTED) {
- impactedTasks.add(nextChild);
- }
- findUnstartedChildren(nextChild);
+ if (nextChild.getState() == ICompositeCheatSheetTask.NOT_STARTED) {
+ impactedTasks.add(nextChild);
+ }
+ findUnstartedChildren(nextChild);
}
}
}
@@ -80,7 +80,7 @@ public class BlockedTaskFinder {
if (nextSuccessor.getState() == ICompositeCheatSheetTask.NOT_STARTED) {
impactedTasks.add(nextSuccessor);
}
- findUnstartedChildren(nextSuccessor);
+ findUnstartedChildren(nextSuccessor);
}
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java
index a1cdd607c..43fb1654d 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetModel.java
@@ -47,9 +47,9 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh
public CompositeCheatSheetModel(String name, String description, String explorerId) {
this.name = name;
- this.description = description;
- this.explorerId = explorerId;
- this.dependencies = new TaskDependencies();
+ this.description = description;
+ this.explorerId = explorerId;
+ this.dependencies = new TaskDependencies();
}
public String getName() {
@@ -150,32 +150,32 @@ public class CompositeCheatSheetModel extends Observable implements ICompositeCh
*/
private void resetTask(ICompositeCheatSheetTask task) {
if (task instanceof EditableTask) {
- EditableTask editable = (EditableTask)task;
+ EditableTask editable = (EditableTask)task;
editable.reset();
if (saveHelper != null) {
- saveHelper.clearTaskMemento(task.getId());
+ saveHelper.clearTaskMemento(task.getId());
}
} else if (task instanceof TaskGroup) {
TaskGroup group = (TaskGroup)task;
- ICompositeCheatSheetTask[] subtasks = group.getSubtasks();
+ ICompositeCheatSheetTask[] subtasks = group.getSubtasks();
for (ICompositeCheatSheetTask subtask : subtasks) {
resetTask(subtask);
- }
- group.setStateNoNotify(ICompositeCheatSheetTask.NOT_STARTED);
+ }
+ group.setStateNoNotify(ICompositeCheatSheetTask.NOT_STARTED);
}
}
public void resetAllTasks(Map<String, String> cheatSheetData) {
- if (manager != null) {
- if (cheatSheetData == null) {
+ if (manager != null) {
+ if (cheatSheetData == null) {
manager.setData(new Hashtable<>());
- } else {
- manager.setData(cheatSheetData);
- }
- }
- saveHelper.clearTaskMementos();
- resetTask(getRootTask());
- sendTaskChangeEvents();
+ } else {
+ manager.setData(cheatSheetData);
+ }
+ }
+ saveHelper.clearTaskMementos();
+ resetTask(getRootTask());
+ sendTaskChangeEvents();
}
/**
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetSaveHelper.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetSaveHelper.java
index e127e4855..7fbf20807 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetSaveHelper.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/CompositeCheatSheetSaveHelper.java
@@ -57,12 +57,12 @@ public class CompositeCheatSheetSaveHelper {
if (readMemento == null) {
return Status.OK_STATUS;
}
- taskMementoMap = createTaskMap(readMemento);
- loadTaskState(taskMementoMap, (AbstractTask)model.getRootTask());
- loadCheatsheetManagerData(readMemento, model.getCheatSheetManager());
- loadLayoutData(readMemento, layoutData);
- model.sendTaskChangeEvents();
- return Status.OK_STATUS;
+ taskMementoMap = createTaskMap(readMemento);
+ loadTaskState(taskMementoMap, (AbstractTask)model.getRootTask());
+ loadCheatsheetManagerData(readMemento, model.getCheatSheetManager());
+ loadLayoutData(readMemento, layoutData);
+ model.sendTaskChangeEvents();
+ return Status.OK_STATUS;
}
private Map<String, IMemento> createTaskMap(XMLMemento readMemento) {
@@ -129,8 +129,8 @@ public class CompositeCheatSheetSaveHelper {
if (stateManager instanceof NoSaveStateManager) return Status.OK_STATUS;
XMLMemento writeMemento = XMLMemento.createWriteRoot(ICompositeCheatsheetTags.COMPOSITE_CHEATSHEET_STATE);
writeMemento.putString(IParserTags.ID, model.getId());
- saveTaskState(writeMemento, (AbstractTask)model.getRootTask());
- saveCheatSheetManagerData(writeMemento, model.getCheatSheetManager());
+ saveTaskState(writeMemento, (AbstractTask)model.getRootTask());
+ saveCheatSheetManagerData(writeMemento, model.getCheatSheetManager());
taskMementoMap = createTaskMap(writeMemento);
if (layoutData != null) {
saveMap(writeMemento, layoutData, ICompositeCheatsheetTags.LAYOUT_DATA);
@@ -182,9 +182,9 @@ public class CompositeCheatSheetSaveHelper {
}
private TaskEditor getEditor(AbstractTask task) {
- if (task instanceof EditableTask) {
- return ((EditableTask)task).getEditor();
- }
+ if (task instanceof EditableTask) {
+ return ((EditableTask)task).getEditor();
+ }
return null;
}
@@ -193,10 +193,10 @@ public class CompositeCheatSheetSaveHelper {
return null;
}
IMemento childMemento = taskMementoMap.get(id);
- if (childMemento == null) {
- return null;
- }
- return childMemento.getChild(ICompositeCheatsheetTags.TASK_DATA);
+ if (childMemento == null) {
+ return null;
+ }
+ return childMemento.getChild(ICompositeCheatsheetTags.TASK_DATA);
}
public void clearTaskMementos() {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/SuccesorTaskFinder.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/SuccesorTaskFinder.java
index 0d6a4f603..f67072f2e 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/SuccesorTaskFinder.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/SuccesorTaskFinder.java
@@ -43,18 +43,18 @@ public class SuccesorTaskFinder {
* @param task The task which was just completed
* @return An array of tasks which can be started
*/
- public ICompositeCheatSheetTask[] getRecommendedSuccessors()
- {
- // TODO this code could be moved to TaskGroup
- if (ITaskGroup.CHOICE.equals(currentTask.getKind())) {
- // For a choice if more than one child is runnable return it
+ public ICompositeCheatSheetTask[] getRecommendedSuccessors()
+ {
+ // TODO this code could be moved to TaskGroup
+ if (ITaskGroup.CHOICE.equals(currentTask.getKind())) {
+ // For a choice if more than one child is runnable return it
List<ICompositeCheatSheetTask> runnableChoices = findRunnableChoices();
- if (runnableChoices.size() != 0) {
+ if (runnableChoices.size() != 0) {
return runnableChoices.toArray(new ICompositeCheatSheetTask[runnableChoices.size()]);
- }
- }
- return getBestSuccessor();
- }
+ }
+ }
+ return getBestSuccessor();
+ }
private List<ICompositeCheatSheetTask> findRunnableChoices() {
List<ICompositeCheatSheetTask> result = new ArrayList<>();
@@ -72,14 +72,14 @@ public class SuccesorTaskFinder {
private boolean isStartable(ICompositeCheatSheetTask task) {
int state = task.getState();
return (state != ICompositeCheatSheetTask.COMPLETED &&
- state != ICompositeCheatSheetTask.SKIPPED &&
- task.requiredTasksCompleted());
+ state != ICompositeCheatSheetTask.SKIPPED &&
+ task.requiredTasksCompleted());
}
private ICompositeCheatSheetTask[] getBestSuccessor() {
bestLaterTask = null;
- bestEarlierTask = null;
- seenThisTask = false;
+ bestEarlierTask = null;
+ seenThisTask = false;
searchRunnableChildren(currentTask.getCompositeCheatSheet().getRootTask());
// If there is a task which is found later in the tree return
// that, otherwise an earlier task.
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskChoiceCompletionStrategy.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskChoiceCompletionStrategy.java
index f08498e30..03d9080f8 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskChoiceCompletionStrategy.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskChoiceCompletionStrategy.java
@@ -32,16 +32,16 @@ public class TaskChoiceCompletionStrategy implements TaskGroup.CompletionStrateg
ICompositeCheatSheetTask[] children = taskGroup.getSubtasks();
for (ICompositeCheatSheetTask element : children) {
switch (element.getState()) {
- case ICompositeCheatSheetTask.NOT_STARTED:
- break;
- case ICompositeCheatSheetTask.IN_PROGRESS:
- noChildrenStarted = false;
- break;
- case ICompositeCheatSheetTask.SKIPPED:
- case ICompositeCheatSheetTask.COMPLETED:
- noChildrenStarted = false;
- atLeastOneChildCompleted = true;
- break;
+ case ICompositeCheatSheetTask.NOT_STARTED:
+ break;
+ case ICompositeCheatSheetTask.IN_PROGRESS:
+ noChildrenStarted = false;
+ break;
+ case ICompositeCheatSheetTask.SKIPPED:
+ case ICompositeCheatSheetTask.COMPLETED:
+ noChildrenStarted = false;
+ atLeastOneChildCompleted = true;
+ break;
}
}
if (atLeastOneChildCompleted || children.length == 0) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java
index 242f91e75..91f6c5331 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskDependencies.java
@@ -173,13 +173,13 @@ public class TaskDependencies {
lastTask = thisTask;
thisTask = task.getName();
if (lastTask != null) {
- String message = NLS.bind(Messages.ERROR_PARSING_CYCLE_CONTAINS, (new Object[] {lastTask, thisTask}));
- status.addStatus(IStatus.ERROR, message, null);
+ String message = NLS.bind(Messages.ERROR_PARSING_CYCLE_CONTAINS, (new Object[] {lastTask, thisTask}));
+ status.addStatus(IStatus.ERROR, message, null);
}
}
}
String message = NLS.bind(Messages.ERROR_PARSING_CYCLE_CONTAINS, (new Object[] {thisTask, firstTask}));
- status.addStatus(IStatus.ERROR, message, null);
+ status.addStatus(IStatus.ERROR, message, null);
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskGroup.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskGroup.java
index ef4d549ef..8d962d7ac 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskGroup.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskGroup.java
@@ -81,8 +81,8 @@ public class TaskGroup extends AbstractTask implements ITaskGroup {
/**
* Determine the state based on the state of the children, which
- * will use a different computation depending on whether this is a set,
- * sequence or choice.
+ * will use a different computation depending on whether this is a set,
+ * sequence or choice.
*/
public int computeState() {
return completionStrategy.computeState(this);
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskSetCompletionStrategy.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskSetCompletionStrategy.java
index 938b23f59..2623c880d 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskSetCompletionStrategy.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskSetCompletionStrategy.java
@@ -32,17 +32,17 @@ public class TaskSetCompletionStrategy implements TaskGroup.CompletionStrategy {
ICompositeCheatSheetTask[] children = taskGroup.getSubtasks();
for (ICompositeCheatSheetTask element : children) {
switch (element.getState()) {
- case ICompositeCheatSheetTask.NOT_STARTED:
- allChildrenCompleted = false;
- break;
- case ICompositeCheatSheetTask.IN_PROGRESS:
- noChildrenStarted = false;
- allChildrenCompleted = false;
- break;
- case ICompositeCheatSheetTask.COMPLETED:
- case ICompositeCheatSheetTask.SKIPPED:
- noChildrenStarted = false;
- break;
+ case ICompositeCheatSheetTask.NOT_STARTED:
+ allChildrenCompleted = false;
+ break;
+ case ICompositeCheatSheetTask.IN_PROGRESS:
+ noChildrenStarted = false;
+ allChildrenCompleted = false;
+ break;
+ case ICompositeCheatSheetTask.COMPLETED:
+ case ICompositeCheatSheetTask.SKIPPED:
+ noChildrenStarted = false;
+ break;
}
}
if (allChildrenCompleted) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskStateUtilities.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskStateUtilities.java
index 54fb6054f..9eedca252 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskStateUtilities.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/model/TaskStateUtilities.java
@@ -40,7 +40,7 @@ public class TaskStateUtilities {
if (parent == null) {
return null;
}
- if (!parent.requiredTasksCompleted()) {
+ if (!parent.requiredTasksCompleted()) {
return parent;
}
return findBlockedAncestor(parent);
@@ -56,7 +56,7 @@ public class TaskStateUtilities {
if (parent == null) {
return null;
}
- if (parent.getState() == ICompositeCheatSheetTask.SKIPPED) {
+ if (parent.getState() == ICompositeCheatSheetTask.SKIPPED) {
return parent;
}
return findSkippedAncestor(parent);
@@ -72,7 +72,7 @@ public class TaskStateUtilities {
if (parent == null) {
return null;
}
- if (parent.getState() == ICompositeCheatSheetTask.COMPLETED) {
+ if (parent.getState() == ICompositeCheatSheetTask.COMPLETED) {
return parent;
}
return findCompletedAncestor(parent);
@@ -116,11 +116,11 @@ public class TaskStateUtilities {
*/
private static boolean isStartable(ICompositeCheatSheetTask task) {
if (task.getState() != ICompositeCheatSheetTask.NOT_STARTED) return false;
- if (findSkippedAncestor(task) != null) return false;
- if (findCompletedAncestor(task) != null) return false;
- if (!task.requiredTasksCompleted()) return false;
- if (findBlockedAncestor(task) != null) return false;
- return true;
+ if (findSkippedAncestor(task) != null) return false;
+ if (findCompletedAncestor(task) != null) return false;
+ if (!task.requiredTasksCompleted()) return false;
+ if (findBlockedAncestor(task) != null) return false;
+ return true;
}
/**
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java
index 7d5a77378..cac5d13fd 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java
@@ -192,7 +192,7 @@ public class CompositeCheatSheetParser implements IStatusContainer {
}
if (status.getSeverity() != IStatus.ERROR) {
compositeCS.setContentUrl(url);
- return compositeCS;
+ return compositeCS;
}
}
return null;
@@ -209,12 +209,12 @@ public class CompositeCheatSheetParser implements IStatusContainer {
Node nextNode = childNodes.item(index);
if (isAbstractTask(nextNode.getNodeName()) ) {
AbstractTask task = parseAbstractTask(nextNode, model);
- if (model.getRootTask() == null ) {
+ if (model.getRootTask() == null ) {
model.setRootTask(task);
parseTaskChildren(nextNode, task, model);
- } else {
- addStatus(IStatus.ERROR, Messages.ERROR_PARSING_MULTIPLE_ROOT, null);
- }
+ } else {
+ addStatus(IStatus.ERROR, Messages.ERROR_PARSING_MULTIPLE_ROOT, null);
+ }
}
}
}
@@ -242,18 +242,18 @@ public class CompositeCheatSheetParser implements IStatusContainer {
parseDependency(childNode, parentTask, model);
} else if (CompositeCheatSheetParser.isAbstractTask(nodeName)) {
if (parentTask instanceof TaskGroup) {
- AbstractTask task = parseAbstractTask(childNode, model);
- ((TaskGroup)parentTask).addSubtask(task);
- parseTaskChildren(childNode, task, model);
+ AbstractTask task = parseAbstractTask(childNode, model);
+ ((TaskGroup)parentTask).addSubtask(task);
+ parseTaskChildren(childNode, task, model);
}
- } else {
+ } else {
if (!strategy.parseElementNode(childNode, parentNode, parentTask, this)) {
String message = NLS
.bind(
Messages.WARNING_PARSING_UNKNOWN_ELEMENT,
(new Object[] { nodeName,
parentNode.getNodeName() }));
- addStatus(IStatus.WARNING, message, null);
+ addStatus(IStatus.WARNING, message, null);
}
}
}
@@ -265,13 +265,13 @@ public class CompositeCheatSheetParser implements IStatusContainer {
private void parseDependency(Node taskNode, AbstractTask task, CompositeCheatSheetModel model) {
NamedNodeMap attributes = taskNode.getAttributes();
if (attributes != null) {
- Node taskAttribute = attributes.getNamedItem(ICompositeCheatsheetTags.TASK);
- if (taskAttribute != null) {
- String requiredTaskId = taskAttribute.getNodeValue();
- model.getDependencies().addDependency(task, requiredTaskId);
- } else {
- addStatus(IStatus.ERROR, Messages.ERROR_PARSING_NO_ID, null);
- }
+ Node taskAttribute = attributes.getNamedItem(ICompositeCheatsheetTags.TASK);
+ if (taskAttribute != null) {
+ String requiredTaskId = taskAttribute.getNodeValue();
+ model.getDependencies().addDependency(task, requiredTaskId);
+ } else {
+ addStatus(IStatus.ERROR, Messages.ERROR_PARSING_NO_ID, null);
+ }
}
}
@@ -348,7 +348,7 @@ public class CompositeCheatSheetParser implements IStatusContainer {
String message = NLS.bind(Messages.ERROR_PARSING_DUPLICATE_TASK_ID, (new Object[] {id, }));
addStatus(IStatus.ERROR, message, null);
} else {
- model.getDependencies().saveId(task);
+ model.getDependencies().saveId(task);
}
return task;
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/EditableTaskParseStrategy.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/EditableTaskParseStrategy.java
index 3fda8d9d8..e19e5a00b 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/EditableTaskParseStrategy.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/EditableTaskParseStrategy.java
@@ -55,13 +55,13 @@ public class EditableTaskParseStrategy implements ITaskParseStrategy {
String message = NLS.bind(
Messages.ERROR_PARSING_TASK_NO_KIND,
(new Object[] { parentTask.getName()}));
- status.addStatus(IStatus.ERROR, message, null);
+ status.addStatus(IStatus.ERROR, message, null);
} else if (CheatSheetRegistryReader.getInstance().
findTaskEditor(parentTask.getKind()) == null) {
String message = NLS.bind(
Messages.ERROR_PARSING_TASK_INVALID_KIND,
(new Object[] { parentTask.getKind(), ICompositeCheatsheetTags.TASK, parentTask.getName()}));
- status.addStatus(IStatus.ERROR, message, null);
+ status.addStatus(IStatus.ERROR, message, null);
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ICompositeCheatsheetTags.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ICompositeCheatsheetTags.java
index 55b5631fb..414ad3161 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ICompositeCheatsheetTags.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/ICompositeCheatsheetTags.java
@@ -36,13 +36,13 @@ public interface ICompositeCheatsheetTags {
// Attribute values
public static final String TREE = "tree"; //$NON-NLS-1$
- // Cheatsheet task parameters
+ // Cheatsheet task parameters
public static final String CHEATSHEET_TASK_KIND = "cheatsheet"; //$NON-NLS-1$
public static final String CHEATSHEET_TASK_ID = "id"; //$NON-NLS-1$
public static final String CHEATSHEET_TASK_PATH = "path"; //$NON-NLS-1$
public static final String CHEATSHEET_TASK_SHOW_INTRO = "showIntro"; //$NON-NLS-1$
- // Tags used in Memento
+ // Tags used in Memento
public static final String TASK_DATA = "taskData"; //$NON-NLS-1$
public static final String CHEAT_SHEET_MANAGER = "cheatSheetManager"; //$NON-NLS-1$
public static final String KEY = "key"; //$NON-NLS-1$
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java
index 8ad0107f2..896e58317 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/MarkupParser.java
@@ -25,7 +25,7 @@ public class MarkupParser {
}
private static String parseMarkup(Node parentNode) {
- NodeList children = parentNode.getChildNodes();
+ NodeList children = parentNode.getChildNodes();
StringBuilder text = new StringBuilder();
for (int i = 0; i < children.getLength(); i++) {
Node childNode = children.item(i);
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/TaskGroupParseStrategy.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/TaskGroupParseStrategy.java
index 5ef79b82d..89f5fc235 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/TaskGroupParseStrategy.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/TaskGroupParseStrategy.java
@@ -35,7 +35,7 @@ public class TaskGroupParseStrategy implements ITaskParseStrategy {
@Override
public boolean parseElementNode(Node childNode, Node parentNode,
AbstractTask parentTask, IStatusContainer status)
- {
+ {
// Task children are handled by CompositeCheatSheetParser
return false;
}
@@ -64,7 +64,7 @@ public class TaskGroupParseStrategy implements ITaskParseStrategy {
String message = NLS.bind(
Messages.ERROR_PARSING_TASK_INVALID_KIND,
(new Object[] { parentTask.getKind(), ICompositeCheatsheetTags.TASK_GROUP, parentTask.getName()}));
- status.addStatus(IStatus.ERROR, message, null);
+ status.addStatus(IStatus.ERROR, message, null);
}
}
@@ -73,7 +73,7 @@ public class TaskGroupParseStrategy implements ITaskParseStrategy {
String message = NLS.bind(
Messages.ERROR_PARSING_CHILDLESS_TASK_GROUP,
(new Object[] { parentTask.getName()}));
- status.addStatus(IStatus.ERROR, message, null);
+ status.addStatus(IStatus.ERROR, message, null);
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java
index d9fdf34ef..63ea4ef92 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CheatsheetTaskEditor.java
@@ -70,7 +70,7 @@ public class CheatsheetTaskEditor extends TaskEditor {
id = task.getId();
}
if (url != null) {
- viewer.setInput(id, task.getName(), url, stateManager, false);
+ viewer.setInput(id, task.getName(), url, stateManager, false);
} else {
errorBadUrl(path);
}
@@ -78,7 +78,7 @@ public class CheatsheetTaskEditor extends TaskEditor {
errorBadUrl(path);
}
} else if (id != null){
- viewer.setInput(id, stateManager);
+ viewer.setInput(id, stateManager);
} else {
viewer.showError(Messages.CHEATSHEET_TASK_NO_ID);
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java
index 2d2719f21..fadd60d20 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/CompositeCheatSheetPage.java
@@ -253,10 +253,10 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
for (Control excontrol : excontrols) {
Object data = excontrol.getData(ICompositeCheatsheetTags.EXPLORER);
if (data instanceof TaskExplorer) {
- explorer = (TaskExplorer)data;
- if (explorer.getId().equals(id)) {
- return explorer;
- }
+ explorer = (TaskExplorer)data;
+ if (explorer.getId().equals(id)) {
+ return explorer;
+ }
}
}
@@ -315,7 +315,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
public void saveState() {
Map<String, String> layout = new HashMap<>();
if (selectedTask != null) {
- layout.put(ICompositeCheatsheetTags.SELECTED_TASK, selectedTask.getId());
+ layout.put(ICompositeCheatsheetTags.SELECTED_TASK, selectedTask.getId());
}
saveHelper.saveCompositeState(model, layout);
}
@@ -366,16 +366,16 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
GridData data = new GridData();
data.heightHint = 1;
data.horizontalAlignment = SWT.FILL;
- separator.setLayoutData(data);
- FormText text = toolkit.createFormText(container, false);
+ separator.setLayoutData(data);
+ FormText text = toolkit.createFormText(container, false);
text.setImage(DescriptionPanel.REVIEW_IMAGE, CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.COMPOSITE_TASK_REVIEW));
- text.addHyperlinkListener(getEndReviewListener());
- text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ text.addHyperlinkListener(getEndReviewListener());
+ text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
StringBuilder buf = new StringBuilder();
- buf.append("<form>"); //$NON-NLS-1$
- addHyperlink(buf, END_REVIEW_TAG + task.getId(), DescriptionPanel.REVIEW_IMAGE, Messages.COMPOSITE_PAGE_END_REVIEW );
- buf.append("</form>"); //$NON-NLS-1$
- text.setText(buf.toString(), true, false);
+ buf.append("<form>"); //$NON-NLS-1$
+ addHyperlink(buf, END_REVIEW_TAG + task.getId(), DescriptionPanel.REVIEW_IMAGE, Messages.COMPOSITE_PAGE_END_REVIEW );
+ buf.append("</form>"); //$NON-NLS-1$
+ text.setText(buf.toString(), true, false);
task.setUnderReview(true);
container.layout(true);
showEditor(task);
@@ -409,29 +409,29 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
if (ref.equals(START_HREF)) {
Object data = descriptionPanel.getControl().getData(ICompositeCheatsheetTags.TASK);
if (data instanceof EditableTask) {
- EditableTask task = (EditableTask)data;
- task.setStarted();
+ EditableTask task = (EditableTask)data;
+ task.setStarted();
}
}
- if (ref.equals(SKIP_HREF)) {
+ if (ref.equals(SKIP_HREF)) {
Object data = descriptionPanel.getControl().getData(ICompositeCheatsheetTags.TASK);
if (data instanceof AbstractTask) {
- AbstractTask task = (AbstractTask)data;
- task.setState(ICompositeCheatSheetTask.SKIPPED);
+ AbstractTask task = (AbstractTask)data;
+ task.setState(ICompositeCheatSheetTask.SKIPPED);
}
}
if (ref.equals(REVIEW_TAG)) {
Object data = descriptionPanel.getControl().getData(ICompositeCheatsheetTags.TASK);
if (data instanceof EditableTask) {
- reviewTask((EditableTask) data);
+ reviewTask((EditableTask) data);
}
}
if (ref.startsWith(GOTO_TASK_TAG)) {
String next = ref.substring(GOTO_TASK_TAG.length());
AbstractTask nextTask =
- model.getDependencies().getTask(next);
+ model.getDependencies().getTask(next);
currentExplorer.setSelection
- (new StructuredSelection(nextTask), true);
+ (new StructuredSelection(nextTask), true);
}
}
}
@@ -447,7 +447,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
if (ref.startsWith(END_REVIEW_TAG)) {
String next = ref.substring(END_REVIEW_TAG.length());
AbstractTask task =
- model.getDependencies().getTask(next);
+ model.getDependencies().getTask(next);
endReview((EditableTask)task);
}
}
@@ -468,7 +468,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
*/
private TaskEditor getTaskEditor(EditableTask editable) {
if (editable.getEditor() == null) {
- // Create a new editor using the extension point data
+ // Create a new editor using the extension point data
TaskEditor editor = TaskEditorManager.getInstance().getEditor(editable.getKind());
if (editor != null) {
Composite editorPanel = new Composite(taskEditorContainer, SWT.NULL);
@@ -524,8 +524,8 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
public void widgetSelected(SelectionEvent e) {
if (model != null) {
if (RestartAllAction.confirmRestart()) {
- restart(null);
- }
+ restart(null);
+ }
}
}
});
@@ -537,28 +537,28 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
if (explorerIds.length == 1) {
return index; // no other explorer to chosse from
}
- MenuItem menuItem = new MenuItem(menu, SWT.CASCADE, index++);
+ MenuItem menuItem = new MenuItem(menu, SWT.CASCADE, index++);
- menuItem.setText(Messages.EXPLORER_PULLDOWN_MENU);
+ menuItem.setText(Messages.EXPLORER_PULLDOWN_MENU);
- Menu subMenu = new Menu(menu);
- menuItem.setMenu(subMenu);
+ Menu subMenu = new Menu(menu);
+ menuItem.setMenu(subMenu);
for (final String id : explorerIds) {
- TaskExplorerNode node = CheatSheetRegistryReader.getInstance().findTaskExplorer(id);
- boolean isCurrentExplorer = id.equals(currentExplorer.getId());
- int style = isCurrentExplorer ? SWT.RADIO: SWT.PUSH;
- MenuItem item = new MenuItem(subMenu, style);
- item.setText(node.getName());
- item.setSelection(isCurrentExplorer);
- item.setImage(TaskExplorerManager.getInstance().getImage(id));
- item.addSelectionListener(new SelectionAdapter() {
- @Override
+ TaskExplorerNode node = CheatSheetRegistryReader.getInstance().findTaskExplorer(id);
+ boolean isCurrentExplorer = id.equals(currentExplorer.getId());
+ int style = isCurrentExplorer ? SWT.RADIO: SWT.PUSH;
+ MenuItem item = new MenuItem(subMenu, style);
+ item.setText(node.getName());
+ item.setSelection(isCurrentExplorer);
+ item.setImage(TaskExplorerManager.getInstance().getImage(id));
+ item.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- setCurrentExplorerFromId(id);
- }
- });
- }
+ setCurrentExplorerFromId(id);
+ }
+ });
+ }
return index;
}
@@ -566,7 +566,7 @@ public class CompositeCheatSheetPage extends Page implements ISelectionChangedLi
public void restart(Map<String, String> cheatSheetData) {
model.resetAllTasks(cheatSheetData);
currentExplorer.setSelection
- (new StructuredSelection(model.getRootTask()), true);
+ (new StructuredSelection(model.getRootTask()), true);
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java
index 157ebe81c..891b554ac 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/DescriptionPanel.java
@@ -89,11 +89,11 @@ public class DescriptionPanel {
Composite separator = toolkit.createCompositeSeparator(panel);
- TableWrapData data = new TableWrapData();
- data.align = TableWrapData.FILL;
- data.grabHorizontal = true;
- data.maxHeight = 1;
- separator.setLayoutData(data);
+ TableWrapData data = new TableWrapData();
+ data.align = TableWrapData.FILL;
+ data.grabHorizontal = true;
+ data.maxHeight = 1;
+ separator.setLayoutData(data);
lowerText = mform.getToolkit().createFormText(panel, false);
mform.getToolkit().adapt(lowerText, false, false);
@@ -128,14 +128,14 @@ public class DescriptionPanel {
upperMessage.append("</span></p>"); //$NON-NLS-1$
upperMessage.append(MarkupParser.createParagraph(task.getDescription(), null));
upperMessage.append("</form>"); //$NON-NLS-1$
- upperText.setText(upperMessage.toString(), true, false);
+ upperText.setText(upperMessage.toString(), true, false);
StringBuilder buf = new StringBuilder();
buf.append("<form>"); //$NON-NLS-1$
- boolean startable = false;
- boolean isBlocked = false;
- boolean isSkippable = ((AbstractTask)task).isSkippable();
+ boolean startable = false;
+ boolean isBlocked = false;
+ boolean isSkippable = ((AbstractTask)task).isSkippable();
if (task.getState() == ICompositeCheatSheetTask.COMPLETED) {
buf.append(MarkupParser.createParagraph(task.getCompletionMessage(), null));
@@ -183,7 +183,7 @@ public class DescriptionPanel {
} else {
skipMessage = Messages.COMPOSITE_PAGE_SKIP_TASK;
}
- addHyperlink(buf, CompositeCheatSheetPage.SKIP_HREF, SKIP_IMAGE, skipMessage);
+ addHyperlink(buf, CompositeCheatSheetPage.SKIP_HREF, SKIP_IMAGE, skipMessage);
}
if (!startable && !isBlocked) {
@@ -237,10 +237,10 @@ public class DescriptionPanel {
buf.append(task.getId());
buf.append("\">"); //$NON-NLS-1$
buf.append(NLS.bind(Messages.COMPOSITE_PAGE_TASK_NOT_COMPLETE, (new Object[]
- {MarkupParser.escapeText(task.getName())})));
+ {MarkupParser.escapeText(task.getName())})));
buf.append("</a>"); //$NON-NLS-1$
buf.append("</li>"); //$NON-NLS-1$
- }
+ }
}
private void showSuccesorTaskLinks(ICompositeCheatSheetTask task, StringBuilder buf) {
@@ -248,7 +248,7 @@ public class DescriptionPanel {
ICompositeCheatSheetTask[] successorTasks = new SuccesorTaskFinder(task).getRecommendedSuccessors();
for (ICompositeCheatSheetTask successor : successorTasks) {
String message = NLS.bind(Messages.COMPOSITE_PAGE_GOTO_TASK, (new Object[]
- {MarkupParser.escapeText(successor.getName())}));
+ {MarkupParser.escapeText(successor.getName())}));
addHyperlink(buf, CompositeCheatSheetPage.GOTO_TASK_TAG + successor.getId(), GOTO_IMAGE, message);
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java
index 3dde0401c..bd0a20316 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/views/TaskExplorerManager.java
@@ -89,7 +89,7 @@ private static TaskExplorerManager instance;
if (explorerInfo == null) {
return null;
}
- String iconPath = explorerInfo.getIconPath();
+ String iconPath = explorerInfo.getIconPath();
if (iconPath == null) {
return null;
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java
index 96fb07d51..b2e88675a 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/AbstractExecutable.java
@@ -99,11 +99,11 @@ public abstract class AbstractExecutable {
this.when = when;
}
- /**
- * Handle an attribute specific to this type of AbstractExecutable
- * @param attribute
- * @return true if this parameter is valid for this type of executable
- */
+ /**
+ * Handle an attribute specific to this type of AbstractExecutable
+ * @param attribute
+ * @return true if this parameter is valid for this type of executable
+ */
public abstract boolean handleAttribute(Node attribute);
/**
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java
index 448ba1d75..1e9f5c81c 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetCommand.java
@@ -57,9 +57,9 @@ public class CheatSheetCommand extends AbstractExecutable {
@Override
public boolean handleAttribute(Node attribute) {
if (IParserTags.SERIALIZATION.equals(attribute.getNodeName())) {
- setSerialization(attribute.getNodeValue());
- serializationFound = true;
- return true;
+ setSerialization(attribute.getNodeValue());
+ serializationFound = true;
+ return true;
} else if (IParserTags.RETURNS.equals(attribute.getNodeName())) {
setReturns(attribute.getNodeValue());
return true;
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
index b702302c8..98bd50a71 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
@@ -274,7 +274,7 @@ public class CheatSheetParser implements IStatusContainer {
throw new CheatSheetParserException(errorMessage);
}
}
- checkForNoChildren(executableNode);
+ checkForNoChildren(executableNode);
executable.setParams(params);
item.setExecutable(executable);
}
@@ -429,7 +429,7 @@ public class CheatSheetParser implements IStatusContainer {
Node node = nodes.item(i);
if(node.getNodeType() == Node.TEXT_NODE) {
String nodeValue = node.getNodeValue();
- if (isLeadingTrimRequired) {
+ if (isLeadingTrimRequired) {
nodeValue = trimLeadingWhitespace(nodeValue);
}
text.append(nodeValue);
@@ -481,7 +481,7 @@ public class CheatSheetParser implements IStatusContainer {
firstNonWhitespaceIndex++;
}
if (firstNonWhitespaceIndex > 0) {
- return nodeValue.substring(firstNonWhitespaceIndex, nodeValue.length());
+ return nodeValue.substring(firstNonWhitespaceIndex, nodeValue.length());
}
return nodeValue;
}
@@ -496,7 +496,7 @@ public class CheatSheetParser implements IStatusContainer {
}
String message;
if (IParserTags.DESCRIPTION.equals(nodeName)) {
- message = NLS.bind(Messages.WARNING_PARSING_DESCRIPTION_UNKNOWN_ELEMENT, (new Object[] {parentNode.getNodeName(), node.getNodeName()}));
+ message = NLS.bind(Messages.WARNING_PARSING_DESCRIPTION_UNKNOWN_ELEMENT, (new Object[] {parentNode.getNodeName(), node.getNodeName()}));
} else {
message = NLS.bind(Messages.WARNING_PARSING_ON_COMPLETION_UNKNOWN_ELEMENT, (new Object[] {parentNode.getNodeName(), node.getNodeName()}));
}
@@ -516,7 +516,7 @@ public class CheatSheetParser implements IStatusContainer {
handleIntroAttributes(introItem, introNode);
- boolean hasDescription = false;
+ boolean hasDescription = false;
NodeList nodes = introNode.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
@@ -527,8 +527,8 @@ public class CheatSheetParser implements IStatusContainer {
String message = NLS.bind(Messages.ERROR_PARSING_MULTIPLE_DESCRIPTION, (new Object[] {introNode.getNodeName()}));
addStatus(IStatus.ERROR, message, null);
} else {
- hasDescription = true;
- handleDescription(introItem, node);
+ hasDescription = true;
+ handleDescription(introItem, node);
}
} else {
if(node.getNodeType() != Node.TEXT_NODE && node.getNodeType() != Node.COMMENT_NODE ) {
@@ -595,8 +595,8 @@ public class CheatSheetParser implements IStatusContainer {
String message = NLS.bind(Messages.ERROR_PARSING_MULTIPLE_DESCRIPTION, (new Object[] {itemNode.getNodeName()}));
addStatus(IStatus.ERROR, message, null);
} else {
- hasDescription = true;
- handleDescription(item, node);
+ hasDescription = true;
+ handleDescription(item, node);
}
} else if(node.getNodeName().equals(IParserTags.ON_COMPLETION)) {
handleOnCompletion(item, node);
@@ -904,7 +904,7 @@ public class CheatSheetParser implements IStatusContainer {
InputStream is = null;
InputSource inputSource = null;
- String filename = ""; //$NON-NLS-1$
+ String filename = ""; //$NON-NLS-1$
URL url = input.getUrl();
if (input.getXml() != null) {
@@ -1029,8 +1029,8 @@ public class CheatSheetParser implements IStatusContainer {
if (hasIntro) {
addStatus(IStatus.ERROR, Messages.ERROR_PARSING_MORE_THAN_ONE_INTRO, null);
} else {
- hasIntro = true;
- handleIntroNode(cheatSheet, node);
+ hasIntro = true;
+ handleIntroNode(cheatSheet, node);
}
} else {
if(node.getNodeType() != Node.TEXT_NODE && node.getNodeType() != Node.COMMENT_NODE ) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java
index c7047ba33..cd467917b 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetSaveHelper.java
@@ -206,10 +206,10 @@ public class CheatSheetSaveHelper {
public IStatus saveState(Properties properties, CheatSheetManager csm) {
String csID = (String) properties.get(IParserTags.ID);
XMLMemento writeMemento = XMLMemento.createWriteRoot(IParserTags.CHEATSHEET_STATE);
- IStatus status = saveToMemento(properties, csm, writeMemento);
- if (!status.isOK()) {
- return status;
- }
+ IStatus status = saveToMemento(properties, csm, writeMemento);
+ if (!status.isOK()) {
+ return status;
+ }
return CheatSheetPlugin.getPlugin().saveMemento(writeMemento, csID + DOT_XML);
}
@@ -223,7 +223,7 @@ public class CheatSheetSaveHelper {
writeMemento.putString(IParserTags.ID, (String)properties.get(IParserTags.ID));
String contentPath = (String)properties.get(IParserTags.CONTENT_URL);
if (contentPath != null) {
- writeMemento.putString(IParserTags.CONTENT_URL, contentPath);
+ writeMemento.putString(IParserTags.CONTENT_URL, contentPath);
}
addListOfStringsToMemento(writeMemento, properties, IParserTags.COMPLETED);
@@ -267,7 +267,7 @@ public class CheatSheetSaveHelper {
properties.put(IParserTags.ID, memento.getString(IParserTags.ID));
String contentURL = memento.getString(IParserTags.CONTENT_URL);
if (contentURL != null) {
- properties.put(IParserTags.CONTENT_URL, contentURL);
+ properties.put(IParserTags.CONTENT_URL, contentURL);
}
getListOfStringsFromMemento(memento, properties, IParserTags.COMPLETED);
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IncompatibleSiblingChecker.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IncompatibleSiblingChecker.java
index 02eae0b1c..31fd8d6c4 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IncompatibleSiblingChecker.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/IncompatibleSiblingChecker.java
@@ -26,15 +26,15 @@ import org.w3c.dom.Node;
public class IncompatibleSiblingChecker {
- private IStatusContainer statusContainer;
+ private IStatusContainer statusContainer;
private Node parentNode;
private String existingChild;
private boolean errorReported = false;
public IncompatibleSiblingChecker(IStatusContainer statusContainer, Node parentNode) {
- this.statusContainer = statusContainer;
- this.parentNode = parentNode;
- }
+ this.statusContainer = statusContainer;
+ this.parentNode = parentNode;
+ }
/**
* Check to see that adding this new element does not create an error based on
@@ -59,14 +59,14 @@ public class IncompatibleSiblingChecker {
private boolean isSubitem(String elementKind) {
return IParserTags.SUBITEM.equals(elementKind)
- || IParserTags.CONDITIONALSUBITEM.equals(elementKind)
- || IParserTags.REPEATEDSUBITM.equals(elementKind);
+ || IParserTags.CONDITIONALSUBITEM.equals(elementKind)
+ || IParserTags.REPEATEDSUBITM.equals(elementKind);
}
private boolean isExecutable(String elementKind) {
return IParserTags.ACTION.equals(elementKind)
- || IParserTags.COMMAND.equals(elementKind)
- || IParserTags.PERFORMWHEN.equals(elementKind);
+ || IParserTags.COMMAND.equals(elementKind)
+ || IParserTags.PERFORMWHEN.equals(elementKind);
}
private void reportIncompatible(String elementKind) {
@@ -75,11 +75,11 @@ public class IncompatibleSiblingChecker {
}
errorReported = true;
String message;
- if (elementKind.equals(existingChild)) {
- message = NLS.bind(Messages.ERROR_PARSING_DUPLICATE_CHILD, (new Object[] {parentNode.getNodeName(), elementKind}));
- } else {
- message = NLS.bind(Messages.ERROR_PARSING_INCOMPATIBLE_CHILDREN, (new Object[] {parentNode.getNodeName(), existingChild, elementKind}));
- }
- statusContainer.addStatus(IStatus.ERROR, message, null);
+ if (elementKind.equals(existingChild)) {
+ message = NLS.bind(Messages.ERROR_PARSING_DUPLICATE_CHILD, (new Object[] {parentNode.getNodeName(), elementKind}));
+ } else {
+ message = NLS.bind(Messages.ERROR_PARSING_INCOMPATIBLE_CHILDREN, (new Object[] {parentNode.getNodeName(), existingChild, elementKind}));
+ }
+ statusContainer.addStatus(IStatus.ERROR, message, null);
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
index 761425003..9570ba265 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/dialogs/CheatSheetCategoryBasedSelectionDialog.java
@@ -295,7 +295,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends
}
});
- // Create radio button for select from file
+ // Create radio button for select from file
selectFileRadio = new Button(outerContainer, SWT.RADIO);
selectFileRadio.setText(Messages.SELECTION_DIALOG_OPEN_FROM_FILE);
@@ -582,26 +582,26 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends
String id = filePath.lastSegment();
int extensionIndex = id.indexOf('.');
if (extensionIndex > 0) {
- id = id.substring(0, extensionIndex);
+ id = id.substring(0, extensionIndex);
}
// Use the id as the name
URL url = null;
boolean opened = false;
try {
- File contentFile = new File(selectFileCombo.getText());
- url = contentFile.toURI().toURL();
- new OpenCheatSheetAction(id, id ,url).run();
- opened = true;
- } catch (MalformedURLException e) {
- opened = false;
- }
- if (!opened) {
- String message = NLS.bind(Messages.ERROR_OPENING_FILE, (new Object[] {selectFileCombo.getText()}));
- status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, ParserStatusUtility.PARSER_ERROR, message, null);
- CheatSheetView view = ViewUtilities.showCheatSheetView();
- view.getCheatSheetViewer().showError(message);
- }
+ File contentFile = new File(selectFileCombo.getText());
+ url = contentFile.toURI().toURL();
+ new OpenCheatSheetAction(id, id ,url).run();
+ opened = true;
+ } catch (MalformedURLException e) {
+ opened = false;
+ }
+ if (!opened) {
+ String message = NLS.bind(Messages.ERROR_OPENING_FILE, (new Object[] {selectFileCombo.getText()}));
+ status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, ParserStatusUtility.PARSER_ERROR, message, null);
+ CheatSheetView view = ViewUtilities.showCheatSheetView();
+ view.getCheatSheetViewer().showError(message);
+ }
}
private void setResultFromUrl() {
@@ -613,7 +613,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends
}
int extensionIndex = id.indexOf('.');
if (extensionIndex > 0) {
- id = id.substring(0, extensionIndex);
+ id = id.substring(0, extensionIndex);
}
// Use the id as the name
URL url = null;
@@ -625,15 +625,15 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends
try {
url = new URL(selectUrlCombo.getText());
view.getCheatSheetViewer().setInput(id, id, url, new DefaultStateManager(), true);
- opened = true;
- } catch (MalformedURLException e) {
- opened = false;
- }
- if (!opened) {
- String message = NLS.bind(Messages.ERROR_OPENING_FILE, (new Object[] {selectUrlCombo.getText()}));
- status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, ParserStatusUtility.PARSER_ERROR, message, null);
- view.getCheatSheetViewer().showError(message);
- }
+ opened = true;
+ } catch (MalformedURLException e) {
+ opened = false;
+ }
+ if (!opened) {
+ String message = NLS.bind(Messages.ERROR_OPENING_FILE, (new Object[] {selectUrlCombo.getText()}));
+ status = new Status(IStatus.ERROR, ICheatSheetResource.CHEAT_SHEET_PLUGIN_ID, ParserStatusUtility.PARSER_ERROR, message, null);
+ view.getCheatSheetViewer().showError(message);
+ }
}
/**
@@ -657,7 +657,7 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends
private void restoreFileSettings() {
int radioSetting = RADIO_REGISTERED;
try {
- radioSetting = settings.getInt(STORE_RADIO_SETTING);
+ radioSetting = settings.getInt(STORE_RADIO_SETTING);
}
catch(NumberFormatException n) {
}
@@ -688,12 +688,12 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends
private void saveMRU(List<String> mostRecentList, String key, String selection) {
if (selection.length() > 0 && !mostRecentList.contains(selection)) {
- mostRecentList.add(0, selection);
+ mostRecentList.add(0, selection);
}
for (int i = 0; i < MOST_RECENT_LENGTH & i < mostRecentList.size(); i++) {
String name = mostRecentList.get(i);
if (name.length() > 0) {
- settings.put(key + i, name);
+ settings.put(key + i, name);
}
}
}
@@ -796,12 +796,12 @@ public class CheatSheetCategoryBasedSelectionDialog extends TrayDialog //extends
@Override
protected IDialogSettings getDialogBoundsSettings() {
- IDialogSettings settings = CheatSheetPlugin.getPlugin().getDialogSettings();
- IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
- if (section == null) {
- section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
- }
- return section;
+ IDialogSettings settings = CheatSheetPlugin.getPlugin().getDialogSettings();
+ IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
+ if (section == null) {
+ section = settings.addNewSection(DIALOG_SETTINGS_SECTION);
+ }
+ return section;
}
private Label createMessageArea(Composite composite) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java
index 3e9cb5d00..c55c21ab2 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetElement.java
@@ -217,7 +217,7 @@ public class CheatSheetElement extends WorkbenchAdapter implements IAdaptable, I
*/
public String getRestorePath() {
if (!registered) {
- return contentFile;
+ return contentFile;
}
return null;
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java
index 8ece31d19..5a2a366c3 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/registry/CheatSheetRegistryReader.java
@@ -62,7 +62,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
}
/**
- * Represents a taskEditor entry in the registry
+ * Represents a taskEditor entry in the registry
*/
public class TaskEditorNode {
private String className;
@@ -96,7 +96,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
}
/**
- * Represents a taskExplorer entry in the registry
+ * Represents a taskExplorer entry in the registry
*/
public class TaskExplorerNode {
private String className;
@@ -156,9 +156,9 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
protected final static String trueString = "TRUE"; //$NON-NLS-1$
private final static String UNCATEGORIZED_CHEATSHEET_CATEGORY = "org.eclipse.ui.Other"; //$NON-NLS-1$
private final static String UNCATEGORIZED_CHEATSHEET_CATEGORY_LABEL = Messages.CHEAT_SHEET_OTHER_CATEGORY;
- public final static String CHEAT_SHEET_CONTENT = "cheatSheetContent"; //$NON-NLS-1$
+ public final static String CHEAT_SHEET_CONTENT = "cheatSheetContent"; //$NON-NLS-1$
- /**
+ /**
* Returns a list of cheatsheets, project and not.
*
* The return value for this method is cached since computing its value
@@ -294,7 +294,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
*/
public TaskEditorNode findTaskEditor(String id) {
if (cheatsheets == null) {
- readCheatSheets(); // Ensure that the registry has been read
+ readCheatSheets(); // Ensure that the registry has been read
}
return taskEditors.get(id);
}
@@ -305,7 +305,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
*/
public TaskExplorerNode findTaskExplorer(String id) {
if (cheatsheets == null) {
- readCheatSheets(); // Ensure that the registry has been read
+ readCheatSheets(); // Ensure that the registry has been read
}
return taskExplorers.get(id);
}
@@ -316,7 +316,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
*/
public String[] getExplorerIds() {
if (cheatsheets == null) {
- readCheatSheets(); // Ensure that the registry has been read
+ readCheatSheets(); // Ensure that the registry has been read
}
Set<String> keys = taskExplorers.keySet();
return keys.toArray(new String[keys.size()]);
@@ -430,7 +430,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
currentCollectionElement = (CheatSheetCollectionElement) nestedCategoryIds.get(category);
currentCollectionElement.add(element);
} else {
- moveElementToUncategorizedCategory(currentResult, element);
+ moveElementToUncategorizedCategory(currentResult, element);
}
} else {
currentCollectionElement.add(element);
@@ -636,7 +636,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
String pluginId = element.getContributor().getName();
if (id != null && className != null && name != null ) {
TaskExplorerNode node = new TaskExplorerNode();
- node.setId(id);
+ node.setId(id);
node.setIconPath(icon);
node.setClassName(className);
node.setName(name);
@@ -652,7 +652,7 @@ public class CheatSheetRegistryReader extends RegistryReader implements IRegistr
String pluginId = element.getContributor().getName();
if (id != null && className != null && icon != null ) {
TaskEditorNode node = new TaskEditorNode();
- node.setId(id);
+ node.setId(id);
node.setIconPath(icon);
node.setClassName(className);
node.setPluginId(pluginId);
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/TrayStateManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/TrayStateManager.java
index fc20c1700..900884468 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/TrayStateManager.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/state/TrayStateManager.java
@@ -39,7 +39,7 @@ public class TrayStateManager implements ICheatSheetStateManager {
@Override
public void setElement(CheatSheetElement element) {
- // element not used
+ // element not used
}
@Override
@@ -53,7 +53,7 @@ public class TrayStateManager implements ICheatSheetStateManager {
*/
@Override
public IStatus saveState(Properties properties, CheatSheetManager manager) {
- this.properties = properties;
+ this.properties = properties;
this.manager = manager;
return Status.OK_STATUS;
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetManager.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetManager.java
index a1f70071c..df30be769 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetManager.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetManager.java
@@ -55,7 +55,7 @@ public class CheatSheetManager implements ICheatSheetManager {
public void fireEvent(int eventType) {
// Send an event to every listener
for (CheatSheetListener listener : listeners) {
- ICheatSheetEvent event = new CheatSheetEvent(eventType, cheatsheetID, this);
+ ICheatSheetEvent event = new CheatSheetEvent(eventType, cheatsheetID, this);
listener.cheatSheetEvent(event);
}
}
@@ -105,13 +105,13 @@ public class CheatSheetManager implements ICheatSheetManager {
return result;
}
- /**
- * Substitute occurences of ${data} with values from the cheatsheetmanager.
- * @param input The input string
- * @param csm The cheatsheet manager
- * @return The input string with substitutions made for any cheatsheet
- * variables encountered.
- */
+ /**
+ * Substitute occurences of ${data} with values from the cheatsheetmanager.
+ * @param input The input string
+ * @param csm The cheatsheet manager
+ * @return The input string with substitutions made for any cheatsheet
+ * variables encountered.
+ */
public String performVariableSubstitution(String input)
{
String remaining = input;
@@ -123,14 +123,14 @@ public class CheatSheetManager implements ICheatSheetManager {
output += remaining;
remaining = ""; //$NON-NLS-1$
} else {
- String varName = remaining.substring(varIndex + VARIABLE_BEGIN.length(),
- endIndex);
- String value = getDataQualified(varName);
- output += remaining.substring(0, varIndex);
- if (value != null) {
- output += value;
- }
- remaining = remaining.substring(endIndex + VARIABLE_END.length());
+ String varName = remaining.substring(varIndex + VARIABLE_BEGIN.length(),
+ endIndex);
+ String value = getDataQualified(varName);
+ output += remaining.substring(0, varIndex);
+ if (value != null) {
+ output += value;
+ }
+ remaining = remaining.substring(endIndex + VARIABLE_END.length());
}
}
return output;
@@ -181,7 +181,7 @@ public class CheatSheetManager implements ICheatSheetManager {
*/
public void addListener(CheatSheetListener listener) {
if (listener != null) {
- listeners.add(listener);
+ listeners.add(listener);
}
}
@@ -199,7 +199,7 @@ public class CheatSheetManager implements ICheatSheetManager {
if (dataTable == null) {
return new HashSet<>();
} else {
- return dataTable.keySet();
+ return dataTable.keySet();
}
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java
index f2b96e0e3..cb8b24b32 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetPage.java
@@ -205,20 +205,20 @@ public class CheatSheetPage extends Page implements IMenuContributor {
}
private void computeReverseVideoColors(Display display) {
- Color background = toolkit.getColors().getBackground();
+ Color background = toolkit.getColors().getBackground();
RGB white = new RGB(255, 255, 255);
- // Create new colors, they will get disposed
- RGB rgb = background.getRGB();
+ // Create new colors, they will get disposed
+ RGB rgb = background.getRGB();
activeColor = new Color(display, rgb );
rgb = FormColors.blend(rgb, white, 85);
inactiveColor1 = new Color(display, rgb);
rgb = FormColors.blend(rgb, white, 85);
inactiveColor2 = new Color(display, rgb );
- introColor = new Color(display, rgb );
+ introColor = new Color(display, rgb );
}
private boolean isReverseVideo() {
- Color bg = toolkit.getColors().getBackground();
+ Color bg = toolkit.getColors().getBackground();
return ((bg.getBlue() + bg.getRed() + bg.getGreen()) < 380);
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
index bcdba5989..343074529 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
@@ -231,7 +231,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
//set that item as complete.
if (markAsCompleted) {
if (!currentItem.isCompleted()) {
- currentItem.setComplete();
+ currentItem.setComplete();
}
/* LP-item event */
// fireManagerItemEvent(ICheatSheetItemEvent.ITEM_COMPLETED, currentItem);
@@ -260,7 +260,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
FormToolkit.ensureVisible(currentItem.getMainItemComposite());
} else if (indexNextItem == viewItemList.size()) {
if (!currentItem.isCompletionMessageExpanded()) { // The event will already have been fired
- getManager().fireEvent(ICheatSheetEvent.CHEATSHEET_COMPLETED);
+ getManager().fireEvent(ICheatSheetEvent.CHEATSHEET_COMPLETED);
}
showIntroItem();
}
@@ -417,10 +417,10 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
} else {
item.setButtonsVisible(true);
if (i >currentItemNum || item.isCompleted()) {
- item.setCompletionMessageExpanded(i + 1 >= viewItemList.size());
- } else {
+ item.setCompletionMessageExpanded(i + 1 >= viewItemList.size());
+ } else {
item.setCompletionMessageCollapsed();
- }
+ }
}
if (expandRestoreList.contains(Integer.toString(i))) {
item.setCollapsed();
@@ -432,7 +432,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
CoreItem coreitemws = (CoreItem) item;
ArrayList<SubItemCompositeHolder> subItemCompositeHolders = coreitemws
.getListOfSubItemCompositeHolders();
- if (subItemCompositeHolders != null) {
+ if (subItemCompositeHolders != null) {
while (st.hasMoreTokens()) {
String token = st.nextToken();
subItemCompositeHolders.get(Integer.parseInt(token)).setCompleted(true);
@@ -444,7 +444,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
}
}
- }
+ }
}
}
if (skippedSubItemsItemList.contains(Integer.toString(i))) {
@@ -859,10 +859,10 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
control.setRedraw(false);
if (model instanceof CheatSheet) {
- CheatSheet cheatSheetModel = (CheatSheet)model;
+ CheatSheet cheatSheetModel = (CheatSheet)model;
- if (isRestricted && cheatSheetModel.isContainsCommandOrAction()) {
- boolean isOK = MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ if (isRestricted && cheatSheetModel.isContainsCommandOrAction()) {
+ boolean isOK = MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
Messages.CHEATSHEET_FROM_URL_WITH_EXEC_TITLE,
Messages.CHEATSHEET_FROM_URL_WITH_EXEC);
@@ -871,22 +871,22 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
showStartPage();
return true;
}
- }
+ }
currentPage = new CheatSheetPage(cheatSheetModel, viewItemList, this);
- setCollapseExpandButtonEnabled(true);
+ setCollapseExpandButtonEnabled(true);
} else if (model instanceof CompositeCheatSheetModel) {
CompositeCheatSheetModel compositeCheatSheetModel = ((CompositeCheatSheetModel)model);
compositeCheatSheetModel.setId(currentID);
currentPage = new CompositeCheatSheetPage(compositeCheatSheetModel, stateManager);
compositeCheatSheetModel.setCheatSheetManager(initManager());
setCollapseExpandButtonEnabled(false);
- }
- CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() after CheatSheetPage() call: "); //$NON-NLS-1$ //$NON-NLS-2$
- currentPage.createPart(control);
- CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() after CheatSheetPage.createPart() call: "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() after CheatSheetPage() call: "); //$NON-NLS-1$ //$NON-NLS-2$
+ currentPage.createPart(control);
+ CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() after CheatSheetPage.createPart() call: "); //$NON-NLS-1$ //$NON-NLS-2$
- if (model instanceof CheatSheet) {
+ if (model instanceof CheatSheet) {
CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() after fireEvent() call: "); //$NON-NLS-1$ //$NON-NLS-2$
if(!loadState()) {
@@ -897,7 +897,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
}
getManager().fireEvent(ICheatSheetEvent.CHEATSHEET_OPENED);
- }
+ }
CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() after checkSavedState() call: "); //$NON-NLS-1$ //$NON-NLS-2$
currentPage.initialized();
@@ -908,7 +908,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
if (currentItem != null && !currentItem.isCompleted())
currentItem.setFocus();
CheatSheetStopWatch.printLapTime("CheatSheetViewer.initCheatSheetView()", "Time in CheatSheetViewer.initCheatSheetView() at end of method: "); //$NON-NLS-1$ //$NON-NLS-2$
- return true;
+ return true;
}
private void internalDispose() {
@@ -1043,9 +1043,9 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
if (status.isOK() && dialogReturnCode != Window.CANCEL) {
coreItem.setRestartImage();
if (!coreItem.hasConfirm()) {
- //set that item as complete.
- advanceItem(link, true);
- saveCurrentSheet();
+ //set that item as complete.
+ advanceItem(link, true);
+ saveCurrentSheet();
}
}
}
@@ -1089,10 +1089,10 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
if(currentID != null) {
if (currentPage instanceof CheatSheetPage) {
Properties properties = saveHelper.createProperties(currentItemNum, viewItemList, getExpandRestoreActionState(), expandRestoreList, currentID, restorePath);
- IStatus status = stateManager.saveState(properties, getManager());
- if (!status.isOK()) {
- CheatSheetPlugin.getPlugin().getLog().log(status);
- }
+ IStatus status = stateManager.saveState(properties, getManager());
+ if (!status.isOK()) {
+ CheatSheetPlugin.getPlugin().getLog().log(status);
+ }
} else if (currentPage instanceof CompositeCheatSheetPage) {
((CompositeCheatSheetPage)currentPage).saveState();
}
@@ -1174,7 +1174,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
errorMessage = NLS.bind(Messages.ERROR_OPENING_FILE_IN_PARSER, (new Object[] {element.getHref()}));
}
}
- String pluginId = bundle != null ? bundle.getSymbolicName() : null;
+ String pluginId = bundle != null ? bundle.getSymbolicName() : null;
parserInput = new ParserInput(contentURL, pluginId, errorMessage);
}
@@ -1268,7 +1268,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
setContent(element, inputStateManager);
}
- /*package*/ void toggleExpandRestore() {
+ /*package*/ void toggleExpandRestore() {
if(expandRestoreAction == null)
return;
@@ -1321,7 +1321,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
public void saveState(IMemento memento) {
if (currentPage instanceof CheatSheetPage) {
Properties properties = saveHelper.createProperties(currentItemNum, viewItemList, getExpandRestoreActionState(), expandRestoreList, currentID, restorePath);
- saveHelper.saveToMemento(properties, getManager(), memento);
+ saveHelper.saveToMemento(properties, getManager(), memento);
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
index c473587c1..57dc7c663 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CoreItem.java
@@ -255,10 +255,10 @@ public class CoreItem extends ViewItem {
separatorData.valign = TableWrapData.MIDDLE;
separator.setLayoutData(separatorData);
for (int i = 3; i <= SUBITEM_COLUMNS; i++) {
- Label filler = page.getToolkit().createLabel(buttonComposite, null);
- TableWrapData fillerData = new TableWrapData();
- fillerData.maxWidth = 0;
- filler.setLayoutData(fillerData);
+ Label filler = page.getToolkit().createLabel(buttonComposite, null);
+ TableWrapData fillerData = new TableWrapData();
+ fillerData.maxWidth = 0;
+ filler.setLayoutData(fillerData);
}
}
@@ -531,7 +531,7 @@ public class CoreItem extends ViewItem {
}
if ( status.getSeverity() == IStatus.ERROR) {
CheatSheetPlugin.getPlugin().getLog().log(status);
- org.eclipse.jface.dialogs.ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), null, null, status);
+ org.eclipse.jface.dialogs.ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), null, null, status);
}
return VIEWITEM_DONOT_ADVANCE;
} finally {
@@ -574,7 +574,7 @@ public class CoreItem extends ViewItem {
if (startButton != null) {
startButton.setImage(CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_ITEM_BUTTON_RESTART));
startButton.setText(Messages.RESTART_TASK_TOOLTIP);
- startButton.setToolTipText(Messages.RESTART_TASK_TOOLTIP);
+ startButton.setToolTipText(Messages.RESTART_TASK_TOOLTIP);
}
}
@@ -584,9 +584,9 @@ public class CoreItem extends ViewItem {
if (startButton != null) {
startButton.setImage(CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.CHEATSHEET_ITEM_BUTTON_START));
if (startButton.getText() != null) {
- startButton.setText(Messages.PERFORM_TASK_TOOLTIP);
+ startButton.setText(Messages.PERFORM_TASK_TOOLTIP);
}
- startButton.setToolTipText(Messages.PERFORM_TASK_TOOLTIP);
+ startButton.setToolTipText(Messages.PERFORM_TASK_TOOLTIP);
}
}
@@ -599,7 +599,7 @@ public class CoreItem extends ViewItem {
@Override
void createCompletionComposite(boolean isFinalItem) {
String completionMessage = viewer.getManager().performVariableSubstitution
- (item.getCompletionMessage());
+ (item.getCompletionMessage());
if (completionMessage != null) {
Color backgroundColor = bodyWrapperComposite.getBackground();
completionComposite = page.getToolkit().createComposite(
@@ -673,25 +673,25 @@ public class CoreItem extends ViewItem {
ArrayList<SubItemCompositeHolder> list = getListOfSubItemCompositeHolders();
Control subitemLabel = null;
SubItemCompositeHolder holder = null;
- if (list != null) {
+ if (list != null) {
for (Iterator<SubItemCompositeHolder> iter = list.iterator(); iter.hasNext() && subitemLabel == null;) {
holder = iter.next();
- if (!holder.isCompleted() && !holder.isSkipped()) {
- subitemLabel = holder.getSubitemLabel();
- }
- }
- }
- if (subitemLabel != null) {
- FormToolkit.ensureVisible(subitemLabel);
- if (holder.getStartButton() != null) {
- holder.getStartButton().setFocus();
- } else if (holder.getCompleteButton() != null) {
- holder.getCompleteButton().setFocus();
- }
- } else {
- FormToolkit.ensureVisible(getMainItemComposite());
- super.setFocus();
- }
+ if (!holder.isCompleted() && !holder.isSkipped()) {
+ subitemLabel = holder.getSubitemLabel();
+ }
+ }
+ }
+ if (subitemLabel != null) {
+ FormToolkit.ensureVisible(subitemLabel);
+ if (holder.getStartButton() != null) {
+ holder.getStartButton().setFocus();
+ } else if (holder.getCompleteButton() != null) {
+ holder.getCompleteButton().setFocus();
+ }
+ } else {
+ FormToolkit.ensureVisible(getMainItemComposite());
+ super.setFocus();
+ }
}
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java
index 25b9ab2ea..9ab6ca9bf 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ErrorPage.java
@@ -115,20 +115,20 @@ public class ErrorPage extends Page {
}
/**
- * Return the image for a status message
- *
- * @return
- */
- private Image getImage(int severity) {
- switch(severity) {
- case IStatus.ERROR:
- return CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.ERROR);
- case IStatus.WARNING:
- return CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.WARNING);
- default:
- return CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.INFORMATION);
- }
- }
+ * Return the image for a status message
+ *
+ * @return
+ */
+ private Image getImage(int severity) {
+ switch(severity) {
+ case IStatus.ERROR:
+ return CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.ERROR);
+ case IStatus.WARNING:
+ return CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.WARNING);
+ default:
+ return CheatSheetPlugin.getPlugin().getImage(ICheatSheetResource.INFORMATION);
+ }
+ }
/**
* Creates the cheatsheet's title areawhich will consists
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java
index fbe0b91fe..bc98a0ca2 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/ViewItem.java
@@ -359,14 +359,14 @@ public abstract class ViewItem {
}
public boolean isCompletionMessageExpanded() {
- return completionMessageExpanded;
- }
+ return completionMessageExpanded;
+ }
/**
- * Returns whether or not cheat sheet viewer containing this item is in
- * a modal dialog.
- *
- * @return whether the cheat sheet viewer is in a modal dialog
+ * Returns whether or not cheat sheet viewer containing this item is in
+ * a modal dialog.
+ *
+ * @return whether the cheat sheet viewer is in a modal dialog
*/
public boolean isInDialogMode() {
return viewer.isInDialogMode();
@@ -403,7 +403,7 @@ public abstract class ViewItem {
Point point = widget.getDisplay().getCursorLocation();
point = new Point(point.x + 15, point.y);
// display the help
- PlatformUI.getWorkbench().getHelpSystem().displayContext(context, point.x, point.y);
+ PlatformUI.getWorkbench().getHelpSystem().displayContext(context, point.x, point.y);
}
}
@@ -618,6 +618,6 @@ public abstract class ViewItem {
bodyText.copy();
}
- abstract boolean hasCompletionMessage();
+ abstract boolean hasCompletionMessage();
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
index 87bdcd486..ddc830aa1 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
@@ -407,12 +407,12 @@ public class CustomizationContentsArea {
if (previewImage==null) {
String path = element.getAttribute("previewImage"); //$NON-NLS-1$
if (path!=null) {
- String bid = element.getDeclaringExtension().getContributor().getName();
- Bundle bundle = Platform.getBundle(bid);
- if (bundle!=null) {
- ImageDescriptor desc = ImageUtil.createImageDescriptor(bundle, path);
- previewImage = desc.createImage();
- }
+ String bid = element.getDeclaringExtension().getContributor().getName();
+ Bundle bundle = Platform.getBundle(bid);
+ if (bundle!=null) {
+ ImageDescriptor desc = ImageUtil.createImageDescriptor(bundle, path);
+ previewImage = desc.createImage();
+ }
}
}
return previewImage;
@@ -622,7 +622,7 @@ public class CustomizationContentsArea {
while (stok.hasMoreTokens()) {
String tok = stok.nextToken().trim();
if (!NO_ROOT_PAGES.equals(tok)) {
- introRootPages.add(tok);
+ introRootPages.add(tok);
}
}
}
@@ -650,11 +650,11 @@ public class CustomizationContentsArea {
String pidKey = pid + "_" + key; //$NON-NLS-1$
String value;
if (!fromDefault) {
- prefs = InstanceScope.INSTANCE.getNode(pluginId);
- value = getPreference(key, prefs, pidKey, null);
- if (value != null) {
- return value;
- }
+ prefs = InstanceScope.INSTANCE.getNode(pluginId);
+ value = getPreference(key, prefs, pidKey, null);
+ if (value != null) {
+ return value;
+ }
}
prefs = DefaultScope.INSTANCE.getNode(pluginId);
return getPreference(key, prefs, pidKey, ""); //$NON-NLS-1$
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java
index a4d3d6a07..9d6937035 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationDialog.java
@@ -24,7 +24,7 @@ import org.eclipse.ui.internal.intro.universal.util.ImageUtil;
public class CustomizationDialog extends TrayDialog {
- private CustomizationContentsArea contentsArea;
+ private CustomizationContentsArea contentsArea;
private String pageId;
private CustomizationContentsArea getContentsArea() {
@@ -53,22 +53,22 @@ public class CustomizationDialog extends TrayDialog {
@Override
protected void okPressed() {
if (getContentsArea().performOk()) {
- getContentsArea().dispose();
+ getContentsArea().dispose();
}
super.okPressed();
}
@Override
protected void cancelPressed() {
- getContentsArea().dispose();
- super.cancelPressed();
+ getContentsArea().dispose();
+ super.cancelPressed();
}
- @Override
+ @Override
protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
+ super.configureShell(newShell);
newShell.setText(Messages.WelcomeCustomizationPreferencePage_Customize);
- newShell.setImage(ImageUtil.createImage("full/elcl16/configure.png")); //$NON-NLS-1$);
- }
+ newShell.setImage(ImageUtil.createImage("full/elcl16/configure.png")); //$NON-NLS-1$);
+ }
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IUniversalIntroConstants.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IUniversalIntroConstants.java
index 0b4649edc..b678bf1df 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IUniversalIntroConstants.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IUniversalIntroConstants.java
@@ -16,50 +16,50 @@ package org.eclipse.ui.internal.intro.universal;
public interface IUniversalIntroConstants {
- // all attributes here are by default public static final.
-
- // General consts.
- // ---------------
- String PLUGIN_ID = "org.eclipse.ui.intro.universal"; //$NON-NLS-1$
- String PREFIX = PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Empty Standby Content part. This is registered in this plugin,
- // through markup.
- String EMPTY_STANDBY_CONTENT_PART = "org.eclipse.ui.intro.config.emptyStandby"; //$NON-NLS-1$
-
- // Memento constants
- // ------------------
- String MEMENTO_PRESENTATION_TAG = "presentation"; //$NON-NLS-1$
- String MEMENTO_CURRENT_PAGE_ATT = "currentPage"; //$NON-NLS-1$
- String MEMENTO_STANDBY_PART_TAG = "standbyPart"; //$NON-NLS-1$
- String MEMENTO_STANDBY_CONTENT_PART_ID_ATT = "contentPartID"; //$NON-NLS-1$
- String MEMENTO_STANDBY_CONTENT_PART_TAG = "standbyContentPart"; //$NON-NLS-1$
- String MEMENTO_RESTORE_ATT = "restore"; //$NON-NLS-1$
-
- // CustomizableIntroPart consts:
- // -----------------------------
- // key to retrieve if a standby part is needed.
- String SHOW_STANDBY_PART = "showStandbyPart"; //$NON-NLS-1$
-
- // Form implementation consts:
- // ---------------------------
- // key to retrieve the into link model object from imageHyperlink widget.
- // convention: actual string value is class name.
- String INTRO_LINK = "IntroLink"; //$NON-NLS-1$
-
- // key to retrive page sub-title from PageContentForm
- String PAGE_SUBTITLE = "PageSubtitle"; //$NON-NLS-1$
-
-
- // Performance keys
- // -----------------------
- String INTRO = "intro"; //$NON-NLS-1$
- String PERF_VIEW_CREATION_TIME = PLUGIN_ID + "/perf/createView"; //$NON-NLS-1$
- String PERF_SET_STANDBY_STATE = PLUGIN_ID + "/perf/setStandbyState"; //$NON-NLS-1$
- // not exposed in .option. Used because framework is convenient.
- String PERF_UI_ZOOM = PLUGIN_ID + "/perf/uiZoom"; //$NON-NLS-1$
-
- // Universal Welcome
+ // all attributes here are by default public static final.
+
+ // General consts.
+ // ---------------
+ String PLUGIN_ID = "org.eclipse.ui.intro.universal"; //$NON-NLS-1$
+ String PREFIX = PLUGIN_ID + "."; //$NON-NLS-1$
+
+ // Empty Standby Content part. This is registered in this plugin,
+ // through markup.
+ String EMPTY_STANDBY_CONTENT_PART = "org.eclipse.ui.intro.config.emptyStandby"; //$NON-NLS-1$
+
+ // Memento constants
+ // ------------------
+ String MEMENTO_PRESENTATION_TAG = "presentation"; //$NON-NLS-1$
+ String MEMENTO_CURRENT_PAGE_ATT = "currentPage"; //$NON-NLS-1$
+ String MEMENTO_STANDBY_PART_TAG = "standbyPart"; //$NON-NLS-1$
+ String MEMENTO_STANDBY_CONTENT_PART_ID_ATT = "contentPartID"; //$NON-NLS-1$
+ String MEMENTO_STANDBY_CONTENT_PART_TAG = "standbyContentPart"; //$NON-NLS-1$
+ String MEMENTO_RESTORE_ATT = "restore"; //$NON-NLS-1$
+
+ // CustomizableIntroPart consts:
+ // -----------------------------
+ // key to retrieve if a standby part is needed.
+ String SHOW_STANDBY_PART = "showStandbyPart"; //$NON-NLS-1$
+
+ // Form implementation consts:
+ // ---------------------------
+ // key to retrieve the into link model object from imageHyperlink widget.
+ // convention: actual string value is class name.
+ String INTRO_LINK = "IntroLink"; //$NON-NLS-1$
+
+ // key to retrive page sub-title from PageContentForm
+ String PAGE_SUBTITLE = "PageSubtitle"; //$NON-NLS-1$
+
+
+ // Performance keys
+ // -----------------------
+ String INTRO = "intro"; //$NON-NLS-1$
+ String PERF_VIEW_CREATION_TIME = PLUGIN_ID + "/perf/createView"; //$NON-NLS-1$
+ String PERF_SET_STANDBY_STATE = PLUGIN_ID + "/perf/setStandbyState"; //$NON-NLS-1$
+ // not exposed in .option. Used because framework is convenient.
+ String PERF_UI_ZOOM = PLUGIN_ID + "/perf/uiZoom"; //$NON-NLS-1$
+
+ // Universal Welcome
String LOW = "low"; //$NON-NLS-1$
String MEDIUM = "medium"; //$NON-NLS-1$
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java
index 236b0ce5b..4a79ca4f5 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/IntroData.java
@@ -103,44 +103,44 @@ public class IntroData {
if (bundle==null)
return;
String content = BundleUtil.getResolvedResourceLocation("", fileName, //$NON-NLS-1$
- bundle);
- IntroContentParser parser = new IntroContentParser(content);
- Document dom = parser.getDocument();
- // dom can be null if the content file cannot be found
- if (dom==null)
- return;
- Element root = dom.getDocumentElement();
- Element extension = null;
- NodeList children = root.getChildNodes();
- for (int i=0; i<children.getLength(); i++) {
- Node child = children.item(i);
- if (child.getNodeType()==Node.ELEMENT_NODE) {
- Element el = (Element)child;
- if (el.getNodeName().equalsIgnoreCase("extensionContent")) { //$NON-NLS-1$
- extension = el;
- break;
- }
- }
- }
- if (extension==null)
- return;
- String id = extension.getAttribute("id"); //$NON-NLS-1$
- String name = extension.getAttribute("name"); //$NON-NLS-1$
- String path = extension.getAttribute("path"); //$NON-NLS-1$
- if (id==null || path==null)
- return;
- int at = path.lastIndexOf("/@"); //$NON-NLS-1$
- if (at == -1)
- return;
- if (path.charAt(path.length()-1)!='@')
- return;
- String pageId = path.substring(0, at);
- PageData pd = pages.get(pageId);
- if (pd==null) {
- pd = new PageData(pageId);
- pages.put(pageId, pd);
- }
- pd.addImplicitExtension(id, name);
+ bundle);
+ IntroContentParser parser = new IntroContentParser(content);
+ Document dom = parser.getDocument();
+ // dom can be null if the content file cannot be found
+ if (dom==null)
+ return;
+ Element root = dom.getDocumentElement();
+ Element extension = null;
+ NodeList children = root.getChildNodes();
+ for (int i=0; i<children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child.getNodeType()==Node.ELEMENT_NODE) {
+ Element el = (Element)child;
+ if (el.getNodeName().equalsIgnoreCase("extensionContent")) { //$NON-NLS-1$
+ extension = el;
+ break;
+ }
+ }
+ }
+ if (extension==null)
+ return;
+ String id = extension.getAttribute("id"); //$NON-NLS-1$
+ String name = extension.getAttribute("name"); //$NON-NLS-1$
+ String path = extension.getAttribute("path"); //$NON-NLS-1$
+ if (id==null || path==null)
+ return;
+ int at = path.lastIndexOf("/@"); //$NON-NLS-1$
+ if (at == -1)
+ return;
+ if (path.charAt(path.length()-1)!='@')
+ return;
+ String pageId = path.substring(0, at);
+ PageData pd = pages.get(pageId);
+ if (pd==null) {
+ pd = new PageData(pageId);
+ pages.put(pageId, pd);
+ }
+ pd.addImplicitExtension(id, name);
}
private Document parse(String fileNameOrData) {
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/Messages.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/Messages.java
index 927066f1d..a2bbe6437 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/Messages.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/Messages.java
@@ -16,14 +16,14 @@ package org.eclipse.ui.internal.intro.universal;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
- private static final String INTRO_RESOURCE_BUNDLE = "org.eclipse.ui.internal.intro.universal.Messages"; //$NON-NLS-1$
+ private static final String INTRO_RESOURCE_BUNDLE = "org.eclipse.ui.internal.intro.universal.Messages"; //$NON-NLS-1$
- static {
- initializeMessages(INTRO_RESOURCE_BUNDLE, Messages.class);
- }
+ static {
+ initializeMessages(INTRO_RESOURCE_BUNDLE, Messages.class);
+ }
- // Misc
- // -------
+ // Misc
+ // -------
public static String SharedIntroConfigurer_overview_name;
public static String SharedIntroConfigurer_overview_alt;
public static String SharedIntroConfigurer_overview_tooltip;
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java
index 4a339d596..aa9b29a8a 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroPlugin.java
@@ -26,118 +26,118 @@ import org.osgi.framework.BundleContext;
public class UniversalIntroPlugin extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.eclipse.ui.intro.universal"; //$NON-NLS-1$
- // The static shared instance.
- private static UniversalIntroPlugin inst;
-
- // used for performance logging. Time when the constructor of
- // CustomizableIntroPart is called.
- private long uiCreationStartTime;
-
- // image registry that can be disposed while the
- // plug-in is still active. This is important for
- // switching themes after the plug-in has been loaded.
- private ImageRegistry volatileImageRegistry;
-
- /**
- * The constructor.
- */
- public UniversalIntroPlugin() {
- super();
- }
-
- /**
- * Returns the shared plugin instance.
- */
- public static UniversalIntroPlugin getDefault() {
- return inst;
- }
-
- /**
- * Returns the Intro Part.
- */
- public static IIntroPart getIntro() {
- IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
- .getIntro();
- return introPart;
- }
-
- /**
- * Returns the Intro Part after forcing an open on it.
- */
- public static IIntroPart showIntro(boolean standby) {
- IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
- .showIntro(PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
- standby);
- return introPart;
- }
-
- /**
- * Returns the standby state of the Intro Part. If the intro is closed,
- * retruns false.
- */
- public static boolean isIntroStandby() {
- return PlatformUI.getWorkbench().getIntroManager().isIntroStandby(
- getIntro());
- }
-
- /**
- * Sets the standby state of the Intro Part. If the intro is closed, retruns
- * false.
- */
- public static void setIntroStandby(boolean standby) {
- PlatformUI.getWorkbench().getIntroManager().setIntroStandby(getIntro(),
- standby);
- }
-
-
- /**
- * Returns the standby state of the Intro Part. If the intro is closed,
- * retruns false.
- */
- public static boolean closeIntro() {
- // Relies on Workbench.
- return PlatformUI.getWorkbench().getIntroManager().closeIntro(
- getIntro());
- }
-
- public ImageRegistry getVolatileImageRegistry() {
- if (volatileImageRegistry==null) {
- volatileImageRegistry = createImageRegistry();
- initializeImageRegistry(volatileImageRegistry);
- }
- return volatileImageRegistry;
- }
-
- public void resetVolatileImageRegistry() {
- if (volatileImageRegistry!=null) {
- volatileImageRegistry.dispose();
- volatileImageRegistry = null;
- }
- }
-
-
- @Override
+ // The static shared instance.
+ private static UniversalIntroPlugin inst;
+
+ // used for performance logging. Time when the constructor of
+ // CustomizableIntroPart is called.
+ private long uiCreationStartTime;
+
+ // image registry that can be disposed while the
+ // plug-in is still active. This is important for
+ // switching themes after the plug-in has been loaded.
+ private ImageRegistry volatileImageRegistry;
+
+ /**
+ * The constructor.
+ */
+ public UniversalIntroPlugin() {
+ super();
+ }
+
+ /**
+ * Returns the shared plugin instance.
+ */
+ public static UniversalIntroPlugin getDefault() {
+ return inst;
+ }
+
+ /**
+ * Returns the Intro Part.
+ */
+ public static IIntroPart getIntro() {
+ IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
+ .getIntro();
+ return introPart;
+ }
+
+ /**
+ * Returns the Intro Part after forcing an open on it.
+ */
+ public static IIntroPart showIntro(boolean standby) {
+ IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
+ .showIntro(PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+ standby);
+ return introPart;
+ }
+
+ /**
+ * Returns the standby state of the Intro Part. If the intro is closed,
+ * retruns false.
+ */
+ public static boolean isIntroStandby() {
+ return PlatformUI.getWorkbench().getIntroManager().isIntroStandby(
+ getIntro());
+ }
+
+ /**
+ * Sets the standby state of the Intro Part. If the intro is closed, retruns
+ * false.
+ */
+ public static void setIntroStandby(boolean standby) {
+ PlatformUI.getWorkbench().getIntroManager().setIntroStandby(getIntro(),
+ standby);
+ }
+
+
+ /**
+ * Returns the standby state of the Intro Part. If the intro is closed,
+ * retruns false.
+ */
+ public static boolean closeIntro() {
+ // Relies on Workbench.
+ return PlatformUI.getWorkbench().getIntroManager().closeIntro(
+ getIntro());
+ }
+
+ public ImageRegistry getVolatileImageRegistry() {
+ if (volatileImageRegistry==null) {
+ volatileImageRegistry = createImageRegistry();
+ initializeImageRegistry(volatileImageRegistry);
+ }
+ return volatileImageRegistry;
+ }
+
+ public void resetVolatileImageRegistry() {
+ if (volatileImageRegistry!=null) {
+ volatileImageRegistry.dispose();
+ volatileImageRegistry = null;
+ }
+ }
+
+
+ @Override
public void start(BundleContext context) throws Exception {
- super.start(context);
- inst = this;
- if (Log.logInfo)
- Log.info("IntroPlugin - calling start on Intro bundle"); //$NON-NLS-1$
+ super.start(context);
+ inst = this;
+ if (Log.logInfo)
+ Log.info("IntroPlugin - calling start on Intro bundle"); //$NON-NLS-1$
- }
+ }
- @Override
+ @Override
public void stop(BundleContext context) throws Exception {
- resetVolatileImageRegistry();
- super.stop(context);
- }
+ resetVolatileImageRegistry();
+ super.stop(context);
+ }
- public long gettUICreationStartTime() {
- return uiCreationStartTime;
- }
+ public long gettUICreationStartTime() {
+ return uiCreationStartTime;
+ }
- public void setUICreationStartTime(long uiCreationStartTime) {
- this.uiCreationStartTime = uiCreationStartTime;
- }
+ public void setUICreationStartTime(long uiCreationStartTime) {
+ this.uiCreationStartTime = uiCreationStartTime;
+ }
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java
index ca65ce244..3cd20e844 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/WelcomeCustomizationPreferencePage.java
@@ -26,7 +26,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
public class WelcomeCustomizationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage,
IExecutableExtension {
- private CustomizationContentsArea contentsArea;
+ private CustomizationContentsArea contentsArea;
public WelcomeCustomizationPreferencePage() {
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java
index 5c44f968a..2adb2d873 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetectHelper.java
@@ -47,16 +47,16 @@ public class ContentDetectHelper {
private File getConfigurationLocation() {
if (configurationDirectory == null) {
- Location location = Platform.getConfigurationLocation();
- if (location != null) {
- URL configURL = location.getURL();
- if (configURL != null && configURL.getProtocol().startsWith("file")) { //$NON-NLS-1$
- configurationDirectory = new File(configURL.getFile(), PLUGIN_ID);
+ Location location = Platform.getConfigurationLocation();
+ if (location != null) {
+ URL configURL = location.getURL();
+ if (configURL != null && configURL.getProtocol().startsWith("file")) { //$NON-NLS-1$
+ configurationDirectory = new File(configURL.getFile(), PLUGIN_ID);
if (configurationDirectory != null && !configurationDirectory.exists()) {
configurationDirectory.mkdirs();
}
- }
- }
+ }
+ }
}
return configurationDirectory;
}
@@ -119,7 +119,7 @@ public class ContentDetectHelper {
memento = null;
// Do nothing, the file will not exist the first time the workbench in used.
} catch (Exception e) {
- // TODO should we log an error?
+ // TODO should we log an error?
memento = null;
} finally {
try {
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java
index 17befbae5..3cbf652bb 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/contentdetect/ContentDetector.java
@@ -71,9 +71,9 @@ public class ContentDetector extends IntroContentDetector {
*/
public static Set<String> getNewContributors() {
if (!detectorCalled) {
- detectorCalled = true;
- new ContentDetector().isNewContentAvailable();
- }
+ detectorCalled = true;
+ new ContentDetector().isNewContentAvailable();
+ }
return newContributors;
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java
index b0f127175..765078805 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/BundleUtil.java
@@ -30,230 +30,230 @@ import org.osgi.framework.Constants;
*/
public class BundleUtil {
- private static String NL_TAG = "$nl$/"; //$NON-NLS-1$
+ private static String NL_TAG = "$nl$/"; //$NON-NLS-1$
- /**
- * Utility method to validate the state of a bundle. Log invalid bundles to
- * log file.
- */
- public static boolean bundleHasValidState(Bundle bundle) {
- if (bundle == null || bundle.getState() == Bundle.UNINSTALLED
- || bundle.getState() == Bundle.INSTALLED) {
+ /**
+ * Utility method to validate the state of a bundle. Log invalid bundles to
+ * log file.
+ */
+ public static boolean bundleHasValidState(Bundle bundle) {
+ if (bundle == null || bundle.getState() == Bundle.UNINSTALLED
+ || bundle.getState() == Bundle.INSTALLED) {
- if (bundle == null)
- Log.error("Universal Welcome tried accessing a NULL bundle.", null); //$NON-NLS-1$
- else {
+ if (bundle == null)
+ Log.error("Universal Welcome tried accessing a NULL bundle.", null); //$NON-NLS-1$
+ else {
String msg = StringUtil.concat("Universal Welcome tried accessing Bundle: ", getBundleHeader( //$NON-NLS-1$
bundle, Constants.BUNDLE_NAME), " vendor: ", //$NON-NLS-1$
getBundleHeader(bundle, Constants.BUNDLE_VENDOR), " bundle state: ", //$NON-NLS-1$
String.valueOf(bundle.getState()));
Log.error(msg, null);
- }
- return false;
- }
-
- return true;
- }
-
- /**
- * Retrieves the given key from the bundle header.
- *
- * @param bundle
- * @param key
- * @return
- */
- public static String getBundleHeader(Bundle bundle, String key) {
- return bundle.getHeaders().get(key);
- }
-
-
- public static Bundle getBundleFromConfigurationElement(
- IConfigurationElement cfg) {
- return Platform.getBundle(cfg.getNamespaceIdentifier());
- }
-
-
- /**
- * Get the resourcelocation, but do not force an $nl$ on it.
- *
- * @param resource
- * @param element
- * @return
- */
- public static String getResourceLocation(String resource,
- IConfigurationElement element) {
- Bundle bundle = getBundleFromConfigurationElement(element);
- return getResolvedResourceLocation(resource, bundle, false);
- }
-
-
- /**
- * Returns the fully qualified location of the passed resource string from
- * the passed plugin id. If the file could not be loaded from the plugin,
- * the resource is returned as is.
- *
- * @param resource
- * @return
- */
- public static String getResolvedResourceLocation(String resource,
- String pluginId) {
- Bundle bundle = Platform.getBundle(pluginId);
- return getResolvedResourceLocation(resource, bundle, true);
- }
-
-
- /**
- * Shorthand util method.
- *
- * @param resource
- * @return
- */
- public static String getResolvedResourceLocation(String resource,
- Bundle bundle) {
- return getResolvedResourceLocation(resource, bundle, true);
- }
-
-
- public static String getResolvedResourceLocation(String base,
- String resource, Bundle bundle) {
- // quick exits.
- if (resource == null)
- return null;
-
- String fullResource = new Path(base).append(resource).toString();
- String resolvedResource = getResolvedResourceLocation(fullResource,
- bundle, true);
-
- if (resolvedResource.equals(fullResource))
- // return resource as is when the resource does not exist.
- return resource;
- return resolvedResource;
- }
-
-
- public static String getResolvedResourceLocation(String resource,
- Bundle bundle, boolean forceNLResolve) {
- // quick exits.
- if (resource == null)
- return null;
-
- if (bundle == null || !bundleHasValidState(bundle))
- return resource;
-
- URL localLocation = null;
- try {
- // we need to resolve this URL.
- String copyResource = resource;
- if (forceNLResolve && !copyResource.startsWith(NL_TAG)) {
- if (copyResource.startsWith("/") //$NON-NLS-1$
- || copyResource.startsWith("\\")) //$NON-NLS-1$
- copyResource = resource.substring(1);
- copyResource = NL_TAG + copyResource;
- }
- IPath resourcePath = new Path(copyResource);
- localLocation = FileLocator.find(bundle, resourcePath, null);
- if (localLocation == null) {
- // localLocation can be null if the passed resource could not
- // be found relative to the plugin. log fact, return resource,
- // as is.
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Retrieves the given key from the bundle header.
+ *
+ * @param bundle
+ * @param key
+ * @return
+ */
+ public static String getBundleHeader(Bundle bundle, String key) {
+ return bundle.getHeaders().get(key);
+ }
+
+
+ public static Bundle getBundleFromConfigurationElement(
+ IConfigurationElement cfg) {
+ return Platform.getBundle(cfg.getNamespaceIdentifier());
+ }
+
+
+ /**
+ * Get the resourcelocation, but do not force an $nl$ on it.
+ *
+ * @param resource
+ * @param element
+ * @return
+ */
+ public static String getResourceLocation(String resource,
+ IConfigurationElement element) {
+ Bundle bundle = getBundleFromConfigurationElement(element);
+ return getResolvedResourceLocation(resource, bundle, false);
+ }
+
+
+ /**
+ * Returns the fully qualified location of the passed resource string from
+ * the passed plugin id. If the file could not be loaded from the plugin,
+ * the resource is returned as is.
+ *
+ * @param resource
+ * @return
+ */
+ public static String getResolvedResourceLocation(String resource,
+ String pluginId) {
+ Bundle bundle = Platform.getBundle(pluginId);
+ return getResolvedResourceLocation(resource, bundle, true);
+ }
+
+
+ /**
+ * Shorthand util method.
+ *
+ * @param resource
+ * @return
+ */
+ public static String getResolvedResourceLocation(String resource,
+ Bundle bundle) {
+ return getResolvedResourceLocation(resource, bundle, true);
+ }
+
+
+ public static String getResolvedResourceLocation(String base,
+ String resource, Bundle bundle) {
+ // quick exits.
+ if (resource == null)
+ return null;
+
+ String fullResource = new Path(base).append(resource).toString();
+ String resolvedResource = getResolvedResourceLocation(fullResource,
+ bundle, true);
+
+ if (resolvedResource.equals(fullResource))
+ // return resource as is when the resource does not exist.
+ return resource;
+ return resolvedResource;
+ }
+
+
+ public static String getResolvedResourceLocation(String resource,
+ Bundle bundle, boolean forceNLResolve) {
+ // quick exits.
+ if (resource == null)
+ return null;
+
+ if (bundle == null || !bundleHasValidState(bundle))
+ return resource;
+
+ URL localLocation = null;
+ try {
+ // we need to resolve this URL.
+ String copyResource = resource;
+ if (forceNLResolve && !copyResource.startsWith(NL_TAG)) {
+ if (copyResource.startsWith("/") //$NON-NLS-1$
+ || copyResource.startsWith("\\")) //$NON-NLS-1$
+ copyResource = resource.substring(1);
+ copyResource = NL_TAG + copyResource;
+ }
+ IPath resourcePath = new Path(copyResource);
+ localLocation = FileLocator.find(bundle, resourcePath, null);
+ if (localLocation == null) {
+ // localLocation can be null if the passed resource could not
+ // be found relative to the plugin. log fact, return resource,
+ // as is.
String msg = StringUtil.concat("Could not find resource: ", //$NON-NLS-1$
resource, " in ", getBundleHeader( //$NON-NLS-1$
bundle, Constants.BUNDLE_NAME));
- Log.warning(msg);
- return resource;
- }
- /*
- localLocation = FileLocator.toFileURL(localLocation);
- return localLocation.toExternalForm();
- */
- return toExternalForm(localLocation);
- } catch (Exception e) {
+ Log.warning(msg);
+ return resource;
+ }
+ /*
+ localLocation = FileLocator.toFileURL(localLocation);
+ return localLocation.toExternalForm();
+ */
+ return toExternalForm(localLocation);
+ } catch (Exception e) {
String msg = StringUtil.concat("Failed to load resource: ", //$NON-NLS-1$
resource, " from ", getBundleHeader(bundle, //$NON-NLS-1$
Constants.BUNDLE_NAME));
- Log.error(msg, e);
- return resource;
- }
- }
-
- private static String toExternalForm(URL localURL) {
- try {
- localURL = FileLocator.toFileURL(localURL);
- String result = localURL.toExternalForm();
- if (result.startsWith("file:/")) { //$NON-NLS-1$
- if (result.startsWith("file:///")==false) { //$NON-NLS-1$
- result = "file:///"+result.substring(6); //$NON-NLS-1$
- }
- }
- return result;
- }
- catch (IOException e) {
- String msg = "Failed to resolve URL: " //$NON-NLS-1$
- + localURL.toString();
- Log.error(msg, e);
- return localURL.toString();
- }
- }
-
-
-
-
- /** *** used by Intro parser ***** */
- /*
- * Util method to return an URL to a plugin relative resource.
- */
- public static URL getResourceAsURL(String resource, String pluginId) {
- Bundle bundle = Platform.getBundle(pluginId);
- URL localLocation = FileLocator.find(bundle, new Path(
- resource), null);
- return localLocation;
- }
-
-
-
-
- /** ********************* Used by HTML generator ****************** */
- /**
- * Get the absolute path of the given bundle, in the form
- * file:/path_to_plugin
- *
- * @param bundle
- * @return
- */
- public static String getResolvedBundleLocation(Bundle bundle) {
- try {
- URL bundleLocation = bundle.getEntry(""); //$NON-NLS-1$
- if (bundleLocation == null)
- return null;
- /*
- bundleLocation = FileLocator.toFileURL(bundleLocation);
- return bundleLocation.toExternalForm();
- */
- return toExternalForm(bundleLocation);
- } catch (IllegalStateException e) {
- Log.error("Failed to access bundle: " //$NON-NLS-1$
- + bundle.getSymbolicName(), e);
- return null;
- } /* catch (IOException e) {
- Log.error("Failed to resolve URL path for bundle: " //$NON-NLS-1$
- + bundle.getSymbolicName(), e);
- return null;
- } */
- }
-
- /**
- * Get the absolute path of the bundle with id <code>bundleId</code>. If
- * no such bundle is found, return null.
- *
- * @param bundleId
- * @return
- */
- public static String getResolvedBundleLocation(String bundleId) {
- Bundle bundle = Platform.getBundle(bundleId);
- if (bundle == null)
- return null;
- return getResolvedBundleLocation(bundle);
- }
+ Log.error(msg, e);
+ return resource;
+ }
+ }
+
+ private static String toExternalForm(URL localURL) {
+ try {
+ localURL = FileLocator.toFileURL(localURL);
+ String result = localURL.toExternalForm();
+ if (result.startsWith("file:/")) { //$NON-NLS-1$
+ if (result.startsWith("file:///")==false) { //$NON-NLS-1$
+ result = "file:///"+result.substring(6); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+ catch (IOException e) {
+ String msg = "Failed to resolve URL: " //$NON-NLS-1$
+ + localURL.toString();
+ Log.error(msg, e);
+ return localURL.toString();
+ }
+ }
+
+
+
+
+ /** *** used by Intro parser ***** */
+ /*
+ * Util method to return an URL to a plugin relative resource.
+ */
+ public static URL getResourceAsURL(String resource, String pluginId) {
+ Bundle bundle = Platform.getBundle(pluginId);
+ URL localLocation = FileLocator.find(bundle, new Path(
+ resource), null);
+ return localLocation;
+ }
+
+
+
+
+ /** ********************* Used by HTML generator ****************** */
+ /**
+ * Get the absolute path of the given bundle, in the form
+ * file:/path_to_plugin
+ *
+ * @param bundle
+ * @return
+ */
+ public static String getResolvedBundleLocation(Bundle bundle) {
+ try {
+ URL bundleLocation = bundle.getEntry(""); //$NON-NLS-1$
+ if (bundleLocation == null)
+ return null;
+ /*
+ bundleLocation = FileLocator.toFileURL(bundleLocation);
+ return bundleLocation.toExternalForm();
+ */
+ return toExternalForm(bundleLocation);
+ } catch (IllegalStateException e) {
+ Log.error("Failed to access bundle: " //$NON-NLS-1$
+ + bundle.getSymbolicName(), e);
+ return null;
+ } /* catch (IOException e) {
+ Log.error("Failed to resolve URL path for bundle: " //$NON-NLS-1$
+ + bundle.getSymbolicName(), e);
+ return null;
+ } */
+ }
+
+ /**
+ * Get the absolute path of the bundle with id <code>bundleId</code>. If
+ * no such bundle is found, return null.
+ *
+ * @param bundleId
+ * @return
+ */
+ public static String getResolvedBundleLocation(String bundleId) {
+ Bundle bundle = Platform.getBundle(bundleId);
+ if (bundle == null)
+ return null;
+ return getResolvedBundleLocation(bundle);
+ }
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java
index ff379fc81..1a0fc6f71 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/Log.java
@@ -32,114 +32,114 @@ import org.eclipse.ui.internal.intro.universal.UniversalIntroPlugin;
*/
public class Log implements IUniversalIntroConstants {
- /**
- * This MUST be set to <b>false </b> in production. <br>
- * Used to compile out developement debug messages. <br>
- * Compiler compiles out code warpped wit this flag as an optimization.
- */
- public static final boolean DEBUG = false;
-
-
- // Use these flags to filter out code that may be a performance hit.
- // Flag that controls logging of warning message
- public static boolean logWarning = false;
- // Flag that controls logging of information messages
- public static boolean logInfo = false;
- // Flag that controls logging of performance messages
- public static boolean logPerformance = false;
-
- private final static ILog pluginLog = UniversalIntroPlugin.getDefault().getLog();
-
- static {
- // init debug options based on settings defined in ".options" file. If
- // the plugin is not in debug mode, no point setting debug options.
- if (UniversalIntroPlugin.getDefault().isDebugging()) {
- logWarning = true;
- logInfo = getDebugOption("/trace/logInfo"); //$NON-NLS-1$
- logPerformance = getDebugOption("/trace/logPerformance"); //$NON-NLS-1$
- }
-
- }
-
- private static boolean getDebugOption(String option) {
- return "true".equalsIgnoreCase(//$NON-NLS-1$
- Platform.getDebugOption(PLUGIN_ID + option));
- }
-
- /**
- * Log an Error message with an exception. Note that the message should
- * already be localized to proper local. Errors are always logged.
- */
- public static synchronized void error(String message, Throwable ex) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
- message, ex);
- pluginLog.log(errorStatus);
- }
-
- /**
- * Log an Information message. Note that the message should already be
- * localized to proper local. Info messages are only logged when the
- * /trace/logInfo debug option is true.
- */
- public static synchronized void info(String message) {
- if (!logInfo)
- // logging of info messages is not enabled.
- return;
-
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
- message, null);
- pluginLog.log(infoStatus);
- }
-
- /**
- * Log an Information message. Note that the message should already be
- * localized to proper local. These messages are always logged. They are not
- * controlled by any debug flags. Logging of these messages can be
- * controlled by the public flags in this class.
- */
- public static synchronized void forcedInfo(String message) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
- message, null);
- pluginLog.log(infoStatus);
- }
-
-
- /**
- * Log a Warning message. Note that the message should already be localized
- * to proper local. Warning messages are only logged when the plugin is in
- * debug mode.
- */
- public static synchronized void warning(String message) {
- if (!logWarning)
- // no warning messages (ie: plugin is not in debug mode). Default is
- // to not log warning messages.
- return;
-
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID,
- IStatus.OK, message, null);
- pluginLog.log(warningStatus);
- }
-
- /**
- * Log a development debug message. Debug messages are compiled out.
- */
- public static synchronized void debugMessage(String className,
- String message) {
- if (DEBUG) {
- MultiStatus debugStatus = new MultiStatus(PLUGIN_ID, IStatus.OK,
- className, null);
- Status infoStatus = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK,
- message, null);
- debugStatus.add(infoStatus);
- pluginLog.log(debugStatus);
- }
- }
+ /**
+ * This MUST be set to <b>false </b> in production. <br>
+ * Used to compile out developement debug messages. <br>
+ * Compiler compiles out code warpped wit this flag as an optimization.
+ */
+ public static final boolean DEBUG = false;
+
+
+ // Use these flags to filter out code that may be a performance hit.
+ // Flag that controls logging of warning message
+ public static boolean logWarning = false;
+ // Flag that controls logging of information messages
+ public static boolean logInfo = false;
+ // Flag that controls logging of performance messages
+ public static boolean logPerformance = false;
+
+ private final static ILog pluginLog = UniversalIntroPlugin.getDefault().getLog();
+
+ static {
+ // init debug options based on settings defined in ".options" file. If
+ // the plugin is not in debug mode, no point setting debug options.
+ if (UniversalIntroPlugin.getDefault().isDebugging()) {
+ logWarning = true;
+ logInfo = getDebugOption("/trace/logInfo"); //$NON-NLS-1$
+ logPerformance = getDebugOption("/trace/logPerformance"); //$NON-NLS-1$
+ }
+
+ }
+
+ private static boolean getDebugOption(String option) {
+ return "true".equalsIgnoreCase(//$NON-NLS-1$
+ Platform.getDebugOption(PLUGIN_ID + option));
+ }
+
+ /**
+ * Log an Error message with an exception. Note that the message should
+ * already be localized to proper local. Errors are always logged.
+ */
+ public static synchronized void error(String message, Throwable ex) {
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
+ message, ex);
+ pluginLog.log(errorStatus);
+ }
+
+ /**
+ * Log an Information message. Note that the message should already be
+ * localized to proper local. Info messages are only logged when the
+ * /trace/logInfo debug option is true.
+ */
+ public static synchronized void info(String message) {
+ if (!logInfo)
+ // logging of info messages is not enabled.
+ return;
+
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
+ message, null);
+ pluginLog.log(infoStatus);
+ }
+
+ /**
+ * Log an Information message. Note that the message should already be
+ * localized to proper local. These messages are always logged. They are not
+ * controlled by any debug flags. Logging of these messages can be
+ * controlled by the public flags in this class.
+ */
+ public static synchronized void forcedInfo(String message) {
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
+ message, null);
+ pluginLog.log(infoStatus);
+ }
+
+
+ /**
+ * Log a Warning message. Note that the message should already be localized
+ * to proper local. Warning messages are only logged when the plugin is in
+ * debug mode.
+ */
+ public static synchronized void warning(String message) {
+ if (!logWarning)
+ // no warning messages (ie: plugin is not in debug mode). Default is
+ // to not log warning messages.
+ return;
+
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID,
+ IStatus.OK, message, null);
+ pluginLog.log(warningStatus);
+ }
+
+ /**
+ * Log a development debug message. Debug messages are compiled out.
+ */
+ public static synchronized void debugMessage(String className,
+ String message) {
+ if (DEBUG) {
+ MultiStatus debugStatus = new MultiStatus(PLUGIN_ID, IStatus.OK,
+ className, null);
+ Status infoStatus = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK,
+ message, null);
+ debugStatus.add(infoStatus);
+ pluginLog.log(debugStatus);
+ }
+ }
}
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java
index 2fe35a2b0..c1a8ee53e 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/util/StringUtil.java
@@ -16,10 +16,10 @@ package org.eclipse.ui.internal.intro.universal.util;
public class StringUtil {
public static String concat(String... strings) {
- StringBuilder buffer = new StringBuilder();
- for (String string : strings) {
+ StringBuilder buffer = new StringBuilder();
+ for (String string : strings) {
buffer.append(string);
}
- return buffer.toString();
- }
+ return buffer.toString();
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/FontSelection.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/FontSelection.java
index d29e4ed61..9504228f0 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/FontSelection.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/FontSelection.java
@@ -39,14 +39,14 @@ public class FontSelection {
* Returns the height in points of the default SWT font
*/
private static int getDefaultFontHeight() {
- Font defaultFont = JFaceResources.getDefaultFont();
- FontData[] fontData = defaultFont.getFontData();
- int height = MIN_HEIGHT;
+ Font defaultFont = JFaceResources.getDefaultFont();
+ FontData[] fontData = defaultFont.getFontData();
+ int height = MIN_HEIGHT;
for (int i=0; i< fontData.length; i++) {
FontData data = fontData[i];
height = Math.max(height, data.getHeight());
}
- return Math.min(height, MAX_HEIGHT);
+ return Math.min(height, MAX_HEIGHT);
}
public static String generatePageFontStyle() {
@@ -93,19 +93,19 @@ public class FontSelection {
public static String getFontStyle() {
IProduct product = Platform.getProduct();
if (product != null) {
- String pid = product.getId();
- String style = Platform.getPreferencesService().getString
- (IntroPlugin.PLUGIN_ID, pid + "_" +FontSelection.VAR_FONT_STYLE, "", null); //$NON-NLS-1$ //$NON-NLS-2$
- if (style.length() > 0) {
- return style;
- }
- style = Platform.getPreferencesService().getString
- (IntroPlugin.PLUGIN_ID, (FontSelection.VAR_FONT_STYLE), "", null); //$NON-NLS-1$
- if (style.length() > 0) {
- return style;
- }
+ String pid = product.getId();
+ String style = Platform.getPreferencesService().getString
+ (IntroPlugin.PLUGIN_ID, pid + "_" +FontSelection.VAR_FONT_STYLE, "", null); //$NON-NLS-1$ //$NON-NLS-2$
+ if (style.length() > 0) {
+ return style;
+ }
+ style = Platform.getPreferencesService().getString
+ (IntroPlugin.PLUGIN_ID, (FontSelection.VAR_FONT_STYLE), "", null); //$NON-NLS-1$
+ if (style.length() > 0) {
+ return style;
+ }
}
// Use default for font style if not specified
- return FontSelection.FONT_RELATIVE;
+ return FontSelection.FONT_RELATIVE;
}
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IIntroConstants.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IIntroConstants.java
index de0088e2e..1fd09f977 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IIntroConstants.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IIntroConstants.java
@@ -16,48 +16,48 @@ package org.eclipse.ui.internal.intro.impl;
public interface IIntroConstants {
- // all attributes here are by default public static final.
+ // all attributes here are by default public static final.
- // General consts.
- // ---------------
- String PLUGIN_ID = "org.eclipse.ui.intro"; //$NON-NLS-1$
- String PREFIX = PLUGIN_ID + "."; //$NON-NLS-1$
+ // General consts.
+ // ---------------
+ String PLUGIN_ID = "org.eclipse.ui.intro"; //$NON-NLS-1$
+ String PREFIX = PLUGIN_ID + "."; //$NON-NLS-1$
- // Empty Standby Content part. This is registered in this plugin,
- // through markup.
- String EMPTY_STANDBY_CONTENT_PART = "org.eclipse.ui.intro.config.emptyStandby"; //$NON-NLS-1$
+ // Empty Standby Content part. This is registered in this plugin,
+ // through markup.
+ String EMPTY_STANDBY_CONTENT_PART = "org.eclipse.ui.intro.config.emptyStandby"; //$NON-NLS-1$
- // Memento constants
- // ------------------
- String MEMENTO_PRESENTATION_TAG = "presentation"; //$NON-NLS-1$
- String MEMENTO_CURRENT_PAGE_ATT = "currentPage"; //$NON-NLS-1$
- String MEMENTO_STANDBY_PART_TAG = "standbyPart"; //$NON-NLS-1$
- String MEMENTO_STANDBY_CONTENT_PART_ID_ATT = "contentPartID"; //$NON-NLS-1$
- String MEMENTO_STANDBY_CONTENT_PART_TAG = "standbyContentPart"; //$NON-NLS-1$
- String MEMENTO_RESTORE_ATT = "restore"; //$NON-NLS-1$
+ // Memento constants
+ // ------------------
+ String MEMENTO_PRESENTATION_TAG = "presentation"; //$NON-NLS-1$
+ String MEMENTO_CURRENT_PAGE_ATT = "currentPage"; //$NON-NLS-1$
+ String MEMENTO_STANDBY_PART_TAG = "standbyPart"; //$NON-NLS-1$
+ String MEMENTO_STANDBY_CONTENT_PART_ID_ATT = "contentPartID"; //$NON-NLS-1$
+ String MEMENTO_STANDBY_CONTENT_PART_TAG = "standbyContentPart"; //$NON-NLS-1$
+ String MEMENTO_RESTORE_ATT = "restore"; //$NON-NLS-1$
- // CustomizableIntroPart consts:
- // -----------------------------
- // key to retrieve if a standby part is needed.
- String SHOW_STANDBY_PART = "showStandbyPart"; //$NON-NLS-1$
+ // CustomizableIntroPart consts:
+ // -----------------------------
+ // key to retrieve if a standby part is needed.
+ String SHOW_STANDBY_PART = "showStandbyPart"; //$NON-NLS-1$
- // Form implementation consts:
- // ---------------------------
- // key to retrieve the into link model object from imageHyperlink widget.
- // convention: actual string value is class name.
- String INTRO_LINK = "IntroLink"; //$NON-NLS-1$
+ // Form implementation consts:
+ // ---------------------------
+ // key to retrieve the into link model object from imageHyperlink widget.
+ // convention: actual string value is class name.
+ String INTRO_LINK = "IntroLink"; //$NON-NLS-1$
- // key to retrive page sub-title from PageContentForm
- String PAGE_SUBTITLE = "PageSubtitle"; //$NON-NLS-1$
+ // key to retrive page sub-title from PageContentForm
+ String PAGE_SUBTITLE = "PageSubtitle"; //$NON-NLS-1$
- // Performance keys
- // -----------------------
- String INTRO = "intro"; //$NON-NLS-1$
- String PERF_VIEW_CREATION_TIME = PLUGIN_ID + "/perf/createView"; //$NON-NLS-1$
- String PERF_SET_STANDBY_STATE = PLUGIN_ID + "/perf/setStandbyState"; //$NON-NLS-1$
- // not exposed in .option. Used because framework is convenient.
- String PERF_UI_ZOOM = PLUGIN_ID + "/perf/uiZoom"; //$NON-NLS-1$
+ // Performance keys
+ // -----------------------
+ String INTRO = "intro"; //$NON-NLS-1$
+ String PERF_VIEW_CREATION_TIME = PLUGIN_ID + "/perf/createView"; //$NON-NLS-1$
+ String PERF_SET_STANDBY_STATE = PLUGIN_ID + "/perf/setStandbyState"; //$NON-NLS-1$
+ // not exposed in .option. Used because framework is convenient.
+ String PERF_UI_ZOOM = PLUGIN_ID + "/perf/uiZoom"; //$NON-NLS-1$
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IntroPlugin.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IntroPlugin.java
index 737f47320..7dcb25819 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IntroPlugin.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/IntroPlugin.java
@@ -38,142 +38,142 @@ public class IntroPlugin extends AbstractUIPlugin {
public static boolean LOG_INFO =
"true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID+"/debug/info")); //$NON-NLS-1$ //$NON-NLS-2$
- // The static shared instance.
- private static IntroPlugin inst;
+ // The static shared instance.
+ private static IntroPlugin inst;
- // We must keep track of the launch bar so that we can
- // close it if intro is opened from the menu.
- private IntroLaunchBar launchBar;
+ // We must keep track of the launch bar so that we can
+ // close it if intro is opened from the menu.
+ private IntroLaunchBar launchBar;
- // used for performance logging. Time when the constructor of
- // CustomizableIntroPart is called.
- private long uiCreationStartTime;
+ // used for performance logging. Time when the constructor of
+ // CustomizableIntroPart is called.
+ private long uiCreationStartTime;
- // image registry that can be disposed while the
- // plug-in is still active. This is important for
- // switching themes after the plug-in has been loaded.
- private ImageRegistry volatileImageRegistry;
+ // image registry that can be disposed while the
+ // plug-in is still active. This is important for
+ // switching themes after the plug-in has been loaded.
+ private ImageRegistry volatileImageRegistry;
- // debug options
+ // debug options
public static boolean DEBUG = false;
public static boolean DEBUG_NO_BROWSER = false;
public static boolean DEBUG_TOOLBAR = false;
- /**
- * The constructor.
- */
- public IntroPlugin() {
- super();
- }
-
- /**
- * Returns the shared plugin instance.
- */
- public static IntroPlugin getDefault() {
- return inst;
- }
-
- public ImageRegistry getVolatileImageRegistry() {
- if (volatileImageRegistry==null) {
- volatileImageRegistry = createImageRegistry();
- initializeImageRegistry(volatileImageRegistry);
- }
- return volatileImageRegistry;
- }
-
- public void resetVolatileImageRegistry() {
- if (volatileImageRegistry!=null) {
- volatileImageRegistry.dispose();
- volatileImageRegistry = null;
- }
- }
-
-
- public void closeLaunchBar() {
- if (launchBar != null) {
- launchBar.close();
- launchBar = null;
- }
+ /**
+ * The constructor.
+ */
+ public IntroPlugin() {
+ super();
+ }
+
+ /**
+ * Returns the shared plugin instance.
+ */
+ public static IntroPlugin getDefault() {
+ return inst;
+ }
+
+ public ImageRegistry getVolatileImageRegistry() {
+ if (volatileImageRegistry==null) {
+ volatileImageRegistry = createImageRegistry();
+ initializeImageRegistry(volatileImageRegistry);
+ }
+ return volatileImageRegistry;
+ }
+
+ public void resetVolatileImageRegistry() {
+ if (volatileImageRegistry!=null) {
+ volatileImageRegistry.dispose();
+ volatileImageRegistry = null;
+ }
+ }
+
+
+ public void closeLaunchBar() {
+ if (launchBar != null) {
+ launchBar.close();
+ launchBar = null;
+ }
IntroLaunchBar.destroyAll(getWorkbench());
- }
-
- public void setLaunchBar(IntroLaunchBar launchBar) {
- this.launchBar = launchBar;
- }
-
-
- /**
- * @return Returns the extensionPointManager.
- */
- public ExtensionPointManager getExtensionPointManager() {
- return ExtensionPointManager.getInst();
- }
-
- /**
- * Returns the model root. Will always guarantee that model is loaded.
- *
- * @return Returns the introModelRoot.
- */
- public IntroModelRoot getIntroModelRoot() {
- return getExtensionPointManager().getCurrentModel();
- }
-
- /**
- * Returns the Intro Part.
- */
- public static IIntroPart getIntro() {
- IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
- .getIntro();
- return introPart;
- }
-
- /**
- * Returns the Intro Part after forcing an open on it.
- */
- public static IIntroPart showIntro(boolean standby) {
- IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
- .showIntro(PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
- standby);
- return introPart;
- }
-
- /**
- * Returns the standby state of the Intro Part. If the intro is closed,
- * retruns false.
- */
- public static boolean isIntroStandby() {
- return PlatformUI.getWorkbench().getIntroManager().isIntroStandby(
- getIntro());
- }
-
- /**
- * Sets the standby state of the Intro Part. If the intro is closed, retruns
- * false.
- */
- public static void setIntroStandby(boolean standby) {
- PlatformUI.getWorkbench().getIntroManager().setIntroStandby(getIntro(),
- standby);
- }
-
-
- /**
- * Returns the standby state of the Intro Part. If the intro is closed,
- * retruns false.
- */
- public static boolean closeIntro() {
- // Relies on Workbench.
- return PlatformUI.getWorkbench().getIntroManager().closeIntro(
- getIntro());
- }
-
-
- @Override
+ }
+
+ public void setLaunchBar(IntroLaunchBar launchBar) {
+ this.launchBar = launchBar;
+ }
+
+
+ /**
+ * @return Returns the extensionPointManager.
+ */
+ public ExtensionPointManager getExtensionPointManager() {
+ return ExtensionPointManager.getInst();
+ }
+
+ /**
+ * Returns the model root. Will always guarantee that model is loaded.
+ *
+ * @return Returns the introModelRoot.
+ */
+ public IntroModelRoot getIntroModelRoot() {
+ return getExtensionPointManager().getCurrentModel();
+ }
+
+ /**
+ * Returns the Intro Part.
+ */
+ public static IIntroPart getIntro() {
+ IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
+ .getIntro();
+ return introPart;
+ }
+
+ /**
+ * Returns the Intro Part after forcing an open on it.
+ */
+ public static IIntroPart showIntro(boolean standby) {
+ IIntroPart introPart = PlatformUI.getWorkbench().getIntroManager()
+ .showIntro(PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
+ standby);
+ return introPart;
+ }
+
+ /**
+ * Returns the standby state of the Intro Part. If the intro is closed,
+ * retruns false.
+ */
+ public static boolean isIntroStandby() {
+ return PlatformUI.getWorkbench().getIntroManager().isIntroStandby(
+ getIntro());
+ }
+
+ /**
+ * Sets the standby state of the Intro Part. If the intro is closed, retruns
+ * false.
+ */
+ public static void setIntroStandby(boolean standby) {
+ PlatformUI.getWorkbench().getIntroManager().setIntroStandby(getIntro(),
+ standby);
+ }
+
+
+ /**
+ * Returns the standby state of the Intro Part. If the intro is closed,
+ * retruns false.
+ */
+ public static boolean closeIntro() {
+ // Relies on Workbench.
+ return PlatformUI.getWorkbench().getIntroManager().closeIntro(
+ getIntro());
+ }
+
+
+ @Override
public void start(BundleContext context) throws Exception {
- super.start(context);
- inst = this;
- if (Log.logInfo)
- Log.info("IntroPlugin - calling start on Intro bundle"); //$NON-NLS-1$
- // Setup debugging options
+ super.start(context);
+ inst = this;
+ if (Log.logInfo)
+ Log.info("IntroPlugin - calling start on Intro bundle"); //$NON-NLS-1$
+ // Setup debugging options
DEBUG = isDebugging();
if (DEBUG) {
DEBUG_NO_BROWSER = "true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID + "/flags/noBrowser")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -182,23 +182,23 @@ public class IntroPlugin extends AbstractUIPlugin {
DEBUG_TOOLBAR = "true".equalsIgnoreCase(Platform.getDebugOption(PLUGIN_ID + "/debug/toolbar")); //$NON-NLS-1$ //$NON-NLS-2$
}
- }
+ }
- @Override
+ @Override
public void stop(BundleContext context) throws Exception {
- resetVolatileImageRegistry();
- super.stop(context);
- }
+ resetVolatileImageRegistry();
+ super.stop(context);
+ }
- public long gettUICreationStartTime() {
- return uiCreationStartTime;
- }
+ public long gettUICreationStartTime() {
+ return uiCreationStartTime;
+ }
- public void setUICreationStartTime(long uiCreationStartTime) {
- this.uiCreationStartTime = uiCreationStartTime;
- }
+ public void setUICreationStartTime(long uiCreationStartTime) {
+ this.uiCreationStartTime = uiCreationStartTime;
+ }
- /**
+ /**
* Logs an Error message. To print errors to console,
* run eclipse with the -console -consolelog arguments
*/
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/Messages.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/Messages.java
index 7f34849eb..c20d47280 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/Messages.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/Messages.java
@@ -16,50 +16,50 @@ package org.eclipse.ui.internal.intro.impl;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
- private static final String INTRO_RESOURCE_BUNDLE = "org.eclipse.ui.internal.intro.impl.Messages"; //$NON-NLS-1$
+ private static final String INTRO_RESOURCE_BUNDLE = "org.eclipse.ui.internal.intro.impl.Messages"; //$NON-NLS-1$
- static {
- initializeMessages(INTRO_RESOURCE_BUNDLE, Messages.class);
- }
+ static {
+ initializeMessages(INTRO_RESOURCE_BUNDLE, Messages.class);
+ }
- public static String Browser_homeButton_tooltip;
- public static String Browser_forwardButton_tooltip;
- public static String Browser_backwardButton_tooltip;
- public static String Browser_invalidConfig;
- public static String Browser_magnify_tooltip;
- public static String Browser_reduce_tooltip;
+ public static String Browser_homeButton_tooltip;
+ public static String Browser_forwardButton_tooltip;
+ public static String Browser_backwardButton_tooltip;
+ public static String Browser_invalidConfig;
+ public static String Browser_magnify_tooltip;
+ public static String Browser_reduce_tooltip;
- // Dialogs
- // --------
- public static String MessageDialog_errorTitle;
- public static String MessageDialog_warningTitle;
- public static String MessageDialog_infoTitle;
+ // Dialogs
+ // --------
+ public static String MessageDialog_errorTitle;
+ public static String MessageDialog_warningTitle;
+ public static String MessageDialog_infoTitle;
- public static String CustomizableIntroPart_configNotFound;
- public static String StandbyPart_returnToIntro;
- public static String StandbyPart_returnTo;
- public static String EmptyStandbyContentPart_text;
- public static String StandbyPart_failedToCreate;
- public static String StandbyPart_nonDefined;
- public static String StandbyPart_canNotRestore;
+ public static String CustomizableIntroPart_configNotFound;
+ public static String StandbyPart_returnToIntro;
+ public static String StandbyPart_returnTo;
+ public static String EmptyStandbyContentPart_text;
+ public static String StandbyPart_failedToCreate;
+ public static String StandbyPart_nonDefined;
+ public static String StandbyPart_canNotRestore;
- public static String IntroURL_failedToDecode;
- public static String IntroURL_badCommand;
- public static String HyperlinkAdapter_urlIs;
- public static String HTML_embeddedLink;
- public static String StaticHTML_welcome;
+ public static String IntroURL_failedToDecode;
+ public static String IntroURL_badCommand;
+ public static String HyperlinkAdapter_urlIs;
+ public static String HTML_embeddedLink;
+ public static String StaticHTML_welcome;
- public static String IntroLaunchBar_close_label;
- public static String IntroLaunchBar_close_tooltip;
- public static String IntroLaunchBar_restore_tooltip;
+ public static String IntroLaunchBar_close_label;
+ public static String IntroLaunchBar_close_tooltip;
+ public static String IntroLaunchBar_restore_tooltip;
public static String IntroLaunchBar_welcome;
- // Misc
- // -------
- public static String IntroPart_openExternal_tooltip;
- public static String IntroPart_showContentButton_tooltip;
+ // Misc
+ // -------
+ public static String IntroPart_openExternal_tooltip;
+ public static String IntroPart_showContentButton_tooltip;
- //Always Welcome Checkbox
+ //Always Welcome Checkbox
public static String AlwaysWelcomeCheckbox_Text;
//Eclipse RSS Viewer
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLUtil.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLUtil.java
index a976b1cb0..c508be4e8 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLUtil.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/HTMLUtil.java
@@ -21,159 +21,159 @@ import java.util.Set;
* Convenience class for generating HTML elements.
*/
public final class HTMLUtil {
- /**
- * Creates an HTML opening element of the form <elementName
- * elementAttributes>
- *
- * @param elementName
- * the name of the element to create
- * @param elementAttributes
- * a map of attribute names and values to be inserted into the
- * element start tag
- * @param insertLineBreak
- * true to insert a line break after the start tag is closed,
- * false otherwise
- * @return
- */
- public static StringBuffer createHTMLStartTag(String elementName,
- Map elementAttributes, boolean insertLineBreak) {
- StringBuffer element = new StringBuffer();
- if (elementName != null) {
- // open the start tag
- element.append(openHTMLStartTag(elementName));
- // add the attributes, if there are any
- if (elementAttributes != null && !(elementAttributes.isEmpty()))
- element.append(IIntroHTMLConstants.SPACE).append(
- createAttributeList(elementAttributes));
- // close the start tag
- element.append(closeHTMLTag(insertLineBreak));
- }
- return element;
- }
+ /**
+ * Creates an HTML opening element of the form <elementName
+ * elementAttributes>
+ *
+ * @param elementName
+ * the name of the element to create
+ * @param elementAttributes
+ * a map of attribute names and values to be inserted into the
+ * element start tag
+ * @param insertLineBreak
+ * true to insert a line break after the start tag is closed,
+ * false otherwise
+ * @return
+ */
+ public static StringBuffer createHTMLStartTag(String elementName,
+ Map elementAttributes, boolean insertLineBreak) {
+ StringBuffer element = new StringBuffer();
+ if (elementName != null) {
+ // open the start tag
+ element.append(openHTMLStartTag(elementName));
+ // add the attributes, if there are any
+ if (elementAttributes != null && !(elementAttributes.isEmpty()))
+ element.append(IIntroHTMLConstants.SPACE).append(
+ createAttributeList(elementAttributes));
+ // close the start tag
+ element.append(closeHTMLTag(insertLineBreak));
+ }
+ return element;
+ }
- /**
- * Creates an HTML start tag of the form <elementName>
- *
- * @param elementName
- * the name of the element to create
- * @param insertLineBreak
- * true to insert a new line after the start tag
- * @return
- */
- public static StringBuffer createHTMLStartTag(String elementName,
- boolean insertLineBreak) {
- return createHTMLStartTag(elementName, null, insertLineBreak);
- }
+ /**
+ * Creates an HTML start tag of the form <elementName>
+ *
+ * @param elementName
+ * the name of the element to create
+ * @param insertLineBreak
+ * true to insert a new line after the start tag
+ * @return
+ */
+ public static StringBuffer createHTMLStartTag(String elementName,
+ boolean insertLineBreak) {
+ return createHTMLStartTag(elementName, null, insertLineBreak);
+ }
- /**
- * Creates an HTML start tag of the form <elementName>and inserts a line
- * break after the start tag
- *
- * @param elementName
- * the name of the element to create
- * @return
- */
- public static StringBuffer createHTMLStartTag(String elementName) {
- return createHTMLStartTag(elementName, null, true);
- }
+ /**
+ * Creates an HTML start tag of the form <elementName>and inserts a line
+ * break after the start tag
+ *
+ * @param elementName
+ * the name of the element to create
+ * @return
+ */
+ public static StringBuffer createHTMLStartTag(String elementName) {
+ return createHTMLStartTag(elementName, null, true);
+ }
- /**
- * Creates an HTML closing element of the form </elementName>
- *
- * @param elementName
- * the name of the closing element to create
- * @param addNewLine
- * true to add a new line at the end
- * @return
- */
- public static StringBuffer createHTMLEndTag(String elementName,
- boolean addNewLine) {
- StringBuffer closingElement = new StringBuffer();
- if (elementName != null)
- closingElement.append(IIntroHTMLConstants.LT).append(
- IIntroHTMLConstants.FORWARD_SLASH).append(elementName)
- .append(closeHTMLTag(addNewLine));
- return closingElement;
- }
+ /**
+ * Creates an HTML closing element of the form </elementName>
+ *
+ * @param elementName
+ * the name of the closing element to create
+ * @param addNewLine
+ * true to add a new line at the end
+ * @return
+ */
+ public static StringBuffer createHTMLEndTag(String elementName,
+ boolean addNewLine) {
+ StringBuffer closingElement = new StringBuffer();
+ if (elementName != null)
+ closingElement.append(IIntroHTMLConstants.LT).append(
+ IIntroHTMLConstants.FORWARD_SLASH).append(elementName)
+ .append(closeHTMLTag(addNewLine));
+ return closingElement;
+ }
- /**
- * Given a map of attribute names and values, this method will create a
- * StringBuilder of the attributes in the form: attrName="attrValue". These
- * attributes can appear in the start tag of an HTML element.
- *
- * @param attributes
- * the attributes to be converted into a String list
- * @return
- */
- public static String createAttributeList(Map attributes) {
- if (attributes == null)
- return null;
- StringBuilder attributeList = new StringBuilder();
- Set attrNames = attributes.keySet();
- for (Iterator it = attrNames.iterator(); it.hasNext();) {
- Object name = it.next();
- Object value = attributes.get(name);
- if ((name instanceof String) && (value instanceof String)) {
- attributeList.append(createAttribute((String) name,
- (String) value));
- if (it.hasNext()) {
- attributeList.append(IIntroHTMLConstants.SPACE);
- }
- }
- }
- return attributeList.toString();
- }
+ /**
+ * Given a map of attribute names and values, this method will create a
+ * StringBuilder of the attributes in the form: attrName="attrValue". These
+ * attributes can appear in the start tag of an HTML element.
+ *
+ * @param attributes
+ * the attributes to be converted into a String list
+ * @return
+ */
+ public static String createAttributeList(Map attributes) {
+ if (attributes == null)
+ return null;
+ StringBuilder attributeList = new StringBuilder();
+ Set attrNames = attributes.keySet();
+ for (Iterator it = attrNames.iterator(); it.hasNext();) {
+ Object name = it.next();
+ Object value = attributes.get(name);
+ if ((name instanceof String) && (value instanceof String)) {
+ attributeList.append(createAttribute((String) name,
+ (String) value));
+ if (it.hasNext()) {
+ attributeList.append(IIntroHTMLConstants.SPACE);
+ }
+ }
+ }
+ return attributeList.toString();
+ }
- /**
- * Creates an HTML attribute of the form attrName="attrValue"
- *
- * @param attrName
- * the name of the attribute
- * @param attrValue
- * the value of the attribute
- * @return
- */
- public static StringBuffer createAttribute(String attrName, String attrValue) {
- StringBuffer attribute = new StringBuffer();
- if (attrName != null && attrValue != null) {
- attribute.append(attrName).append(IIntroHTMLConstants.EQUALS)
- .append(IIntroHTMLConstants.QUOTE).append(attrValue)
- .append(IIntroHTMLConstants.QUOTE);
- }
- return attribute;
- }
+ /**
+ * Creates an HTML attribute of the form attrName="attrValue"
+ *
+ * @param attrName
+ * the name of the attribute
+ * @param attrValue
+ * the value of the attribute
+ * @return
+ */
+ public static StringBuffer createAttribute(String attrName, String attrValue) {
+ StringBuffer attribute = new StringBuffer();
+ if (attrName != null && attrValue != null) {
+ attribute.append(attrName).append(IIntroHTMLConstants.EQUALS)
+ .append(IIntroHTMLConstants.QUOTE).append(attrValue)
+ .append(IIntroHTMLConstants.QUOTE);
+ }
+ return attribute;
+ }
- public static StringBuffer openHTMLStartTag(String elementName) {
- return new StringBuffer().append(IIntroHTMLConstants.LT).append(
- elementName);
- }
+ public static StringBuffer openHTMLStartTag(String elementName) {
+ return new StringBuffer().append(IIntroHTMLConstants.LT).append(
+ elementName);
+ }
- public static StringBuffer closeHTMLTag() {
- return closeHTMLTag(true);
- }
+ public static StringBuffer closeHTMLTag() {
+ return closeHTMLTag(true);
+ }
- public static StringBuffer closeHTMLTag(boolean newLine) {
- StringBuffer closing = new StringBuffer()
- .append(IIntroHTMLConstants.GT);
- if (newLine)
- closing.append(IIntroHTMLConstants.NEW_LINE);
- return closing;
- }
+ public static StringBuffer closeHTMLTag(boolean newLine) {
+ StringBuffer closing = new StringBuffer()
+ .append(IIntroHTMLConstants.GT);
+ if (newLine)
+ closing.append(IIntroHTMLConstants.NEW_LINE);
+ return closing;
+ }
- /**
- * Determine if the contents of two character arrays are equal
- *
- * @param a
- * @param b
- * @return
- */
- public static boolean equalCharArrayContent(char[] a, char[] b) {
- if (a.length != b.length)
- return false;
- for (int i = 0; i < a.length; i++) {
- if (a[i] != b[i])
- return false;
- }
- return true;
- }
+ /**
+ * Determine if the contents of two character arrays are equal
+ *
+ * @param a
+ * @param b
+ * @return
+ */
+ public static boolean equalCharArrayContent(char[] a, char[] b) {
+ if (a.length != b.length)
+ return false;
+ for (int i = 0; i < a.length; i++) {
+ if (a[i] != b[i])
+ return false;
+ }
+ return true;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IIntroHTMLConstants.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IIntroHTMLConstants.java
index 77d2153a3..021e5fd33 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IIntroHTMLConstants.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IIntroHTMLConstants.java
@@ -15,78 +15,78 @@ package org.eclipse.ui.internal.intro.impl.html;
public interface IIntroHTMLConstants {
- /* Constants required for creating html element tags */
- String LT = "<"; //$NON-NLS-1$
- String GT = ">"; //$NON-NLS-1$
- String FORWARD_SLASH = "/"; //$NON-NLS-1$
- String QUOTE = "\""; //$NON-NLS-1$
- String EQUALS = "="; //$NON-NLS-1$
- String HYPHEN = "-"; //$NON-NLS-1$
- String SPACE = " "; //$NON-NLS-1$
- String NEW_LINE = "\n"; //$NON-NLS-1$
- String TAB = "\t"; //$NON-NLS-1$
- String SMALL_TAB = " "; //$NON-NLS-1$
+ /* Constants required for creating html element tags */
+ String LT = "<"; //$NON-NLS-1$
+ String GT = ">"; //$NON-NLS-1$
+ String FORWARD_SLASH = "/"; //$NON-NLS-1$
+ String QUOTE = "\""; //$NON-NLS-1$
+ String EQUALS = "="; //$NON-NLS-1$
+ String HYPHEN = "-"; //$NON-NLS-1$
+ String SPACE = " "; //$NON-NLS-1$
+ String NEW_LINE = "\n"; //$NON-NLS-1$
+ String TAB = "\t"; //$NON-NLS-1$
+ String SMALL_TAB = " "; //$NON-NLS-1$
- /* HTML element names */
- String ELEMENT_HTML = "HTML"; //$NON-NLS-1$
- String ELEMENT_HEAD = "HEAD"; //$NON-NLS-1$
- String ELEMENT_BASE = "BASE"; //$NON-NLS-1$
- String ELEMENT_BODY = "BODY"; //$NON-NLS-1$
- String ELEMENT_TITLE = "TITLE"; //$NON-NLS-1$
- String ELEMENT_LINK = "LINK"; //$NON-NLS-1$
- String ELEMENT_DIV = "DIV"; //$NON-NLS-1$
- String ELEMENT_SPAN = "SPAN"; //$NON-NLS-1$
- String ELEMENT_ANCHOR = "A"; //$NON-NLS-1$
- String ELEMENT_OBJECT = "OBJECT"; //$NON-NLS-1$
- String ELEMENT_IMG = "IMG"; //$NON-NLS-1$
- String ELEMENT_H1 = "H1"; //$NON-NLS-1$
- String ELEMENT_H2 = "H2"; //$NON-NLS-1$
- String ELEMENT_H3 = "H3"; //$NON-NLS-1$
- String ELEMENT_H4 = "H4"; //$NON-NLS-1$
- String ELEMENT_HR = "HR"; //$NON-NLS-1$
- String ELEMENT_PARAGRAPH = "P"; //$NON-NLS-1$
- String ELEMENT_STYLE = "STYLE"; //$NON-NLS-1$
- String ELEMENT_TABLE = "TABLE"; //$NON-NLS-1$
- String ELEMENT_TR = "TR"; //$NON-NLS-1$
- String ELEMENT_TD = "TD"; //$NON-NLS-1$
- String ELEMENT_IFrame = "iFrame"; //$NON-NLS-1$
+ /* HTML element names */
+ String ELEMENT_HTML = "HTML"; //$NON-NLS-1$
+ String ELEMENT_HEAD = "HEAD"; //$NON-NLS-1$
+ String ELEMENT_BASE = "BASE"; //$NON-NLS-1$
+ String ELEMENT_BODY = "BODY"; //$NON-NLS-1$
+ String ELEMENT_TITLE = "TITLE"; //$NON-NLS-1$
+ String ELEMENT_LINK = "LINK"; //$NON-NLS-1$
+ String ELEMENT_DIV = "DIV"; //$NON-NLS-1$
+ String ELEMENT_SPAN = "SPAN"; //$NON-NLS-1$
+ String ELEMENT_ANCHOR = "A"; //$NON-NLS-1$
+ String ELEMENT_OBJECT = "OBJECT"; //$NON-NLS-1$
+ String ELEMENT_IMG = "IMG"; //$NON-NLS-1$
+ String ELEMENT_H1 = "H1"; //$NON-NLS-1$
+ String ELEMENT_H2 = "H2"; //$NON-NLS-1$
+ String ELEMENT_H3 = "H3"; //$NON-NLS-1$
+ String ELEMENT_H4 = "H4"; //$NON-NLS-1$
+ String ELEMENT_HR = "HR"; //$NON-NLS-1$
+ String ELEMENT_PARAGRAPH = "P"; //$NON-NLS-1$
+ String ELEMENT_STYLE = "STYLE"; //$NON-NLS-1$
+ String ELEMENT_TABLE = "TABLE"; //$NON-NLS-1$
+ String ELEMENT_TR = "TR"; //$NON-NLS-1$
+ String ELEMENT_TD = "TD"; //$NON-NLS-1$
+ String ELEMENT_IFrame = "iFrame"; //$NON-NLS-1$
String ELEMENT_META = "meta"; //$NON-NLS-1$
- /* HTML attribute names */
- String ATTRIBUTE_ID = "id"; //$NON-NLS-1$
- String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
- String ATTRIBUTE_STYLE = "style"; //$NON-NLS-1$
- String ATTRIBUTE_HREF = "href"; //$NON-NLS-1$
- String ATTRIBUTE_RELATIONSHIP = "rel"; //$NON-NLS-1$
- String ATTRIBUTE_SRC = "src"; //$NON-NLS-1$
- String ATTRIBUTE_TYPE = "type"; //$NON-NLS-1$
- String ATTRIBUTE_DATA = "data"; //$NON-NLS-1$
- String ATTRIBUTE_ALT = "alt"; //$NON-NLS-1$
- String ATTRIBUTE_TITLE = "title"; //$NON-NLS-1$
- String ATTRIBUTE_FRAMEBORDER = "frameborder"; //$NON-NLS-1$
- String ATTRIBUTE_SCROLLING = "scrolling"; //$NON-NLS-1$
+ /* HTML attribute names */
+ String ATTRIBUTE_ID = "id"; //$NON-NLS-1$
+ String ATTRIBUTE_CLASS = "class"; //$NON-NLS-1$
+ String ATTRIBUTE_STYLE = "style"; //$NON-NLS-1$
+ String ATTRIBUTE_HREF = "href"; //$NON-NLS-1$
+ String ATTRIBUTE_RELATIONSHIP = "rel"; //$NON-NLS-1$
+ String ATTRIBUTE_SRC = "src"; //$NON-NLS-1$
+ String ATTRIBUTE_TYPE = "type"; //$NON-NLS-1$
+ String ATTRIBUTE_DATA = "data"; //$NON-NLS-1$
+ String ATTRIBUTE_ALT = "alt"; //$NON-NLS-1$
+ String ATTRIBUTE_TITLE = "title"; //$NON-NLS-1$
+ String ATTRIBUTE_FRAMEBORDER = "frameborder"; //$NON-NLS-1$
+ String ATTRIBUTE_SCROLLING = "scrolling"; //$NON-NLS-1$
String ATTRIBUTE_CONTENT = "content"; //$NON-NLS-1$
String ATTRIBUTE_HTTP_EQUIV = "http-equiv"; //$NON-NLS-1$
- /* HTML attribute values */
- String LINK_REL = "stylesheet"; //$NON-NLS-1$
- String LINK_STYLE = "text/css"; //$NON-NLS-1$
- String OBJECT_TYPE = "text/html"; //$NON-NLS-1$
+ /* HTML attribute values */
+ String LINK_REL = "stylesheet"; //$NON-NLS-1$
+ String LINK_STYLE = "text/css"; //$NON-NLS-1$
+ String OBJECT_TYPE = "text/html"; //$NON-NLS-1$
String TYPE_HTML_UTF_8 = "text/html; charset=UTF-8"; //$NON-NLS-1$
String CONTENT_TYPE = "Content-Type"; //$NON-NLS-1$
- String DIV_ID_PAGE = "page"; //$NON-NLS-1$
- String DIV_CLASS_INLINE_HTML = "inline-html"; //$NON-NLS-1$
- String DIV_CLASS_PROVIDED_CONTENT = "provided-content"; //$NON-NLS-1$
+ String DIV_ID_PAGE = "page"; //$NON-NLS-1$
+ String DIV_CLASS_INLINE_HTML = "inline-html"; //$NON-NLS-1$
+ String DIV_CLASS_PROVIDED_CONTENT = "provided-content"; //$NON-NLS-1$
- String ANCHOR_CLASS_LINK = "link"; //$NON-NLS-1$
- String IMAGE_SRC_BLANK = "icons/blank.gif"; //$NON-NLS-1$
- String IMAGE_CLASS_BG = "background-image"; //$NON-NLS-1$
- String LINK_EXTRA_DIV = "link-extra-div"; //$NON-NLS-1$
- String SPAN_CLASS_DIV_LABEL = "div-label"; //$NON-NLS-1$
- String SPAN_CLASS_LINK_LABEL = "link-label"; //$NON-NLS-1$
- String SPAN_CLASS_TEXT = "text"; //$NON-NLS-1$
+ String ANCHOR_CLASS_LINK = "link"; //$NON-NLS-1$
+ String IMAGE_SRC_BLANK = "icons/blank.gif"; //$NON-NLS-1$
+ String IMAGE_CLASS_BG = "background-image"; //$NON-NLS-1$
+ String LINK_EXTRA_DIV = "link-extra-div"; //$NON-NLS-1$
+ String SPAN_CLASS_DIV_LABEL = "div-label"; //$NON-NLS-1$
+ String SPAN_CLASS_LINK_LABEL = "link-label"; //$NON-NLS-1$
+ String SPAN_CLASS_TEXT = "text"; //$NON-NLS-1$
- /* HTML style */
- String STYLE_HTML = "HTML, BODY, IMG { border: 0px; }"; //$NON-NLS-1$
+ /* HTML style */
+ String STYLE_HTML = "HTML, BODY, IMG { border: 0px; }"; //$NON-NLS-1$
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java
index 9e7df8353..dbeef3888 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/html/IntroHTMLGenerator.java
@@ -510,8 +510,8 @@ public class IntroHTMLGenerator {
int indentBase = indentLevel;
if (useTable) {
indentBase = indentLevel + 1;
- anchor2 = generateAnchorElement(element, indentLevel + 1);
- labelAnchor = anchor2;
+ anchor2 = generateAnchorElement(element, indentLevel + 1);
+ labelAnchor = anchor2;
}
// add <IMG src="blank.gif">
String blankImageURL = BundleUtil.getResolvedResourceLocation(IIntroHTMLConstants.IMAGE_SRC_BLANK,
@@ -828,8 +828,8 @@ public class IntroHTMLGenerator {
IntroTheme theme = introPage.getModelRoot().getTheme();
if (theme != null && theme.isScalable()
&& FontSelection.FONT_RELATIVE.equals(FontSelection.getFontStyle())) {
- String sizeStyle = FontSelection.generatePageFontStyle();
- style.addContent(sizeStyle);
+ String sizeStyle = FontSelection.generatePageFontStyle();
+ style.addContent(sizeStyle);
}
return style;
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractBaseIntroElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractBaseIntroElement.java
index 0aa974584..1c820c714 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractBaseIntroElement.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractBaseIntroElement.java
@@ -33,74 +33,74 @@ import org.w3c.dom.Element;
*/
public abstract class AbstractBaseIntroElement extends AbstractIntroIdElement {
- protected static final String ATT_STYLE_ID = "style-id"; //$NON-NLS-1$
- protected static final String ATT_FILTERED_FROM = "filteredFrom"; //$NON-NLS-1$
-
- protected String style_id;
- protected String filteredFrom;
- private boolean isFiltered;
-
- AbstractBaseIntroElement(IConfigurationElement element) {
- super(element);
- style_id = element.getAttribute(ATT_STYLE_ID);
- filteredFrom = element.getAttribute(ATT_FILTERED_FROM);
- }
-
- AbstractBaseIntroElement(Element element, Bundle bundle) {
- super(element, bundle);
- style_id = getAttribute(element, ATT_STYLE_ID);
- filteredFrom = getAttribute(element, ATT_FILTERED_FROM);
- }
-
- /**
- * Filter this element out based on the presentation kind.
- *
- */
- private boolean checkFilterState() {
- if (this.isOfType(AbstractIntroElement.MODEL_ROOT))
- // root element is not filtered.
- return false;
- IntroModelRoot root = (IntroModelRoot) getParentPage().getParent();
- return root.getPresentation().getImplementationKind().equals(
- filteredFrom) ? true : false;
- }
-
-
- /**
- * @return Returns the class id.
- */
- public String getStyleId() {
- return style_id;
- }
-
- @Override
+ protected static final String ATT_STYLE_ID = "style-id"; //$NON-NLS-1$
+ protected static final String ATT_FILTERED_FROM = "filteredFrom"; //$NON-NLS-1$
+
+ protected String style_id;
+ protected String filteredFrom;
+ private boolean isFiltered;
+
+ AbstractBaseIntroElement(IConfigurationElement element) {
+ super(element);
+ style_id = element.getAttribute(ATT_STYLE_ID);
+ filteredFrom = element.getAttribute(ATT_FILTERED_FROM);
+ }
+
+ AbstractBaseIntroElement(Element element, Bundle bundle) {
+ super(element, bundle);
+ style_id = getAttribute(element, ATT_STYLE_ID);
+ filteredFrom = getAttribute(element, ATT_FILTERED_FROM);
+ }
+
+ /**
+ * Filter this element out based on the presentation kind.
+ *
+ */
+ private boolean checkFilterState() {
+ if (this.isOfType(AbstractIntroElement.MODEL_ROOT))
+ // root element is not filtered.
+ return false;
+ IntroModelRoot root = (IntroModelRoot) getParentPage().getParent();
+ return root.getPresentation().getImplementationKind().equals(
+ filteredFrom) ? true : false;
+ }
+
+
+ /**
+ * @return Returns the class id.
+ */
+ public String getStyleId() {
+ return style_id;
+ }
+
+ @Override
protected void loadFromParent() {
- style_id = getAttribute(getElement(), ATT_STYLE_ID);
- filteredFrom = getAttribute(getElement(), ATT_FILTERED_FROM);
- }
-
- /**
- * @return Returns the filter_kind.
- */
- public String getFilteredFrom() {
- return filteredFrom;
- }
-
- /**
- * Return the filter state of this intro element. We need to do this when
- * this element has been added to the model, and it has a parent. Also, this
- * method will not be valid if the UI has not been loaded yet because it it
- * the creation of the UI that determines the presentation details.
- *
- * @return Returns the isFiltered.
- */
- public boolean isFiltered() {
- return checkFilterState() || isFiltered;
- }
-
- public void setFilterState(boolean state) {
- isFiltered = state;
- }
+ style_id = getAttribute(getElement(), ATT_STYLE_ID);
+ filteredFrom = getAttribute(getElement(), ATT_FILTERED_FROM);
+ }
+
+ /**
+ * @return Returns the filter_kind.
+ */
+ public String getFilteredFrom() {
+ return filteredFrom;
+ }
+
+ /**
+ * Return the filter state of this intro element. We need to do this when
+ * this element has been added to the model, and it has a parent. Also, this
+ * method will not be valid if the UI has not been loaded yet because it it
+ * the creation of the UI that determines the presentation details.
+ *
+ * @return Returns the isFiltered.
+ */
+ public boolean isFiltered() {
+ return checkFilterState() || isFiltered;
+ }
+
+ public void setFilterState(boolean state) {
+ isFiltered = state;
+ }
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroContainer.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroContainer.java
index 6e256e0af..5004763a7 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroContainer.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroContainer.java
@@ -33,626 +33,626 @@ import org.w3c.dom.NodeList;
*/
public abstract class AbstractIntroContainer extends AbstractBaseIntroElement {
- protected static final String ATT_BG_IMAGE = "bgImage"; //$NON-NLS-1$
+ protected static final String ATT_BG_IMAGE = "bgImage"; //$NON-NLS-1$
// vector is lazily created when children are loaded in a call to
- // loadChildren().
+ // loadChildren().
protected Vector<AbstractIntroElement> children;
- protected boolean loaded = false;
- protected boolean resolved = false;
- protected Element element;
-
- // store the base since it will needed later to resolve children.
- protected String base;
-
- /**
- * @param element
- */
- AbstractIntroContainer(IConfigurationElement element) {
- super(element);
- }
-
- /**
- * @param element
- */
- AbstractIntroContainer(Element element, Bundle bundle) {
- super(element, bundle);
- this.element = element;
- }
-
- /**
- * @param element
- */
- AbstractIntroContainer(Element element, Bundle bundle, String base) {
- super(element, bundle);
- this.element = element;
- this.base = base;
- }
-
-
- /**
- * Get the children of this container. Loading children and resolving
- * includes and extension is delayed until this method call.
- *
- * @return Returns all the children of this container.
- */
- public AbstractIntroElement[] getChildren() {
- if (!loaded)
- loadChildren();
-
- if (!loaded)
- // if loaded still is false, something went wrong. This could happen
- // when loading content from another external content files.
- return new AbstractIntroElement[0];
-
- if (!resolved)
- resolveChildren();
-
- Vector filtered = filterChildren(children);
-
- AbstractIntroElement[] childrenElements = (AbstractIntroElement[]) convertToModelArray(
- filtered, AbstractIntroElement.ELEMENT);
- return childrenElements;
- }
-
- /**
- * Returns all the children of this container that are of the specified
- * type(s). <br>
- * An example of an element mask is as follows:
- * <p>
- * <code>
- * int elementMask = IntroElement.IMAGE | IntroElement.DEFAULT_LINK;
- * int elementMask = IntroElement.ABSTRACT_CONTAINER;
- * </code>
- * The return type is determined depending on the mask. If the mask is a
- * predefined constant in the IntroElement, and it does not correspond to an
- * abstract model class, then the object returned can be safely cast to an
- * array of the corresponding model class. For exmaple, the following code
- * gets all groups in the given page, in the same order they appear in the
- * plugin.xml markup:
- * <p>
- * <code>
- * Introgroup[] groups = (IntroGroup[])page.getChildrenOfType(IntroElement.GROUP);
- * </code>
- *
- * However, if the element mask is not homogenous (for example: LINKS |
- * GROUP) then the returned array must be cast to an array of
- * IntroElements.For exmaple, the following code gets all images and links
- * in the given page, in the same order they appear in the plugin.xml
- * markup:
- * <p>
- * <code>
- * int elementMask = IntroElement.IMAGE | IntroElement.DEFAULT_LINK;
- * IntroElement[] imagesAndLinks =
- * (IntroElement[])page.getChildrenOfType(elementMask);
- * </code>
- *
- * @return An array of elements of the right type. If the container has no
- * children, or no children of the specified types, returns an empty
- * array.
- */
- public Object[] getChildrenOfType(int elementMask) {
-
- AbstractIntroElement[] childrenElements = getChildren();
- // if we have no children, we still need to return an empty array of
- // the correct type.
+ protected boolean loaded = false;
+ protected boolean resolved = false;
+ protected Element element;
+
+ // store the base since it will needed later to resolve children.
+ protected String base;
+
+ /**
+ * @param element
+ */
+ AbstractIntroContainer(IConfigurationElement element) {
+ super(element);
+ }
+
+ /**
+ * @param element
+ */
+ AbstractIntroContainer(Element element, Bundle bundle) {
+ super(element, bundle);
+ this.element = element;
+ }
+
+ /**
+ * @param element
+ */
+ AbstractIntroContainer(Element element, Bundle bundle, String base) {
+ super(element, bundle);
+ this.element = element;
+ this.base = base;
+ }
+
+
+ /**
+ * Get the children of this container. Loading children and resolving
+ * includes and extension is delayed until this method call.
+ *
+ * @return Returns all the children of this container.
+ */
+ public AbstractIntroElement[] getChildren() {
+ if (!loaded)
+ loadChildren();
+
+ if (!loaded)
+ // if loaded still is false, something went wrong. This could happen
+ // when loading content from another external content files.
+ return new AbstractIntroElement[0];
+
+ if (!resolved)
+ resolveChildren();
+
+ Vector filtered = filterChildren(children);
+
+ AbstractIntroElement[] childrenElements = (AbstractIntroElement[]) convertToModelArray(
+ filtered, AbstractIntroElement.ELEMENT);
+ return childrenElements;
+ }
+
+ /**
+ * Returns all the children of this container that are of the specified
+ * type(s). <br>
+ * An example of an element mask is as follows:
+ * <p>
+ * <code>
+ * int elementMask = IntroElement.IMAGE | IntroElement.DEFAULT_LINK;
+ * int elementMask = IntroElement.ABSTRACT_CONTAINER;
+ * </code>
+ * The return type is determined depending on the mask. If the mask is a
+ * predefined constant in the IntroElement, and it does not correspond to an
+ * abstract model class, then the object returned can be safely cast to an
+ * array of the corresponding model class. For exmaple, the following code
+ * gets all groups in the given page, in the same order they appear in the
+ * plugin.xml markup:
+ * <p>
+ * <code>
+ * Introgroup[] groups = (IntroGroup[])page.getChildrenOfType(IntroElement.GROUP);
+ * </code>
+ *
+ * However, if the element mask is not homogenous (for example: LINKS |
+ * GROUP) then the returned array must be cast to an array of
+ * IntroElements.For exmaple, the following code gets all images and links
+ * in the given page, in the same order they appear in the plugin.xml
+ * markup:
+ * <p>
+ * <code>
+ * int elementMask = IntroElement.IMAGE | IntroElement.DEFAULT_LINK;
+ * IntroElement[] imagesAndLinks =
+ * (IntroElement[])page.getChildrenOfType(elementMask);
+ * </code>
+ *
+ * @return An array of elements of the right type. If the container has no
+ * children, or no children of the specified types, returns an empty
+ * array.
+ */
+ public Object[] getChildrenOfType(int elementMask) {
+
+ AbstractIntroElement[] childrenElements = getChildren();
+ // if we have no children, we still need to return an empty array of
+ // the correct type.
Vector<AbstractIntroElement> typedChildren = new Vector<>();
- for (int i = 0; i < childrenElements.length; i++) {
- AbstractIntroElement element = childrenElements[i];
- if (element.isOfType(elementMask))
- typedChildren.addElement(element);
- }
- return convertToModelArray(typedChildren, elementMask);
- }
-
- /**
- * Utility method to convert all the content of a vector of
- * AbstractIntroElements into an array of IntroElements cast to the correct
- * class type. It is assumed that all elements in this vector are
- * IntroElement instances. If elementMask is a predefined model type (ie:
- * homogenous), then return array of corresponding type. Else, returns an
- * array of IntroElements.
- *
- * @param vector
- */
- private Object[] convertToModelArray(Vector vector, int elementMask) {
- int size = vector.size();
- Object[] src = null;
- switch (elementMask) {
- // homogenous vector.
- case AbstractIntroElement.GROUP:
- src = new IntroGroup[size];
- break;
- case AbstractIntroElement.LINK:
- src = new IntroLink[size];
- break;
- case AbstractIntroElement.TEXT:
- src = new IntroText[size];
- break;
- case AbstractIntroElement.IMAGE:
- src = new IntroImage[size];
- break;
- case AbstractIntroElement.HR:
- src = new IntroSeparator[size];
- break;
- case AbstractIntroElement.HTML:
- src = new IntroHTML[size];
- break;
- case AbstractIntroElement.INCLUDE:
- src = new IntroInclude[size];
- break;
- case AbstractIntroElement.PAGE:
- src = new IntroPage[size];
- break;
- case AbstractIntroElement.ABSTRACT_PAGE:
- src = new AbstractIntroPage[size];
- break;
- case AbstractIntroElement.ABSTRACT_CONTAINER:
- src = new AbstractIntroContainer[size];
- break;
- case AbstractIntroElement.HEAD:
- src = new IntroHead[size];
- break;
- case AbstractIntroElement.PAGE_TITLE:
- src = new IntroPageTitle[size];
- break;
- case AbstractIntroElement.ANCHOR:
- src = new IntroAnchor[size];
- break;
- case AbstractIntroElement.CONTENT_PROVIDER:
- src = new IntroContentProvider[size];
- break;
-
- default:
- // now handle left over abstract types. Vector is not homogenous.
- src = new AbstractIntroElement[size];
- break;
- }
-
- vector.copyInto(src);
- return src;
-
- }
-
- /**
- * Load all the children of this container. A container can have other
- * containers, links, htmls, text, image, include. Load them in the order
- * they appear in the xml content file.
- */
- protected void loadChildren() {
- // init the children vector. old children are disposed automatically.
+ for (int i = 0; i < childrenElements.length; i++) {
+ AbstractIntroElement element = childrenElements[i];
+ if (element.isOfType(elementMask))
+ typedChildren.addElement(element);
+ }
+ return convertToModelArray(typedChildren, elementMask);
+ }
+
+ /**
+ * Utility method to convert all the content of a vector of
+ * AbstractIntroElements into an array of IntroElements cast to the correct
+ * class type. It is assumed that all elements in this vector are
+ * IntroElement instances. If elementMask is a predefined model type (ie:
+ * homogenous), then return array of corresponding type. Else, returns an
+ * array of IntroElements.
+ *
+ * @param vector
+ */
+ private Object[] convertToModelArray(Vector vector, int elementMask) {
+ int size = vector.size();
+ Object[] src = null;
+ switch (elementMask) {
+ // homogenous vector.
+ case AbstractIntroElement.GROUP:
+ src = new IntroGroup[size];
+ break;
+ case AbstractIntroElement.LINK:
+ src = new IntroLink[size];
+ break;
+ case AbstractIntroElement.TEXT:
+ src = new IntroText[size];
+ break;
+ case AbstractIntroElement.IMAGE:
+ src = new IntroImage[size];
+ break;
+ case AbstractIntroElement.HR:
+ src = new IntroSeparator[size];
+ break;
+ case AbstractIntroElement.HTML:
+ src = new IntroHTML[size];
+ break;
+ case AbstractIntroElement.INCLUDE:
+ src = new IntroInclude[size];
+ break;
+ case AbstractIntroElement.PAGE:
+ src = new IntroPage[size];
+ break;
+ case AbstractIntroElement.ABSTRACT_PAGE:
+ src = new AbstractIntroPage[size];
+ break;
+ case AbstractIntroElement.ABSTRACT_CONTAINER:
+ src = new AbstractIntroContainer[size];
+ break;
+ case AbstractIntroElement.HEAD:
+ src = new IntroHead[size];
+ break;
+ case AbstractIntroElement.PAGE_TITLE:
+ src = new IntroPageTitle[size];
+ break;
+ case AbstractIntroElement.ANCHOR:
+ src = new IntroAnchor[size];
+ break;
+ case AbstractIntroElement.CONTENT_PROVIDER:
+ src = new IntroContentProvider[size];
+ break;
+
+ default:
+ // now handle left over abstract types. Vector is not homogenous.
+ src = new AbstractIntroElement[size];
+ break;
+ }
+
+ vector.copyInto(src);
+ return src;
+
+ }
+
+ /**
+ * Load all the children of this container. A container can have other
+ * containers, links, htmls, text, image, include. Load them in the order
+ * they appear in the xml content file.
+ */
+ protected void loadChildren() {
+ // init the children vector. old children are disposed automatically.
children = new Vector<>();
- NodeList nodeList = element.getChildNodes();
+ NodeList nodeList = element.getChildNodes();
Vector<Node> vector = new Vector<>();
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node node = nodeList.item(i);
- if (node.getNodeType() == Node.ELEMENT_NODE)
- vector.add(node);
- }
- Element[] filteredElements = new Element[vector.size()];
- vector.copyInto(filteredElements);
- // add the elements at the end children's vector.
- insertElementsBefore(filteredElements, getBundle(), base, children
- .size(), null);
- loaded = true;
- // we cannot free DOM model element because a page's children may be
- // nulled when reflowing a content provider.
- }
-
- /**
- * Adds the given elements as children of this container, before the
- * specified index.
- *
- * @param childElements
- */
- protected void insertElementsBefore(Element[] childElements, Bundle bundle,
- String base, int index, String mixinStyle) {
- for (int i = 0; i < childElements.length; i++) {
- Element childElement = childElements[i];
- AbstractIntroElement child = getModelChild(childElement, bundle,
- base);
- if (child != null) {
- child.setParent(this);
- child.setMixinStyle(mixinStyle);
- children.add(index, child);
- // index is only incremented if we actually added a child.
- index++;
- }
- }
- }
-
- /**
- * Adds the given elements as children of this container, before the
- * specified element. The element must be a direct child of this container.
- *
- * @param childElements
- */
- protected void insertElementsBefore(Element[] childElements, Bundle bundle,
- String base, AbstractIntroElement child, String mixinStyle) {
- int childLocation = children.indexOf(child);
- if (childLocation == -1)
- // bad reference child.
- return;
- insertElementsBefore(childElements, bundle, base, childLocation, mixinStyle);
- }
-
-
-
- /**
- * Adds a child to this container, depending on its type. Subclasses may
- * override if there is a child specific to the subclass.
- *
- * @param childElements
- */
- protected AbstractIntroElement getModelChild(Element childElement,
- Bundle bundle, String base) {
-
- AbstractIntroElement child = null;
- if (childElement.getNodeName().equalsIgnoreCase(IntroGroup.TAG_GROUP))
- child = new IntroGroup(childElement, bundle, base);
- else if (childElement.getNodeName()
- .equalsIgnoreCase(IntroLink.TAG_LINK))
- child = new IntroLink(childElement, bundle, base);
- else if (childElement.getNodeName()
- .equalsIgnoreCase(IntroText.TAG_TEXT))
- child = new IntroText(childElement, bundle);
- else if (childElement.getNodeName().equalsIgnoreCase(
- IntroImage.TAG_IMAGE))
- child = new IntroImage(childElement, bundle, base);
- else if (childElement.getNodeName().equalsIgnoreCase(
- IntroSeparator.TAG_HR))
- child = new IntroSeparator(childElement, bundle, base);
- else if (childElement.getNodeName()
- .equalsIgnoreCase(IntroHTML.TAG_HTML))
- child = new IntroHTML(childElement, bundle, base);
- else if (childElement.getNodeName().equalsIgnoreCase(
- IntroInclude.TAG_INCLUDE))
- child = new IntroInclude(childElement, bundle);
- else if (childElement.getNodeName().equalsIgnoreCase(
- IntroAnchor.TAG_ANCHOR))
- child = new IntroAnchor(childElement, bundle);
- else if (childElement.getNodeName().equalsIgnoreCase(
- IntroContentProvider.TAG_CONTENT_PROVIDER))
- child = new IntroContentProvider(childElement, bundle);
- return child;
- }
-
-
- /**
- * Resolve each include in this container's children. Includes are lazily
- * resolved on a per container basis, when the container is resolved.
- */
- protected void resolveChildren() {
- AbstractIntroElement[] array = children.toArray(new AbstractIntroElement[children.size()]);
- for (int i=0;i<array.length;++i) {
- AbstractIntroElement child = array[i];
- if (UAContentFilter.isFiltered(UAElementFactory.newElement(child.getElement()), IntroEvaluationContext.getContext())) {
- children.remove(child);
- }
- else if (child.getType() == AbstractIntroElement.INCLUDE) {
- resolveInclude((IntroInclude) child);
- }
- }
- resolved = true;
- }
-
- /**
- * Resolves an include. Gets the intro element pointed to by the include,
- * and adds it as a child of this current container. If target is not a
- * group, or any element that can be included in a group, ignore this
- * include.
- *
- * @param include
- */
- private void resolveInclude(IntroInclude include) {
- AbstractIntroElement target = findIncludeTarget(include);
- if (target == null)
- // target could not be found.
- return;
- if (target.isOfType(AbstractIntroElement.GROUP
- | AbstractIntroElement.ABSTRACT_TEXT
- | AbstractIntroElement.IMAGE | AbstractIntroElement.TEXT
- | AbstractIntroElement.PAGE_TITLE))
- // be picky about model elements to include. Can not use
- // BASE_ELEMENT model class because pages can not be included.
- insertTarget(include, target);
- }
-
- /**
- * Filters the appropriate elements from the given Vector, according to the current
- * environment. For example, if one of the elements has a tag to filter for os=linux and
- * the os is win32, the element will not be returned in the resulting Vector.
- *
- * @param unfiltered the unfiltered elements
- * @return a new Vector with elements filtered
- */
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE)
+ vector.add(node);
+ }
+ Element[] filteredElements = new Element[vector.size()];
+ vector.copyInto(filteredElements);
+ // add the elements at the end children's vector.
+ insertElementsBefore(filteredElements, getBundle(), base, children
+ .size(), null);
+ loaded = true;
+ // we cannot free DOM model element because a page's children may be
+ // nulled when reflowing a content provider.
+ }
+
+ /**
+ * Adds the given elements as children of this container, before the
+ * specified index.
+ *
+ * @param childElements
+ */
+ protected void insertElementsBefore(Element[] childElements, Bundle bundle,
+ String base, int index, String mixinStyle) {
+ for (int i = 0; i < childElements.length; i++) {
+ Element childElement = childElements[i];
+ AbstractIntroElement child = getModelChild(childElement, bundle,
+ base);
+ if (child != null) {
+ child.setParent(this);
+ child.setMixinStyle(mixinStyle);
+ children.add(index, child);
+ // index is only incremented if we actually added a child.
+ index++;
+ }
+ }
+ }
+
+ /**
+ * Adds the given elements as children of this container, before the
+ * specified element. The element must be a direct child of this container.
+ *
+ * @param childElements
+ */
+ protected void insertElementsBefore(Element[] childElements, Bundle bundle,
+ String base, AbstractIntroElement child, String mixinStyle) {
+ int childLocation = children.indexOf(child);
+ if (childLocation == -1)
+ // bad reference child.
+ return;
+ insertElementsBefore(childElements, bundle, base, childLocation, mixinStyle);
+ }
+
+
+
+ /**
+ * Adds a child to this container, depending on its type. Subclasses may
+ * override if there is a child specific to the subclass.
+ *
+ * @param childElements
+ */
+ protected AbstractIntroElement getModelChild(Element childElement,
+ Bundle bundle, String base) {
+
+ AbstractIntroElement child = null;
+ if (childElement.getNodeName().equalsIgnoreCase(IntroGroup.TAG_GROUP))
+ child = new IntroGroup(childElement, bundle, base);
+ else if (childElement.getNodeName()
+ .equalsIgnoreCase(IntroLink.TAG_LINK))
+ child = new IntroLink(childElement, bundle, base);
+ else if (childElement.getNodeName()
+ .equalsIgnoreCase(IntroText.TAG_TEXT))
+ child = new IntroText(childElement, bundle);
+ else if (childElement.getNodeName().equalsIgnoreCase(
+ IntroImage.TAG_IMAGE))
+ child = new IntroImage(childElement, bundle, base);
+ else if (childElement.getNodeName().equalsIgnoreCase(
+ IntroSeparator.TAG_HR))
+ child = new IntroSeparator(childElement, bundle, base);
+ else if (childElement.getNodeName()
+ .equalsIgnoreCase(IntroHTML.TAG_HTML))
+ child = new IntroHTML(childElement, bundle, base);
+ else if (childElement.getNodeName().equalsIgnoreCase(
+ IntroInclude.TAG_INCLUDE))
+ child = new IntroInclude(childElement, bundle);
+ else if (childElement.getNodeName().equalsIgnoreCase(
+ IntroAnchor.TAG_ANCHOR))
+ child = new IntroAnchor(childElement, bundle);
+ else if (childElement.getNodeName().equalsIgnoreCase(
+ IntroContentProvider.TAG_CONTENT_PROVIDER))
+ child = new IntroContentProvider(childElement, bundle);
+ return child;
+ }
+
+
+ /**
+ * Resolve each include in this container's children. Includes are lazily
+ * resolved on a per container basis, when the container is resolved.
+ */
+ protected void resolveChildren() {
+ AbstractIntroElement[] array = children.toArray(new AbstractIntroElement[children.size()]);
+ for (int i=0;i<array.length;++i) {
+ AbstractIntroElement child = array[i];
+ if (UAContentFilter.isFiltered(UAElementFactory.newElement(child.getElement()), IntroEvaluationContext.getContext())) {
+ children.remove(child);
+ }
+ else if (child.getType() == AbstractIntroElement.INCLUDE) {
+ resolveInclude((IntroInclude) child);
+ }
+ }
+ resolved = true;
+ }
+
+ /**
+ * Resolves an include. Gets the intro element pointed to by the include,
+ * and adds it as a child of this current container. If target is not a
+ * group, or any element that can be included in a group, ignore this
+ * include.
+ *
+ * @param include
+ */
+ private void resolveInclude(IntroInclude include) {
+ AbstractIntroElement target = findIncludeTarget(include);
+ if (target == null)
+ // target could not be found.
+ return;
+ if (target.isOfType(AbstractIntroElement.GROUP
+ | AbstractIntroElement.ABSTRACT_TEXT
+ | AbstractIntroElement.IMAGE | AbstractIntroElement.TEXT
+ | AbstractIntroElement.PAGE_TITLE))
+ // be picky about model elements to include. Can not use
+ // BASE_ELEMENT model class because pages can not be included.
+ insertTarget(include, target);
+ }
+
+ /**
+ * Filters the appropriate elements from the given Vector, according to the current
+ * environment. For example, if one of the elements has a tag to filter for os=linux and
+ * the os is win32, the element will not be returned in the resulting Vector.
+ *
+ * @param unfiltered the unfiltered elements
+ * @return a new Vector with elements filtered
+ */
private <T> Vector<T> filterChildren(Vector<T> unfiltered) {
Vector<T> filtered = new Vector<>();
Iterator<T> iter = unfiltered.iterator();
- while (iter.hasNext()) {
+ while (iter.hasNext()) {
T element = iter.next();
- if (!UAContentFilter.isFiltered(element, IntroEvaluationContext.getContext())) {
- filtered.add(element);
- }
- }
- return filtered;
- }
-
- /**
- * Find the target element pointed to by the path in the include. It is
- * assumed that configId always points to an external config, and not the
- * same config of the inlcude.
- *
- * @param include
- * @param path
- * @return
- */
- private AbstractIntroElement findIncludeTarget(IntroInclude include) {
- String path = include.getPath();
- IntroModelRoot targetModelRoot = (IntroModelRoot) getParentPage()
- .getParent();
- String targetConfigID = include.getConfigId();
- if (targetConfigID != null)
- targetModelRoot = ExtensionPointManager.getInst().getModel(
- targetConfigID);
- if (targetModelRoot == null)
- // if the target config was not found, skip this include.
- return null;
- AbstractIntroElement target = findTarget(targetModelRoot, path);
- return target;
- }
-
- /**
- * Finds the child element that corresponds to the given path in the passed
- * model.<br>
- * ps: This method could be a static method, but left as instance for model
- * enhancements.
- *
- * @param model
- * @param path
- * @return
- */
- public AbstractIntroElement findTarget(AbstractIntroContainer container,
- String path) {
- // extract path segments. Get first segment to start search.
- String[] pathSegments = path.split("/"); //$NON-NLS-1$
- if (container == null)
- return null;
-
- AbstractIntroElement target = container.findChild(pathSegments[0]);
- if (target == null)
- // there is no direct child with the specified first path segment.
- return null;
-
- // found parent segment. now find each child segment.
- for (int i = 1; i < pathSegments.length; i++) {
- if (!(target instanceof AbstractIntroContainer)) {
- // parent is not a container, so no point going on.
- return null;
- }
- String pathSegment = pathSegments[i];
- target = ((AbstractIntroContainer) target).findChild(pathSegment);
- if (target == null)
- // tried to find next segment and failed.
- return null;
- }
- return target;
- }
-
- public AbstractIntroElement findTarget(AbstractIntroContainer container,
- String path, String extensionId) {
- // resolve path segments if they are incomplete.
- if (path.contains("@")) { //$NON-NLS-1$
- // new in 3.2: dynamic resolution of incomplete target paths
- IntroModelRoot root = getModelRoot();
- if (root!=null) {
- path = root.resolvePath(extensionId, path);
- if (path==null)
- return null;
- }
-
- }
- return this.findTarget(container, path);
- }
-
-
- public AbstractIntroElement findTarget(String path) {
- return findTarget(this, path);
- }
-
-
-
- /*
- * searches direct children for the first child with the given id. The type
- * of the child can be any model element that has an id. ie:
- * AbstractIntroIdElement
- *
- * @see org.eclipse.ui.internal.intro.impl.model.IntroElement#getType()
- */
- public AbstractIntroElement findChild(String elementId) {
- return findChild(elementId, ID_ELEMENT);
- }
-
- /*
- * searches direct children for the first child with the given id. The type
- * of the child must be of the passed model types mask. This method handles
- * the 3.0 style model for content. Pages enhance this behavior with DOM
- * apis.
- *
- * @see org.eclipse.ui.internal.intro.impl.model.IntroElement#getType()
- */
- public AbstractIntroElement findChild(String elementId, int elementMask) {
- if (!loaded)
- loadChildren();
-
- for (int i = 0; i < children.size(); i++) {
- AbstractIntroElement aChild = children.elementAt(i);
- if (!aChild.isOfType(ID_ELEMENT))
- // includes and heads do not have ids, and so can not be
- // referenced directly. This means that they can not be
- // targets for other includes. Skip, just in case someone
- // adds an id to it! Also, this applies to all elements in
- // the model that do not have ids.
- continue;
- AbstractIntroIdElement child = (AbstractIntroIdElement) aChild;
- if (child.getId() != null && child.getId().equals(elementId)
- && child.isOfType(elementMask))
- return child;
- }
- // no child with given id and type found.
- return null;
- }
-
-
-
- private void insertTarget(IntroInclude include, AbstractIntroElement target) {
- int includeLocation = children.indexOf(include);
- if (includeLocation == -1)
- // should never be here.
- return;
- children.remove(includeLocation);
- // handle merging target styles first, before changing target parent to
- // enable inheritance of styles.
- handleIncludeStyleInheritence(include, target);
- // now clone the target node because original model should be kept
- // intact.
- AbstractIntroElement clonedTarget = null;
- try {
- clonedTarget = (AbstractIntroElement) target.clone();
- } catch (CloneNotSupportedException ex) {
- // should never be here.
- Log.error("Failed to clone Intro model node.", ex); //$NON-NLS-1$
- return;
- }
- // set parent of cloned target to be this container.
- clonedTarget.setParent(this);
- children.insertElementAt(clonedTarget, includeLocation);
- }
-
- /**
- * Updates the inherited styles based on the merge-style attribute. If we
- * are including a shared group, or if we are including an element from the
- * same page, do nothing. For inherited alt-styles, we have to cache the pd
- * from which we inherited the styles to be able to access resources in that
- * plugin. Also note that when including a container, it must be resolved
- * otherwise reparenting will cause includes in this target container to
- * fail.
- *
- * @param include
- * @param target
- */
- private void handleIncludeStyleInheritence(IntroInclude include,
- AbstractIntroElement target) {
-
- if (include.getMergeStyle() == false)
- // target styles are not needed. nothing to do.
- return;
-
- if (target.getParent().getType() == AbstractIntroElement.MODEL_ROOT
- || target.getParentPage().equals(include.getParentPage()))
- // If we are including from this same page ie: target is in the
- // same page, OR if we are including a shared group, defined
- // under a config, do not include styles.
- return;
-
- // Update the parent page styles. skip style if it is null. Note,
- // include both the target page styles and inherited styles. The full
- // page styles need to be include.
- String style = target.getParentPage().getStyle();
- if (style != null)
- getParentPage().addStyle(style);
-
- // for alt-style cache bundle for loading resources.
- style = target.getParentPage().getAltStyle();
- if (style != null) {
- Bundle bundle = target.getBundle();
- getParentPage().addAltStyle(style, bundle);
- }
-
- // now add inherited styles. Race condition could happen here if Page A
- // is including from Page B which is in turn including from Page A.
- getParentPage().addStyles(target.getParentPage().getStyles());
- getParentPage().addAltStyles(target.getParentPage().getAltStyles());
-
- }
-
- /**
- * Creates a clone of the given target node. A clone is create by simply
- * recreating that protion of the model.
- *
- * Note: looked into the clonable interface in Java, but it was not used
- * because it makes modifications/additions to the model harder to maintain.
- * Will revisit later.
- *
- * @param targer
- * @return
- */
- protected AbstractIntroElement cloneTarget(AbstractIntroElement target) {
- return null;
- }
-
- @Override
+ if (!UAContentFilter.isFiltered(element, IntroEvaluationContext.getContext())) {
+ filtered.add(element);
+ }
+ }
+ return filtered;
+ }
+
+ /**
+ * Find the target element pointed to by the path in the include. It is
+ * assumed that configId always points to an external config, and not the
+ * same config of the inlcude.
+ *
+ * @param include
+ * @param path
+ * @return
+ */
+ private AbstractIntroElement findIncludeTarget(IntroInclude include) {
+ String path = include.getPath();
+ IntroModelRoot targetModelRoot = (IntroModelRoot) getParentPage()
+ .getParent();
+ String targetConfigID = include.getConfigId();
+ if (targetConfigID != null)
+ targetModelRoot = ExtensionPointManager.getInst().getModel(
+ targetConfigID);
+ if (targetModelRoot == null)
+ // if the target config was not found, skip this include.
+ return null;
+ AbstractIntroElement target = findTarget(targetModelRoot, path);
+ return target;
+ }
+
+ /**
+ * Finds the child element that corresponds to the given path in the passed
+ * model.<br>
+ * ps: This method could be a static method, but left as instance for model
+ * enhancements.
+ *
+ * @param model
+ * @param path
+ * @return
+ */
+ public AbstractIntroElement findTarget(AbstractIntroContainer container,
+ String path) {
+ // extract path segments. Get first segment to start search.
+ String[] pathSegments = path.split("/"); //$NON-NLS-1$
+ if (container == null)
+ return null;
+
+ AbstractIntroElement target = container.findChild(pathSegments[0]);
+ if (target == null)
+ // there is no direct child with the specified first path segment.
+ return null;
+
+ // found parent segment. now find each child segment.
+ for (int i = 1; i < pathSegments.length; i++) {
+ if (!(target instanceof AbstractIntroContainer)) {
+ // parent is not a container, so no point going on.
+ return null;
+ }
+ String pathSegment = pathSegments[i];
+ target = ((AbstractIntroContainer) target).findChild(pathSegment);
+ if (target == null)
+ // tried to find next segment and failed.
+ return null;
+ }
+ return target;
+ }
+
+ public AbstractIntroElement findTarget(AbstractIntroContainer container,
+ String path, String extensionId) {
+ // resolve path segments if they are incomplete.
+ if (path.contains("@")) { //$NON-NLS-1$
+ // new in 3.2: dynamic resolution of incomplete target paths
+ IntroModelRoot root = getModelRoot();
+ if (root!=null) {
+ path = root.resolvePath(extensionId, path);
+ if (path==null)
+ return null;
+ }
+
+ }
+ return this.findTarget(container, path);
+ }
+
+
+ public AbstractIntroElement findTarget(String path) {
+ return findTarget(this, path);
+ }
+
+
+
+ /*
+ * searches direct children for the first child with the given id. The type
+ * of the child can be any model element that has an id. ie:
+ * AbstractIntroIdElement
+ *
+ * @see org.eclipse.ui.internal.intro.impl.model.IntroElement#getType()
+ */
+ public AbstractIntroElement findChild(String elementId) {
+ return findChild(elementId, ID_ELEMENT);
+ }
+
+ /*
+ * searches direct children for the first child with the given id. The type
+ * of the child must be of the passed model types mask. This method handles
+ * the 3.0 style model for content. Pages enhance this behavior with DOM
+ * apis.
+ *
+ * @see org.eclipse.ui.internal.intro.impl.model.IntroElement#getType()
+ */
+ public AbstractIntroElement findChild(String elementId, int elementMask) {
+ if (!loaded)
+ loadChildren();
+
+ for (int i = 0; i < children.size(); i++) {
+ AbstractIntroElement aChild = children.elementAt(i);
+ if (!aChild.isOfType(ID_ELEMENT))
+ // includes and heads do not have ids, and so can not be
+ // referenced directly. This means that they can not be
+ // targets for other includes. Skip, just in case someone
+ // adds an id to it! Also, this applies to all elements in
+ // the model that do not have ids.
+ continue;
+ AbstractIntroIdElement child = (AbstractIntroIdElement) aChild;
+ if (child.getId() != null && child.getId().equals(elementId)
+ && child.isOfType(elementMask))
+ return child;
+ }
+ // no child with given id and type found.
+ return null;
+ }
+
+
+
+ private void insertTarget(IntroInclude include, AbstractIntroElement target) {
+ int includeLocation = children.indexOf(include);
+ if (includeLocation == -1)
+ // should never be here.
+ return;
+ children.remove(includeLocation);
+ // handle merging target styles first, before changing target parent to
+ // enable inheritance of styles.
+ handleIncludeStyleInheritence(include, target);
+ // now clone the target node because original model should be kept
+ // intact.
+ AbstractIntroElement clonedTarget = null;
+ try {
+ clonedTarget = (AbstractIntroElement) target.clone();
+ } catch (CloneNotSupportedException ex) {
+ // should never be here.
+ Log.error("Failed to clone Intro model node.", ex); //$NON-NLS-1$
+ return;
+ }
+ // set parent of cloned target to be this container.
+ clonedTarget.setParent(this);
+ children.insertElementAt(clonedTarget, includeLocation);
+ }
+
+ /**
+ * Updates the inherited styles based on the merge-style attribute. If we
+ * are including a shared group, or if we are including an element from the
+ * same page, do nothing. For inherited alt-styles, we have to cache the pd
+ * from which we inherited the styles to be able to access resources in that
+ * plugin. Also note that when including a container, it must be resolved
+ * otherwise reparenting will cause includes in this target container to
+ * fail.
+ *
+ * @param include
+ * @param target
+ */
+ private void handleIncludeStyleInheritence(IntroInclude include,
+ AbstractIntroElement target) {
+
+ if (include.getMergeStyle() == false)
+ // target styles are not needed. nothing to do.
+ return;
+
+ if (target.getParent().getType() == AbstractIntroElement.MODEL_ROOT
+ || target.getParentPage().equals(include.getParentPage()))
+ // If we are including from this same page ie: target is in the
+ // same page, OR if we are including a shared group, defined
+ // under a config, do not include styles.
+ return;
+
+ // Update the parent page styles. skip style if it is null. Note,
+ // include both the target page styles and inherited styles. The full
+ // page styles need to be include.
+ String style = target.getParentPage().getStyle();
+ if (style != null)
+ getParentPage().addStyle(style);
+
+ // for alt-style cache bundle for loading resources.
+ style = target.getParentPage().getAltStyle();
+ if (style != null) {
+ Bundle bundle = target.getBundle();
+ getParentPage().addAltStyle(style, bundle);
+ }
+
+ // now add inherited styles. Race condition could happen here if Page A
+ // is including from Page B which is in turn including from Page A.
+ getParentPage().addStyles(target.getParentPage().getStyles());
+ getParentPage().addAltStyles(target.getParentPage().getAltStyles());
+
+ }
+
+ /**
+ * Creates a clone of the given target node. A clone is create by simply
+ * recreating that protion of the model.
+ *
+ * Note: looked into the clonable interface in Java, but it was not used
+ * because it makes modifications/additions to the model harder to maintain.
+ * Will revisit later.
+ *
+ * @param targer
+ * @return
+ */
+ protected AbstractIntroElement cloneTarget(AbstractIntroElement target) {
+ return null;
+ }
+
+ @Override
public int getType() {
- return AbstractIntroElement.ABSTRACT_CONTAINER;
- }
-
- /**
- * Deep copy since class has mutable objects. Leave DOM element as a shallow
- * reference copy since DOM is immutable.
- */
- @Override
+ return AbstractIntroElement.ABSTRACT_CONTAINER;
+ }
+
+ /**
+ * Deep copy since class has mutable objects. Leave DOM element as a shallow
+ * reference copy since DOM is immutable.
+ */
+ @Override
public Object clone() throws CloneNotSupportedException {
- AbstractIntroContainer clone = (AbstractIntroContainer) super.clone();
+ AbstractIntroContainer clone = (AbstractIntroContainer) super.clone();
clone.children = new Vector<>();
- if (children != null) {
- for (int i = 0; i < children.size(); i++) {
- AbstractIntroElement cloneChild = (AbstractIntroElement) children
- .elementAt(i).clone();
- cloneChild.setParent(clone);
- clone.children.add(i, cloneChild);
- }
- }
- return clone;
- }
-
- /**
- * Returns the element.
- *
- * @return
- */
- @Override
+ if (children != null) {
+ for (int i = 0; i < children.size(); i++) {
+ AbstractIntroElement cloneChild = (AbstractIntroElement) children
+ .elementAt(i).clone();
+ cloneChild.setParent(clone);
+ clone.children.add(i, cloneChild);
+ }
+ }
+ return clone;
+ }
+
+ /**
+ * Returns the element.
+ *
+ * @return
+ */
+ @Override
public Element getElement() {
- return this.element;
- }
-
- public String getBase() {
- return base;
- }
-
-
- /*
- * Clears this container. This means emptying the children, and resetting
- * flags.
- */
- public void clearChildren() {
- this.children.clear();
- }
-
-
- /**
- * Adds a model element as a child. Caller is responsible for inserting
- * model elements that rea valid as children.
- *
- * @param child
- */
- public void addChild(AbstractIntroElement child) {
- children.add(child);
- }
-
- public void removeChild(AbstractIntroElement child) {
- children.remove(child);
- }
+ return this.element;
+ }
+
+ public String getBase() {
+ return base;
+ }
+
+
+ /*
+ * Clears this container. This means emptying the children, and resetting
+ * flags.
+ */
+ public void clearChildren() {
+ this.children.clear();
+ }
+
+
+ /**
+ * Adds a model element as a child. Caller is responsible for inserting
+ * model elements that rea valid as children.
+ *
+ * @param child
+ */
+ public void addChild(AbstractIntroElement child) {
+ children.add(child);
+ }
+
+ public void removeChild(AbstractIntroElement child) {
+ children.remove(child);
+ }
public String getBackgroundImage() {
return getAttribute(element, ATT_BG_IMAGE);
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroElement.java
index c8ca58f4a..4446c46ec 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroElement.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroElement.java
@@ -41,424 +41,424 @@ import org.w3c.dom.Element;
*/
public abstract class AbstractIntroElement implements Cloneable {
- /**
- * Type constant which identifies an IntroModelRoot element.
- */
- public static final int MODEL_ROOT = 1;
-
- /**
- * Type constant which identifies an IntroPartPresentation element.
- */
- public static final int PRESENTATION = 1 << 1;
-
- /**
- * Type constant which identifies an IntroHomePage element.
- */
- public static final int HOME_PAGE = 1 << 2;
-
- /**
- * Type constant which identifies the IntroPage element.
- */
- public static final int PAGE = 1 << 3;
-
- /**
- * Type constant which identifies the AbstractIntroPage element.
- */
- public static final int ABSTRACT_PAGE = HOME_PAGE | PAGE;
-
- /**
- * Type constant which identifies an IntroDiv element.
- */
- public static final int GROUP = 1 << 4;
-
- /**
- * Type constant which identifies the AbstractIntroContainer element.
- */
- public static final int ABSTRACT_CONTAINER = ABSTRACT_PAGE | GROUP
- | MODEL_ROOT;
-
- /**
- * Type constant which identifies the IntroHtml element.
- */
- public static final int HTML = 1 << 5;
-
- /**
- * Type constant which identifies the IntroLink element.
- */
- public static final int LINK = 1 << 6;
-
- /**
- * Type constant which identifies the IntroImage element.
- */
- public static final int IMAGE = 1 << 7;
-
- /**
- * Type constant which identifies the IntroInclude element.
- */
- public static final int INCLUDE = 1 << 8;
-
- /**
- * Type constant which identifies the IntroText element.
- */
- public static final int TEXT = 1 << 9;
-
- /**
- * Type constant which identifies the IntroContainerExtension element.
- */
- public static final int CONTAINER_EXTENSION = 1 << 10;
-
- /**
- * Type constant which identifies the IntroHead element.
- */
- public static final int HEAD = 1 << 11;
-
- /**
- * Type constant which identifies the IntroHead element.
- */
- public static final int PAGE_TITLE = 1 << 12;
-
- /**
- * Type constant which identifies the IntroAnchor element.
- */
- public static final int ANCHOR = 1 << 13;
-
- /**
- * Type constant which identifies the IntroContentProvider element.
- */
- public static final int CONTENT_PROVIDER = 1 << 14;
-
- /**
- * Type constant which identifies the LaunchBarElement.
- */
- public static final int LAUNCH_BAR = 1 << 15;
-
- /**
- * Type constant which identifies the launch bar shortcut.
- */
- public static final int LAUNCH_BAR_SHORTCUT = 1 << 16;
-
- /**
- * Type constant which identifies am injected IFrame model element.
- */
- public static final int INJECTED_IFRAME = 1 << 17;
-
- /**
- * Type constant for the theme element.
- */
- public static final int THEME = 1 << 18;
-
- /**
- * Type constant for the hr element.
- */
- public static final int HR = 1 << 19;
-
-
- /**
- * Type constant which identifies the AbstractText element.
- */
- public static final int ABSTRACT_TEXT = HTML | LINK | CONTENT_PROVIDER;
-
- /**
- * Type constant which identifies the AbstractCommonIntroElement element.
- */
- public static final int BASE_ELEMENT = ABSTRACT_CONTAINER | ABSTRACT_TEXT
- | IMAGE | TEXT | PAGE_TITLE;
-
- /**
- * Type constant which identifies any element in the Intro Model which can
- * have an id. Note: eventhough IntroStandbyContentPart has an id, it does
- * not appear as a child in the model, and so it does not have a type.
- */
- public static final int ID_ELEMENT = BASE_ELEMENT | ANCHOR;
-
- /**
- * Type constant which identifies any element in the Intro Model.
- */
- public static final int ELEMENT = ID_ELEMENT | CONTAINER_EXTENSION | HEAD
- | INCLUDE | PRESENTATION | LAUNCH_BAR | LAUNCH_BAR_SHORTCUT;
-
-
-
- private AbstractIntroElement parent;
- private Object cfgElement;
- private Bundle bundle;
- private String mixinStyle;
-
-
- /**
- * Constructor used when model elements are being loaded from plugin.xml.
- */
- AbstractIntroElement(IConfigurationElement element) {
- cfgElement = element;
- bundle = BundleUtil.getBundleFromConfigurationElement(element);
- }
-
-
- /**
- * Constructor used when model elements are being loaded from an xml content
- * file. Bundle is propagated down the model to enable resolving resources
- * relative to the base of the bundle.
- *
- * @param element
- * @param pd
- */
- AbstractIntroElement(Element element, Bundle bundle) {
- this.cfgElement = element;
- this.bundle = bundle;
- }
-
-
- /**
- * Constructor used when model elements are being loaded from an xml content
- * file. Bundle AND base is propagated down the model to enable resolving
- * resources relative to the xml content file. The base is set to point to
- * the relative location of the parent folder that holds the content file.
- * In the case of a configExtension, it is set to point to the relative
- * position of the parent folder that holds the extension. Only when needed,
- * the base field is stored in a model element. This saves memory.
- *
- * @param element
- * @param pd
- */
- AbstractIntroElement(Element element, Bundle bundle, String base) {
- this(element, bundle);
- }
-
-
-
-
- /**
- * Returns the configuration element from which this intro element was
- * loaded. In the case of extension, returns the configuration element of
- * the defining extension.
- *
- * @return
- */
- public IConfigurationElement getCfgElement() {
- return cfgElement instanceof IConfigurationElement?(IConfigurationElement)cfgElement:null;
- }
-
- public Element getElement() {
- return cfgElement instanceof Element?(Element)cfgElement:null;
- }
-
- /**
- * DOM getAttribute retruns an empty string (not null) if attribute is not
- * defined. Override this behavior to be consistent with Intro Model, and
- * IConfiguration element.
- *
- * @param element
- * @param att
- * @return
- */
- protected String getAttribute(Element element, String att) {
- if (element.hasAttribute(att)) {
- String value = element.getAttribute(att);
- if (value!=null) {
- IntroModelRoot root = getModelRoot();
- if (root!=null)
- return root.resolveVariables(value);
- return value;
- }
- }
- return null;
- }
-
- /**
- * Util method to parse a comma separated list of values
- *
- * @param element
- * @param att
- * @return
- */
- protected String[] getAttributeList(Element element, String att) {
- if (element.hasAttribute(att)) {
- String value = element.getAttribute(att);
- if (value!=null) {
- String[] splitValues = value.split(","); //$NON-NLS-1$
+ /**
+ * Type constant which identifies an IntroModelRoot element.
+ */
+ public static final int MODEL_ROOT = 1;
+
+ /**
+ * Type constant which identifies an IntroPartPresentation element.
+ */
+ public static final int PRESENTATION = 1 << 1;
+
+ /**
+ * Type constant which identifies an IntroHomePage element.
+ */
+ public static final int HOME_PAGE = 1 << 2;
+
+ /**
+ * Type constant which identifies the IntroPage element.
+ */
+ public static final int PAGE = 1 << 3;
+
+ /**
+ * Type constant which identifies the AbstractIntroPage element.
+ */
+ public static final int ABSTRACT_PAGE = HOME_PAGE | PAGE;
+
+ /**
+ * Type constant which identifies an IntroDiv element.
+ */
+ public static final int GROUP = 1 << 4;
+
+ /**
+ * Type constant which identifies the AbstractIntroContainer element.
+ */
+ public static final int ABSTRACT_CONTAINER = ABSTRACT_PAGE | GROUP
+ | MODEL_ROOT;
+
+ /**
+ * Type constant which identifies the IntroHtml element.
+ */
+ public static final int HTML = 1 << 5;
+
+ /**
+ * Type constant which identifies the IntroLink element.
+ */
+ public static final int LINK = 1 << 6;
+
+ /**
+ * Type constant which identifies the IntroImage element.
+ */
+ public static final int IMAGE = 1 << 7;
+
+ /**
+ * Type constant which identifies the IntroInclude element.
+ */
+ public static final int INCLUDE = 1 << 8;
+
+ /**
+ * Type constant which identifies the IntroText element.
+ */
+ public static final int TEXT = 1 << 9;
+
+ /**
+ * Type constant which identifies the IntroContainerExtension element.
+ */
+ public static final int CONTAINER_EXTENSION = 1 << 10;
+
+ /**
+ * Type constant which identifies the IntroHead element.
+ */
+ public static final int HEAD = 1 << 11;
+
+ /**
+ * Type constant which identifies the IntroHead element.
+ */
+ public static final int PAGE_TITLE = 1 << 12;
+
+ /**
+ * Type constant which identifies the IntroAnchor element.
+ */
+ public static final int ANCHOR = 1 << 13;
+
+ /**
+ * Type constant which identifies the IntroContentProvider element.
+ */
+ public static final int CONTENT_PROVIDER = 1 << 14;
+
+ /**
+ * Type constant which identifies the LaunchBarElement.
+ */
+ public static final int LAUNCH_BAR = 1 << 15;
+
+ /**
+ * Type constant which identifies the launch bar shortcut.
+ */
+ public static final int LAUNCH_BAR_SHORTCUT = 1 << 16;
+
+ /**
+ * Type constant which identifies am injected IFrame model element.
+ */
+ public static final int INJECTED_IFRAME = 1 << 17;
+
+ /**
+ * Type constant for the theme element.
+ */
+ public static final int THEME = 1 << 18;
+
+ /**
+ * Type constant for the hr element.
+ */
+ public static final int HR = 1 << 19;
+
+
+ /**
+ * Type constant which identifies the AbstractText element.
+ */
+ public static final int ABSTRACT_TEXT = HTML | LINK | CONTENT_PROVIDER;
+
+ /**
+ * Type constant which identifies the AbstractCommonIntroElement element.
+ */
+ public static final int BASE_ELEMENT = ABSTRACT_CONTAINER | ABSTRACT_TEXT
+ | IMAGE | TEXT | PAGE_TITLE;
+
+ /**
+ * Type constant which identifies any element in the Intro Model which can
+ * have an id. Note: eventhough IntroStandbyContentPart has an id, it does
+ * not appear as a child in the model, and so it does not have a type.
+ */
+ public static final int ID_ELEMENT = BASE_ELEMENT | ANCHOR;
+
+ /**
+ * Type constant which identifies any element in the Intro Model.
+ */
+ public static final int ELEMENT = ID_ELEMENT | CONTAINER_EXTENSION | HEAD
+ | INCLUDE | PRESENTATION | LAUNCH_BAR | LAUNCH_BAR_SHORTCUT;
+
+
+
+ private AbstractIntroElement parent;
+ private Object cfgElement;
+ private Bundle bundle;
+ private String mixinStyle;
+
+
+ /**
+ * Constructor used when model elements are being loaded from plugin.xml.
+ */
+ AbstractIntroElement(IConfigurationElement element) {
+ cfgElement = element;
+ bundle = BundleUtil.getBundleFromConfigurationElement(element);
+ }
+
+
+ /**
+ * Constructor used when model elements are being loaded from an xml content
+ * file. Bundle is propagated down the model to enable resolving resources
+ * relative to the base of the bundle.
+ *
+ * @param element
+ * @param pd
+ */
+ AbstractIntroElement(Element element, Bundle bundle) {
+ this.cfgElement = element;
+ this.bundle = bundle;
+ }
+
+
+ /**
+ * Constructor used when model elements are being loaded from an xml content
+ * file. Bundle AND base is propagated down the model to enable resolving
+ * resources relative to the xml content file. The base is set to point to
+ * the relative location of the parent folder that holds the content file.
+ * In the case of a configExtension, it is set to point to the relative
+ * position of the parent folder that holds the extension. Only when needed,
+ * the base field is stored in a model element. This saves memory.
+ *
+ * @param element
+ * @param pd
+ */
+ AbstractIntroElement(Element element, Bundle bundle, String base) {
+ this(element, bundle);
+ }
+
+
+
+
+ /**
+ * Returns the configuration element from which this intro element was
+ * loaded. In the case of extension, returns the configuration element of
+ * the defining extension.
+ *
+ * @return
+ */
+ public IConfigurationElement getCfgElement() {
+ return cfgElement instanceof IConfigurationElement?(IConfigurationElement)cfgElement:null;
+ }
+
+ public Element getElement() {
+ return cfgElement instanceof Element?(Element)cfgElement:null;
+ }
+
+ /**
+ * DOM getAttribute retruns an empty string (not null) if attribute is not
+ * defined. Override this behavior to be consistent with Intro Model, and
+ * IConfiguration element.
+ *
+ * @param element
+ * @param att
+ * @return
+ */
+ protected String getAttribute(Element element, String att) {
+ if (element.hasAttribute(att)) {
+ String value = element.getAttribute(att);
+ if (value!=null) {
IntroModelRoot root = getModelRoot();
- if (root!=null) {
- for (int i = 0; i < splitValues.length; i++) {
- splitValues[i] = root.resolveVariables(splitValues[i]);
- }
- }
- return splitValues;
- }
- }
- /*
- if (element.hasAttribute(att))
- return element.getAttribute(att).split(","); //$NON-NLS-1$
- */
- return null;
- }
-
- protected void loadFromParent() {
- }
-
-
- /**
- * Returns the plugin descriptor of the plugin from which this intro element
- * was loaded. In the case of extension, returns the plugin descriptor of
- * the plugin defining the extension.
- *
- * @return
- */
- public Bundle getBundle() {
- return bundle;
- }
-
-
-
- /**
- * Returns the specific model type of this intro element. To be implemented
- * by all subclasses.
- *
- * @return returns one of the model class types defined in this class.
- */
- public abstract int getType();
-
-
- /**
- * Returns the parent of this intro element.
- * <p>
- * Rules:
- * <ul>
- * <li>For the model root, it retruns null.</li>
- * <li>For the introPart presentation it returns a model root.</li>
- * <li>For Pages, it returns an intro model root.</li>
- * <li>For all other elements, it retruns a subclass of abstract container.
- * </li>
- * <li>for divs that are children of configs (shared divs), it returns the
- * holding model root.</li>
- * <li>for Head elements that are children of Implementation elements
- * (shared Heads), it returns the holding presentation element.</li>
- * </ul>
- *
- * @return returns the parent of this intro element. Null only for model
- * root.
- */
- public AbstractIntroElement getParent() {
- return parent;
- }
-
- /**
- * @param parent
- * The parent to set.
- */
- public void setParent(AbstractIntroElement parent) {
- this.parent = parent;
- if (parent!=null)
- loadFromParent();
- }
-
- public void setBundle(Bundle bundle) {
- this.bundle = bundle;
- }
-
- /**
- * Returns the parent page holding this intro element. For the model root
- * and the introPart presentation it returns null. For Pages, it returns the
- * page itself. For all other element, returns the holding page.
- * <p>
- * Exceptions:
- * <ul>
- * <li>for divs that are children of configs (shared divs), it returns
- * null.</li>
- * <li>for Head elements that are children of Implementation elements
- * (shared Heads), it returns null.</li>
- * </ul>
- */
- public AbstractIntroPage getParentPage() {
- // return yourself if you are a page.
- if (isOfType(AbstractIntroElement.ABSTRACT_PAGE))
- return (AbstractIntroPage) this;
-
- AbstractIntroElement parent = getParent();
- if (parent == null)
- return null;
-
- while (parent != null && parent.getParent() != null
- && !parent.isOfType(AbstractIntroElement.ABSTRACT_PAGE))
- parent = parent.getParent();
- if (parent.isOfType(ABSTRACT_PAGE))
- return (AbstractIntroPage) parent;
- return null;
- }
-
- public IntroModelRoot getModelRoot() {
- // return yourself if you are a model root.
- if (isOfType(AbstractIntroElement.MODEL_ROOT))
- return (IntroModelRoot) this;
-
- AbstractIntroElement parent = getParent();
- if (parent == null)
- return null;
-
- while (parent != null && parent.getParent() != null
- && !parent.isOfType(AbstractIntroElement.MODEL_ROOT))
- parent = parent.getParent();
- if (parent.isOfType(MODEL_ROOT))
- return (IntroModelRoot) parent;
- return null;
- }
-
-
- /**
- * Returns whether the element is among the specified element types. An
- * example of an element mask is as follows:
- * <p>
- * <code>
- * int elementMask = IntroElement.ABSTRACT_CONTAINER;
- * int elementMask = IntroElement.DIV | IntroElement.DEFAULT_LINK;
- * </code>
- *
- * @param elementMask
- * element mask formed by bitwise OR of element type constants
- * defined in this class.
- * @return <code>true</code> if this element has a matching type, and
- * <code>false</code> otherwise.
- */
- public boolean isOfType(int elementMask) {
- return (getType() & elementMask) != 0;
- }
-
- /**
- * Returns whether the types of all the elements in the given array are
- * among the specified element types. <br>
- * An example of an element mask is as follows:
- * <p>
- * <code>
- * int elementMask = IntroElement.DIV | IntroElement.DEFAULT_LINK;
- * </code>
- *
- * @return <code>true</code> if all elements are of the right type, and
- * <code>false</code> if the list is empty, or at least one
- * element is not of the specified types.
- */
- public static final boolean allElementsAreOfType(
- AbstractIntroElement[] elements, int elementMask) {
- // if we have an empty list, no point going on.
- if (elements.length == 0)
- return false;
-
- for (int i = 0; i < elements.length; i++) {
- AbstractIntroElement element = elements[i];
- if (!element.isOfType(elementMask))
- return false;
- }
- return true;
- }
-
- /**
- * Shallow copy. The design of cloning this model assumes that when a
- * container is cloned, all its children must be cloned and reparented to
- * it, hence one clone of this container object. This is why we have a
- * shallow copy here.
- */
- @Override
+ if (root!=null)
+ return root.resolveVariables(value);
+ return value;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Util method to parse a comma separated list of values
+ *
+ * @param element
+ * @param att
+ * @return
+ */
+ protected String[] getAttributeList(Element element, String att) {
+ if (element.hasAttribute(att)) {
+ String value = element.getAttribute(att);
+ if (value!=null) {
+ String[] splitValues = value.split(","); //$NON-NLS-1$
+ IntroModelRoot root = getModelRoot();
+ if (root!=null) {
+ for (int i = 0; i < splitValues.length; i++) {
+ splitValues[i] = root.resolveVariables(splitValues[i]);
+ }
+ }
+ return splitValues;
+ }
+ }
+ /*
+ if (element.hasAttribute(att))
+ return element.getAttribute(att).split(","); //$NON-NLS-1$
+ */
+ return null;
+ }
+
+ protected void loadFromParent() {
+ }
+
+
+ /**
+ * Returns the plugin descriptor of the plugin from which this intro element
+ * was loaded. In the case of extension, returns the plugin descriptor of
+ * the plugin defining the extension.
+ *
+ * @return
+ */
+ public Bundle getBundle() {
+ return bundle;
+ }
+
+
+
+ /**
+ * Returns the specific model type of this intro element. To be implemented
+ * by all subclasses.
+ *
+ * @return returns one of the model class types defined in this class.
+ */
+ public abstract int getType();
+
+
+ /**
+ * Returns the parent of this intro element.
+ * <p>
+ * Rules:
+ * <ul>
+ * <li>For the model root, it retruns null.</li>
+ * <li>For the introPart presentation it returns a model root.</li>
+ * <li>For Pages, it returns an intro model root.</li>
+ * <li>For all other elements, it retruns a subclass of abstract container.
+ * </li>
+ * <li>for divs that are children of configs (shared divs), it returns the
+ * holding model root.</li>
+ * <li>for Head elements that are children of Implementation elements
+ * (shared Heads), it returns the holding presentation element.</li>
+ * </ul>
+ *
+ * @return returns the parent of this intro element. Null only for model
+ * root.
+ */
+ public AbstractIntroElement getParent() {
+ return parent;
+ }
+
+ /**
+ * @param parent
+ * The parent to set.
+ */
+ public void setParent(AbstractIntroElement parent) {
+ this.parent = parent;
+ if (parent!=null)
+ loadFromParent();
+ }
+
+ public void setBundle(Bundle bundle) {
+ this.bundle = bundle;
+ }
+
+ /**
+ * Returns the parent page holding this intro element. For the model root
+ * and the introPart presentation it returns null. For Pages, it returns the
+ * page itself. For all other element, returns the holding page.
+ * <p>
+ * Exceptions:
+ * <ul>
+ * <li>for divs that are children of configs (shared divs), it returns
+ * null.</li>
+ * <li>for Head elements that are children of Implementation elements
+ * (shared Heads), it returns null.</li>
+ * </ul>
+ */
+ public AbstractIntroPage getParentPage() {
+ // return yourself if you are a page.
+ if (isOfType(AbstractIntroElement.ABSTRACT_PAGE))
+ return (AbstractIntroPage) this;
+
+ AbstractIntroElement parent = getParent();
+ if (parent == null)
+ return null;
+
+ while (parent != null && parent.getParent() != null
+ && !parent.isOfType(AbstractIntroElement.ABSTRACT_PAGE))
+ parent = parent.getParent();
+ if (parent.isOfType(ABSTRACT_PAGE))
+ return (AbstractIntroPage) parent;
+ return null;
+ }
+
+ public IntroModelRoot getModelRoot() {
+ // return yourself if you are a model root.
+ if (isOfType(AbstractIntroElement.MODEL_ROOT))
+ return (IntroModelRoot) this;
+
+ AbstractIntroElement parent = getParent();
+ if (parent == null)
+ return null;
+
+ while (parent != null && parent.getParent() != null
+ && !parent.isOfType(AbstractIntroElement.MODEL_ROOT))
+ parent = parent.getParent();
+ if (parent.isOfType(MODEL_ROOT))
+ return (IntroModelRoot) parent;
+ return null;
+ }
+
+
+ /**
+ * Returns whether the element is among the specified element types. An
+ * example of an element mask is as follows:
+ * <p>
+ * <code>
+ * int elementMask = IntroElement.ABSTRACT_CONTAINER;
+ * int elementMask = IntroElement.DIV | IntroElement.DEFAULT_LINK;
+ * </code>
+ *
+ * @param elementMask
+ * element mask formed by bitwise OR of element type constants
+ * defined in this class.
+ * @return <code>true</code> if this element has a matching type, and
+ * <code>false</code> otherwise.
+ */
+ public boolean isOfType(int elementMask) {
+ return (getType() & elementMask) != 0;
+ }
+
+ /**
+ * Returns whether the types of all the elements in the given array are
+ * among the specified element types. <br>
+ * An example of an element mask is as follows:
+ * <p>
+ * <code>
+ * int elementMask = IntroElement.DIV | IntroElement.DEFAULT_LINK;
+ * </code>
+ *
+ * @return <code>true</code> if all elements are of the right type, and
+ * <code>false</code> if the list is empty, or at least one
+ * element is not of the specified types.
+ */
+ public static final boolean allElementsAreOfType(
+ AbstractIntroElement[] elements, int elementMask) {
+ // if we have an empty list, no point going on.
+ if (elements.length == 0)
+ return false;
+
+ for (int i = 0; i < elements.length; i++) {
+ AbstractIntroElement element = elements[i];
+ if (!element.isOfType(elementMask))
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Shallow copy. The design of cloning this model assumes that when a
+ * container is cloned, all its children must be cloned and reparented to
+ * it, hence one clone of this container object. This is why we have a
+ * shallow copy here.
+ */
+ @Override
public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
+ return super.clone();
+ }
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroIdElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroIdElement.java
index 10b7aacdc..487089f37 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroIdElement.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroIdElement.java
@@ -26,29 +26,29 @@ import org.w3c.dom.Element;
*/
public abstract class AbstractIntroIdElement extends AbstractIntroElement {
- public static final String ATT_ID = "id"; //$NON-NLS-1$
-
- protected String id;
-
- AbstractIntroIdElement(IConfigurationElement element) {
- super(element);
- id = element.getAttribute(ATT_ID);
- }
-
- AbstractIntroIdElement(Element element, Bundle bundle) {
- super(element, bundle);
- id = getAttribute(element, ATT_ID);
- }
-
- AbstractIntroIdElement(Element element, Bundle bundle, String base) {
- super(element, bundle, base);
- id = getAttribute(element, ATT_ID);
- }
-
- /**
- * @return Returns the id.
- */
- public String getId() {
- return id;
- }
+ public static final String ATT_ID = "id"; //$NON-NLS-1$
+
+ protected String id;
+
+ AbstractIntroIdElement(IConfigurationElement element) {
+ super(element);
+ id = element.getAttribute(ATT_ID);
+ }
+
+ AbstractIntroIdElement(Element element, Bundle bundle) {
+ super(element, bundle);
+ id = getAttribute(element, ATT_ID);
+ }
+
+ AbstractIntroIdElement(Element element, Bundle bundle, String base) {
+ super(element, bundle, base);
+ id = getAttribute(element, ATT_ID);
+ }
+
+ /**
+ * @return Returns the id.
+ */
+ public String getId() {
+ return id;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java
index afc39a757..e36f8ac7e 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPage.java
@@ -56,871 +56,871 @@ import org.w3c.dom.NodeList;
*/
public abstract class AbstractIntroPage extends AbstractIntroContainer {
- protected static final String TAG_PAGE = "page"; //$NON-NLS-1$
- private static final String ATT_STYLE = "style"; //$NON-NLS-1$
- private static final String ATT_ALT_STYLE = "alt-style"; //$NON-NLS-1$
- private static final String ATT_CONTENT = "content"; //$NON-NLS-1$
- private static final String ATT_SHARED_STYLE = "shared-style"; //$NON-NLS-1$
- private static final String INVALID_CONTENT = "invalidPage/invalidPage.xhtml"; //$NON-NLS-1$
- private static final String INVALID_CONTENT_BASE = "invalidPage"; //$NON-NLS-1$
+ protected static final String TAG_PAGE = "page"; //$NON-NLS-1$
+ private static final String ATT_STYLE = "style"; //$NON-NLS-1$
+ private static final String ATT_ALT_STYLE = "alt-style"; //$NON-NLS-1$
+ private static final String ATT_CONTENT = "content"; //$NON-NLS-1$
+ private static final String ATT_SHARED_STYLE = "shared-style"; //$NON-NLS-1$
+ private static final String INVALID_CONTENT = "invalidPage/invalidPage.xhtml"; //$NON-NLS-1$
+ private static final String INVALID_CONTENT_BASE = "invalidPage"; //$NON-NLS-1$
protected static final String ATT_URL = "url"; //$NON-NLS-1$
- private String style;
- private String altStyle;
- private String sharedStyle;
- private IntroPageTitle title;
- private String content;
- private String url;
-
- // if iframe is not null, this indicates that this page was cloned at
- // runtime from another page whose id was "originalId".
- private IntroInjectedIFrame iframe;
-
- // id of page from which this page was cloned.
- private String originalId;
-
- // DOM representing XHTML content. DOM is only cached in the case of XHTML
- // content.
- private Document dom;
-
- private DocumentProcessor domProcessor;
-
- // set when the content file is loaded (ie: loadChildren is called)
- private boolean isXHTMLPage;
-
- // Model base attribute is stored in parent class. This base attribute here
- // is to cache the initial location of the content file. When content
- // attribute is defined, the base in the model becomes relative to
- // new xml file. However, in the case of XHTML content, and when
- // presentation is UI forms, we need to reuse initial content file location.
- private String initialBase;
-
- /**
- * The vectors to hold all inhertied styles and alt styles from included
- * elements. They are lazily created when children are resolved (ie:
- * includes are resolved) OR when extensions are resolved and styles need to
- * be added to the target page.
- * <p>
- * Style Rules:
- * <ul>
- * <li>For includes, merge-style controls wether or not the enclosing page
- * inherits the styles of the target.
- * <li>If a page is including a shared div, merging target styles into this
- * page is ignored. Shared divs do not have styles.</li>
- * <li>For extensions, if the style or alt-style is not defined, that means
- * that no style inheritence is needed, and the style of the target page are
- * not updated.
- * <li>If an extension is extending a shared div, merging the styles of
- * this extension into the target is ignored. Shared divs do not have
- * styles.</li>
- * <li>Shared hashtable has alt-styles as keys and bundles as values.</li>
- * </ul>
- */
+ private String style;
+ private String altStyle;
+ private String sharedStyle;
+ private IntroPageTitle title;
+ private String content;
+ private String url;
+
+ // if iframe is not null, this indicates that this page was cloned at
+ // runtime from another page whose id was "originalId".
+ private IntroInjectedIFrame iframe;
+
+ // id of page from which this page was cloned.
+ private String originalId;
+
+ // DOM representing XHTML content. DOM is only cached in the case of XHTML
+ // content.
+ private Document dom;
+
+ private DocumentProcessor domProcessor;
+
+ // set when the content file is loaded (ie: loadChildren is called)
+ private boolean isXHTMLPage;
+
+ // Model base attribute is stored in parent class. This base attribute here
+ // is to cache the initial location of the content file. When content
+ // attribute is defined, the base in the model becomes relative to
+ // new xml file. However, in the case of XHTML content, and when
+ // presentation is UI forms, we need to reuse initial content file location.
+ private String initialBase;
+
+ /**
+ * The vectors to hold all inhertied styles and alt styles from included
+ * elements. They are lazily created when children are resolved (ie:
+ * includes are resolved) OR when extensions are resolved and styles need to
+ * be added to the target page.
+ * <p>
+ * Style Rules:
+ * <ul>
+ * <li>For includes, merge-style controls wether or not the enclosing page
+ * inherits the styles of the target.
+ * <li>If a page is including a shared div, merging target styles into this
+ * page is ignored. Shared divs do not have styles.</li>
+ * <li>For extensions, if the style or alt-style is not defined, that means
+ * that no style inheritence is needed, and the style of the target page are
+ * not updated.
+ * <li>If an extension is extending a shared div, merging the styles of
+ * this extension into the target is ignored. Shared divs do not have
+ * styles.</li>
+ * <li>Shared hashtable has alt-styles as keys and bundles as values.</li>
+ * </ul>
+ */
private Vector<String> styles;
private Map<String, Bundle> altStyles;
private boolean isDynamic = false;
protected boolean isStandbyPage;
- /**
- * Parent class for all pages. Make sure to set the bundle to where the
- * pages are loaded from. This means that the bundle for root may be
- * different from the bundle for all the other pages. Only pages do this
- * logic and so other model objects might have the wrong bundle cached if
- * the resource was loaded from an nl directory.
- *
- * @param element
- */
- AbstractIntroPage(Element element, Bundle bundle, String base) {
- super(element, bundle, base);
- this.initialBase = base;
- content = getAttribute(element, ATT_CONTENT);
- if (content == null) {
- //Delaying init until we have the model
- // so that we can resolve theme
- //init(element, bundle, base);
- }
- else {
- // Content is not null. Resolve it. Other page attributes (style,
- // alt-style...) will be loaded when xml content file is loaded
- // since we need to pick them up from external xml content file. In
- // the case where this external content file is XHTML and we have
- // HTML presentation, page attributes are simply not loaded. In the
- // case where we have XHTML in a UI forms presentation, we will need
- // to load initial page attributes.
- // BASE: since content is being loaded from another xml file, point
- // the base of this page to be relative to the new xml file
- // location.
- IPath subBase = ModelUtil.getParentFolderPath(content);
- this.base = new Path(base).append(subBase).toString();
- content = BundleUtil.getResolvedResourceLocation(base, content,
- bundle);
- }
- // load shared-style attribure. This is needed in the XML and in the
- // XHTML cases. Default is to include shared style.
- this.sharedStyle = getAttribute(element, ATT_SHARED_STYLE);
- if (sharedStyle == null)
- sharedStyle = "true"; //$NON-NLS-1$
- url = getAttribute(element, ATT_URL);
- if (url == null)
- // if we do not have a URL attribute, then we have dynamic content.
- isDynamic = true;
- else
- // check the url/standby-url attributes and update accordingly.
- url = ModelUtil.resolveURL(base, url, bundle);
-
- }
-
- @Override
+ /**
+ * Parent class for all pages. Make sure to set the bundle to where the
+ * pages are loaded from. This means that the bundle for root may be
+ * different from the bundle for all the other pages. Only pages do this
+ * logic and so other model objects might have the wrong bundle cached if
+ * the resource was loaded from an nl directory.
+ *
+ * @param element
+ */
+ AbstractIntroPage(Element element, Bundle bundle, String base) {
+ super(element, bundle, base);
+ this.initialBase = base;
+ content = getAttribute(element, ATT_CONTENT);
+ if (content == null) {
+ //Delaying init until we have the model
+ // so that we can resolve theme
+ //init(element, bundle, base);
+ }
+ else {
+ // Content is not null. Resolve it. Other page attributes (style,
+ // alt-style...) will be loaded when xml content file is loaded
+ // since we need to pick them up from external xml content file. In
+ // the case where this external content file is XHTML and we have
+ // HTML presentation, page attributes are simply not loaded. In the
+ // case where we have XHTML in a UI forms presentation, we will need
+ // to load initial page attributes.
+ // BASE: since content is being loaded from another xml file, point
+ // the base of this page to be relative to the new xml file
+ // location.
+ IPath subBase = ModelUtil.getParentFolderPath(content);
+ this.base = new Path(base).append(subBase).toString();
+ content = BundleUtil.getResolvedResourceLocation(base, content,
+ bundle);
+ }
+ // load shared-style attribure. This is needed in the XML and in the
+ // XHTML cases. Default is to include shared style.
+ this.sharedStyle = getAttribute(element, ATT_SHARED_STYLE);
+ if (sharedStyle == null)
+ sharedStyle = "true"; //$NON-NLS-1$
+ url = getAttribute(element, ATT_URL);
+ if (url == null)
+ // if we do not have a URL attribute, then we have dynamic content.
+ isDynamic = true;
+ else
+ // check the url/standby-url attributes and update accordingly.
+ url = ModelUtil.resolveURL(base, url, bundle);
+
+ }
+
+ @Override
public void setParent(AbstractIntroElement parent) {
- super.setParent(parent);
- if (content == null)
- init(element, getBundle(), initialBase);
- }
-
- /**
- * Returns unresolved content value as found in the source file.
- * the source file.
- * @return the unresolved content value
- */
-
- public String getRawContent() {
- return getAttribute(element, ATT_CONTENT);
- }
-
- /**
- * Initialize styles. Take first style in style attribute and make it the
- * page style. Then put other styles in styles vectors. Make sure to resolve
- * each style.
- *
- * @param element
- * @param bundle
- */
- private void init(Element element, Bundle bundle, String base) {
- String[] styleValues = getAttributeList(element, ATT_STYLE);
- if (styleValues != null && styleValues.length > 0) {
- style = styleValues[0];
- style = BundleUtil.getResolvedResourceLocation(base, style, bundle);
- for (int i = 1; i < styleValues.length; i++) {
- String style = styleValues[i];
- style = BundleUtil.getResolvedResourceLocation(base, style,
- bundle);
- addStyle(style);
- }
- }
-
- String[] altStyleValues = getAttributeList(element, ATT_ALT_STYLE);
- if (altStyleValues != null && altStyleValues.length > 0) {
- altStyle = altStyleValues[0];
- altStyle = BundleUtil.getResolvedResourceLocation(base, altStyle,
- bundle);
- for (int i = 1; i < altStyleValues.length; i++) {
- String style = altStyleValues[i];
- style = BundleUtil.getResolvedResourceLocation(base, style,
- bundle);
- addAltStyle(style, bundle);
- }
- }
- }
-
-
-
-
- /**
- * The page's title. Each page can have one title.
- *
- * @return Returns the title of this page.
- */
- public String getTitle() {
- // title is a child of the page, and so we have to load children first.
- // We also have to resolve children because someone might be including a
- // title. Update title instance after all includes and extensions have
- // been resolved.
- getChildren();
- if (title == null) {
- // there should only be one title child per page. safe to cast.
- IntroPageTitle[] titles = (IntroPageTitle[]) getChildrenOfType(AbstractIntroElement.PAGE_TITLE);
- if (titles.length > 0)
- title = titles[0];
- }
-
- if (title == null)
- // still null. no title.
- return null;
- return title.getTitle();
- }
-
- /**
- * @return Returns the style.
- */
- public String getStyle() {
- return style;
- }
-
- /**
- * @return Returns the alt_style.
- */
- public String getAltStyle() {
- return altStyle;
- }
-
- /**
- * Gets all the inherited styles of this page. Styles can be inherited from
- * includes or from configExtensions.
- * <p>
- * Note: this call needs to get all the children of this page, and so it
- * will resolve this page. might be expensive.
- *
- * @return Returns all the inherited styles of this page. Returns an empty
- * array if page is not expandable or does not have inherited
- * styles.
- */
- public String[] getStyles() {
- // call get children first to resolve includes and populate styles
- // vector. Resolving children will initialize the style vectors.
- getChildren();
- if (styles == null)
- // style vector is still null because page does not have styles.
- return new String[0];
- String[] stylesArray = new String[styles.size()];
- styles.copyInto(stylesArray);
- return stylesArray;
- }
-
- /**
- * Gets all the inherited alt-styles of this page (ie: styles for the SWT
- * presentation). A hashtable is returned that has inhertied alt-styles as
- * keys, and plugin descriptors as values. This is needed to be able to load
- * resources from the inherited target plugin. Note: this call needs to get
- * all the children of this page, and so its will resolve this page. might
- * be expensive.
- *
- * @return Returns all the inherited styles of this page. Returns an empty
- * hashtable if page is not expandable, does not have any includes,
- * or has includes that do not merge styles.
- */
+ super.setParent(parent);
+ if (content == null)
+ init(element, getBundle(), initialBase);
+ }
+
+ /**
+ * Returns unresolved content value as found in the source file.
+ * the source file.
+ * @return the unresolved content value
+ */
+
+ public String getRawContent() {
+ return getAttribute(element, ATT_CONTENT);
+ }
+
+ /**
+ * Initialize styles. Take first style in style attribute and make it the
+ * page style. Then put other styles in styles vectors. Make sure to resolve
+ * each style.
+ *
+ * @param element
+ * @param bundle
+ */
+ private void init(Element element, Bundle bundle, String base) {
+ String[] styleValues = getAttributeList(element, ATT_STYLE);
+ if (styleValues != null && styleValues.length > 0) {
+ style = styleValues[0];
+ style = BundleUtil.getResolvedResourceLocation(base, style, bundle);
+ for (int i = 1; i < styleValues.length; i++) {
+ String style = styleValues[i];
+ style = BundleUtil.getResolvedResourceLocation(base, style,
+ bundle);
+ addStyle(style);
+ }
+ }
+
+ String[] altStyleValues = getAttributeList(element, ATT_ALT_STYLE);
+ if (altStyleValues != null && altStyleValues.length > 0) {
+ altStyle = altStyleValues[0];
+ altStyle = BundleUtil.getResolvedResourceLocation(base, altStyle,
+ bundle);
+ for (int i = 1; i < altStyleValues.length; i++) {
+ String style = altStyleValues[i];
+ style = BundleUtil.getResolvedResourceLocation(base, style,
+ bundle);
+ addAltStyle(style, bundle);
+ }
+ }
+ }
+
+
+
+
+ /**
+ * The page's title. Each page can have one title.
+ *
+ * @return Returns the title of this page.
+ */
+ public String getTitle() {
+ // title is a child of the page, and so we have to load children first.
+ // We also have to resolve children because someone might be including a
+ // title. Update title instance after all includes and extensions have
+ // been resolved.
+ getChildren();
+ if (title == null) {
+ // there should only be one title child per page. safe to cast.
+ IntroPageTitle[] titles = (IntroPageTitle[]) getChildrenOfType(AbstractIntroElement.PAGE_TITLE);
+ if (titles.length > 0)
+ title = titles[0];
+ }
+
+ if (title == null)
+ // still null. no title.
+ return null;
+ return title.getTitle();
+ }
+
+ /**
+ * @return Returns the style.
+ */
+ public String getStyle() {
+ return style;
+ }
+
+ /**
+ * @return Returns the alt_style.
+ */
+ public String getAltStyle() {
+ return altStyle;
+ }
+
+ /**
+ * Gets all the inherited styles of this page. Styles can be inherited from
+ * includes or from configExtensions.
+ * <p>
+ * Note: this call needs to get all the children of this page, and so it
+ * will resolve this page. might be expensive.
+ *
+ * @return Returns all the inherited styles of this page. Returns an empty
+ * array if page is not expandable or does not have inherited
+ * styles.
+ */
+ public String[] getStyles() {
+ // call get children first to resolve includes and populate styles
+ // vector. Resolving children will initialize the style vectors.
+ getChildren();
+ if (styles == null)
+ // style vector is still null because page does not have styles.
+ return new String[0];
+ String[] stylesArray = new String[styles.size()];
+ styles.copyInto(stylesArray);
+ return stylesArray;
+ }
+
+ /**
+ * Gets all the inherited alt-styles of this page (ie: styles for the SWT
+ * presentation). A hashtable is returned that has inhertied alt-styles as
+ * keys, and plugin descriptors as values. This is needed to be able to load
+ * resources from the inherited target plugin. Note: this call needs to get
+ * all the children of this page, and so its will resolve this page. might
+ * be expensive.
+ *
+ * @return Returns all the inherited styles of this page. Returns an empty
+ * hashtable if page is not expandable, does not have any includes,
+ * or has includes that do not merge styles.
+ */
public Map<String, Bundle> getAltStyles() {
- // call get children first to resolve includes and populate hashtable.
- // Resolving children will initialize the style vectors.
- getChildren();
- return altStyles;
- }
-
- /**
- * Adds the given style to the list. Style is not added if it already exists
- * in the list.
- *
- * @param style
- */
- protected void addStyle(String style) {
- if (!initStyles(style))
- return;
- if (styles.contains(style))
- return;
- styles.add(style);
- }
-
- public void insertStyle(String style, int location) {
- if (!initStyles(style))
- return;
- if (styles.contains(style))
- return;
- styles.add(location, style);
- }
-
-
-
- /**
- * Adds the given style to the list.Style is not added if it already exists
- * in the list.
- *
- * @param altStyle
- */
- protected void addAltStyle(String altStyle, Bundle bundle) {
- if (!initAltStyles(altStyle))
- return;
- if (altStyles.containsKey(altStyle))
- return;
- altStyles.put(altStyle, bundle);
- }
-
-
- /**
- * Util method to add given styles to the list.
- *
- */
- protected void addStyles(String[] styles) {
- if (styles == null)
- return;
- for (int i = 0; i < styles.length; i++)
- addStyle(styles[i]);
- }
-
- /**
- * Util method to add map of altstyles to list.
- */
+ // call get children first to resolve includes and populate hashtable.
+ // Resolving children will initialize the style vectors.
+ getChildren();
+ return altStyles;
+ }
+
+ /**
+ * Adds the given style to the list. Style is not added if it already exists
+ * in the list.
+ *
+ * @param style
+ */
+ protected void addStyle(String style) {
+ if (!initStyles(style))
+ return;
+ if (styles.contains(style))
+ return;
+ styles.add(style);
+ }
+
+ public void insertStyle(String style, int location) {
+ if (!initStyles(style))
+ return;
+ if (styles.contains(style))
+ return;
+ styles.add(location, style);
+ }
+
+
+
+ /**
+ * Adds the given style to the list.Style is not added if it already exists
+ * in the list.
+ *
+ * @param altStyle
+ */
+ protected void addAltStyle(String altStyle, Bundle bundle) {
+ if (!initAltStyles(altStyle))
+ return;
+ if (altStyles.containsKey(altStyle))
+ return;
+ altStyles.put(altStyle, bundle);
+ }
+
+
+ /**
+ * Util method to add given styles to the list.
+ *
+ */
+ protected void addStyles(String[] styles) {
+ if (styles == null)
+ return;
+ for (int i = 0; i < styles.length; i++)
+ addStyle(styles[i]);
+ }
+
+ /**
+ * Util method to add map of altstyles to list.
+ */
protected void addAltStyles(Map<String, Bundle> altStyles) {
- if (altStyles == null)
- return;
- if (this.altStyles == null)
- // delay creation until needed.
+ if (altStyles == null)
+ return;
+ if (this.altStyles == null)
+ // delay creation until needed.
this.altStyles = new Hashtable<>();
- this.altStyles.putAll(altStyles);
- }
+ this.altStyles.putAll(altStyles);
+ }
- private boolean initStyles(String style) {
- if (style == null)
- return false;
- if (this.styles == null)
- // delay creation until needed.
+ private boolean initStyles(String style) {
+ if (style == null)
+ return false;
+ if (this.styles == null)
+ // delay creation until needed.
this.styles = new Vector<>();
- return true;
- }
-
- private boolean initAltStyles(String style) {
- if (style == null)
- return false;
- if (this.altStyles == null)
- // delay creation until needed.
+ return true;
+ }
+
+ private boolean initAltStyles(String style) {
+ if (style == null)
+ return false;
+ if (this.altStyles == null)
+ // delay creation until needed.
this.altStyles = new Hashtable<>();
- return true;
- }
+ return true;
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.ABSTRACT_PAGE;
- }
-
- /*
- * Override parent behavior to lazily initialize styles vectors. This will
- * only be called once, if resolved == false. In the case of DOM model,
- * resolve this page's full DOM.
- *
- * @see org.eclipse.ui.internal.intro.impl.model.AbstractIntroContainer#resolveChildren()
- */
- @Override
+ return AbstractIntroElement.ABSTRACT_PAGE;
+ }
+
+ /*
+ * Override parent behavior to lazily initialize styles vectors. This will
+ * only be called once, if resolved == false. In the case of DOM model,
+ * resolve this page's full DOM.
+ *
+ * @see org.eclipse.ui.internal.intro.impl.model.AbstractIntroContainer#resolveChildren()
+ */
+ @Override
protected void resolveChildren() {
- // flag would be set
- if (isXHTMLPage)
- resolvePage();
- else
- super.resolveChildren();
- }
-
-
-
- /**
- * Override parent behavior to add support for HEAD & Title element in pages
- * only, and not in divs.
- *
- * @see org.eclipse.ui.internal.intro.impl.model.AbstractIntroContainer#getModelChild(org.eclipse.core.runtime.IConfigurationElement)
- */
- @Override
+ // flag would be set
+ if (isXHTMLPage)
+ resolvePage();
+ else
+ super.resolveChildren();
+ }
+
+
+
+ /**
+ * Override parent behavior to add support for HEAD & Title element in pages
+ * only, and not in divs.
+ *
+ * @see org.eclipse.ui.internal.intro.impl.model.AbstractIntroContainer#getModelChild(org.eclipse.core.runtime.IConfigurationElement)
+ */
+ @Override
protected AbstractIntroElement getModelChild(Element childElement,
- Bundle bundle, String base) {
- AbstractIntroElement child = null;
- if (childElement.getNodeName().equalsIgnoreCase(IntroHead.TAG_HEAD)) {
- child = new IntroHead(childElement, bundle, base);
- } else if (childElement.getNodeName().equalsIgnoreCase(
- IntroPageTitle.TAG_TITLE)) {
- // if we have a title, only add it as a child if we did not load one
- // before. A page can only have one title.
- if (title == null) {
- child = new IntroPageTitle(childElement, bundle);
- }
- }
- if (child != null)
- return child;
- return super.getModelChild(childElement, bundle, base);
- }
-
- /**
- * Returns all head contributions in this page. There can be more than one
- * head contribution in the page;
- *
- * @return
- */
- public IntroHead[] getHTMLHeads() {
- return (IntroHead[]) getChildrenOfType(AbstractIntroElement.HEAD);
- }
-
-
- /**
- * load the children of this container. Override parent behavior because we
- * want to support loading content from other xml files. The design is that
- * only the id and content from the existing page are honored. All other
- * attributes are what they are defined in the external paget. For XHTML
- * content, all info is in the xhtml page. If we fail to load the page,
- * display the Invalid Page page.
- */
- @Override
+ Bundle bundle, String base) {
+ AbstractIntroElement child = null;
+ if (childElement.getNodeName().equalsIgnoreCase(IntroHead.TAG_HEAD)) {
+ child = new IntroHead(childElement, bundle, base);
+ } else if (childElement.getNodeName().equalsIgnoreCase(
+ IntroPageTitle.TAG_TITLE)) {
+ // if we have a title, only add it as a child if we did not load one
+ // before. A page can only have one title.
+ if (title == null) {
+ child = new IntroPageTitle(childElement, bundle);
+ }
+ }
+ if (child != null)
+ return child;
+ return super.getModelChild(childElement, bundle, base);
+ }
+
+ /**
+ * Returns all head contributions in this page. There can be more than one
+ * head contribution in the page;
+ *
+ * @return
+ */
+ public IntroHead[] getHTMLHeads() {
+ return (IntroHead[]) getChildrenOfType(AbstractIntroElement.HEAD);
+ }
+
+
+ /**
+ * load the children of this container. Override parent behavior because we
+ * want to support loading content from other xml files. The design is that
+ * only the id and content from the existing page are honored. All other
+ * attributes are what they are defined in the external paget. For XHTML
+ * content, all info is in the xhtml page. If we fail to load the page,
+ * display the Invalid Page page.
+ */
+ @Override
protected void loadChildren() {
- if (content == null) {
- // no content. do regular loading.
- super.loadChildren();
- return;
- }
-
- // content attribute is defined. It either points to an XHTML file, or
- // an introContent.xml file. Process each case. Assume it is an
- // introContent file.
- // INTRO: XHTML file is loaded needlessly when we have XHTML content and
- // SWT presentation.
- IntroContentParser parser = new IntroContentParser(content);
- Document dom = parser.getDocument();
- if (dom == null) {
- // bad xml. This could be bad XHTML or bad intro XML. Parser would
- // have logged fact. Load dom for invalid page, and make sure to
- // force an extract on parent folder to enabling jarring.
- Bundle introBundle = Platform.getBundle(IIntroConstants.PLUGIN_ID);
- ModelUtil.ensureFileURLsExist(introBundle, INVALID_CONTENT);
-
- String invalidContentFilePath = BundleUtil
- .getResolvedResourceLocation(INVALID_CONTENT, introBundle);
- parser = new IntroContentParser(invalidContentFilePath);
- dom = parser.getDocument();
- // make sure to override all attributes to resolve the Invalid
- // Page page correctly.
- content = invalidContentFilePath;
- this.base = INVALID_CONTENT_BASE;
- setBundle(introBundle);
- }
-
- // parse content depending on type. Make sure to set the loaded flag
- // accordingly, otherwise content file will always be parsed.
- if (parser.hasXHTMLContent()) {
- loadXHTMLContent(dom);
- // make sure to use correct base.
- init(element, getBundle(), initialBase);
- super.loadChildren();
- } else
- // load the first page with correct id, from content xml file.
- loadXMLContent(dom);
- }
-
- /**
- * Load the xml content from the introContent.xml file pointed to by the
- * content attribute, and loaded into the passed DOM. Load the first page
- * with correct id from this content file.
- *
- * @param dom
- */
- private void loadXMLContent(Document dom) {
- Element[] pages = ModelUtil.getElementsByTagName(dom,
- AbstractIntroPage.TAG_PAGE);
- if (pages.length == 0) {
- Log.warning("Content file has no pages."); //$NON-NLS-1$
- return;
- }
- // point the element of this page to the new element. Pick first page
- // with matching id. Make sure to disable loading of children of current
- // element if a matching page in the external content file is not found.
- boolean foundMatchingPage = false;
- for (int i = 0; i < pages.length; i++) {
- Element pageElement = pages[i];
- if (pageElement.getAttribute(AbstractIntroIdElement.ATT_ID).equals(
- getId())) {
- this.element = pageElement;
- // call init on the new element. the filtering and the style-id
- // are loaded by the parent class.
- init(pageElement, getBundle(), base);
- // INTRO: revisit. Special processing here should be made more
- // general. we know id is correct.
- style_id = getAttribute(element,
- AbstractBaseIntroElement.ATT_STYLE_ID);
- filteredFrom = getAttribute(element,
- AbstractBaseIntroElement.ATT_FILTERED_FROM);
- sharedStyle = getAttribute(element, ATT_SHARED_STYLE);
- if (sharedStyle == null)
- sharedStyle = "true"; //$NON-NLS-1$
- foundMatchingPage = true;
- }
- }
- if (foundMatchingPage)
- // now do children loading as usual.
- super.loadChildren();
- else {
- // page was not found in content file. Perform load actions, and log
- // fact. init the children vector.
+ if (content == null) {
+ // no content. do regular loading.
+ super.loadChildren();
+ return;
+ }
+
+ // content attribute is defined. It either points to an XHTML file, or
+ // an introContent.xml file. Process each case. Assume it is an
+ // introContent file.
+ // INTRO: XHTML file is loaded needlessly when we have XHTML content and
+ // SWT presentation.
+ IntroContentParser parser = new IntroContentParser(content);
+ Document dom = parser.getDocument();
+ if (dom == null) {
+ // bad xml. This could be bad XHTML or bad intro XML. Parser would
+ // have logged fact. Load dom for invalid page, and make sure to
+ // force an extract on parent folder to enabling jarring.
+ Bundle introBundle = Platform.getBundle(IIntroConstants.PLUGIN_ID);
+ ModelUtil.ensureFileURLsExist(introBundle, INVALID_CONTENT);
+
+ String invalidContentFilePath = BundleUtil
+ .getResolvedResourceLocation(INVALID_CONTENT, introBundle);
+ parser = new IntroContentParser(invalidContentFilePath);
+ dom = parser.getDocument();
+ // make sure to override all attributes to resolve the Invalid
+ // Page page correctly.
+ content = invalidContentFilePath;
+ this.base = INVALID_CONTENT_BASE;
+ setBundle(introBundle);
+ }
+
+ // parse content depending on type. Make sure to set the loaded flag
+ // accordingly, otherwise content file will always be parsed.
+ if (parser.hasXHTMLContent()) {
+ loadXHTMLContent(dom);
+ // make sure to use correct base.
+ init(element, getBundle(), initialBase);
+ super.loadChildren();
+ } else
+ // load the first page with correct id, from content xml file.
+ loadXMLContent(dom);
+ }
+
+ /**
+ * Load the xml content from the introContent.xml file pointed to by the
+ * content attribute, and loaded into the passed DOM. Load the first page
+ * with correct id from this content file.
+ *
+ * @param dom
+ */
+ private void loadXMLContent(Document dom) {
+ Element[] pages = ModelUtil.getElementsByTagName(dom,
+ AbstractIntroPage.TAG_PAGE);
+ if (pages.length == 0) {
+ Log.warning("Content file has no pages."); //$NON-NLS-1$
+ return;
+ }
+ // point the element of this page to the new element. Pick first page
+ // with matching id. Make sure to disable loading of children of current
+ // element if a matching page in the external content file is not found.
+ boolean foundMatchingPage = false;
+ for (int i = 0; i < pages.length; i++) {
+ Element pageElement = pages[i];
+ if (pageElement.getAttribute(AbstractIntroIdElement.ATT_ID).equals(
+ getId())) {
+ this.element = pageElement;
+ // call init on the new element. the filtering and the style-id
+ // are loaded by the parent class.
+ init(pageElement, getBundle(), base);
+ // INTRO: revisit. Special processing here should be made more
+ // general. we know id is correct.
+ style_id = getAttribute(element,
+ AbstractBaseIntroElement.ATT_STYLE_ID);
+ filteredFrom = getAttribute(element,
+ AbstractBaseIntroElement.ATT_FILTERED_FROM);
+ sharedStyle = getAttribute(element, ATT_SHARED_STYLE);
+ if (sharedStyle == null)
+ sharedStyle = "true"; //$NON-NLS-1$
+ foundMatchingPage = true;
+ }
+ }
+ if (foundMatchingPage)
+ // now do children loading as usual.
+ super.loadChildren();
+ else {
+ // page was not found in content file. Perform load actions, and log
+ // fact. init the children vector.
children = new Vector<>();
- loaded = true;
- // free DOM model for memory performance.
- element = null;
- Log.warning("Content file does not have page with id= " + getId()); //$NON-NLS-1$
- }
- }
-
- private void loadXHTMLContent(Document dom) {
- // no need to load any children since we use XSLT to print XHTML
- // content. Simply cache DOM.
- this.dom = dom;
- this.isXHTMLPage = true;
- // init empty children vector.
+ loaded = true;
+ // free DOM model for memory performance.
+ element = null;
+ Log.warning("Content file does not have page with id= " + getId()); //$NON-NLS-1$
+ }
+ }
+
+ private void loadXHTMLContent(Document dom) {
+ // no need to load any children since we use XSLT to print XHTML
+ // content. Simply cache DOM.
+ this.dom = dom;
+ this.isXHTMLPage = true;
+ // init empty children vector.
children = new Vector<>();
- loaded = true;
- }
-
- /**
- * Returns the DOM representing an external XHTML file. May return null if
- * extension content is 3.0 format. The page is resolved before returning,
- * meaning includes are resolved, and the base of the page is defined.
- *
- * @return
- */
- public Document getResolvedDocument() {
- // we need to force a getChildren to resolve the page.
- getChildren();
- return dom;
- }
-
-
- /**
- * Returns the DOM representing an external XHTML file. May return null if
- * extension content is 3.0 format. The page is NOT resolved before
- * returning. It is retruned as given by the dom parser.
- *
- * @return
- */
- public Document getDocument() {
- // we only need to load children here.
- if (!loaded)
- loadChildren();
- return dom;
- }
-
-
- /**
- * Returns whether or not we have an XHTML page as the content for this
- * page. The XHTML page is defined through the content attribute. This
- * method forces the content file to be parsed and loaded in memory.
- *
- * @return
- */
- public boolean isXHTMLPage() {
- // we need to force loading of children since we need to determine
- // content type. Load the children without resolving (for performance),
- // this will set the XHTML flag at the page level.
- if (!loaded)
- loadChildren();
- return isXHTMLPage;
- }
-
-
- /**
- * Deep searches all children in this container's DOM for the first child
- * with the given id. The element retrieved must have the passed local name.
- * Note that in an XHTML file (aka DOM) elements should have a unique id
- * within the scope of a document. We use local name because this allows for
- * finding intro anchors, includes and dynamic content element regardless of
- * whether or not an xmlns was used in the xml. note: could not have used
- * inheritance from parent container because return type for parent is intro
- * legacy model.
- *
- */
- public Element findDomChild(String id, String localElementName) {
- if (!loaded)
- loadChildren();
- // using getElementById is tricky and we need to have intro XHTML
- // modules to properly use this method.
- return ModelUtil.getElementById(dom, id, localElementName);
- }
-
- /**
- * Search for any element with the given id.
- *
- * @param id
- * @return
- */
- public Element findDomChild(String id) {
- return findDomChild(id, "*"); //$NON-NLS-1$
-
- }
-
-
-
- /**
- * Resolves the full page. It is called just before the page needs to be
- * displayed.
- * <li>adds a BASE child to the DOM HEAD element, if one is not defined.
- * All intro documents must have a base defined to resolve all urls.</li>
- * <li>resolves all includes in the page. This means importing target DOM.
- * </li>
- * <li>resolves all XHTML attributes for resources, eg: src, href
- * attributes.</li>
- */
- protected void resolvePage() {
- // insert base meta-tag,
- ModelUtil.insertBase(dom, ModelUtil.getParentFolderOSString(content));
-
- // resolve all relative resources relative to content file. Do it before
- // inserting shared style to enable comparing fully qualified styles.
- ModelUtil.updateResourceAttributes(dom.getDocumentElement(), this);
-
- // now add shared style.
- IntroModelRoot modelRoot = (IntroModelRoot)getParent();
- IntroPartPresentation presentation = modelRoot.getPresentation();
- String [] styles = presentation!=null?presentation.getImplementationStyles():null;
- if (styles != null && injectSharedStyle()) {
- for (int i=0; i<styles.length; i++)
- ModelUtil.insertStyle(dom, styles[i]);
- }
-
- // filter the content
- if (domProcessor == null) {
- domProcessor = new DocumentProcessor(new ProcessorHandler[] { new FilterHandler(IntroEvaluationContext.getContext()) });
- }
- UAElement element = UAElementFactory.newElement(dom.getDocumentElement());
- domProcessor.process(element, null);
-
- // and resolve includes.
- resolveIncludes();
-
- // now remove all anchors from this page.
- ModelUtil.removeAllElements(dom, IntroAnchor.TAG_ANCHOR);
- resolved = true;
- }
-
- /**
- * Resolves all includes in this page. This means importing the DOM of the
- * target path into the current page DOM, and resolving XHTML attributes for
- * resources.
- */
- protected void resolveIncludes() {
- // get all includes elements in DOM.
- NodeList includes = dom.getElementsByTagNameNS("*", //$NON-NLS-1$
- IntroInclude.TAG_INCLUDE);
- // get the array version of the include nodelist to work around
- // replaceChild() DOM api design.
- Node[] nodes = ModelUtil.getArray(includes);
- for (int i = 0; i < nodes.length; i++) {
- Element includeElement = (Element) nodes[i];
- IntroInclude include = new IntroInclude(includeElement, getBundle());
- // result[0] is target parent page, result[1] is target element.
- Object[] results = findDOMIncludeTarget(include);
- Element targetElement = (Element) results[1];
- if (targetElement == null) {
- String message = "Could not resolve following include: " //$NON-NLS-1$
- + ModelLoaderUtil.getLogString(getBundle(),
- includeElement, IntroInclude.ATT_PATH);
- Log.warning(message);
- return;
- }
-
- // insert the target element instead of the include.
- Node targetNode = dom.importNode(targetElement, true);
- // update the src attribute of this node, if defined by w3
- // specs.
- AbstractIntroPage page = ((AbstractIntroPage) results[0]);
- ModelUtil.updateResourceAttributes((Element) targetNode, page);
- // use of replace API to remove include element is tricky. It
- // confuses the NodeList used in the loop above. Removing an include
- // removes it from the NodeList. Used cloned Array instead.
- includeElement.getParentNode().replaceChild(targetNode,
- includeElement);
- }
- }
-
-
- /**
- * Find the target Element pointed to by the path in the include. It is
- * assumed that configId always points to an external config, and not the
- * same config of the inlcude.
- *
- * @param include
- * @param path
- * @return
- */
- private Object[] findDOMIncludeTarget(IntroInclude include) {
- String path = include.getPath();
- IntroModelRoot targetModelRoot = (IntroModelRoot) getParentPage()
- .getParent();
- String targetConfigID = include.getConfigId();
- if (targetConfigID != null)
- targetModelRoot = ExtensionPointManager.getInst().getModel(
- targetConfigID);
- if (targetModelRoot == null)
- // if the target config was not found, skip this include.
- return null;
- return findDOMTarget(targetModelRoot, path);
-
- }
-
-
-
- /**
- * Finds the child element that corresponds to the given path in the passed
- * model.
- *
- * @param model
- * model containing target path.
- * @param path
- * the path to look for
- * @param results
- * two object array that will return the target intro page as the
- * first result, and the actual target DOM Element as the second
- * result. It is gauranteed to not be null. Content may be null.
- * @return target DOM element
- */
- public Object[] findDOMTarget(IntroModelRoot model, String path) {
- Object[] results = new Object[2];
- // path must be pageId/anchorID in the case of of XHTML pages.
- // pages.
- String[] pathSegments = path.split("/"); //$NON-NLS-1$
- if (pathSegments.length != 2)
- // path does not have correct format. Return empty results.
- return results;
-
- // save to cast.
- AbstractIntroPage targetPage = (AbstractIntroPage) model.findChild(
- pathSegments[0], ABSTRACT_PAGE);
-
- if (targetPage != null) {
- results[0] = targetPage;
- Element targetElement = targetPage.findDomChild(pathSegments[1]);
- if (targetElement != null)
- results[1] = targetElement;
- }
- return results;
- }
-
-
- /**
- * @return Returns the content.
- */
- public String getContent() {
- return content;
- }
-
-
-
- /**
- * Deep copy since class has mutable objects.
- */
- @Override
+ loaded = true;
+ }
+
+ /**
+ * Returns the DOM representing an external XHTML file. May return null if
+ * extension content is 3.0 format. The page is resolved before returning,
+ * meaning includes are resolved, and the base of the page is defined.
+ *
+ * @return
+ */
+ public Document getResolvedDocument() {
+ // we need to force a getChildren to resolve the page.
+ getChildren();
+ return dom;
+ }
+
+
+ /**
+ * Returns the DOM representing an external XHTML file. May return null if
+ * extension content is 3.0 format. The page is NOT resolved before
+ * returning. It is retruned as given by the dom parser.
+ *
+ * @return
+ */
+ public Document getDocument() {
+ // we only need to load children here.
+ if (!loaded)
+ loadChildren();
+ return dom;
+ }
+
+
+ /**
+ * Returns whether or not we have an XHTML page as the content for this
+ * page. The XHTML page is defined through the content attribute. This
+ * method forces the content file to be parsed and loaded in memory.
+ *
+ * @return
+ */
+ public boolean isXHTMLPage() {
+ // we need to force loading of children since we need to determine
+ // content type. Load the children without resolving (for performance),
+ // this will set the XHTML flag at the page level.
+ if (!loaded)
+ loadChildren();
+ return isXHTMLPage;
+ }
+
+
+ /**
+ * Deep searches all children in this container's DOM for the first child
+ * with the given id. The element retrieved must have the passed local name.
+ * Note that in an XHTML file (aka DOM) elements should have a unique id
+ * within the scope of a document. We use local name because this allows for
+ * finding intro anchors, includes and dynamic content element regardless of
+ * whether or not an xmlns was used in the xml. note: could not have used
+ * inheritance from parent container because return type for parent is intro
+ * legacy model.
+ *
+ */
+ public Element findDomChild(String id, String localElementName) {
+ if (!loaded)
+ loadChildren();
+ // using getElementById is tricky and we need to have intro XHTML
+ // modules to properly use this method.
+ return ModelUtil.getElementById(dom, id, localElementName);
+ }
+
+ /**
+ * Search for any element with the given id.
+ *
+ * @param id
+ * @return
+ */
+ public Element findDomChild(String id) {
+ return findDomChild(id, "*"); //$NON-NLS-1$
+
+ }
+
+
+
+ /**
+ * Resolves the full page. It is called just before the page needs to be
+ * displayed.
+ * <li>adds a BASE child to the DOM HEAD element, if one is not defined.
+ * All intro documents must have a base defined to resolve all urls.</li>
+ * <li>resolves all includes in the page. This means importing target DOM.
+ * </li>
+ * <li>resolves all XHTML attributes for resources, eg: src, href
+ * attributes.</li>
+ */
+ protected void resolvePage() {
+ // insert base meta-tag,
+ ModelUtil.insertBase(dom, ModelUtil.getParentFolderOSString(content));
+
+ // resolve all relative resources relative to content file. Do it before
+ // inserting shared style to enable comparing fully qualified styles.
+ ModelUtil.updateResourceAttributes(dom.getDocumentElement(), this);
+
+ // now add shared style.
+ IntroModelRoot modelRoot = (IntroModelRoot)getParent();
+ IntroPartPresentation presentation = modelRoot.getPresentation();
+ String [] styles = presentation!=null?presentation.getImplementationStyles():null;
+ if (styles != null && injectSharedStyle()) {
+ for (int i=0; i<styles.length; i++)
+ ModelUtil.insertStyle(dom, styles[i]);
+ }
+
+ // filter the content
+ if (domProcessor == null) {
+ domProcessor = new DocumentProcessor(new ProcessorHandler[] { new FilterHandler(IntroEvaluationContext.getContext()) });
+ }
+ UAElement element = UAElementFactory.newElement(dom.getDocumentElement());
+ domProcessor.process(element, null);
+
+ // and resolve includes.
+ resolveIncludes();
+
+ // now remove all anchors from this page.
+ ModelUtil.removeAllElements(dom, IntroAnchor.TAG_ANCHOR);
+ resolved = true;
+ }
+
+ /**
+ * Resolves all includes in this page. This means importing the DOM of the
+ * target path into the current page DOM, and resolving XHTML attributes for
+ * resources.
+ */
+ protected void resolveIncludes() {
+ // get all includes elements in DOM.
+ NodeList includes = dom.getElementsByTagNameNS("*", //$NON-NLS-1$
+ IntroInclude.TAG_INCLUDE);
+ // get the array version of the include nodelist to work around
+ // replaceChild() DOM api design.
+ Node[] nodes = ModelUtil.getArray(includes);
+ for (int i = 0; i < nodes.length; i++) {
+ Element includeElement = (Element) nodes[i];
+ IntroInclude include = new IntroInclude(includeElement, getBundle());
+ // result[0] is target parent page, result[1] is target element.
+ Object[] results = findDOMIncludeTarget(include);
+ Element targetElement = (Element) results[1];
+ if (targetElement == null) {
+ String message = "Could not resolve following include: " //$NON-NLS-1$
+ + ModelLoaderUtil.getLogString(getBundle(),
+ includeElement, IntroInclude.ATT_PATH);
+ Log.warning(message);
+ return;
+ }
+
+ // insert the target element instead of the include.
+ Node targetNode = dom.importNode(targetElement, true);
+ // update the src attribute of this node, if defined by w3
+ // specs.
+ AbstractIntroPage page = ((AbstractIntroPage) results[0]);
+ ModelUtil.updateResourceAttributes((Element) targetNode, page);
+ // use of replace API to remove include element is tricky. It
+ // confuses the NodeList used in the loop above. Removing an include
+ // removes it from the NodeList. Used cloned Array instead.
+ includeElement.getParentNode().replaceChild(targetNode,
+ includeElement);
+ }
+ }
+
+
+ /**
+ * Find the target Element pointed to by the path in the include. It is
+ * assumed that configId always points to an external config, and not the
+ * same config of the inlcude.
+ *
+ * @param include
+ * @param path
+ * @return
+ */
+ private Object[] findDOMIncludeTarget(IntroInclude include) {
+ String path = include.getPath();
+ IntroModelRoot targetModelRoot = (IntroModelRoot) getParentPage()
+ .getParent();
+ String targetConfigID = include.getConfigId();
+ if (targetConfigID != null)
+ targetModelRoot = ExtensionPointManager.getInst().getModel(
+ targetConfigID);
+ if (targetModelRoot == null)
+ // if the target config was not found, skip this include.
+ return null;
+ return findDOMTarget(targetModelRoot, path);
+
+ }
+
+
+
+ /**
+ * Finds the child element that corresponds to the given path in the passed
+ * model.
+ *
+ * @param model
+ * model containing target path.
+ * @param path
+ * the path to look for
+ * @param results
+ * two object array that will return the target intro page as the
+ * first result, and the actual target DOM Element as the second
+ * result. It is gauranteed to not be null. Content may be null.
+ * @return target DOM element
+ */
+ public Object[] findDOMTarget(IntroModelRoot model, String path) {
+ Object[] results = new Object[2];
+ // path must be pageId/anchorID in the case of of XHTML pages.
+ // pages.
+ String[] pathSegments = path.split("/"); //$NON-NLS-1$
+ if (pathSegments.length != 2)
+ // path does not have correct format. Return empty results.
+ return results;
+
+ // save to cast.
+ AbstractIntroPage targetPage = (AbstractIntroPage) model.findChild(
+ pathSegments[0], ABSTRACT_PAGE);
+
+ if (targetPage != null) {
+ results[0] = targetPage;
+ Element targetElement = targetPage.findDomChild(pathSegments[1]);
+ if (targetElement != null)
+ results[1] = targetElement;
+ }
+ return results;
+ }
+
+
+ /**
+ * @return Returns the content.
+ */
+ public String getContent() {
+ return content;
+ }
+
+
+
+ /**
+ * Deep copy since class has mutable objects.
+ */
+ @Override
public Object clone() throws CloneNotSupportedException {
- AbstractIntroPage clone = (AbstractIntroPage) super.clone();
- if (title != null) {
- IntroPageTitle clonedTitle = (IntroPageTitle) title.clone();
- clonedTitle.setParent(clone);
- clone.title = clonedTitle;
- }
- // styles are safe for a shallow copy.
- if (styles != null)
+ AbstractIntroPage clone = (AbstractIntroPage) super.clone();
+ if (title != null) {
+ IntroPageTitle clonedTitle = (IntroPageTitle) title.clone();
+ clonedTitle.setParent(clone);
+ clone.title = clonedTitle;
+ }
+ // styles are safe for a shallow copy.
+ if (styles != null)
clone.styles = new Vector<>(styles);
- if (altStyles != null)
+ if (altStyles != null)
clone.altStyles = new Hashtable<>(altStyles);
- return clone;
- }
-
- /**
- * Used when cloning pages to assign a unique id. Cache original id before
- * setting.
- *
- * @param id
- */
- public void setId(String id) {
- this.originalId = this.id;
- this.id = id;
- }
-
- /*
- * Creates an IFrame and injects it as the only child of the specified path.
- */
- public boolean injectIFrame(String url, String embedTarget) {
- // embed url as IFrame in target div. We need to find target div in
- // this cloned page not in the original page.
- IntroGroup divToReplace = (IntroGroup) findTarget(embedTarget);
- if (divToReplace == null) {
- // we failed to find embed div, log and exit.
- Log.warning("Failed to find embedTarget: " + embedTarget //$NON-NLS-1$
- + " in page " + getId()); //$NON-NLS-1$
- return false;
- }
-
- this.iframe = new IntroInjectedIFrame(getElement(), getBundle());
- this.iframe.setParent(divToReplace);
- this.iframe.setIFrameURL(url);
- divToReplace.clearChildren();
- divToReplace.addChild(iframe);
- return true;
- }
-
- /**
- * Return true if this page is a cloned page that has an IFrame.
- *
- * @return
- */
- public boolean isIFramePage() {
- return (iframe != null) ? true : false;
- }
-
-
- public String getUnmangledId() {
- if (isIFramePage())
- return originalId;
- return id;
- }
-
-
- /**
- * Set the url of the embedded IFrame, if this page is an IFrame page.
- *
- * @param url
- */
- public void setIFrameURL(String url) {
- if (!isIFramePage())
- return;
- this.iframe.setIFrameURL(url);
- }
-
- /**
- * Return the url of the embedded IFrame, if this page is an IFrame page.
- *
- * @param url
- */
- public String getIFrameURL() {
- if (!isIFramePage())
- return null;
- return this.iframe.getIFrameURL();
- }
-
- /**
- * Returns the raw or unprocessed base location.
- */
- public String getInitialBase() {
- return initialBase;
- }
-
- /**
- * Return the url of the embedded IFrame, if this page is an IFrame page.
- *
- * @param url
- */
- public boolean injectSharedStyle() {
- return this.sharedStyle.equals("true") ? true : false; //$NON-NLS-1$
- }
+ return clone;
+ }
+
+ /**
+ * Used when cloning pages to assign a unique id. Cache original id before
+ * setting.
+ *
+ * @param id
+ */
+ public void setId(String id) {
+ this.originalId = this.id;
+ this.id = id;
+ }
+
+ /*
+ * Creates an IFrame and injects it as the only child of the specified path.
+ */
+ public boolean injectIFrame(String url, String embedTarget) {
+ // embed url as IFrame in target div. We need to find target div in
+ // this cloned page not in the original page.
+ IntroGroup divToReplace = (IntroGroup) findTarget(embedTarget);
+ if (divToReplace == null) {
+ // we failed to find embed div, log and exit.
+ Log.warning("Failed to find embedTarget: " + embedTarget //$NON-NLS-1$
+ + " in page " + getId()); //$NON-NLS-1$
+ return false;
+ }
+
+ this.iframe = new IntroInjectedIFrame(getElement(), getBundle());
+ this.iframe.setParent(divToReplace);
+ this.iframe.setIFrameURL(url);
+ divToReplace.clearChildren();
+ divToReplace.addChild(iframe);
+ return true;
+ }
+
+ /**
+ * Return true if this page is a cloned page that has an IFrame.
+ *
+ * @return
+ */
+ public boolean isIFramePage() {
+ return (iframe != null) ? true : false;
+ }
+
+
+ public String getUnmangledId() {
+ if (isIFramePage())
+ return originalId;
+ return id;
+ }
+
+
+ /**
+ * Set the url of the embedded IFrame, if this page is an IFrame page.
+ *
+ * @param url
+ */
+ public void setIFrameURL(String url) {
+ if (!isIFramePage())
+ return;
+ this.iframe.setIFrameURL(url);
+ }
+
+ /**
+ * Return the url of the embedded IFrame, if this page is an IFrame page.
+ *
+ * @param url
+ */
+ public String getIFrameURL() {
+ if (!isIFramePage())
+ return null;
+ return this.iframe.getIFrameURL();
+ }
+
+ /**
+ * Returns the raw or unprocessed base location.
+ */
+ public String getInitialBase() {
+ return initialBase;
+ }
+
+ /**
+ * Return the url of the embedded IFrame, if this page is an IFrame page.
+ *
+ * @param url
+ */
+ public boolean injectSharedStyle() {
+ return this.sharedStyle.equals("true") ? true : false; //$NON-NLS-1$
+ }
/**
* Returns true if this is a dynamicpage or not.
* @return Returns the isDynamic.
*/
public boolean isDynamic() {
- return isDynamic;
+ return isDynamic;
}
/**
- * @return Returns the url.
- */
- public String getUrl() {
- return url;
- }
+ * @return Returns the url.
+ */
+ public String getUrl() {
+ return url;
+ }
/**
* @return Returns the isStandbyPage.
*/
public boolean isStandbyPage() {
- return isStandbyPage;
+ return isStandbyPage;
}
/**
@@ -928,7 +928,7 @@ public abstract class AbstractIntroPage extends AbstractIntroContainer {
* The isStandbyPage to set.
*/
public void setStandbyPage(boolean isStandbyPage) {
- this.isStandbyPage = isStandbyPage;
+ this.isStandbyPage = isStandbyPage;
}
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPartImplementation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPartImplementation.java
index 2341c71d1..ec5bfcc93 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPartImplementation.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractIntroPartImplementation.java
@@ -42,363 +42,363 @@ import org.eclipse.ui.intro.config.CustomizableIntroPart;
*/
public abstract class AbstractIntroPartImplementation {
- // CustomizableIntroPart instance.
- private CustomizableIntroPart introPart = null;
+ // CustomizableIntroPart instance.
+ private CustomizableIntroPart introPart = null;
- // IMemento for restoring state.
- private IMemento memento;
+ // IMemento for restoring state.
+ private IMemento memento;
- protected History history = new History();
+ protected History history = new History();
- // flag used to enable logging of perf data for full UI creation only once.
- // Since standbyStateChanged is called several times, flag is used in method
- // to filter out all subsequent calls.
- boolean logUIcreationTime = true;
+ // flag used to enable logging of perf data for full UI creation only once.
+ // Since standbyStateChanged is called several times, flag is used in method
+ // to filter out all subsequent calls.
+ boolean logUIcreationTime = true;
- // Global actions
- protected Action backAction = new Action() {
+ // Global actions
+ protected Action backAction = new Action() {
- {
- setToolTipText(Messages.Browser_backwardButton_tooltip);
- setImageDescriptor(ImageUtil
- .createImageDescriptor("full/elcl16/backward_nav.png")); //$NON-NLS-1$
- setDisabledImageDescriptor(ImageUtil
- .createImageDescriptor("full/dlcl16/backward_nav.png")); //$NON-NLS-1$
- }
+ {
+ setToolTipText(Messages.Browser_backwardButton_tooltip);
+ setImageDescriptor(ImageUtil
+ .createImageDescriptor("full/elcl16/backward_nav.png")); //$NON-NLS-1$
+ setDisabledImageDescriptor(ImageUtil
+ .createImageDescriptor("full/dlcl16/backward_nav.png")); //$NON-NLS-1$
+ }
- @Override
+ @Override
public void run() {
- navigateBackward();
- }
- };
+ navigateBackward();
+ }
+ };
- protected Action forwardAction = new Action() {
+ protected Action forwardAction = new Action() {
- {
- setToolTipText(Messages.Browser_forwardButton_tooltip);
- setImageDescriptor(ImageUtil
- .createImageDescriptor("full/elcl16/forward_nav.png")); //$NON-NLS-1$
- setDisabledImageDescriptor(ImageUtil
- .createImageDescriptor("full/dlcl16/forward_nav.png")); //$NON-NLS-1$
- }
+ {
+ setToolTipText(Messages.Browser_forwardButton_tooltip);
+ setImageDescriptor(ImageUtil
+ .createImageDescriptor("full/elcl16/forward_nav.png")); //$NON-NLS-1$
+ setDisabledImageDescriptor(ImageUtil
+ .createImageDescriptor("full/dlcl16/forward_nav.png")); //$NON-NLS-1$
+ }
- @Override
+ @Override
public void run() {
- navigateForward();
- }
- };
+ navigateForward();
+ }
+ };
- protected Action homeAction = new Action() {
+ protected Action homeAction = new Action() {
- {
- setToolTipText(Messages.Browser_homeButton_tooltip);
- setImageDescriptor(ImageUtil
- .createImageDescriptor("full/elcl16/home_nav.png")); //$NON-NLS-1$
- setDisabledImageDescriptor(ImageUtil
- .createImageDescriptor("full/dlcl16/home_nav.png")); //$NON-NLS-1$
- }
+ {
+ setToolTipText(Messages.Browser_homeButton_tooltip);
+ setImageDescriptor(ImageUtil
+ .createImageDescriptor("full/elcl16/home_nav.png")); //$NON-NLS-1$
+ setDisabledImageDescriptor(ImageUtil
+ .createImageDescriptor("full/dlcl16/home_nav.png")); //$NON-NLS-1$
+ }
- @Override
+ @Override
public void run() {
- navigateHome();
- }
- };
+ navigateHome();
+ }
+ };
- protected Action viewIntroModelAction = new Action() {
+ protected Action viewIntroModelAction = new Action() {
- {
- setToolTipText(Messages.IntroPart_showContentButton_tooltip);
- setImageDescriptor(ImageUtil
- .createImageDescriptor("contents_view.png")); //$NON-NLS-1$
- }
+ {
+ setToolTipText(Messages.IntroPart_showContentButton_tooltip);
+ setImageDescriptor(ImageUtil
+ .createImageDescriptor("contents_view.png")); //$NON-NLS-1$
+ }
- @Override
+ @Override
public void run() {
- ElementTreeSelectionDialog treeViewer = new ElementTreeSelectionDialog(
- getIntroPart().getIntroSite().getShell(),
- new IntroModelLabelProvider(), new IntroModelContentProvider());
- treeViewer.setInput(getModel());
- treeViewer.open();
- }
- };
-
- /**
- * Creates the UI based on this implementation class. .
- *
- * @param parent
- */
- public abstract void createPartControl(Composite parent);
-
- /**
- * Called when the init method is called in the IIntroPart. Subclasses may
- * extend, for example to get the passed Memento. When extending, make sure
- * you include a call to super.
- *
- * @param introPart
- */
- public void init(IIntroPart introPart, IMemento memento) {
- // we know the class type to cast to.
- this.introPart = (CustomizableIntroPart) introPart;
- this.memento = memento;
- }
-
- /**
- * @return
- */
- public IntroModelRoot getModel() {
- return IntroPlugin.getDefault().getIntroModelRoot();
- }
-
- /**
- * @return Returns the introPart.
- */
- public CustomizableIntroPart getIntroPart() {
- return introPart;
- }
-
-
- /**
- * Updates the UI navigation history with either a real URL.
- *
- * @param location
- */
- public void updateHistory(String location) {
- history.updateHistory(location);
- updateNavigationActionsState();
- }
-
- /**
- * Updates the UI navigation history with a page ID.
- *
- * @param pageId
- */
- public void updateHistory(AbstractIntroPage page) {
- history.updateHistory(page);
- updateNavigationActionsState();
- }
-
-
- /**
- * Subclasses must implement to set the state of the navigation actions in
- * the toolbar.
- *
- */
- public abstract void setFocus();
-
-
- /**
- * Subclasses must implement to update the intro view actions when history
- * is updated.
- *
- */
- protected abstract void updateNavigationActionsState();
-
-
-
- public abstract boolean navigateBackward();
-
- public abstract boolean navigateForward();
-
- public abstract boolean navigateHome();
-
-
- /**
- * Called when the IntroPart is disposed. Subclasses should override to
- * dispose of resources. By default, this implementation does nothing.
- */
- public void dispose() {
- // no-op
- }
-
-
- /*
- * Add the Intro Model Viewer as an action to all implementations.
- */
- protected void addToolBarActions() {
- // Handle menus:
- IActionBars actionBars = getIntroPart().getIntroSite().getActionBars();
- IToolBarManager toolBarManager = actionBars.getToolBarManager();
- toolBarManager.add(viewIntroModelAction);
- toolBarManager.update(true);
- actionBars.updateActionBars();
- }
-
- /**
- * Called when the Intro changes state. This method should not be
- * subclassed. It adds performance logging calls. Subclasses must implement
- * doStandbyStateChanged instead.
- *
- * @param standby
- */
- public void standbyStateChanged(boolean standby, boolean isStandbyPartNeeded) {
- PerformanceStats setStandbyStateStats = null;
- long start = 0;
- if (Log.logPerformance) {
- if (logUIcreationTime && PerformanceStats.ENABLED) {
- PerformanceStats stats = PerformanceStats.getStats(
- IIntroConstants.PERF_UI_ZOOM, IIntroConstants.INTRO);
- stats.endRun();
- Util
- .logPerformanceMessage(
- "(perf stats) time spent in UI code before content is displayed (standbyStateChanged event is fired) ", //$NON-NLS-1$
- stats.getRunningTime());
- stats.reset();
- }
-
- // standby time.
- setStandbyStateStats = PerformanceStats.getStats(
- IIntroConstants.PERF_SET_STANDBY_STATE, IIntroConstants.INTRO);
- setStandbyStateStats.startRun();
- start = System.currentTimeMillis();
- }
-
-
- doStandbyStateChanged(standby, isStandbyPartNeeded);
-
- // now log performance
- if (Log.logPerformance) {
- if (PerformanceStats.ENABLED) {
- setStandbyStateStats.endRun();
- Util
- .logPerformanceMessage(
- "(perf stats) setting standby state (zooming, displaying content) took:", //$NON-NLS-1$
- +setStandbyStateStats.getRunningTime());
- setStandbyStateStats.reset();
- } else
- Util
- .logPerformanceTime(
- "setting standby state (zooming, generating content, setText() ) took:", //$NON-NLS-1$
- +start);
-
- if (logUIcreationTime) {
- if (PerformanceStats.ENABLED) {
- PerformanceStats stats = PerformanceStats.getStats(
- IIntroConstants.PERF_VIEW_CREATION_TIME,
- IIntroConstants.INTRO);
- stats.endRun();
- Util
- .logPerformanceMessage(
- "END - (perf stats): creating CustomizableIntroPart view took:", //$NON-NLS-1$
- +stats.getRunningTime());
- stats.reset();
- } else
- Util.logPerformanceTime(
- "END: creating CustomizableIntroPart view took:", //$NON-NLS-1$
- +IntroPlugin.getDefault().gettUICreationStartTime());
-
-
- // prevent further logging of UI creation time.
- logUIcreationTime = false;
- }
-
- }
- }
-
-
-
- /*
- * Subclasses must implement the actual logic for the method.
- */
- protected abstract void doStandbyStateChanged(boolean standby,
- boolean isStandbyPartNeeded);
-
-
- /**
- * Save the current state of the intro. Currently, we only store information
- * about the most recently visited intro page. In static case, the last HTML
- * page is remembered. In dynamic case, the last UI page or HTML page is
- * remembered.
- *
- * Note: This method saves the last visited intro page in a dynamic case.
- * Subclasses need to extend to get the desired behavior relavent to the
- * specific implementation. Broswer implementation needs to cache an http
- * web page, if it happens to be the last page visited.
- *
- * @param memento
- */
- public void saveState(IMemento memento) {
- saveCurrentPage(memento);
- }
-
-
- /**
- * This method saves the most recently visited dynamic intro page in the
- * memento. If a given implementation requires saving alternative
- * information (e.g., information about the most recently visited static
- * page) it should override this method.
- *
- * @param memento
- */
- protected void saveCurrentPage(IMemento memento) {
- IntroModelRoot model = getModel();
-
- if (memento == null || model == null)
- return;
- String currentPage = model.getCurrentPageId();
- if (currentPage != null && currentPage.length() > 0) {
- memento.putString(IIntroConstants.MEMENTO_CURRENT_PAGE_ATT,
- currentPage);
- }
- }
-
-
- /**
- * get the last page if it was stored in memento. This page is the last
- * visited intro page. It can be a intro page id, in the case of dynamic
- * intro. Or it can be an http in the case of static intro. It can also be
- * an http in the case of dynamic intro where the last visited page is a
- * url.
- */
- protected String getCachedCurrentPage() {
- // Check to see if the start page has been overridden because
- // content
- String newContentPage = ExtensionMap.getInstance().getStartPage();
- if (newContentPage != null) {
- return newContentPage;
- }
- IMemento memento = getMemento();
- if (memento == null) {
- String startPageId = getModel().getStartPageId();
- if (startPageId.length() > 0) {
- return startPageId;
- } else {
- return null;
- }
- }
- return memento.getString(IIntroConstants.MEMENTO_CURRENT_PAGE_ATT);
- }
-
-
- /**
- * @return Returns the memento passed on creation.
- */
- public IMemento getMemento() {
- return memento;
- }
-
- /**
- * Support dynamic awarness. Clear cached models first, then update UI by
- * delegating to implementation.
- *
- * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
- */
- public void registryChanged(IRegistryChangeEvent event) {
- history.clear();
- // give implementation a chance to react to change.
- handleRegistryChanged(event);
- }
-
- /*
- * Handle reacting to plugin registry changes. This method will only be
- * called when regitry changes pertaining to Intro extension points is
- * detected.
- */
- protected abstract void handleRegistryChanged(IRegistryChangeEvent event);
-
-
- public History getHistory() {
- return history;
- }
+ ElementTreeSelectionDialog treeViewer = new ElementTreeSelectionDialog(
+ getIntroPart().getIntroSite().getShell(),
+ new IntroModelLabelProvider(), new IntroModelContentProvider());
+ treeViewer.setInput(getModel());
+ treeViewer.open();
+ }
+ };
+
+ /**
+ * Creates the UI based on this implementation class. .
+ *
+ * @param parent
+ */
+ public abstract void createPartControl(Composite parent);
+
+ /**
+ * Called when the init method is called in the IIntroPart. Subclasses may
+ * extend, for example to get the passed Memento. When extending, make sure
+ * you include a call to super.
+ *
+ * @param introPart
+ */
+ public void init(IIntroPart introPart, IMemento memento) {
+ // we know the class type to cast to.
+ this.introPart = (CustomizableIntroPart) introPart;
+ this.memento = memento;
+ }
+
+ /**
+ * @return
+ */
+ public IntroModelRoot getModel() {
+ return IntroPlugin.getDefault().getIntroModelRoot();
+ }
+
+ /**
+ * @return Returns the introPart.
+ */
+ public CustomizableIntroPart getIntroPart() {
+ return introPart;
+ }
+
+
+ /**
+ * Updates the UI navigation history with either a real URL.
+ *
+ * @param location
+ */
+ public void updateHistory(String location) {
+ history.updateHistory(location);
+ updateNavigationActionsState();
+ }
+
+ /**
+ * Updates the UI navigation history with a page ID.
+ *
+ * @param pageId
+ */
+ public void updateHistory(AbstractIntroPage page) {
+ history.updateHistory(page);
+ updateNavigationActionsState();
+ }
+
+
+ /**
+ * Subclasses must implement to set the state of the navigation actions in
+ * the toolbar.
+ *
+ */
+ public abstract void setFocus();
+
+
+ /**
+ * Subclasses must implement to update the intro view actions when history
+ * is updated.
+ *
+ */
+ protected abstract void updateNavigationActionsState();
+
+
+
+ public abstract boolean navigateBackward();
+
+ public abstract boolean navigateForward();
+
+ public abstract boolean navigateHome();
+
+
+ /**
+ * Called when the IntroPart is disposed. Subclasses should override to
+ * dispose of resources. By default, this implementation does nothing.
+ */
+ public void dispose() {
+ // no-op
+ }
+
+
+ /*
+ * Add the Intro Model Viewer as an action to all implementations.
+ */
+ protected void addToolBarActions() {
+ // Handle menus:
+ IActionBars actionBars = getIntroPart().getIntroSite().getActionBars();
+ IToolBarManager toolBarManager = actionBars.getToolBarManager();
+ toolBarManager.add(viewIntroModelAction);
+ toolBarManager.update(true);
+ actionBars.updateActionBars();
+ }
+
+ /**
+ * Called when the Intro changes state. This method should not be
+ * subclassed. It adds performance logging calls. Subclasses must implement
+ * doStandbyStateChanged instead.
+ *
+ * @param standby
+ */
+ public void standbyStateChanged(boolean standby, boolean isStandbyPartNeeded) {
+ PerformanceStats setStandbyStateStats = null;
+ long start = 0;
+ if (Log.logPerformance) {
+ if (logUIcreationTime && PerformanceStats.ENABLED) {
+ PerformanceStats stats = PerformanceStats.getStats(
+ IIntroConstants.PERF_UI_ZOOM, IIntroConstants.INTRO);
+ stats.endRun();
+ Util
+ .logPerformanceMessage(
+ "(perf stats) time spent in UI code before content is displayed (standbyStateChanged event is fired) ", //$NON-NLS-1$
+ stats.getRunningTime());
+ stats.reset();
+ }
+
+ // standby time.
+ setStandbyStateStats = PerformanceStats.getStats(
+ IIntroConstants.PERF_SET_STANDBY_STATE, IIntroConstants.INTRO);
+ setStandbyStateStats.startRun();
+ start = System.currentTimeMillis();
+ }
+
+
+ doStandbyStateChanged(standby, isStandbyPartNeeded);
+
+ // now log performance
+ if (Log.logPerformance) {
+ if (PerformanceStats.ENABLED) {
+ setStandbyStateStats.endRun();
+ Util
+ .logPerformanceMessage(
+ "(perf stats) setting standby state (zooming, displaying content) took:", //$NON-NLS-1$
+ +setStandbyStateStats.getRunningTime());
+ setStandbyStateStats.reset();
+ } else
+ Util
+ .logPerformanceTime(
+ "setting standby state (zooming, generating content, setText() ) took:", //$NON-NLS-1$
+ +start);
+
+ if (logUIcreationTime) {
+ if (PerformanceStats.ENABLED) {
+ PerformanceStats stats = PerformanceStats.getStats(
+ IIntroConstants.PERF_VIEW_CREATION_TIME,
+ IIntroConstants.INTRO);
+ stats.endRun();
+ Util
+ .logPerformanceMessage(
+ "END - (perf stats): creating CustomizableIntroPart view took:", //$NON-NLS-1$
+ +stats.getRunningTime());
+ stats.reset();
+ } else
+ Util.logPerformanceTime(
+ "END: creating CustomizableIntroPart view took:", //$NON-NLS-1$
+ +IntroPlugin.getDefault().gettUICreationStartTime());
+
+
+ // prevent further logging of UI creation time.
+ logUIcreationTime = false;
+ }
+
+ }
+ }
+
+
+
+ /*
+ * Subclasses must implement the actual logic for the method.
+ */
+ protected abstract void doStandbyStateChanged(boolean standby,
+ boolean isStandbyPartNeeded);
+
+
+ /**
+ * Save the current state of the intro. Currently, we only store information
+ * about the most recently visited intro page. In static case, the last HTML
+ * page is remembered. In dynamic case, the last UI page or HTML page is
+ * remembered.
+ *
+ * Note: This method saves the last visited intro page in a dynamic case.
+ * Subclasses need to extend to get the desired behavior relavent to the
+ * specific implementation. Broswer implementation needs to cache an http
+ * web page, if it happens to be the last page visited.
+ *
+ * @param memento
+ */
+ public void saveState(IMemento memento) {
+ saveCurrentPage(memento);
+ }
+
+
+ /**
+ * This method saves the most recently visited dynamic intro page in the
+ * memento. If a given implementation requires saving alternative
+ * information (e.g., information about the most recently visited static
+ * page) it should override this method.
+ *
+ * @param memento
+ */
+ protected void saveCurrentPage(IMemento memento) {
+ IntroModelRoot model = getModel();
+
+ if (memento == null || model == null)
+ return;
+ String currentPage = model.getCurrentPageId();
+ if (currentPage != null && currentPage.length() > 0) {
+ memento.putString(IIntroConstants.MEMENTO_CURRENT_PAGE_ATT,
+ currentPage);
+ }
+ }
+
+
+ /**
+ * get the last page if it was stored in memento. This page is the last
+ * visited intro page. It can be a intro page id, in the case of dynamic
+ * intro. Or it can be an http in the case of static intro. It can also be
+ * an http in the case of dynamic intro where the last visited page is a
+ * url.
+ */
+ protected String getCachedCurrentPage() {
+ // Check to see if the start page has been overridden because
+ // content
+ String newContentPage = ExtensionMap.getInstance().getStartPage();
+ if (newContentPage != null) {
+ return newContentPage;
+ }
+ IMemento memento = getMemento();
+ if (memento == null) {
+ String startPageId = getModel().getStartPageId();
+ if (startPageId.length() > 0) {
+ return startPageId;
+ } else {
+ return null;
+ }
+ }
+ return memento.getString(IIntroConstants.MEMENTO_CURRENT_PAGE_ATT);
+ }
+
+
+ /**
+ * @return Returns the memento passed on creation.
+ */
+ public IMemento getMemento() {
+ return memento;
+ }
+
+ /**
+ * Support dynamic awarness. Clear cached models first, then update UI by
+ * delegating to implementation.
+ *
+ * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
+ */
+ public void registryChanged(IRegistryChangeEvent event) {
+ history.clear();
+ // give implementation a chance to react to change.
+ handleRegistryChanged(event);
+ }
+
+ /*
+ * Handle reacting to plugin registry changes. This method will only be
+ * called when regitry changes pertaining to Intro extension points is
+ * detected.
+ */
+ protected abstract void handleRegistryChanged(IRegistryChangeEvent event);
+
+
+ public History getHistory() {
+ return history;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractTextElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractTextElement.java
index df4aed866..f1ccb8977 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractTextElement.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/AbstractTextElement.java
@@ -24,37 +24,37 @@ import org.w3c.dom.Element;
*/
public abstract class AbstractTextElement extends AbstractIntroContainer {
- AbstractTextElement(Element element, Bundle bundle) {
- super(element, bundle);
- }
+ AbstractTextElement(Element element, Bundle bundle) {
+ super(element, bundle);
+ }
- /**
- * Retruns the intro text element embedded in this element.
- */
- public IntroText getIntroText() {
- AbstractIntroElement[] children = getChildren();
- for (int i=0;i<children.length;++i) {
- if (children[i] instanceof IntroText) {
- return (IntroText)children[i];
- }
- }
- return null;
- }
+ /**
+ * Retruns the intro text element embedded in this element.
+ */
+ public IntroText getIntroText() {
+ AbstractIntroElement[] children = getChildren();
+ for (int i=0;i<children.length;++i) {
+ if (children[i] instanceof IntroText) {
+ return (IntroText)children[i];
+ }
+ }
+ return null;
+ }
- /**
- * @return Returns the text of the child text of this element.
- */
- public String getText() {
- // intro text may be null if there is no child Text element.
- IntroText text = getIntroText();
- if (text != null) {
- return text.getText();
- }
- return null;
- }
+ /**
+ * @return Returns the text of the child text of this element.
+ */
+ public String getText() {
+ // intro text may be null if there is no child Text element.
+ IntroText text = getIntroText();
+ if (text != null) {
+ return text.getText();
+ }
+ return null;
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.ABSTRACT_TEXT;
- }
+ return AbstractIntroElement.ABSTRACT_TEXT;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/ExtensionMap.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/ExtensionMap.java
index 7b9135298..acc8123d3 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/ExtensionMap.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/ExtensionMap.java
@@ -51,7 +51,7 @@ public class ExtensionMap {
*/
public void putPluginId(String anchorId, String pluginId) {
if (anchorId != null) {
- extensions.put(anchorId, pluginId);
+ extensions.put(anchorId, pluginId);
}
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/History.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/History.java
index 4ac06576f..f02839a9d 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/History.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/History.java
@@ -22,250 +22,250 @@ import org.eclipse.ui.internal.intro.impl.model.url.IntroURLParser;
* Intro History Model.
*/
public class History {
- // History of Intro Pages and real URL visited by Intro Browser. All
- // elements are all of type HistoryObject.
+ // History of Intro Pages and real URL visited by Intro Browser. All
+ // elements are all of type HistoryObject.
private Vector<HistoryObject> history = new Vector<>();
- private int navigationLocation = 0;
-
-
- // Model class for history objects. A history object may be a url or an
- // Intro page. A url is a regular URL navigated to from a fully qualified
- // link. An intro page may be an IFrame page. IFrame pages are not created
- // for every Help topic navigated in an embedded IFrame. Instead the same
- // IFrame is stored in history as a different object with the IFrameURL set.
- // This way the model actually creates one page for every embedded Help
- // Topic target but the navigation history updates the IFrame accordingly.
- class HistoryObject {
- AbstractIntroPage page;
- String iframeUrl;
- String url;
-
- HistoryObject(Object location) {
- if (location instanceof String)
- this.url = (String) location;
-
- if (location instanceof AbstractIntroPage) {
- this.page = (AbstractIntroPage) location;
- // will be set to null if the page is not an IFrame page.
- this.iframeUrl = this.page.getIFrameURL();
- }
- }
-
- /**
- * returns the history page. If iframe page, updated to correct url.
- *
- * @return
- */
- AbstractIntroPage getPage() {
- if (page.isIFramePage())
- // when page was stored, the IFrame url was also stored. Make
- // sure to return the same state. The page is the same, only the
- // IFrame url changes.
- page.setIFrameURL(getIFrameUrl());
- return page;
- }
-
- String getPageId() {
- return page.getId();
- }
-
- String getIFrameUrl() {
- return iframeUrl;
- }
-
- String getUrl() {
- return url;
- }
-
- boolean isURL() {
- return (url != null) ? true : false;
- }
-
- boolean isIntroPage() {
- return (page != null) ? true : false;
- }
-
- boolean isIFramePage() {
- return (iframeUrl != null) ? true : false;
- }
-
- }
-
-
- /**
- * Updates the UI navigation history with either a real URL, or a page ID.
- *
- * @param pageId
- */
- public void updateHistory(String location) {
- // quick exit.
- if (!history.isEmpty() && isSameLocation(location))
- // resetting the same location is useless.
- return;
- doUpdateHistory(location);
- }
-
- /**
- * Updates the UI navigation history with either a real URL, or a page ID.
- *
- * @param page
- */
- public void updateHistory(AbstractIntroPage page) {
- // quick exit.
- if (!history.isEmpty() && isSameLocation(page))
- // resetting the same location is useless.
- return;
- doUpdateHistory(page);
- }
-
- private void doUpdateHistory(Object location) {
- // we got here due to an intro URL listener or an SWT Form hyperlink
- // listener. location may be a url or an IntroPage.
- if (navigationLocation == getHistoryEndPosition())
- // we are at the end of the vector, just push.
- pushToHistory(location);
- else
- // we already navigated. add item at current location, and clear
- // rest of history. (Same as browser behavior.)
- trimHistory(location);
- }
-
-
- private boolean isSameLocation(Object location) {
- HistoryObject currentLocation = getCurrentLocation();
- if (location instanceof String && currentLocation.isURL())
- return currentLocation.getUrl().equals(location);
-
- if (location instanceof AbstractIntroPage
- && currentLocation.isIntroPage()) {
-
- AbstractIntroPage locationPage = (AbstractIntroPage) location;
- // be carefull here with calling getPage on historyOvject.
- if (!currentLocation.getPageId().equals(locationPage.getId()))
- return false;
-
- // both pages have same ids, they are either both regular pages or
- // both are Iframe pages. check if they have the same IFrame urls
- if (currentLocation.isIFramePage() && locationPage.isIFramePage())
- return currentLocation.getIFrameUrl().equals(
- locationPage.getIFrameURL());
-
- // both pages are not IFrame pages, and they have same id.
- return true;
- }
-
- return false;
- }
-
-
-
-
- private void pushToHistory(Object location) {
- history.add(new HistoryObject(location));
- // point the nav location to the end of the vector.
- navigationLocation = getHistoryEndPosition();
- }
-
- public void removeLastHistory() {
- history.remove(getHistoryEndPosition());
- // point the nav location to the end of the vector.
- navigationLocation = getHistoryEndPosition();
- }
-
- private void trimHistory(Object location) {
+ private int navigationLocation = 0;
+
+
+ // Model class for history objects. A history object may be a url or an
+ // Intro page. A url is a regular URL navigated to from a fully qualified
+ // link. An intro page may be an IFrame page. IFrame pages are not created
+ // for every Help topic navigated in an embedded IFrame. Instead the same
+ // IFrame is stored in history as a different object with the IFrameURL set.
+ // This way the model actually creates one page for every embedded Help
+ // Topic target but the navigation history updates the IFrame accordingly.
+ class HistoryObject {
+ AbstractIntroPage page;
+ String iframeUrl;
+ String url;
+
+ HistoryObject(Object location) {
+ if (location instanceof String)
+ this.url = (String) location;
+
+ if (location instanceof AbstractIntroPage) {
+ this.page = (AbstractIntroPage) location;
+ // will be set to null if the page is not an IFrame page.
+ this.iframeUrl = this.page.getIFrameURL();
+ }
+ }
+
+ /**
+ * returns the history page. If iframe page, updated to correct url.
+ *
+ * @return
+ */
+ AbstractIntroPage getPage() {
+ if (page.isIFramePage())
+ // when page was stored, the IFrame url was also stored. Make
+ // sure to return the same state. The page is the same, only the
+ // IFrame url changes.
+ page.setIFrameURL(getIFrameUrl());
+ return page;
+ }
+
+ String getPageId() {
+ return page.getId();
+ }
+
+ String getIFrameUrl() {
+ return iframeUrl;
+ }
+
+ String getUrl() {
+ return url;
+ }
+
+ boolean isURL() {
+ return (url != null) ? true : false;
+ }
+
+ boolean isIntroPage() {
+ return (page != null) ? true : false;
+ }
+
+ boolean isIFramePage() {
+ return (iframeUrl != null) ? true : false;
+ }
+
+ }
+
+
+ /**
+ * Updates the UI navigation history with either a real URL, or a page ID.
+ *
+ * @param pageId
+ */
+ public void updateHistory(String location) {
+ // quick exit.
+ if (!history.isEmpty() && isSameLocation(location))
+ // resetting the same location is useless.
+ return;
+ doUpdateHistory(location);
+ }
+
+ /**
+ * Updates the UI navigation history with either a real URL, or a page ID.
+ *
+ * @param page
+ */
+ public void updateHistory(AbstractIntroPage page) {
+ // quick exit.
+ if (!history.isEmpty() && isSameLocation(page))
+ // resetting the same location is useless.
+ return;
+ doUpdateHistory(page);
+ }
+
+ private void doUpdateHistory(Object location) {
+ // we got here due to an intro URL listener or an SWT Form hyperlink
+ // listener. location may be a url or an IntroPage.
+ if (navigationLocation == getHistoryEndPosition())
+ // we are at the end of the vector, just push.
+ pushToHistory(location);
+ else
+ // we already navigated. add item at current location, and clear
+ // rest of history. (Same as browser behavior.)
+ trimHistory(location);
+ }
+
+
+ private boolean isSameLocation(Object location) {
+ HistoryObject currentLocation = getCurrentLocation();
+ if (location instanceof String && currentLocation.isURL())
+ return currentLocation.getUrl().equals(location);
+
+ if (location instanceof AbstractIntroPage
+ && currentLocation.isIntroPage()) {
+
+ AbstractIntroPage locationPage = (AbstractIntroPage) location;
+ // be carefull here with calling getPage on historyOvject.
+ if (!currentLocation.getPageId().equals(locationPage.getId()))
+ return false;
+
+ // both pages have same ids, they are either both regular pages or
+ // both are Iframe pages. check if they have the same IFrame urls
+ if (currentLocation.isIFramePage() && locationPage.isIFramePage())
+ return currentLocation.getIFrameUrl().equals(
+ locationPage.getIFrameURL());
+
+ // both pages are not IFrame pages, and they have same id.
+ return true;
+ }
+
+ return false;
+ }
+
+
+
+
+ private void pushToHistory(Object location) {
+ history.add(new HistoryObject(location));
+ // point the nav location to the end of the vector.
+ navigationLocation = getHistoryEndPosition();
+ }
+
+ public void removeLastHistory() {
+ history.remove(getHistoryEndPosition());
+ // point the nav location to the end of the vector.
+ navigationLocation = getHistoryEndPosition();
+ }
+
+ private void trimHistory(Object location) {
List<HistoryObject> newHistory = history.subList(0, navigationLocation + 1);
history = new Vector<>(newHistory);
- history.add(new HistoryObject(location));
- // point the nav location to the end of the vector.
- navigationLocation = getHistoryEndPosition();
- }
-
- /**
- * Return the position of the last element in the navigation history. If
- * vector is empty, return 0.
- *
- * @param vector
- * @return
- */
- private int getHistoryEndPosition() {
- if (history.isEmpty())
- return 0;
- return history.size() - 1;
- }
-
- public void navigateHistoryBackward() {
- if (badNavigationLocation(navigationLocation - 1))
- // do nothing. We are at the begining.
- return;
- --navigationLocation;
- }
-
- /**
- * Navigate forward in the history.
- *
- * @return
- */
- public void navigateHistoryForward() {
- if (badNavigationLocation(navigationLocation + 1))
- // do nothing. We are at the begining.
- return;
- ++navigationLocation;
- }
-
-
- private boolean badNavigationLocation(int navigationLocation) {
- if (navigationLocation < 0 || navigationLocation >= history.size())
- // bad nav location.
- return true;
- return false;
- }
-
-
- /**
- * Returns true if the current location in the navigation history represents
- * a URL. False if the location is an Intro Page id.
- *
- * @return Returns the locationIsURL.
- */
- private HistoryObject getCurrentLocation() {
- return history.elementAt(navigationLocation);
- }
-
- public boolean canNavigateForward() {
- return navigationLocation != getHistoryEndPosition() ? true : false;
- }
-
- public boolean canNavigateBackward() {
- return navigationLocation == 0 ? false : true;
- }
-
- public boolean currentLocationIsUrl() {
- if (history.size() == 0) {
- return false;
- }
- return getCurrentLocation().isURL();
- }
-
- public String getCurrentLocationAsUrl() {
- return getCurrentLocation().getUrl();
- }
-
- public AbstractIntroPage getCurrentLocationAsPage() {
- return getCurrentLocation().getPage();
- }
-
- public static boolean isURL(String aString) {
- IntroURLParser parser = new IntroURLParser(aString);
- if (parser.hasProtocol())
- return true;
- return false;
- }
-
-
- public void clear() {
- history.clear();
- navigationLocation = 0;
- }
+ history.add(new HistoryObject(location));
+ // point the nav location to the end of the vector.
+ navigationLocation = getHistoryEndPosition();
+ }
+
+ /**
+ * Return the position of the last element in the navigation history. If
+ * vector is empty, return 0.
+ *
+ * @param vector
+ * @return
+ */
+ private int getHistoryEndPosition() {
+ if (history.isEmpty())
+ return 0;
+ return history.size() - 1;
+ }
+
+ public void navigateHistoryBackward() {
+ if (badNavigationLocation(navigationLocation - 1))
+ // do nothing. We are at the begining.
+ return;
+ --navigationLocation;
+ }
+
+ /**
+ * Navigate forward in the history.
+ *
+ * @return
+ */
+ public void navigateHistoryForward() {
+ if (badNavigationLocation(navigationLocation + 1))
+ // do nothing. We are at the begining.
+ return;
+ ++navigationLocation;
+ }
+
+
+ private boolean badNavigationLocation(int navigationLocation) {
+ if (navigationLocation < 0 || navigationLocation >= history.size())
+ // bad nav location.
+ return true;
+ return false;
+ }
+
+
+ /**
+ * Returns true if the current location in the navigation history represents
+ * a URL. False if the location is an Intro Page id.
+ *
+ * @return Returns the locationIsURL.
+ */
+ private HistoryObject getCurrentLocation() {
+ return history.elementAt(navigationLocation);
+ }
+
+ public boolean canNavigateForward() {
+ return navigationLocation != getHistoryEndPosition() ? true : false;
+ }
+
+ public boolean canNavigateBackward() {
+ return navigationLocation == 0 ? false : true;
+ }
+
+ public boolean currentLocationIsUrl() {
+ if (history.size() == 0) {
+ return false;
+ }
+ return getCurrentLocation().isURL();
+ }
+
+ public String getCurrentLocationAsUrl() {
+ return getCurrentLocation().getUrl();
+ }
+
+ public AbstractIntroPage getCurrentLocationAsPage() {
+ return getCurrentLocation().getPage();
+ }
+
+ public static boolean isURL(String aString) {
+ IntroURLParser parser = new IntroURLParser(aString);
+ if (parser.hasProtocol())
+ return true;
+ return false;
+ }
+
+
+ public void clear() {
+ history.clear();
+ navigationLocation = 0;
+ }
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroAnchor.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroAnchor.java
index eb7922ade..751935aea 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroAnchor.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroAnchor.java
@@ -22,19 +22,19 @@ import org.w3c.dom.Element;
*/
public class IntroAnchor extends AbstractIntroIdElement {
- protected static final String TAG_ANCHOR = "anchor"; //$NON-NLS-1$
+ protected static final String TAG_ANCHOR = "anchor"; //$NON-NLS-1$
- /**
- * @param element
- */
- IntroAnchor(Element element, Bundle bundle) {
- super(element, bundle);
- }
+ /**
+ * @param element
+ */
+ IntroAnchor(Element element, Bundle bundle) {
+ super(element, bundle);
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.ANCHOR;
- }
+ return AbstractIntroElement.ANCHOR;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroContentProvider.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroContentProvider.java
index ed5f87d33..afdf42a95 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroContentProvider.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroContentProvider.java
@@ -29,42 +29,42 @@ import org.w3c.dom.Element;
* schema.
*/
public class IntroContentProvider extends AbstractTextElement {
- public static final String TAG_CONTENT_PROVIDER = "contentProvider"; //$NON-NLS-1$
+ public static final String TAG_CONTENT_PROVIDER = "contentProvider"; //$NON-NLS-1$
- private static final String ATT_PLUGIN_ID = "pluginId"; //$NON-NLS-1$
- private static final String ATT_CLASS = "class"; //$NON-NLS-1$
+ private static final String ATT_PLUGIN_ID = "pluginId"; //$NON-NLS-1$
+ private static final String ATT_CLASS = "class"; //$NON-NLS-1$
- private String contentProvider;
- private String pluginId;
+ private String contentProvider;
+ private String pluginId;
- public IntroContentProvider(Element element, Bundle bundle) {
- super(element, bundle);
- contentProvider = getAttribute(element, ATT_CLASS);
- pluginId = getAttribute(element, ATT_PLUGIN_ID);
- }
+ public IntroContentProvider(Element element, Bundle bundle) {
+ super(element, bundle);
+ contentProvider = getAttribute(element, ATT_CLASS);
+ pluginId = getAttribute(element, ATT_PLUGIN_ID);
+ }
- /**
- * Returns the content provider, which should implement
- * IIntroContentProvider
- *
- * @return Returns the contentProvider.
- */
- public String getClassName() {
- return contentProvider;
- }
+ /**
+ * Returns the content provider, which should implement
+ * IIntroContentProvider
+ *
+ * @return Returns the contentProvider.
+ */
+ public String getClassName() {
+ return contentProvider;
+ }
- /**
- * Returns the id of the plugin that contains the content provider class
- *
- * @return Returns the pluginId.
- */
- public String getPluginId() {
- return pluginId;
- }
+ /**
+ * Returns the id of the plugin that contains the content provider class
+ *
+ * @return Returns the pluginId.
+ */
+ public String getPluginId() {
+ return pluginId;
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.CONTENT_PROVIDER;
- }
+ return AbstractIntroElement.CONTENT_PROVIDER;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java
index 2f9c20476..7be25461f 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroExtensionContent.java
@@ -41,159 +41,159 @@ import org.w3c.dom.NodeList;
*/
public class IntroExtensionContent extends AbstractIntroElement {
- protected static final String TAG_CONTAINER_EXTENSION = "extensionContent"; //$NON-NLS-1$
- protected static final String TAG_CONTAINER_REPLACE = "replacementContent"; //$NON-NLS-1$
+ protected static final String TAG_CONTAINER_EXTENSION = "extensionContent"; //$NON-NLS-1$
+ protected static final String TAG_CONTAINER_REPLACE = "replacementContent"; //$NON-NLS-1$
- public static final int TYPE_CONTRIBUTION = 0;
- public static final int TYPE_REPLACEMENT = 1;
+ public static final int TYPE_CONTRIBUTION = 0;
+ public static final int TYPE_REPLACEMENT = 1;
- protected static final String ATT_PATH = "path"; //$NON-NLS-1$
- protected static final String ATT_ID = "id"; //$NON-NLS-1$
- private static final String ATT_STYLE = "style"; //$NON-NLS-1$
- private static final String ATT_ALT_STYLE = "alt-style"; //$NON-NLS-1$
- private static final String ATT_CONTENT = "content"; //$NON-NLS-1$
+ protected static final String ATT_PATH = "path"; //$NON-NLS-1$
+ protected static final String ATT_ID = "id"; //$NON-NLS-1$
+ private static final String ATT_STYLE = "style"; //$NON-NLS-1$
+ private static final String ATT_ALT_STYLE = "alt-style"; //$NON-NLS-1$
+ private static final String ATT_CONTENT = "content"; //$NON-NLS-1$
private static final Element[] EMPTY_ELEMENT_ARRAY = new Element[0];
- private String path;
- private String content;
- private String contentFile;
- private String contentId;
- private String anchorId;
+ private String path;
+ private String content;
+ private String contentFile;
+ private String contentId;
+ private String anchorId;
- private Element element;
- private String base;
+ private Element element;
+ private String base;
private Vector<String> styles = new Vector<>();
private Map<String, Bundle> altStyles = new HashMap<>();
- IntroExtensionContent(Element element, Bundle bundle, String base, IConfigurationElement configExtElement) {
- super(element, bundle);
- path = getAttribute(element, ATT_PATH);
- content = getAttribute(element, ATT_CONTENT);
- anchorId = getAttribute(element, ATT_ID);
- this.element = element;
- this.base = base;
-
- // load and resolve styles, first.
- init(element, bundle, base);
-
- // if content is not null we have XHTML extension.
- if (content != null) {
- // BASE: since content is being loaded from another XHTML file and
- // not this xml file, point the base of this page to be relative to
- // the new xml file location.
- IPath subBase = ModelUtil.getParentFolderPath(content);
- String newBase = new Path(base).append(subBase).toString();
- extractFileAndId(bundle);
- contentFile = BundleUtil.getResolvedResourceLocation(base, contentFile,
- bundle);
- this.base = newBase;
- }
-
- // Save the mapping between plugin registry id and base/anchor id
- String contributor = configExtElement.getContributor().getName();
- ExtensionMap.getInstance().putPluginId(anchorId, contributor);
- }
-
- public String getId() {
- return anchorId;
- }
-
-
- /**
- * Initialize styles. Take first style in style attribute and make it the
- * page style. Then put other styles in styles vectors. Make sure to resolve
- * each style.
- *
- * @param element
- * @param bundle
- */
- private void init(Element element, Bundle bundle, String base) {
- String[] styleValues = getAttributeList(element, ATT_STYLE);
- if (styleValues != null && styleValues.length > 0) {
- for (int i = 0; i < styleValues.length; i++) {
- String style = styleValues[i];
- style = BundleUtil.getResolvedResourceLocation(base, style,
- bundle);
- addStyle(style);
- }
- }
-
- String[] altStyleValues = getAttributeList(element, ATT_ALT_STYLE);
- if (altStyleValues != null && altStyleValues.length > 0) {
- for (int i = 0; i < altStyleValues.length; i++) {
- String style = altStyleValues[i];
- style = BundleUtil.getResolvedResourceLocation(base, style,
- bundle);
- addAltStyle(style, bundle);
- }
- }
- }
-
- /**
- * Adds the given style to the list. Style is not added if it already exists
- * in the list.
- *
- * @param style
- */
- protected void addStyle(String style) {
- if (styles.contains(style))
- return;
- styles.add(style);
- }
-
-
- /**
- * Adds the given style to the list.Style is not added if it already exists
- * in the list.
- *
- * @param altStyle
- */
- protected void addAltStyle(String altStyle, Bundle bundle) {
- if (altStyles.containsKey(altStyle))
- return;
- altStyles.put(altStyle, bundle);
- }
-
- /**
- * Returns the extension type; either contribution into an anchor or replacement
- * of an element.
- */
- public int getExtensionType() {
- return TAG_CONTAINER_REPLACE.equals(element.getNodeName()) ? TYPE_REPLACEMENT : TYPE_CONTRIBUTION;
- }
-
- /**
- * @return Returns the path.
- */
- public String getPath() {
- return path;
- }
-
- @Override
+ IntroExtensionContent(Element element, Bundle bundle, String base, IConfigurationElement configExtElement) {
+ super(element, bundle);
+ path = getAttribute(element, ATT_PATH);
+ content = getAttribute(element, ATT_CONTENT);
+ anchorId = getAttribute(element, ATT_ID);
+ this.element = element;
+ this.base = base;
+
+ // load and resolve styles, first.
+ init(element, bundle, base);
+
+ // if content is not null we have XHTML extension.
+ if (content != null) {
+ // BASE: since content is being loaded from another XHTML file and
+ // not this xml file, point the base of this page to be relative to
+ // the new xml file location.
+ IPath subBase = ModelUtil.getParentFolderPath(content);
+ String newBase = new Path(base).append(subBase).toString();
+ extractFileAndId(bundle);
+ contentFile = BundleUtil.getResolvedResourceLocation(base, contentFile,
+ bundle);
+ this.base = newBase;
+ }
+
+ // Save the mapping between plugin registry id and base/anchor id
+ String contributor = configExtElement.getContributor().getName();
+ ExtensionMap.getInstance().putPluginId(anchorId, contributor);
+ }
+
+ public String getId() {
+ return anchorId;
+ }
+
+
+ /**
+ * Initialize styles. Take first style in style attribute and make it the
+ * page style. Then put other styles in styles vectors. Make sure to resolve
+ * each style.
+ *
+ * @param element
+ * @param bundle
+ */
+ private void init(Element element, Bundle bundle, String base) {
+ String[] styleValues = getAttributeList(element, ATT_STYLE);
+ if (styleValues != null && styleValues.length > 0) {
+ for (int i = 0; i < styleValues.length; i++) {
+ String style = styleValues[i];
+ style = BundleUtil.getResolvedResourceLocation(base, style,
+ bundle);
+ addStyle(style);
+ }
+ }
+
+ String[] altStyleValues = getAttributeList(element, ATT_ALT_STYLE);
+ if (altStyleValues != null && altStyleValues.length > 0) {
+ for (int i = 0; i < altStyleValues.length; i++) {
+ String style = altStyleValues[i];
+ style = BundleUtil.getResolvedResourceLocation(base, style,
+ bundle);
+ addAltStyle(style, bundle);
+ }
+ }
+ }
+
+ /**
+ * Adds the given style to the list. Style is not added if it already exists
+ * in the list.
+ *
+ * @param style
+ */
+ protected void addStyle(String style) {
+ if (styles.contains(style))
+ return;
+ styles.add(style);
+ }
+
+
+ /**
+ * Adds the given style to the list.Style is not added if it already exists
+ * in the list.
+ *
+ * @param altStyle
+ */
+ protected void addAltStyle(String altStyle, Bundle bundle) {
+ if (altStyles.containsKey(altStyle))
+ return;
+ altStyles.put(altStyle, bundle);
+ }
+
+ /**
+ * Returns the extension type; either contribution into an anchor or replacement
+ * of an element.
+ */
+ public int getExtensionType() {
+ return TAG_CONTAINER_REPLACE.equals(element.getNodeName()) ? TYPE_REPLACEMENT : TYPE_CONTRIBUTION;
+ }
+
+ /**
+ * @return Returns the path.
+ */
+ public String getPath() {
+ return path;
+ }
+
+ @Override
public int getType() {
- return AbstractIntroElement.CONTAINER_EXTENSION;
- }
+ return AbstractIntroElement.CONTAINER_EXTENSION;
+ }
- protected Element[] getChildren() {
- NodeList nodeList = element.getChildNodes();
+ protected Element[] getChildren() {
+ NodeList nodeList = element.getChildNodes();
Vector<Node> vector = new Vector<>();
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node node = nodeList.item(i);
- if (node.getNodeType() == Node.ELEMENT_NODE)
- vector.add(node);
- }
- Element[] filteredElements = new Element[vector.size()];
- vector.copyInto(filteredElements);
- // free DOM model for memory performance.
- this.element = null;
- return filteredElements;
- }
-
- public boolean isXHTMLContent() {
- return content != null ? true : false;
- }
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE)
+ vector.add(node);
+ }
+ Element[] filteredElements = new Element[vector.size()];
+ vector.copyInto(filteredElements);
+ // free DOM model for memory performance.
+ this.element = null;
+ return filteredElements;
+ }
+
+ public boolean isXHTMLContent() {
+ return content != null ? true : false;
+ }
/**
* Returns the elements loaded from the content attribute. This is the content
@@ -203,56 +203,56 @@ public class IntroExtensionContent extends AbstractIntroElement {
*
* @return the elements to be inserted
*/
- public Element[] getElements() {
- // only applicable when content attribute is specified
- if (isXHTMLContent()) {
- IntroContentParser parser = new IntroContentParser(contentFile);
- Document dom = parser.getDocument();
- if (dom != null) {
- // parser content should be XHTML because defining content here
- // means that we want XHTML extension.
- if (parser.hasXHTMLContent()) {
- if (contentId != null) {
- // id specified, only get that element
- return new Element[] { ModelUtil.getElementById(dom, contentId) };
- }
- else {
- // no id specified, use the whole body
- Element extensionBody = ModelUtil.getBodyElement(dom);
- return ModelUtil.getElementsByTagName(extensionBody, "*"); //$NON-NLS-1$
- }
- }
- }
- }
- return EMPTY_ELEMENT_ARRAY;
- }
-
- /**
- * @return Returns the altStyle.
- */
+ public Element[] getElements() {
+ // only applicable when content attribute is specified
+ if (isXHTMLContent()) {
+ IntroContentParser parser = new IntroContentParser(contentFile);
+ Document dom = parser.getDocument();
+ if (dom != null) {
+ // parser content should be XHTML because defining content here
+ // means that we want XHTML extension.
+ if (parser.hasXHTMLContent()) {
+ if (contentId != null) {
+ // id specified, only get that element
+ return new Element[] { ModelUtil.getElementById(dom, contentId) };
+ }
+ else {
+ // no id specified, use the whole body
+ Element extensionBody = ModelUtil.getBodyElement(dom);
+ return ModelUtil.getElementsByTagName(extensionBody, "*"); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ return EMPTY_ELEMENT_ARRAY;
+ }
+
+ /**
+ * @return Returns the altStyle.
+ */
protected Map<String, Bundle> getAltStyles() {
- return altStyles;
- }
-
- /**
- * @return Returns the style.
- */
- protected String[] getStyles() {
- String[] stylesArray = new String[styles.size()];
- styles.copyInto(stylesArray);
- return stylesArray;
- }
-
- /**
- * @return Returns the content.
- */
- public String getContent() {
- return content;
- }
-
- public String getBase() {
- return base;
- }
+ return altStyles;
+ }
+
+ /**
+ * @return Returns the style.
+ */
+ protected String[] getStyles() {
+ String[] stylesArray = new String[styles.size()];
+ styles.copyInto(stylesArray);
+ return stylesArray;
+ }
+
+ /**
+ * @return Returns the content.
+ */
+ public String getContent() {
+ return content;
+ }
+
+ public String getBase() {
+ return base;
+ }
/**
* Extracts the file and id parts of the content attribute. This attribute has two modes -
@@ -262,7 +262,7 @@ public class IntroExtensionContent extends AbstractIntroElement {
*
* @param bundle the bundle that contributed this extension
*/
- private void extractFileAndId(Bundle bundle) {
+ private void extractFileAndId(Bundle bundle) {
// look for the file
IPath resourcePath = new Path(base + content);
if (FileLocator.find(bundle, resourcePath, null) != null) {
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroGroup.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroGroup.java
index c844200fa..9617313be 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroGroup.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroGroup.java
@@ -28,111 +28,111 @@ import org.w3c.dom.Text;
*/
public class IntroGroup extends AbstractIntroContainer {
- protected static final String TAG_GROUP = "group"; //$NON-NLS-1$
- private static final String ATT_LABEL = "label"; //$NON-NLS-1$
- private static final String ATT_COMPUTED = "computed"; //$NON-NLS-1$
- private static final String ATT_EXPANDABLE = "expandable"; //$NON-NLS-1$
- private static final String ATT_EXPANDED = "expanded"; //$NON-NLS-1$
- private static final String P_UPPERCASE = "capitalizeTitles"; //$NON-NLS-1$
- private String label;
- /**
- * @param element
- */
- IntroGroup(Element element, Bundle bundle, String base) {
- super(element, bundle, base);
- }
+ protected static final String TAG_GROUP = "group"; //$NON-NLS-1$
+ private static final String ATT_LABEL = "label"; //$NON-NLS-1$
+ private static final String ATT_COMPUTED = "computed"; //$NON-NLS-1$
+ private static final String ATT_EXPANDABLE = "expandable"; //$NON-NLS-1$
+ private static final String ATT_EXPANDED = "expanded"; //$NON-NLS-1$
+ private static final String P_UPPERCASE = "capitalizeTitles"; //$NON-NLS-1$
+ private String label;
+ /**
+ * @param element
+ */
+ IntroGroup(Element element, Bundle bundle, String base) {
+ super(element, bundle, base);
+ }
- @Override
+ @Override
protected void loadFromParent() {
- }
+ }
- private void resolve() {
- // reinitialize if there are variables in the value.
- if (label==null) {
- label = getAttribute(element, ATT_LABEL);
- if (label!=null) {
- IntroModelRoot root = getModelRoot();
- if (root!=null && root.getTheme()!=null) {
- Map props = root.getTheme().getProperties();
- String value = (String)props.get(P_UPPERCASE);
- if (value!=null && value.equalsIgnoreCase("true")) //$NON-NLS-1$
- label = label.toUpperCase();
- }
- }
- }
- }
+ private void resolve() {
+ // reinitialize if there are variables in the value.
+ if (label==null) {
+ label = getAttribute(element, ATT_LABEL);
+ if (label!=null) {
+ IntroModelRoot root = getModelRoot();
+ if (root!=null && root.getTheme()!=null) {
+ Map props = root.getTheme().getProperties();
+ String value = (String)props.get(P_UPPERCASE);
+ if (value!=null && value.equalsIgnoreCase("true")) //$NON-NLS-1$
+ label = label.toUpperCase();
+ }
+ }
+ }
+ }
- /**
- * @return Returns the label.
- */
- public String getLabel() {
- resolve();
- return label;
- }
+ /**
+ * @return Returns the label.
+ */
+ public String getLabel() {
+ resolve();
+ return label;
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.GROUP;
- }
+ return AbstractIntroElement.GROUP;
+ }
- public boolean isExpandable() {
- String value=getAttribute(element, ATT_EXPANDABLE);
- return value!=null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
+ public boolean isExpandable() {
+ String value=getAttribute(element, ATT_EXPANDABLE);
+ return value!=null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
+ }
- public boolean isExpanded() {
- String value=getAttribute(element, ATT_EXPANDED);
- return value!=null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
+ public boolean isExpanded() {
+ String value=getAttribute(element, ATT_EXPANDED);
+ return value!=null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
+ }
- @Override
+ @Override
protected void loadChildren() {
- String value = getAttribute(element, ATT_COMPUTED);
- if (value!=null && value.equalsIgnoreCase("true")) //$NON-NLS-1$
- loadDynamicNodes();
- super.loadChildren();
- }
+ String value = getAttribute(element, ATT_COMPUTED);
+ if (value!=null && value.equalsIgnoreCase("true")) //$NON-NLS-1$
+ loadDynamicNodes();
+ super.loadChildren();
+ }
- private void loadDynamicNodes() {
- IntroModelRoot root = getModelRoot();
- if (root==null)
- return;
- AbstractIntroPage page = getParentPage();
- String pageId = page.getId();
- IntroConfigurer configurer = root.getConfigurer();
- if (configurer != null) {
- IntroElement [] nodes = configurer.getGroupChildren(pageId, getId());
- addDynamicNodes(this.element, nodes);
- }
- }
+ private void loadDynamicNodes() {
+ IntroModelRoot root = getModelRoot();
+ if (root==null)
+ return;
+ AbstractIntroPage page = getParentPage();
+ String pageId = page.getId();
+ IntroConfigurer configurer = root.getConfigurer();
+ if (configurer != null) {
+ IntroElement [] nodes = configurer.getGroupChildren(pageId, getId());
+ addDynamicNodes(this.element, nodes);
+ }
+ }
- private void addDynamicNodes(Element target, IntroElement [] nodes) {
- for (int i=0; i<nodes.length; i++) {
- IntroElement node = nodes[i];
- addDynamicNode(target, node);
- }
- }
- private void addDynamicNode(Element target, IntroElement node) {
- // clone node itself
- Element clone = target.getOwnerDocument().createElement(node.getName());
- // set attributes
- Enumeration atts = node.getAttributes();
- for (;atts.hasMoreElements();) {
- String aname = (String)atts.nextElement();
- String avalue = node.getAttribute(aname);
- clone.setAttribute(aname, avalue);
- }
- // set value
- String value = node.getValue();
- if (value!=null) {
- Text textNode = target.getOwnerDocument().createTextNode(value);
- clone.appendChild(textNode);
- }
- // clone children
- IntroElement [] cnodes = node.getChildren();
- if (cnodes.length>0)
- addDynamicNodes(clone, cnodes);
- // add the clone to the target
- target.appendChild(clone);
- }
+ private void addDynamicNodes(Element target, IntroElement [] nodes) {
+ for (int i=0; i<nodes.length; i++) {
+ IntroElement node = nodes[i];
+ addDynamicNode(target, node);
+ }
+ }
+ private void addDynamicNode(Element target, IntroElement node) {
+ // clone node itself
+ Element clone = target.getOwnerDocument().createElement(node.getName());
+ // set attributes
+ Enumeration atts = node.getAttributes();
+ for (;atts.hasMoreElements();) {
+ String aname = (String)atts.nextElement();
+ String avalue = node.getAttribute(aname);
+ clone.setAttribute(aname, avalue);
+ }
+ // set value
+ String value = node.getValue();
+ if (value!=null) {
+ Text textNode = target.getOwnerDocument().createTextNode(value);
+ clone.appendChild(textNode);
+ }
+ // clone children
+ IntroElement [] cnodes = node.getChildren();
+ if (cnodes.length>0)
+ addDynamicNodes(clone, cnodes);
+ // add the clone to the target
+ target.appendChild(clone);
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHTML.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHTML.java
index c4be83752..8e1d1a077 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHTML.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHTML.java
@@ -29,115 +29,115 @@ import org.w3c.dom.NodeList;
*/
public class IntroHTML extends AbstractTextElement {
- protected static final String TAG_HTML = "html"; //$NON-NLS-1$
-
- private static final String ATT_SRC = "src"; //$NON-NLS-1$
- /**
- * type must be "inline" or "embed".
- */
- private static final String ATT_TYPE = "type"; //$NON-NLS-1$
- // Default is UTF-8.
- private static final String ATT_ENCODING = "encoding"; //$NON-NLS-1$
-
- private String src;
- private String html_type;
- private String encoding;
- private IntroImage introImage;
-
- IntroHTML(Element element, Bundle bundle, String base) {
- super(element, bundle);
- src = getAttribute(element, ATT_SRC);
- html_type = getAttribute(element, ATT_TYPE);
- encoding = getAttribute(element, ATT_ENCODING);
- if (encoding == null)
- encoding = "UTF-8"; //$NON-NLS-1$
- if (html_type != null && !html_type.equalsIgnoreCase("inline") //$NON-NLS-1$
- && !html_type.equalsIgnoreCase("embed")) //$NON-NLS-1$
- // if type is not correct, null it.
- html_type = null;
-
- // description will be null if there is no description element.
- introImage = getIntroImage(element, base);
-
- // Resolve.
- src = BundleUtil.getResolvedResourceLocation(base, src, bundle);
- }
-
- /**
- * Retruns the intro image element embedded in this element.
- */
- private IntroImage getIntroImage(Element element, String base) {
- try {
- // There should only be one text element. Since elements where
- // obtained by name, no point validating name.
- NodeList imageElements = element
- .getElementsByTagName(IntroImage.TAG_IMAGE);
- if (imageElements.getLength() == 0)
- // no contributions. done.
- return null;
- IntroImage image = new IntroImage((Element) imageElements.item(0),
- getBundle(), base);
- image.setParent(this);
- return image;
- } catch (Exception e) {
- Log.error(e.getMessage(), e);
- return null;
- }
- }
-
- /**
- * Returns the html type. Will be either "inline" or "embed". If not, null
- * will be returned as if the attibute was nto defined.
- *
- * @return Returns the html type value.
- */
- public boolean isInlined() {
- return (html_type != null && html_type.equalsIgnoreCase("inline")) ? true //$NON-NLS-1$
- : false;
- }
-
- /**
- * @return Returns the src.
- */
- public String getSrc() {
- return src;
- }
-
- /**
- * @return Returns the encoding of the inlined file. This is not needed for
- * embedded files. Default is UTF-8.
- */
- public String getInlineEncoding() {
- return encoding;
- }
-
- /**
- * Returns the intro image used as a replacement if this HTML element fails.
- * May return null if there is no image child.
- *
- * @return Returns the introImage.
- */
- public IntroImage getIntroImage() {
- return introImage;
- }
-
- @Override
+ protected static final String TAG_HTML = "html"; //$NON-NLS-1$
+
+ private static final String ATT_SRC = "src"; //$NON-NLS-1$
+ /**
+ * type must be "inline" or "embed".
+ */
+ private static final String ATT_TYPE = "type"; //$NON-NLS-1$
+ // Default is UTF-8.
+ private static final String ATT_ENCODING = "encoding"; //$NON-NLS-1$
+
+ private String src;
+ private String html_type;
+ private String encoding;
+ private IntroImage introImage;
+
+ IntroHTML(Element element, Bundle bundle, String base) {
+ super(element, bundle);
+ src = getAttribute(element, ATT_SRC);
+ html_type = getAttribute(element, ATT_TYPE);
+ encoding = getAttribute(element, ATT_ENCODING);
+ if (encoding == null)
+ encoding = "UTF-8"; //$NON-NLS-1$
+ if (html_type != null && !html_type.equalsIgnoreCase("inline") //$NON-NLS-1$
+ && !html_type.equalsIgnoreCase("embed")) //$NON-NLS-1$
+ // if type is not correct, null it.
+ html_type = null;
+
+ // description will be null if there is no description element.
+ introImage = getIntroImage(element, base);
+
+ // Resolve.
+ src = BundleUtil.getResolvedResourceLocation(base, src, bundle);
+ }
+
+ /**
+ * Retruns the intro image element embedded in this element.
+ */
+ private IntroImage getIntroImage(Element element, String base) {
+ try {
+ // There should only be one text element. Since elements where
+ // obtained by name, no point validating name.
+ NodeList imageElements = element
+ .getElementsByTagName(IntroImage.TAG_IMAGE);
+ if (imageElements.getLength() == 0)
+ // no contributions. done.
+ return null;
+ IntroImage image = new IntroImage((Element) imageElements.item(0),
+ getBundle(), base);
+ image.setParent(this);
+ return image;
+ } catch (Exception e) {
+ Log.error(e.getMessage(), e);
+ return null;
+ }
+ }
+
+ /**
+ * Returns the html type. Will be either "inline" or "embed". If not, null
+ * will be returned as if the attibute was nto defined.
+ *
+ * @return Returns the html type value.
+ */
+ public boolean isInlined() {
+ return (html_type != null && html_type.equalsIgnoreCase("inline")) ? true //$NON-NLS-1$
+ : false;
+ }
+
+ /**
+ * @return Returns the src.
+ */
+ public String getSrc() {
+ return src;
+ }
+
+ /**
+ * @return Returns the encoding of the inlined file. This is not needed for
+ * embedded files. Default is UTF-8.
+ */
+ public String getInlineEncoding() {
+ return encoding;
+ }
+
+ /**
+ * Returns the intro image used as a replacement if this HTML element fails.
+ * May return null if there is no image child.
+ *
+ * @return Returns the introImage.
+ */
+ public IntroImage getIntroImage() {
+ return introImage;
+ }
+
+ @Override
public int getType() {
- return AbstractIntroElement.HTML;
- }
+ return AbstractIntroElement.HTML;
+ }
- /**
- * Deep copy since class has mutable objects.
- */
- @Override
+ /**
+ * Deep copy since class has mutable objects.
+ */
+ @Override
public Object clone() throws CloneNotSupportedException {
- IntroHTML clone = (IntroHTML) super.clone();
- if (introImage != null) {
- IntroImage cloneIntroImage = (IntroImage) introImage.clone();
- cloneIntroImage.setParent(clone);
- clone.introImage = cloneIntroImage;
- }
- return clone;
- }
+ IntroHTML clone = (IntroHTML) super.clone();
+ if (introImage != null) {
+ IntroImage cloneIntroImage = (IntroImage) introImage.clone();
+ cloneIntroImage.setParent(clone);
+ clone.introImage = cloneIntroImage;
+ }
+ return clone;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHead.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHead.java
index e3ed32ee3..f3a17883c 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHead.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHead.java
@@ -25,56 +25,56 @@ import org.w3c.dom.Element;
*/
public class IntroHead extends AbstractIntroElement {
- protected static final String TAG_HEAD = "head"; //$NON-NLS-1$
-
- private static final String ATT_SRC = "src"; //$NON-NLS-1$
- // default encoding is UTF-8
- private static final String ATT_ENCODING = "encoding"; //$NON-NLS-1$
-
- private String src;
- private String encoding;
-
- IntroHead(IConfigurationElement element) {
- super(element);
- src = element.getAttribute(ATT_SRC);
- encoding = element.getAttribute(ATT_ENCODING);
- if (encoding == null)
- encoding = "UTF-8"; //$NON-NLS-1$
-
- // Resolve.
- src = BundleUtil.getResourceLocation(src, element);
- }
-
-
- IntroHead(Element element, Bundle bundle, String base) {
- super(element, bundle);
- src = getAttribute(element, ATT_SRC);
- encoding = getAttribute(element, ATT_ENCODING);
- if (encoding == null)
- encoding = "UTF-8"; //$NON-NLS-1$
-
- // Resolve.
- src = BundleUtil.getResolvedResourceLocation(base, src, bundle);
- }
-
-
- /**
- * @return Returns the src.
- */
- public String getSrc() {
- return src;
- }
-
- /**
- * @return Returns the encoding of the inlined file. Default is UTF-8.
- */
- public String getInlineEncoding() {
- return encoding;
- }
-
- @Override
+ protected static final String TAG_HEAD = "head"; //$NON-NLS-1$
+
+ private static final String ATT_SRC = "src"; //$NON-NLS-1$
+ // default encoding is UTF-8
+ private static final String ATT_ENCODING = "encoding"; //$NON-NLS-1$
+
+ private String src;
+ private String encoding;
+
+ IntroHead(IConfigurationElement element) {
+ super(element);
+ src = element.getAttribute(ATT_SRC);
+ encoding = element.getAttribute(ATT_ENCODING);
+ if (encoding == null)
+ encoding = "UTF-8"; //$NON-NLS-1$
+
+ // Resolve.
+ src = BundleUtil.getResourceLocation(src, element);
+ }
+
+
+ IntroHead(Element element, Bundle bundle, String base) {
+ super(element, bundle);
+ src = getAttribute(element, ATT_SRC);
+ encoding = getAttribute(element, ATT_ENCODING);
+ if (encoding == null)
+ encoding = "UTF-8"; //$NON-NLS-1$
+
+ // Resolve.
+ src = BundleUtil.getResolvedResourceLocation(base, src, bundle);
+ }
+
+
+ /**
+ * @return Returns the src.
+ */
+ public String getSrc() {
+ return src;
+ }
+
+ /**
+ * @return Returns the encoding of the inlined file. Default is UTF-8.
+ */
+ public String getInlineEncoding() {
+ return encoding;
+ }
+
+ @Override
public int getType() {
- return AbstractIntroElement.HEAD;
- }
+ return AbstractIntroElement.HEAD;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHomePage.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHomePage.java
index a9f955f53..eb9f90c4f 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHomePage.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroHomePage.java
@@ -27,48 +27,48 @@ import org.w3c.dom.Element;
public class IntroHomePage extends AbstractIntroPage {
IntroHomePage(Element element, Bundle bundle, String base) {
- super(element, bundle, base);
- }
+ super(element, bundle, base);
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.HOME_PAGE;
- }
+ return AbstractIntroElement.HOME_PAGE;
+ }
- // THESE METHODS WILL BE REMOVED!
- /**
- * This method is a customized method for root page to return the root page
- * links. Try to get the real links in the page, and all links in all divs.
- */
- public IntroLink[] getLinks() {
+ // THESE METHODS WILL BE REMOVED!
+ /**
+ * This method is a customized method for root page to return the root page
+ * links. Try to get the real links in the page, and all links in all divs.
+ */
+ public IntroLink[] getLinks() {
Vector<AbstractIntroElement> linkVector = new Vector<>();
- AbstractIntroElement[] children = getChildren();
- for (int i = 0; i < children.length; i++) {
- AbstractIntroElement child = children[i];
- if (child.isOfType(AbstractIntroElement.LINK))
- linkVector.add(child);
- else if (child.isOfType(AbstractIntroElement.GROUP)) {
- addLinks((IntroGroup) child, linkVector);
- }
- }
+ AbstractIntroElement[] children = getChildren();
+ for (int i = 0; i < children.length; i++) {
+ AbstractIntroElement child = children[i];
+ if (child.isOfType(AbstractIntroElement.LINK))
+ linkVector.add(child);
+ else if (child.isOfType(AbstractIntroElement.GROUP)) {
+ addLinks((IntroGroup) child, linkVector);
+ }
+ }
- IntroLink[] links = new IntroLink[linkVector.size()];
- linkVector.copyInto(links);
- return links;
- }
+ IntroLink[] links = new IntroLink[linkVector.size()];
+ linkVector.copyInto(links);
+ return links;
+ }
private void addLinks(IntroGroup group, Vector<AbstractIntroElement> linkVector) {
- AbstractIntroElement[] children = group.getChildren();
- for (int i = 0; i < children.length; i++) {
- AbstractIntroElement child = children[i];
- if (child.isOfType(AbstractIntroElement.LINK))
- linkVector.add(child);
- else if (child.isOfType(AbstractIntroElement.GROUP)) {
- addLinks((IntroGroup) child, linkVector);
- }
- }
- }
+ AbstractIntroElement[] children = group.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ AbstractIntroElement child = children[i];
+ if (child.isOfType(AbstractIntroElement.LINK))
+ linkVector.add(child);
+ else if (child.isOfType(AbstractIntroElement.GROUP)) {
+ addLinks((IntroGroup) child, linkVector);
+ }
+ }
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroImage.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroImage.java
index 789e10f50..d79ff013b 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroImage.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroImage.java
@@ -23,55 +23,55 @@ import org.w3c.dom.Element;
*/
public class IntroImage extends AbstractBaseIntroElement {
- protected static final String TAG_IMAGE = "img"; //$NON-NLS-1$
+ protected static final String TAG_IMAGE = "img"; //$NON-NLS-1$
- private static final String ATT_SRC = "src"; //$NON-NLS-1$
- private static final String ATT_ALT = "alt"; //$NON-NLS-1$
- private static final String ATT_TITLE = "title"; //$NON-NLS-1$
+ private static final String ATT_SRC = "src"; //$NON-NLS-1$
+ private static final String ATT_ALT = "alt"; //$NON-NLS-1$
+ private static final String ATT_TITLE = "title"; //$NON-NLS-1$
- private Element element;
- private String src;
- private String base;
+ private Element element;
+ private String src;
+ private String base;
- IntroImage(Element element, Bundle bundle, String base) {
- super(element, bundle);
- this.element = element;
- this.base = base;
- }
+ IntroImage(Element element, Bundle bundle, String base) {
+ super(element, bundle);
+ this.element = element;
+ this.base = base;
+ }
- /**
- * @return Returns the alt.
- */
- public String getAlt() {
- return getAttribute(element, ATT_ALT);
- }
+ /**
+ * @return Returns the alt.
+ */
+ public String getAlt() {
+ return getAttribute(element, ATT_ALT);
+ }
- /**
- * @return Returns the title.
- */
- public String getTitle() {
- return getAttribute(element, ATT_TITLE);
- }
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle() {
+ return getAttribute(element, ATT_TITLE);
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.IMAGE;
- }
+ return AbstractIntroElement.IMAGE;
+ }
- /**
- * @return Returns the src value, already resolved as a local url.
- */
- public String getSrc() {
- if (src==null)// Resolve src.
- src = BundleUtil.getResolvedResourceLocation(base, getSrcAsIs(), getBundle());
- return src;
- }
+ /**
+ * @return Returns the src value, already resolved as a local url.
+ */
+ public String getSrc() {
+ if (src==null)// Resolve src.
+ src = BundleUtil.getResolvedResourceLocation(base, getSrcAsIs(), getBundle());
+ return src;
+ }
- /**
- * @return Returns the src value, as is, without resolving it as a local
- * url. The src value is relative to the parent plugin.
- */
- public String getSrcAsIs() {
- return getAttribute(element, ATT_SRC);
- }
+ /**
+ * @return Returns the src value, as is, without resolving it as a local
+ * url. The src value is relative to the parent plugin.
+ */
+ public String getSrcAsIs() {
+ return getAttribute(element, ATT_SRC);
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroInclude.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroInclude.java
index 1535ca08b..151a849e3 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroInclude.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroInclude.java
@@ -22,52 +22,52 @@ import org.w3c.dom.Element;
*/
public class IntroInclude extends AbstractIntroElement {
- protected static final String TAG_INCLUDE = "include"; //$NON-NLS-1$
+ protected static final String TAG_INCLUDE = "include"; //$NON-NLS-1$
- private static final String ATT_CONFIG_ID = "configId"; //$NON-NLS-1$
- protected static final String ATT_PATH = "path"; //$NON-NLS-1$
- /**
- * boolean attribute, default is false.
- */
- private static final String ATT_MERGE_STYLE = "merge-style"; //$NON-NLS-1$
+ private static final String ATT_CONFIG_ID = "configId"; //$NON-NLS-1$
+ protected static final String ATT_PATH = "path"; //$NON-NLS-1$
+ /**
+ * boolean attribute, default is false.
+ */
+ private static final String ATT_MERGE_STYLE = "merge-style"; //$NON-NLS-1$
- private String configId;
- private String path;
- private boolean mergeStyle = false;
+ private String configId;
+ private String path;
+ private boolean mergeStyle = false;
- IntroInclude(Element element, Bundle bundle) {
- super(element, bundle);
- configId = getAttribute(element, ATT_CONFIG_ID);
- path = getAttribute(element, ATT_PATH);
- String mergeStyleString = getAttribute(element, ATT_MERGE_STYLE);
- mergeStyle = (mergeStyleString != null && mergeStyleString
- .equalsIgnoreCase("true")) ? true : false; //$NON-NLS-1$
- }
+ IntroInclude(Element element, Bundle bundle) {
+ super(element, bundle);
+ configId = getAttribute(element, ATT_CONFIG_ID);
+ path = getAttribute(element, ATT_PATH);
+ String mergeStyleString = getAttribute(element, ATT_MERGE_STYLE);
+ mergeStyle = (mergeStyleString != null && mergeStyleString
+ .equalsIgnoreCase("true")) ? true : false; //$NON-NLS-1$
+ }
- /**
- * @return Returns the configId.
- */
- public String getConfigId() {
- return configId;
- }
+ /**
+ * @return Returns the configId.
+ */
+ public String getConfigId() {
+ return configId;
+ }
- /**
- * @return Returns the mergeStyle.
- */
- public boolean getMergeStyle() {
- return mergeStyle;
- }
+ /**
+ * @return Returns the mergeStyle.
+ */
+ public boolean getMergeStyle() {
+ return mergeStyle;
+ }
- /**
- * @return Returns the path.
- */
- public String getPath() {
- return path;
- }
+ /**
+ * @return Returns the path.
+ */
+ public String getPath() {
+ return path;
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.INCLUDE;
- }
+ return AbstractIntroElement.INCLUDE;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroInjectedIFrame.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroInjectedIFrame.java
index 6ce2e703b..999b80ca1 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroInjectedIFrame.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroInjectedIFrame.java
@@ -24,25 +24,25 @@ import org.w3c.dom.Element;
*/
public class IntroInjectedIFrame extends AbstractIntroIdElement {
- private String url;
+ private String url;
- IntroInjectedIFrame(Element element, Bundle bundle) {
- super(element, bundle);
- }
+ IntroInjectedIFrame(Element element, Bundle bundle) {
+ super(element, bundle);
+ }
- public void setIFrameURL(String url) {
- this.url = url;
- }
+ public void setIFrameURL(String url) {
+ this.url = url;
+ }
- public String getIFrameURL() {
- return this.url;
- }
+ public String getIFrameURL() {
+ return this.url;
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.INJECTED_IFRAME;
- }
+ return AbstractIntroElement.INJECTED_IFRAME;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java
index 592b91a9f..91a311e1e 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarElement.java
@@ -36,156 +36,156 @@ public class IntroLaunchBarElement extends AbstractIntroElement {
private List<IntroLaunchBarShortcut> shortcuts;
- IntroLaunchBarElement(IConfigurationElement element) {
- super(element);
- }
+ IntroLaunchBarElement(IConfigurationElement element) {
+ super(element);
+ }
- /**
- * Returns LAUNCH_BAR.
- */
- @Override
+ /**
+ * Returns LAUNCH_BAR.
+ */
+ @Override
public int getType() {
- return AbstractIntroElement.LAUNCH_BAR;
- }
-
- /**
- * Returns the desired launch bar orientation that results from the desired
- * location. Valid values are <code>SWT.VERTICAL</code> and
- * <code>SWT.HORIZONTAL</code>.
- *
- * @return
- */
- public int getOrientation() {
- int location = getLocation();
- return (location == SWT.RIGHT || location == SWT.LEFT) ? SWT.VERTICAL
- : SWT.HORIZONTAL;
- }
-
- /**
- * Returns the location of the launch bar in the workbench window. Valid
- * values are <code>SWT.RIGHT</code>,<code>SWT.LEFT</code> and
- * <code>SWT.BOTTOM</code>.
- *
- * @return
- */
- public int getLocation() {
- String location = getCfgElement().getAttribute("location"); //$NON-NLS-1$
-
- if (location != null) {
- if (location.equals("left")) //$NON-NLS-1$
- return SWT.LEFT;
- if (location.equals("bottom")) //$NON-NLS-1$
- return SWT.BOTTOM;
- if (location.equals("right")) //$NON-NLS-1$
- return SWT.RIGHT;
- }
- // default to the initial fast view location
- String fastviewLocation = PlatformUI.getPreferenceStore().getString(
- IWorkbenchPreferenceConstants.INITIAL_FAST_VIEW_BAR_LOCATION);
- if (fastviewLocation.equals(IWorkbenchPreferenceConstants.LEFT))
- return SWT.LEFT;
- if (fastviewLocation.equals(IWorkbenchPreferenceConstants.RIGHT))
- return SWT.RIGHT;
- if (fastviewLocation.equals(IWorkbenchPreferenceConstants.BOTTOM))
- return SWT.BOTTOM;
- // just in case
- return SWT.RIGHT;
- }
-
- public String getBackground() {
- return getCfgElement().getAttribute("bg"); //$NON-NLS-1$
- }
-
- public String getForeground() {
- return getCfgElement().getAttribute("fg"); //$NON-NLS-1$
- }
-
- public boolean getCreateHandle() {
- return getHandleElement() != null;
- }
-
- public boolean getClose() {
- IConfigurationElement handle = getHandleElement();
- if (handle != null) {
- String value = handle.getAttribute("close"); //$NON-NLS-1$
- return value == null || value.equals("true"); //$NON-NLS-1$
- }
- return true;
- }
-
- /**
- * Returns the relative icon path of the handle image.
- *
- * @return
- */
- private String getHandleImage() {
- IConfigurationElement handle = getHandleElement();
- if (handle == null)
- return null;
- return handle.getAttribute("image"); //$NON-NLS-1$
- }
-
- /**
- * Returns the icon image of the handle, or <code>null</code> if not
- * defined or found.
- *
- * @return
- */
- public ImageDescriptor getHandleImageDescriptor() {
- String path = getHandleImage();
- if (path == null)
- return null;
- return ImageUtil.createImageDescriptor(getBundle(), path);
- }
-
- private IConfigurationElement getHandleElement() {
- IConfigurationElement[] children = getCfgElement().getChildren(
- "handle"); //$NON-NLS-1$
- if (children.length > 0)
- return children[0];
- return null;
- }
-
- /**
- * Returns an array of shorcut elements.
- *
- * @return
- */
- public IntroLaunchBarShortcut[] getShortcuts() {
- if (shortcuts == null) {
- createShortcuts();
- }
- return shortcuts.toArray(new IntroLaunchBarShortcut[shortcuts.size()]);
- }
-
- /**
- * Creates an array of shortcut elements
- *
- */
- private void createShortcuts() {
+ return AbstractIntroElement.LAUNCH_BAR;
+ }
+
+ /**
+ * Returns the desired launch bar orientation that results from the desired
+ * location. Valid values are <code>SWT.VERTICAL</code> and
+ * <code>SWT.HORIZONTAL</code>.
+ *
+ * @return
+ */
+ public int getOrientation() {
+ int location = getLocation();
+ return (location == SWT.RIGHT || location == SWT.LEFT) ? SWT.VERTICAL
+ : SWT.HORIZONTAL;
+ }
+
+ /**
+ * Returns the location of the launch bar in the workbench window. Valid
+ * values are <code>SWT.RIGHT</code>,<code>SWT.LEFT</code> and
+ * <code>SWT.BOTTOM</code>.
+ *
+ * @return
+ */
+ public int getLocation() {
+ String location = getCfgElement().getAttribute("location"); //$NON-NLS-1$
+
+ if (location != null) {
+ if (location.equals("left")) //$NON-NLS-1$
+ return SWT.LEFT;
+ if (location.equals("bottom")) //$NON-NLS-1$
+ return SWT.BOTTOM;
+ if (location.equals("right")) //$NON-NLS-1$
+ return SWT.RIGHT;
+ }
+ // default to the initial fast view location
+ String fastviewLocation = PlatformUI.getPreferenceStore().getString(
+ IWorkbenchPreferenceConstants.INITIAL_FAST_VIEW_BAR_LOCATION);
+ if (fastviewLocation.equals(IWorkbenchPreferenceConstants.LEFT))
+ return SWT.LEFT;
+ if (fastviewLocation.equals(IWorkbenchPreferenceConstants.RIGHT))
+ return SWT.RIGHT;
+ if (fastviewLocation.equals(IWorkbenchPreferenceConstants.BOTTOM))
+ return SWT.BOTTOM;
+ // just in case
+ return SWT.RIGHT;
+ }
+
+ public String getBackground() {
+ return getCfgElement().getAttribute("bg"); //$NON-NLS-1$
+ }
+
+ public String getForeground() {
+ return getCfgElement().getAttribute("fg"); //$NON-NLS-1$
+ }
+
+ public boolean getCreateHandle() {
+ return getHandleElement() != null;
+ }
+
+ public boolean getClose() {
+ IConfigurationElement handle = getHandleElement();
+ if (handle != null) {
+ String value = handle.getAttribute("close"); //$NON-NLS-1$
+ return value == null || value.equals("true"); //$NON-NLS-1$
+ }
+ return true;
+ }
+
+ /**
+ * Returns the relative icon path of the handle image.
+ *
+ * @return
+ */
+ private String getHandleImage() {
+ IConfigurationElement handle = getHandleElement();
+ if (handle == null)
+ return null;
+ return handle.getAttribute("image"); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the icon image of the handle, or <code>null</code> if not
+ * defined or found.
+ *
+ * @return
+ */
+ public ImageDescriptor getHandleImageDescriptor() {
+ String path = getHandleImage();
+ if (path == null)
+ return null;
+ return ImageUtil.createImageDescriptor(getBundle(), path);
+ }
+
+ private IConfigurationElement getHandleElement() {
+ IConfigurationElement[] children = getCfgElement().getChildren(
+ "handle"); //$NON-NLS-1$
+ if (children.length > 0)
+ return children[0];
+ return null;
+ }
+
+ /**
+ * Returns an array of shorcut elements.
+ *
+ * @return
+ */
+ public IntroLaunchBarShortcut[] getShortcuts() {
+ if (shortcuts == null) {
+ createShortcuts();
+ }
+ return shortcuts.toArray(new IntroLaunchBarShortcut[shortcuts.size()]);
+ }
+
+ /**
+ * Creates an array of shortcut elements
+ *
+ */
+ private void createShortcuts() {
shortcuts = new ArrayList<>();
- IntroModelRoot model = getModelRoot();
- IntroConfigurer configurer = model!=null?model.getConfigurer():null;
-
- String cvalue = getCfgElement().getAttribute("computed"); //$NON-NLS-1$
- boolean computed = cvalue!=null && cvalue.equalsIgnoreCase("true"); //$NON-NLS-1$
-
- if (computed && configurer!=null) {
- IntroElement [] children = configurer.getLaunchBarShortcuts();
- for (int i=0; i<children.length; i++) {
- IntroLaunchBarShortcut shortcut = new IntroLaunchBarShortcut(getCfgElement(), children[i]);
- shortcuts.add(shortcut);
- }
- }
- else {
- IConfigurationElement[] children = getCfgElement().getChildren(
- IntroLaunchBarShortcut.TAG_SHORTCUT);
- for (int i = 0; i < children.length; i++) {
- IConfigurationElement child = children[i];
- IntroLaunchBarShortcut shortcut = new IntroLaunchBarShortcut(child);
- shortcuts.add(shortcut);
- }
- }
- }
+ IntroModelRoot model = getModelRoot();
+ IntroConfigurer configurer = model!=null?model.getConfigurer():null;
+
+ String cvalue = getCfgElement().getAttribute("computed"); //$NON-NLS-1$
+ boolean computed = cvalue!=null && cvalue.equalsIgnoreCase("true"); //$NON-NLS-1$
+
+ if (computed && configurer!=null) {
+ IntroElement [] children = configurer.getLaunchBarShortcuts();
+ for (int i=0; i<children.length; i++) {
+ IntroLaunchBarShortcut shortcut = new IntroLaunchBarShortcut(getCfgElement(), children[i]);
+ shortcuts.add(shortcut);
+ }
+ }
+ else {
+ IConfigurationElement[] children = getCfgElement().getChildren(
+ IntroLaunchBarShortcut.TAG_SHORTCUT);
+ for (int i = 0; i < children.length; i++) {
+ IConfigurationElement child = children[i];
+ IntroLaunchBarShortcut shortcut = new IntroLaunchBarShortcut(child);
+ shortcuts.add(shortcut);
+ }
+ }
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarShortcut.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarShortcut.java
index ac7a5aecf..63bb2fc81 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarShortcut.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLaunchBarShortcut.java
@@ -28,80 +28,80 @@ import org.eclipse.ui.intro.config.IntroElement;
*/
public class IntroLaunchBarShortcut extends AbstractIntroElement {
- protected static final String TAG_SHORTCUT = "shortcut"; //$NON-NLS-1$
+ protected static final String TAG_SHORTCUT = "shortcut"; //$NON-NLS-1$
- private static final String ATT_TOOLTIP = "tooltip"; //$NON-NLS-1$
- private static final String ATT_ICON = "icon"; //$NON-NLS-1$
- private static final String ATT_URL = "url"; //$NON-NLS-1$
+ private static final String ATT_TOOLTIP = "tooltip"; //$NON-NLS-1$
+ private static final String ATT_ICON = "icon"; //$NON-NLS-1$
+ private static final String ATT_URL = "url"; //$NON-NLS-1$
- private IntroElement ielement;
+ private IntroElement ielement;
- IntroLaunchBarShortcut(IConfigurationElement element, IntroElement ielement) {
- super(element);
- this.ielement = ielement;
- }
+ IntroLaunchBarShortcut(IConfigurationElement element, IntroElement ielement) {
+ super(element);
+ this.ielement = ielement;
+ }
- IntroLaunchBarShortcut(IConfigurationElement element) {
- super(element);
- }
+ IntroLaunchBarShortcut(IConfigurationElement element) {
+ super(element);
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.LAUNCH_BAR_SHORTCUT;
- }
+ return AbstractIntroElement.LAUNCH_BAR_SHORTCUT;
+ }
- private String getAttribute(String name) {
- if (ielement!=null)
- return ielement.getAttribute(name);
- return getCfgElement().getAttribute(name);
- }
+ private String getAttribute(String name) {
+ if (ielement!=null)
+ return ielement.getAttribute(name);
+ return getCfgElement().getAttribute(name);
+ }
- /**
- * Returns the URL of this shortcut.
- *
- * @return
- */
- public String getURL() {
- return getAttribute(ATT_URL);
- }
+ /**
+ * Returns the URL of this shortcut.
+ *
+ * @return
+ */
+ public String getURL() {
+ return getAttribute(ATT_URL);
+ }
- /**
- * Returns the tooltip of this shortcut.
- *
- * @return
- */
- public String getToolTip() {
- return getAttribute(ATT_TOOLTIP);
- }
+ /**
+ * Returns the tooltip of this shortcut.
+ *
+ * @return
+ */
+ public String getToolTip() {
+ return getAttribute(ATT_TOOLTIP);
+ }
- /**
- * Returns the relative icon path of this shortcut.
- *
- * @return
- */
- private String getIcon() {
- return getAttribute(ATT_ICON);
- }
+ /**
+ * Returns the relative icon path of this shortcut.
+ *
+ * @return
+ */
+ private String getIcon() {
+ return getAttribute(ATT_ICON);
+ }
- /**
- * Returns the icon image of this shortcut, or <code>null</code> if not
- * found.
- *
- * @return
- */
- public ImageDescriptor getImageDescriptor() {
- String icon = getIcon();
- if (icon!=null) {
- try {
- URL imageUrl = new URL(icon);
- ImageDescriptor desc = ImageDescriptor.createFromURL(imageUrl);
- return desc;
- }
- catch (MalformedURLException e) {
- // not a full url
- }
- }
- return ImageUtil.createImageDescriptor(getBundle(), getIcon());
- }
+ /**
+ * Returns the icon image of this shortcut, or <code>null</code> if not
+ * found.
+ *
+ * @return
+ */
+ public ImageDescriptor getImageDescriptor() {
+ String icon = getIcon();
+ if (icon!=null) {
+ try {
+ URL imageUrl = new URL(icon);
+ ImageDescriptor desc = ImageDescriptor.createFromURL(imageUrl);
+ return desc;
+ }
+ catch (MalformedURLException e) {
+ // not a full url
+ }
+ }
+ return ImageUtil.createImageDescriptor(getBundle(), getIcon());
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLink.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLink.java
index 77be67fee..2f0f57bc3 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLink.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroLink.java
@@ -27,94 +27,94 @@ import org.w3c.dom.NodeList;
*/
public class IntroLink extends AbstractTextElement {
- protected static final String TAG_LINK = "link"; //$NON-NLS-1$
+ protected static final String TAG_LINK = "link"; //$NON-NLS-1$
- private static final String ATT_LABEL = "label"; //$NON-NLS-1$
- private static final String ATT_URL = "url"; //$NON-NLS-1$
- private static final String TAG_IMG = "img"; //$NON-NLS-1$
+ private static final String ATT_LABEL = "label"; //$NON-NLS-1$
+ private static final String ATT_URL = "url"; //$NON-NLS-1$
+ private static final String TAG_IMG = "img"; //$NON-NLS-1$
- private String label;
- private String url;
- private IntroImage img;
- private IntroURL introURL;
+ private String label;
+ private String url;
+ private IntroImage img;
+ private IntroURL introURL;
- /**
- * @param element
- */
- IntroLink(Element element, Bundle bundle, String base) {
- super(element, bundle);
- url = getAttribute(element, ATT_URL);
- label = getAttribute(element, ATT_LABEL);
+ /**
+ * @param element
+ */
+ IntroLink(Element element, Bundle bundle, String base) {
+ super(element, bundle);
+ url = getAttribute(element, ATT_URL);
+ label = getAttribute(element, ATT_LABEL);
- url = ModelUtil.resolveURL(base, url, bundle);
- if (url != null) {
- // check the URL.
- IntroURLParser parser = new IntroURLParser(url);
- if (parser.hasIntroUrl())
- introURL = parser.getIntroURL();
- }
+ url = ModelUtil.resolveURL(base, url, bundle);
+ if (url != null) {
+ // check the URL.
+ IntroURLParser parser = new IntroURLParser(url);
+ if (parser.hasIntroUrl())
+ introURL = parser.getIntroURL();
+ }
- // There should be at most one img element.
- NodeList imgElements = element.getElementsByTagName(TAG_IMG);
- if (imgElements.getLength() > 0) {
- img = new IntroImage((Element) imgElements.item(0), getBundle(),
- base);
- img.setParent(this);
- }
- }
+ // There should be at most one img element.
+ NodeList imgElements = element.getElementsByTagName(TAG_IMG);
+ if (imgElements.getLength() > 0) {
+ img = new IntroImage((Element) imgElements.item(0), getBundle(),
+ base);
+ img.setParent(this);
+ }
+ }
- /**
- * @return Returns the label.
- */
- public String getLabel() {
- IntroModelRoot root = getModelRoot();
- if (root!=null) {
- return root.resolveVariables(label);
- }
- return label;
- }
+ /**
+ * @return Returns the label.
+ */
+ public String getLabel() {
+ IntroModelRoot root = getModelRoot();
+ if (root!=null) {
+ return root.resolveVariables(label);
+ }
+ return label;
+ }
- /**
- * @return Returns the url.
- */
- public String getUrl() {
- return url;
- }
+ /**
+ * @return Returns the url.
+ */
+ public String getUrl() {
+ return url;
+ }
- /**
- * Retruns an IntroURL instance if link has a valid intro url. Returns null
- * otherwise.
- *
- * @return Returns the introURL.
- */
- public IntroURL getIntroURL() {
- return introURL;
- }
+ /**
+ * Retruns an IntroURL instance if link has a valid intro url. Returns null
+ * otherwise.
+ *
+ * @return Returns the introURL.
+ */
+ public IntroURL getIntroURL() {
+ return introURL;
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.LINK;
- }
+ return AbstractIntroElement.LINK;
+ }
- /**
- * @return Returns the img.
- */
- public IntroImage getImg() {
- return img;
- }
+ /**
+ * @return Returns the img.
+ */
+ public IntroImage getImg() {
+ return img;
+ }
- /**
- * Deep copy since class has mutable objects.
- */
- @Override
+ /**
+ * Deep copy since class has mutable objects.
+ */
+ @Override
public Object clone() throws CloneNotSupportedException {
- IntroLink clone = (IntroLink) super.clone();
- if (img != null) {
- IntroImage cloneIntroImage = (IntroImage) img.clone();
- cloneIntroImage.setParent(clone);
- clone.img = cloneIntroImage;
- }
- // no need to clobe IntroURL.
- return clone;
- }
+ IntroLink clone = (IntroLink) super.clone();
+ if (img != null) {
+ IntroImage cloneIntroImage = (IntroImage) img.clone();
+ cloneIntroImage.setParent(clone);
+ clone.img = cloneIntroImage;
+ }
+ // no need to clobe IntroURL.
+ return clone;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
index 2151ddedb..fbde4a244 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java
@@ -103,862 +103,862 @@ import org.w3c.dom.Node;
*/
public class IntroModelRoot extends AbstractIntroContainer {
- /**
- * Model constants that fire property change event when they are changed in
- * the model.
- */
- public static final int CURRENT_PAGE_PROPERTY_ID = 1;
-
- private static final String ATT_CONTENT = "content"; //$NON-NLS-1$
- private static final String ATT_CONFIGURER = "configurer"; //$NON-NLS-1$
- private static final String VAR_THEME = "theme"; //$NON-NLS-1$
- private static final String VAR_DIRECTION = "direction"; //$NON-NLS-1$
-
- // False if there is no valid contribution to the
- // org.eclipse.ui.intro.config extension point. Start off with true, and set
- // to false whenever something bad happens.
- private boolean hasValidConfig = true;
- private IntroConfigurer configurer;
- private IntroTheme theme;
- private IntroPartPresentation introPartPresentation;
- private IntroHomePage rootPage;
- private String currentPageId;
- private String startPageId;
- private AbstractIntroPage standbyPage;
- private AbstractIntroPage homePage;
+ /**
+ * Model constants that fire property change event when they are changed in
+ * the model.
+ */
+ public static final int CURRENT_PAGE_PROPERTY_ID = 1;
+
+ private static final String ATT_CONTENT = "content"; //$NON-NLS-1$
+ private static final String ATT_CONFIGURER = "configurer"; //$NON-NLS-1$
+ private static final String VAR_THEME = "theme"; //$NON-NLS-1$
+ private static final String VAR_DIRECTION = "direction"; //$NON-NLS-1$
+
+ // False if there is no valid contribution to the
+ // org.eclipse.ui.intro.config extension point. Start off with true, and set
+ // to false whenever something bad happens.
+ private boolean hasValidConfig = true;
+ private IntroConfigurer configurer;
+ private IntroTheme theme;
+ private IntroPartPresentation introPartPresentation;
+ private IntroHomePage rootPage;
+ private String currentPageId;
+ private String startPageId;
+ private AbstractIntroPage standbyPage;
+ private AbstractIntroPage homePage;
private String modelStandbyPageId;
- // the config extensions for this model.
- private IConfigurationElement[] configExtensionElements;
+ // the config extensions for this model.
+ private IConfigurationElement[] configExtensionElements;
- // maintain listener list for model changes.
+ // maintain listener list for model changes.
public ListenerList<IPropertyListener> propChangeListeners = new ListenerList<>();
- // a list to hold all loaded DOMs until resolving all configExtensions
- // is done.
+ // a list to hold all loaded DOMs until resolving all configExtensions
+ // is done.
private List<ExtensionContent> unresolvedConfigExt = new ArrayList<>();
- private class ExtensionContent {
- Element element;
- IConfigurationElement configExtElement;
- ExtensionContent(Element element,
- IConfigurationElement configExtElement) {
- this.element = element;
- this.configExtElement = configExtElement;
- }
- }
-
- /**
- * Model root. Takes a configElement that represents <config>in the
- * plugin.xml markup AND all the extension contributed to this model through
- * the configExtension point.
- */
- public IntroModelRoot(IConfigurationElement configElement,
- IConfigurationElement[] configExtensionElements) {
- // the config element that represents the correct model root.
- super(configElement);
- this.configExtensionElements = configExtensionElements;
-
- }
-
- public void loadModel() {
- getChildren();
- determineHomePage();
- }
-
- /**
- * Loads the full model. The children of a model root are the presentation,
- * followed by all pages, and all shared groups. Then if the model has
- * extension, its the unresolved container extensions, followed by all
- * extension pages and groups. The presentation is loaded from the
- * IConfiguration element representing the config. All else is loaded from
- * xml content file.
- *
- */
- @Override
+ private class ExtensionContent {
+ Element element;
+ IConfigurationElement configExtElement;
+ ExtensionContent(Element element,
+ IConfigurationElement configExtElement) {
+ this.element = element;
+ this.configExtElement = configExtElement;
+ }
+ }
+
+ /**
+ * Model root. Takes a configElement that represents <config>in the
+ * plugin.xml markup AND all the extension contributed to this model through
+ * the configExtension point.
+ */
+ public IntroModelRoot(IConfigurationElement configElement,
+ IConfigurationElement[] configExtensionElements) {
+ // the config element that represents the correct model root.
+ super(configElement);
+ this.configExtensionElements = configExtensionElements;
+
+ }
+
+ public void loadModel() {
+ getChildren();
+ determineHomePage();
+ }
+
+ /**
+ * Loads the full model. The children of a model root are the presentation,
+ * followed by all pages, and all shared groups. Then if the model has
+ * extension, its the unresolved container extensions, followed by all
+ * extension pages and groups. The presentation is loaded from the
+ * IConfiguration element representing the config. All else is loaded from
+ * xml content file.
+ *
+ */
+ @Override
protected void loadChildren() {
children = new Vector<>();
- if (Log.logInfo)
- Log.info("Creating Intro plugin model...."); //$NON-NLS-1$
-
- // load presentation first and create the model class for it. If there
- // is more than one presentation, load first one, and log rest.
- IConfigurationElement presentationElement = loadPresentation();
- if (presentationElement == null) {
- // no presentations at all, exit.
- setModelState(true, false);
- Log.warning("Could not find presentation element in intro config."); //$NON-NLS-1$
- return;
- }
-
- loadTheme();
- loadConfigurer();
-
- introPartPresentation = new IntroPartPresentation(presentationElement);
- children.add(introPartPresentation);
- // set parent.
- introPartPresentation.setParent(this);
-
- // now load all children of the config. There should only be pages and
- // groups here. And order is not important. These elements are loaded
- // from the content file DOM.
- Document document = loadDOM(getCfgElement());
- if (document == null) {
- // we failed to parse the content file. Intro Parser would have
- // logged the fact. Parser would also have checked to see if the
- // content file has the correct root tag.
- setModelState(true, false);
- return;
- }
-
- // set base for this model.
- this.base = getBase(getCfgElement());
-
- // now load content.
- loadPages(document, getBundle());
- loadSharedGroups(document, getBundle());
-
- // Attributes of root page decide if we have a static or dynamic case.
- setModelState(true, true);
+ if (Log.logInfo)
+ Log.info("Creating Intro plugin model...."); //$NON-NLS-1$
+
+ // load presentation first and create the model class for it. If there
+ // is more than one presentation, load first one, and log rest.
+ IConfigurationElement presentationElement = loadPresentation();
+ if (presentationElement == null) {
+ // no presentations at all, exit.
+ setModelState(true, false);
+ Log.warning("Could not find presentation element in intro config."); //$NON-NLS-1$
+ return;
+ }
+
+ loadTheme();
+ loadConfigurer();
+
+ introPartPresentation = new IntroPartPresentation(presentationElement);
+ children.add(introPartPresentation);
+ // set parent.
+ introPartPresentation.setParent(this);
+
+ // now load all children of the config. There should only be pages and
+ // groups here. And order is not important. These elements are loaded
+ // from the content file DOM.
+ Document document = loadDOM(getCfgElement());
+ if (document == null) {
+ // we failed to parse the content file. Intro Parser would have
+ // logged the fact. Parser would also have checked to see if the
+ // content file has the correct root tag.
+ setModelState(true, false);
+ return;
+ }
+
+ // set base for this model.
+ this.base = getBase(getCfgElement());
+
+ // now load content.
+ loadPages(document, getBundle());
+ loadSharedGroups(document, getBundle());
+
+ // Attributes of root page decide if we have a static or dynamic case.
+ setModelState(true, true);
if (configurer != null) {
// The configurer may vary its returned results based on the theme
// properties
configurer.bind(this);
}
- }
-
- /**
- * Sets the presentation to the given presentation. The model always has the
- * presentation as the first child, so use that fact. This method is used
- * for dynamic awarness to enable replacing the new presentation with the
- * existing one after a model refresh.
- *
- * @param presentation
- */
- public void setPresentation(IntroPartPresentation presentation) {
- this.introPartPresentation = presentation;
- presentation.setParent(this);
- children.set(0, presentation);
- }
-
- /**
- * Resolve contributions into this container's children.
- */
- @Override
+ }
+
+ /**
+ * Sets the presentation to the given presentation. The model always has the
+ * presentation as the first child, so use that fact. This method is used
+ * for dynamic awarness to enable replacing the new presentation with the
+ * existing one after a model refresh.
+ *
+ * @param presentation
+ */
+ public void setPresentation(IntroPartPresentation presentation) {
+ this.introPartPresentation = presentation;
+ presentation.setParent(this);
+ children.set(0, presentation);
+ }
+
+ /**
+ * Resolve contributions into this container's children.
+ */
+ @Override
protected void resolveChildren() {
- // now handle config extension.
- resolveConfigExtensions();
- resolved = true;
- }
-
- private IConfigurationElement loadPresentation() {
- // If there is more than one presentation, load first one, and log
- // rest.
- IConfigurationElement[] presentationElements = getCfgElement()
- .getChildren(IntroPartPresentation.TAG_PRESENTATION);
-
- IConfigurationElement presentationElement = ModelLoaderUtil
- .validateSingleContribution(presentationElements,
- IntroPartPresentation.ATT_HOME_PAGE_ID);
- return presentationElement;
- }
-
- private void loadConfigurer() {
- String cname = getCfgElement().getAttribute(ATT_CONFIGURER);
- if (cname!=null) {
- try {
- Object obj = getCfgElement().createExecutableExtension(ATT_CONFIGURER);
+ // now handle config extension.
+ resolveConfigExtensions();
+ resolved = true;
+ }
+
+ private IConfigurationElement loadPresentation() {
+ // If there is more than one presentation, load first one, and log
+ // rest.
+ IConfigurationElement[] presentationElements = getCfgElement()
+ .getChildren(IntroPartPresentation.TAG_PRESENTATION);
+
+ IConfigurationElement presentationElement = ModelLoaderUtil
+ .validateSingleContribution(presentationElements,
+ IntroPartPresentation.ATT_HOME_PAGE_ID);
+ return presentationElement;
+ }
+
+ private void loadConfigurer() {
+ String cname = getCfgElement().getAttribute(ATT_CONFIGURER);
+ if (cname!=null) {
+ try {
+ Object obj = getCfgElement().createExecutableExtension(ATT_CONFIGURER);
if (obj instanceof IntroConfigurer) {
- configurer = (IntroConfigurer)obj;
+ configurer = (IntroConfigurer)obj;
+ }
+ }
+ catch (CoreException e) {
+ Log.error("Error loading intro configurer", e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ private void determineHomePage() {
+ homePage = rootPage; // Default, may be overridden
+ if (Platform.getProduct() == null) {
+ return;
+ }
+ String pid = Platform.getProduct().getId();
+ startPageId = getProcessPreference("INTRO_START_PAGE", pid); //$NON-NLS-1$
+ String homePagePreference = getProcessPreference("INTRO_HOME_PAGE", pid); //$NON-NLS-1$
+ if (homePagePreference.length() != 0) {
+ AbstractIntroPage page = (AbstractIntroPage) findChild(homePagePreference,
+ ABSTRACT_PAGE);
+ if (page != null) {
+ homePage = page;
+ if(startPageId.length() == 0) {
+ startPageId = homePagePreference;
+ }
}
- }
- catch (CoreException e) {
- Log.error("Error loading intro configurer", e); //$NON-NLS-1$
- }
- }
- }
-
- private void determineHomePage() {
- homePage = rootPage; // Default, may be overridden
- if (Platform.getProduct() == null) {
- return;
- }
- String pid = Platform.getProduct().getId();
- startPageId = getProcessPreference("INTRO_START_PAGE", pid); //$NON-NLS-1$
- String homePagePreference = getProcessPreference("INTRO_HOME_PAGE", pid); //$NON-NLS-1$
- if (homePagePreference.length() != 0) {
- AbstractIntroPage page = (AbstractIntroPage) findChild(homePagePreference,
- ABSTRACT_PAGE);
- if (page != null) {
- homePage = page;
- if(startPageId.length() == 0) {
- startPageId = homePagePreference;
- }
- }
- }
- String standbyPagePreference = getProcessPreference("INTRO_STANDBY_PAGE", pid); //$NON-NLS-1$
- modelStandbyPageId = getPresentation().getStandbyPageId();
-
- if (standbyPagePreference.length() != 0) {
- standbyPage = (AbstractIntroPage) findChild(standbyPagePreference,
- ABSTRACT_PAGE);
- }
- if (standbyPage == null && modelStandbyPageId != null && modelStandbyPageId.length() != 0) {
- standbyPage = (AbstractIntroPage) findChild(modelStandbyPageId,
- ABSTRACT_PAGE);
- }
- if (standbyPage != null) {
- standbyPage.setStandbyPage(true);
- }
- }
-
- private void loadTheme() {
- String pid = Platform.getProduct() != null ? Platform.getProduct().getId() : null;
- String themeId = pid != null ? getProcessPreference("INTRO_THEME", pid) : null; //$NON-NLS-1$
-
- IConfigurationElement [] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.ui.intro.configExtension"); //$NON-NLS-1$
- IConfigurationElement themeElement=null;
- for (int i=0; i<elements.length; i++) {
- if (elements[i].getName().equals("theme")) { //$NON-NLS-1$
- String id = elements[i].getAttribute("id"); //$NON-NLS-1$
- if (themeId!=null) {
- if (id!=null && themeId.equals(id)) {
- // use this one
- themeElement = elements[i];
- break;
- }
- }
- else {
- // see if this one is the default
- String value = elements[i].getAttribute("default"); //$NON-NLS-1$
- if (value!=null && value.equalsIgnoreCase("true")) { //$NON-NLS-1$
- themeElement = elements[i];
- break;
- }
- }
- }
- }
- if (themeElement!=null) {
- theme = new IntroTheme(themeElement);
- }
- }
-
- /**
- * Loads all pages defined in this config from the xml content file.
- */
- private void loadPages(Document dom, Bundle bundle) {
- String rootPageId = getPresentation().getHomePageId();
- Element[] pages = ModelUtil.getElementsByTagName(dom,
- AbstractIntroPage.TAG_PAGE);
- for (int i = 0; i < pages.length; i++) {
- Element pageElement = pages[i];
- if (pageElement.getAttribute(AbstractIntroIdElement.ATT_ID).equals(
- rootPageId)) {
- // Create the model class for the Root Page.
- rootPage = new IntroHomePage(pageElement, bundle, base);
- rootPage.setParent(this);
- currentPageId = rootPage.getId();
- children.add(rootPage);
- } else {
- // Create the model class for an intro Page.
- IntroPage page = new IntroPage(pageElement, bundle, base);
- page.setParent(this);
- children.add(page);
- }
- }
- }
-
- /**
- * Loads all shared groups defined in this config, from the DOM.
- */
- private void loadSharedGroups(Document dom, Bundle bundle) {
- Element[] groups = ModelUtil.getElementsByTagName(dom,
- IntroGroup.TAG_GROUP);
- for (int i = 0; i < groups.length; i++) {
- IntroGroup group = new IntroGroup(groups[i], bundle, base);
- group.setParent(this);
- children.add(group);
- }
- }
-
- /**
- * Handles all the configExtensions to this current model. Resolving
- * configExts means finding target anchor and inserting extension content at
- * target. Also, several passes are used to resolve as many extensions as
- * possible. This allows for resolving nested anchors (ie: anchors to
- * anchors in contributions).
- */
- private void resolveConfigExtensions() {
- for (int i = 0; i < configExtensionElements.length; i++) {
- processConfigExtension(configExtensionElements[i]);
- }
-
- tryResolvingExtensions();
-
- // At this stage all pages will be resolved, some contributions may not be
-
- // now add all unresolved extensions as model children and log fact.
- Iterator keys = unresolvedConfigExt.iterator();
- while (keys.hasNext()) {
- ExtensionContent extension = (ExtensionContent) keys.next();
- Element configExtensionElement = extension.element;
- IConfigurationElement configExtConfigurationElement = extension.configExtElement;
- Bundle bundle = BundleUtil
- .getBundleFromConfigurationElement(configExtConfigurationElement);
- String base = getBase(configExtConfigurationElement);
- children.add(new IntroExtensionContent(configExtensionElement,
- bundle, base, configExtConfigurationElement));
-
- // INTRO: fix log strings.
- Log
- .warning("Could not resolve the following configExtension: " //$NON-NLS-1$
- + ModelLoaderUtil.getLogString(bundle,
- configExtensionElement,
- IntroExtensionContent.ATT_PATH));
- }
- }
-
- private void processConfigExtension(IConfigurationElement configExtElement) {
- // This call will extract the parent folder if needed.
- Document dom = loadDOM(configExtElement);
- if (dom == null)
- // we failed to parse the content file. Intro Parser would
- // have logged the fact. Parser would also have checked to
- // see if the content file has the correct root tag.
- return;
- processConfigExtension(dom, configExtElement);
- }
-
-
- private void processConfigExtension(Document dom,
- IConfigurationElement configExtElement) {
-
- // Find the target of this container extension, and add all its
- // children to target. Make sure to pass correct bundle and base to
- // propagate to all children.
- String base = getBase(configExtElement);
- Element[] extensionContentElements = loadExtensionContent(dom,
- configExtElement, base);
- for (int i = 0; i < extensionContentElements.length; i++) {
- Element extensionContentElement = extensionContentElements[i];
- unresolvedConfigExt.add(new ExtensionContent(extensionContentElement,
- configExtElement));
- }
-
- // Now load all pages and shared groups
- // from this config extension. Get the bundle from the extensions since they are
- // defined in other plugins.
- Bundle bundle = BundleUtil
- .getBundleFromConfigurationElement(configExtElement);
-
- Element[] pages = ModelUtil.getElementsByTagName(dom,
- AbstractIntroPage.TAG_PAGE);
- for (int j = 0; j < pages.length; j++) {
- // Create the model class for an intro Page.
- if (!UAContentFilter.isFiltered(UAElementFactory.newElement(pages[j]), IntroEvaluationContext.getContext())) {
- IntroPage page = new IntroPage(pages[j], bundle, base);
- page.setParent(this);
- children.add(page);
- }
- }
- }
-
- private void tryResolvingExtensions() {
- int previousSize;
- do {
- previousSize = unresolvedConfigExt.size();
+ }
+ String standbyPagePreference = getProcessPreference("INTRO_STANDBY_PAGE", pid); //$NON-NLS-1$
+ modelStandbyPageId = getPresentation().getStandbyPageId();
+
+ if (standbyPagePreference.length() != 0) {
+ standbyPage = (AbstractIntroPage) findChild(standbyPagePreference,
+ ABSTRACT_PAGE);
+ }
+ if (standbyPage == null && modelStandbyPageId != null && modelStandbyPageId.length() != 0) {
+ standbyPage = (AbstractIntroPage) findChild(modelStandbyPageId,
+ ABSTRACT_PAGE);
+ }
+ if (standbyPage != null) {
+ standbyPage.setStandbyPage(true);
+ }
+ }
+
+ private void loadTheme() {
+ String pid = Platform.getProduct() != null ? Platform.getProduct().getId() : null;
+ String themeId = pid != null ? getProcessPreference("INTRO_THEME", pid) : null; //$NON-NLS-1$
+
+ IConfigurationElement [] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.ui.intro.configExtension"); //$NON-NLS-1$
+ IConfigurationElement themeElement=null;
+ for (int i=0; i<elements.length; i++) {
+ if (elements[i].getName().equals("theme")) { //$NON-NLS-1$
+ String id = elements[i].getAttribute("id"); //$NON-NLS-1$
+ if (themeId!=null) {
+ if (id!=null && themeId.equals(id)) {
+ // use this one
+ themeElement = elements[i];
+ break;
+ }
+ }
+ else {
+ // see if this one is the default
+ String value = elements[i].getAttribute("default"); //$NON-NLS-1$
+ if (value!=null && value.equalsIgnoreCase("true")) { //$NON-NLS-1$
+ themeElement = elements[i];
+ break;
+ }
+ }
+ }
+ }
+ if (themeElement!=null) {
+ theme = new IntroTheme(themeElement);
+ }
+ }
+
+ /**
+ * Loads all pages defined in this config from the xml content file.
+ */
+ private void loadPages(Document dom, Bundle bundle) {
+ String rootPageId = getPresentation().getHomePageId();
+ Element[] pages = ModelUtil.getElementsByTagName(dom,
+ AbstractIntroPage.TAG_PAGE);
+ for (int i = 0; i < pages.length; i++) {
+ Element pageElement = pages[i];
+ if (pageElement.getAttribute(AbstractIntroIdElement.ATT_ID).equals(
+ rootPageId)) {
+ // Create the model class for the Root Page.
+ rootPage = new IntroHomePage(pageElement, bundle, base);
+ rootPage.setParent(this);
+ currentPageId = rootPage.getId();
+ children.add(rootPage);
+ } else {
+ // Create the model class for an intro Page.
+ IntroPage page = new IntroPage(pageElement, bundle, base);
+ page.setParent(this);
+ children.add(page);
+ }
+ }
+ }
+
+ /**
+ * Loads all shared groups defined in this config, from the DOM.
+ */
+ private void loadSharedGroups(Document dom, Bundle bundle) {
+ Element[] groups = ModelUtil.getElementsByTagName(dom,
+ IntroGroup.TAG_GROUP);
+ for (int i = 0; i < groups.length; i++) {
+ IntroGroup group = new IntroGroup(groups[i], bundle, base);
+ group.setParent(this);
+ children.add(group);
+ }
+ }
+
+ /**
+ * Handles all the configExtensions to this current model. Resolving
+ * configExts means finding target anchor and inserting extension content at
+ * target. Also, several passes are used to resolve as many extensions as
+ * possible. This allows for resolving nested anchors (ie: anchors to
+ * anchors in contributions).
+ */
+ private void resolveConfigExtensions() {
+ for (int i = 0; i < configExtensionElements.length; i++) {
+ processConfigExtension(configExtensionElements[i]);
+ }
+
+ tryResolvingExtensions();
+
+ // At this stage all pages will be resolved, some contributions may not be
+
+ // now add all unresolved extensions as model children and log fact.
+ Iterator keys = unresolvedConfigExt.iterator();
+ while (keys.hasNext()) {
+ ExtensionContent extension = (ExtensionContent) keys.next();
+ Element configExtensionElement = extension.element;
+ IConfigurationElement configExtConfigurationElement = extension.configExtElement;
+ Bundle bundle = BundleUtil
+ .getBundleFromConfigurationElement(configExtConfigurationElement);
+ String base = getBase(configExtConfigurationElement);
+ children.add(new IntroExtensionContent(configExtensionElement,
+ bundle, base, configExtConfigurationElement));
+
+ // INTRO: fix log strings.
+ Log
+ .warning("Could not resolve the following configExtension: " //$NON-NLS-1$
+ + ModelLoaderUtil.getLogString(bundle,
+ configExtensionElement,
+ IntroExtensionContent.ATT_PATH));
+ }
+ }
+
+ private void processConfigExtension(IConfigurationElement configExtElement) {
+ // This call will extract the parent folder if needed.
+ Document dom = loadDOM(configExtElement);
+ if (dom == null)
+ // we failed to parse the content file. Intro Parser would
+ // have logged the fact. Parser would also have checked to
+ // see if the content file has the correct root tag.
+ return;
+ processConfigExtension(dom, configExtElement);
+ }
+
+
+ private void processConfigExtension(Document dom,
+ IConfigurationElement configExtElement) {
+
+ // Find the target of this container extension, and add all its
+ // children to target. Make sure to pass correct bundle and base to
+ // propagate to all children.
+ String base = getBase(configExtElement);
+ Element[] extensionContentElements = loadExtensionContent(dom,
+ configExtElement, base);
+ for (int i = 0; i < extensionContentElements.length; i++) {
+ Element extensionContentElement = extensionContentElements[i];
+ unresolvedConfigExt.add(new ExtensionContent(extensionContentElement,
+ configExtElement));
+ }
+
+ // Now load all pages and shared groups
+ // from this config extension. Get the bundle from the extensions since they are
+ // defined in other plugins.
+ Bundle bundle = BundleUtil
+ .getBundleFromConfigurationElement(configExtElement);
+
+ Element[] pages = ModelUtil.getElementsByTagName(dom,
+ AbstractIntroPage.TAG_PAGE);
+ for (int j = 0; j < pages.length; j++) {
+ // Create the model class for an intro Page.
+ if (!UAContentFilter.isFiltered(UAElementFactory.newElement(pages[j]), IntroEvaluationContext.getContext())) {
+ IntroPage page = new IntroPage(pages[j], bundle, base);
+ page.setParent(this);
+ children.add(page);
+ }
+ }
+ }
+
+ private void tryResolvingExtensions() {
+ int previousSize;
+ do {
+ previousSize = unresolvedConfigExt.size();
List<ExtensionContent> stillUnresolved = new ArrayList<>();
for (ExtensionContent content : unresolvedConfigExt) {
- Element extensionContentElement = content.element;
- IConfigurationElement configExtElement = content.configExtElement;
+ Element extensionContentElement = content.element;
+ IConfigurationElement configExtElement = content.configExtElement;
Bundle bundle = BundleUtil.getBundleFromConfigurationElement(configExtElement);
String elementBase = getBase(configExtElement);
- processOneExtension(configExtElement, elementBase, bundle, extensionContentElement);
+ processOneExtension(configExtElement, elementBase, bundle, extensionContentElement);
if (extensionContentElement.hasAttribute("failed")) { //$NON-NLS-1$
stillUnresolved.add(content);
}
- }
- unresolvedConfigExt = stillUnresolved;
- } while (unresolvedConfigExt.size() < previousSize);
- }
-
- /**
- * load the extension content of this configExtension into model classes,
- * and insert them at target. A config extension can have only ONE extension
- * content. This is because if the extension fails, we need to be able to
- * not include the page and group contributions as part of the model. If
- * extension content has XHTML content (ie: content attribute is defined) we
- * load extension DOM into target page dom.
- *
- * note: the extension Element is returned to enable creating a child model
- * element on failure.
- *
- * @param
- * @return
- */
- private Element[] loadExtensionContent(Document dom,
- IConfigurationElement configExtElement, String base) {
-
- // get the bundle from the extensions since they are defined in
- // other plugins.
+ }
+ unresolvedConfigExt = stillUnresolved;
+ } while (unresolvedConfigExt.size() < previousSize);
+ }
+
+ /**
+ * load the extension content of this configExtension into model classes,
+ * and insert them at target. A config extension can have only ONE extension
+ * content. This is because if the extension fails, we need to be able to
+ * not include the page and group contributions as part of the model. If
+ * extension content has XHTML content (ie: content attribute is defined) we
+ * load extension DOM into target page dom.
+ *
+ * note: the extension Element is returned to enable creating a child model
+ * element on failure.
+ *
+ * @param
+ * @return
+ */
+ private Element[] loadExtensionContent(Document dom,
+ IConfigurationElement configExtElement, String base) {
+
+ // get the bundle from the extensions since they are defined in
+ // other plugins.
List<Element> elements = new ArrayList<>();
- Element[] extensionContents = ModelUtil.getElementsByTagName(dom,
- IntroExtensionContent.TAG_CONTAINER_EXTENSION);
- Element[] replacementContents = ModelUtil.getElementsByTagName(dom,
- IntroExtensionContent.TAG_CONTAINER_REPLACE);
+ Element[] extensionContents = ModelUtil.getElementsByTagName(dom,
+ IntroExtensionContent.TAG_CONTAINER_EXTENSION);
+ Element[] replacementContents = ModelUtil.getElementsByTagName(dom,
+ IntroExtensionContent.TAG_CONTAINER_REPLACE);
- addUnfilteredExtensions(elements, extensionContents);
- addUnfilteredExtensions(elements, replacementContents);
+ addUnfilteredExtensions(elements, extensionContents);
+ addUnfilteredExtensions(elements, replacementContents);
- return elements.toArray(new Element[elements.size()]);
- }
+ return elements.toArray(new Element[elements.size()]);
+ }
private void addUnfilteredExtensions(List<Element> elements, Element[] extensionContents) {
for (int i = 0; i < extensionContents.length; i++) {
- Element extensionContentElement = extensionContents[i];
- if (!UAContentFilter.isFiltered(UAElementFactory.newElement(extensionContentElement), IntroEvaluationContext.getContext())) {
- elements.add(extensionContentElement);
- }
- }
+ Element extensionContentElement = extensionContents[i];
+ if (!UAContentFilter.isFiltered(UAElementFactory.newElement(extensionContentElement), IntroEvaluationContext.getContext())) {
+ elements.add(extensionContentElement);
+ }
+ }
}
private void processOneExtension(IConfigurationElement configExtElement, String base, Bundle bundle,
Element extensionContentElement) {
// Create the model class for extension content.
IntroExtensionContent extensionContent = new IntroExtensionContent(
- extensionContentElement, bundle, base, configExtElement);
+ extensionContentElement, bundle, base, configExtElement);
boolean success = false;
if (extensionContent.isXHTMLContent())
- success = loadXHTMLExtensionContent(extensionContent);
+ success = loadXHTMLExtensionContent(extensionContent);
else
- success = load3_0ExtensionContent(extensionContent);
+ success = load3_0ExtensionContent(extensionContent);
if (success) {
- if (extensionContentElement.hasAttribute("failed")) //$NON-NLS-1$
- extensionContentElement.removeAttribute("failed"); //$NON-NLS-1$
+ if (extensionContentElement.hasAttribute("failed")) //$NON-NLS-1$
+ extensionContentElement.removeAttribute("failed"); //$NON-NLS-1$
} else
- extensionContentElement.setAttribute("failed", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- /**
- * Insert the extension content into the target.
- *
- * @param extensionContent
- * @return
- */
- private boolean loadXHTMLExtensionContent(
- IntroExtensionContent extensionContent) {
- String path = extensionContent.getPath();
- // path must be pageId/anchorID in the case of anchors in XHTML pages.
- String[] pathSegments = path.split("/"); //$NON-NLS-1$
- if (pathSegments.length != 2)
- // path does not have correct format.
- return false;
- AbstractIntroPage targetPage = (AbstractIntroPage) findChild(
- pathSegments[0], ABSTRACT_PAGE);
- if (targetPage == null)
- // target could not be found. Signal failure.
- return false;
-
- // Insert all children of this extension before the target element. Anchors need
- // to stay in DOM, even after all extensions have been resolved, to enable other
- // plugins to contribute. Find the target node.
- Document pageDom = targetPage.getDocument();
- Element targetElement = targetPage.findDomChild(pathSegments[1], "*"); //$NON-NLS-1$
- if (targetElement == null)
- return false;
-
- // get extension content
- Element[] elements = extensionContent.getElements();
- // insert all children before anchor in page body.
- for (int i = 0; i < elements.length; i++) {
- Node targetNode = pageDom.importNode(elements[i], true);
- // update the src attribute of this node, if defined by w3
- // specs.
-
- ModelUtil.updateResourceAttributes((Element) targetNode,
- extensionContent);
- targetElement.getParentNode().insertBefore(targetNode, targetElement);
- }
-
- if (extensionContent.getExtensionType() == IntroExtensionContent.TYPE_REPLACEMENT) {
- targetElement.getParentNode().removeChild(targetElement);
- }
-
- // now handle style inheritance.
- // Update the parent page styles. skip style if it is null;
- String[] styles = extensionContent.getStyles();
- if (styles != null) {
- for (int i = 0; i < styles.length; i++)
- ModelUtil.insertStyle(pageDom, styles[i]);
- }
-
- return true;
-
- }
-
-
-
- /**
- * Insert the extension content (3.0 format) into the target.
- *
- * @param extensionContent
- * @return
- */
- private boolean load3_0ExtensionContent(IntroExtensionContent extensionContent) {
- String path = extensionContent.getPath();
- int type = extensionContent.getExtensionType();
- AbstractIntroElement target = findTarget(this, path, extensionContent.getId());
- if (target != null && target.isOfType(AbstractIntroElement.ANCHOR) == (type == IntroExtensionContent.TYPE_CONTRIBUTION)) {
- // insert all children of this extension before the target element/anchor.
- insertExtensionChildren(target, extensionContent, extensionContent.getBundle(), extensionContent.getBase());
- // anchors need to stay around to receive other contributions
- if (type == IntroExtensionContent.TYPE_REPLACEMENT) {
- AbstractIntroContainer parent = (AbstractIntroContainer)target.getParent();
- parent.removeChild(target);
- }
- handleExtensionStyleInheritence(target, extensionContent);
- return true;
- }
- // appropriate target could not be found. Signal failure.
- return false;
- }
-
- private void insertExtensionChildren(AbstractIntroElement target,
- IntroExtensionContent extensionContent, Bundle bundle, String base) {
- AbstractIntroContainer parent = (AbstractIntroContainer)target.getParent();
- // insert the elements of the extension before the target
- String mixinStyle = getMixinStyle(extensionContent);
- Element [] children = extensionContent.getChildren();
- parent.insertElementsBefore(children, bundle, base, target, mixinStyle);
- }
-
- private String getMixinStyle(IntroExtensionContent extensionContent) {
- String path = extensionContent.getPath();
- if (!path.endsWith("/@")) //$NON-NLS-1$
- return null;
- String pageId = path.substring(0, path.length()-2);
- IntroModelRoot modelRoot = getModelRoot();
- if (modelRoot==null)
- return null;
- IntroConfigurer configurer = modelRoot.getConfigurer();
- if (configurer==null)
- return null;
- String extensionId = extensionContent.getId();
- // if this is a replace, take the mixin style as what is being replaced
- if (extensionContent.getExtensionType() == IntroExtensionContent.TYPE_REPLACEMENT) {
- IPath ipath = new Path(extensionContent.getPath());
- String s2 = ipath.segment(1);
- if (s2 != null && s2.startsWith("@") && s2.length() > 1) { //$NON-NLS-1$
- extensionId = s2.substring(1);
- }
- }
- return configurer.getMixinStyle(pageId, extensionId);
- }
-
-
- /**
- * Updates the inherited styles based on the style attribtes defined in the
- * configExtension. If we are extending a shared group do nothing. For
- * inherited alt-styles, we have to cache the bundle from which we inherited
- * the styles to be able to access resources in that plugin.
- *
- * @param include
- * @param target
- */
- private void handleExtensionStyleInheritence(AbstractIntroElement target,
- IntroExtensionContent extension) {
-
- AbstractIntroContainer targetContainer = (AbstractIntroContainer)target.getParent();
- if (targetContainer.getType() == AbstractIntroElement.GROUP
- && targetContainer.getParent().getType() == AbstractIntroElement.MODEL_ROOT)
- // if we are extending a shared group, defined under a config, we
- // can not include styles.
- return;
-
- // Update the parent page styles. skip style if it is null;
- String[] styles = extension.getStyles();
- if (styles != null)
- targetContainer.getParentPage().addStyles(styles);
-
- // for alt-style cache bundle for loading resources.
+ extensionContentElement.setAttribute("failed", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+
+ /**
+ * Insert the extension content into the target.
+ *
+ * @param extensionContent
+ * @return
+ */
+ private boolean loadXHTMLExtensionContent(
+ IntroExtensionContent extensionContent) {
+ String path = extensionContent.getPath();
+ // path must be pageId/anchorID in the case of anchors in XHTML pages.
+ String[] pathSegments = path.split("/"); //$NON-NLS-1$
+ if (pathSegments.length != 2)
+ // path does not have correct format.
+ return false;
+ AbstractIntroPage targetPage = (AbstractIntroPage) findChild(
+ pathSegments[0], ABSTRACT_PAGE);
+ if (targetPage == null)
+ // target could not be found. Signal failure.
+ return false;
+
+ // Insert all children of this extension before the target element. Anchors need
+ // to stay in DOM, even after all extensions have been resolved, to enable other
+ // plugins to contribute. Find the target node.
+ Document pageDom = targetPage.getDocument();
+ Element targetElement = targetPage.findDomChild(pathSegments[1], "*"); //$NON-NLS-1$
+ if (targetElement == null)
+ return false;
+
+ // get extension content
+ Element[] elements = extensionContent.getElements();
+ // insert all children before anchor in page body.
+ for (int i = 0; i < elements.length; i++) {
+ Node targetNode = pageDom.importNode(elements[i], true);
+ // update the src attribute of this node, if defined by w3
+ // specs.
+
+ ModelUtil.updateResourceAttributes((Element) targetNode,
+ extensionContent);
+ targetElement.getParentNode().insertBefore(targetNode, targetElement);
+ }
+
+ if (extensionContent.getExtensionType() == IntroExtensionContent.TYPE_REPLACEMENT) {
+ targetElement.getParentNode().removeChild(targetElement);
+ }
+
+ // now handle style inheritance.
+ // Update the parent page styles. skip style if it is null;
+ String[] styles = extensionContent.getStyles();
+ if (styles != null) {
+ for (int i = 0; i < styles.length; i++)
+ ModelUtil.insertStyle(pageDom, styles[i]);
+ }
+
+ return true;
+
+ }
+
+
+
+ /**
+ * Insert the extension content (3.0 format) into the target.
+ *
+ * @param extensionContent
+ * @return
+ */
+ private boolean load3_0ExtensionContent(IntroExtensionContent extensionContent) {
+ String path = extensionContent.getPath();
+ int type = extensionContent.getExtensionType();
+ AbstractIntroElement target = findTarget(this, path, extensionContent.getId());
+ if (target != null && target.isOfType(AbstractIntroElement.ANCHOR) == (type == IntroExtensionContent.TYPE_CONTRIBUTION)) {
+ // insert all children of this extension before the target element/anchor.
+ insertExtensionChildren(target, extensionContent, extensionContent.getBundle(), extensionContent.getBase());
+ // anchors need to stay around to receive other contributions
+ if (type == IntroExtensionContent.TYPE_REPLACEMENT) {
+ AbstractIntroContainer parent = (AbstractIntroContainer)target.getParent();
+ parent.removeChild(target);
+ }
+ handleExtensionStyleInheritence(target, extensionContent);
+ return true;
+ }
+ // appropriate target could not be found. Signal failure.
+ return false;
+ }
+
+ private void insertExtensionChildren(AbstractIntroElement target,
+ IntroExtensionContent extensionContent, Bundle bundle, String base) {
+ AbstractIntroContainer parent = (AbstractIntroContainer)target.getParent();
+ // insert the elements of the extension before the target
+ String mixinStyle = getMixinStyle(extensionContent);
+ Element [] children = extensionContent.getChildren();
+ parent.insertElementsBefore(children, bundle, base, target, mixinStyle);
+ }
+
+ private String getMixinStyle(IntroExtensionContent extensionContent) {
+ String path = extensionContent.getPath();
+ if (!path.endsWith("/@")) //$NON-NLS-1$
+ return null;
+ String pageId = path.substring(0, path.length()-2);
+ IntroModelRoot modelRoot = getModelRoot();
+ if (modelRoot==null)
+ return null;
+ IntroConfigurer configurer = modelRoot.getConfigurer();
+ if (configurer==null)
+ return null;
+ String extensionId = extensionContent.getId();
+ // if this is a replace, take the mixin style as what is being replaced
+ if (extensionContent.getExtensionType() == IntroExtensionContent.TYPE_REPLACEMENT) {
+ IPath ipath = new Path(extensionContent.getPath());
+ String s2 = ipath.segment(1);
+ if (s2 != null && s2.startsWith("@") && s2.length() > 1) { //$NON-NLS-1$
+ extensionId = s2.substring(1);
+ }
+ }
+ return configurer.getMixinStyle(pageId, extensionId);
+ }
+
+
+ /**
+ * Updates the inherited styles based on the style attribtes defined in the
+ * configExtension. If we are extending a shared group do nothing. For
+ * inherited alt-styles, we have to cache the bundle from which we inherited
+ * the styles to be able to access resources in that plugin.
+ *
+ * @param include
+ * @param target
+ */
+ private void handleExtensionStyleInheritence(AbstractIntroElement target,
+ IntroExtensionContent extension) {
+
+ AbstractIntroContainer targetContainer = (AbstractIntroContainer)target.getParent();
+ if (targetContainer.getType() == AbstractIntroElement.GROUP
+ && targetContainer.getParent().getType() == AbstractIntroElement.MODEL_ROOT)
+ // if we are extending a shared group, defined under a config, we
+ // can not include styles.
+ return;
+
+ // Update the parent page styles. skip style if it is null;
+ String[] styles = extension.getStyles();
+ if (styles != null)
+ targetContainer.getParentPage().addStyles(styles);
+
+ // for alt-style cache bundle for loading resources.
Map<String, Bundle> altStyles = extension.getAltStyles();
- if (altStyles != null)
- targetContainer.getParentPage().addAltStyles(altStyles);
- }
-
- /**
- * Sets the model state based on all the model classes.
- */
- private void setModelState(boolean loaded, boolean hasValidConfig) {
- this.loaded = loaded;
- this.hasValidConfig = hasValidConfig;
- }
-
- /**
- * Returns true if there is a valid contribution to
- * org.eclipse.ui.intro.config extension point, with a valid Presentation,
- * and pages.
- *
- * @return Returns the hasValidConfig.
- */
- public boolean hasValidConfig() {
- return hasValidConfig;
- }
-
- /**
- * @return Returns the introPartPresentation.
- */
- public IntroPartPresentation getPresentation() {
- return introPartPresentation;
- }
-
- public IntroConfigurer getConfigurer() {
- return configurer;
- }
-
- /**
- * @return Returns the home Page.
- */
- public AbstractIntroPage getHomePage() {
- return homePage;
- }
-
- /**
- * @return Returns the root Page.
- */
- public IntroHomePage getRootPage() {
- return rootPage;
- }
-
- /**
- * @return Returns the standby Page. May return null if standby page is not
- * defined.
- */
- public AbstractIntroPage getStandbyPage() {
- return standbyPage;
- }
-
- /**
- * @return all pages *excluding* the Home Page. If all pages are needed,
- * call <code>(AbstractIntroPage[])
- * getChildrenOfType(IntroElement.ABSTRACT_PAGE);</code>
- */
- public IntroPage[] getPages() {
- return (IntroPage[]) getChildrenOfType(AbstractIntroElement.PAGE);
- }
-
- /**
- * @return Returns the isdynamicIntro.
- */
- public boolean isDynamic() {
- if ("swt".equals(getPresentation().getImplementationKind())) { //$NON-NLS-1$
- return rootPage != null && rootPage.isDynamic();
- }
- return true;
- }
-
- /**
- * @return Returns the currentPageId.
- */
- public String getCurrentPageId() {
- return currentPageId;
- }
-
-
- /**
- * Sets the current page. If the model does not have a page with the passed
- * id, the message is logged, and the model retains its old current page.
- *
- * @param currentPageId
- * The currentPageId to set. *
- * @param fireEvent
- * flag to indicate if event notification is needed.
- * @return true if the model has a page with the passed id, false otherwise.
- * If the method fails, the current page remains the same as the
- * last state.
- */
- public boolean setCurrentPageId(String pageId, boolean fireEvent) {
- if (pageId.equals(currentPageId))
- // setting to the same page does nothing. Return true because we did
- // not actually fail. just a no op.
- return true;
-
- AbstractIntroPage page = (AbstractIntroPage) findChild(pageId,
- ABSTRACT_PAGE);
- if (page == null) {
- // not a page. Test for root page.
- if (!pageId.equals(rootPage.getId())) {
- // not a page nor the home page.
- Log
- .warning("Could not set current page to Intro page with id: " + pageId); //$NON-NLS-1$
- return false;
- }
- }
-
- currentPageId = pageId;
- if (fireEvent)
- firePropertyChange(CURRENT_PAGE_PROPERTY_ID);
- return true;
- }
-
- public boolean setCurrentPageId(String pageId) {
- return setCurrentPageId(pageId, true);
- }
-
- public void addPropertyListener(IPropertyListener l) {
- propChangeListeners.add(l);
- }
-
- /**
- * Fires a property changed event. Made public because it can be used to
- * trigger a UI refresh.
- *
- * @param propertyId
- * the id of the property that changed
- */
- public void firePropertyChange(final int propertyId) {
- Object[] array = propChangeListeners.getListeners();
- for (int i = 0; i < array.length; i++) {
- final IPropertyListener l = (IPropertyListener) array[i];
- SafeRunner.run(new SafeRunnable() {
-
- @Override
+ if (altStyles != null)
+ targetContainer.getParentPage().addAltStyles(altStyles);
+ }
+
+ /**
+ * Sets the model state based on all the model classes.
+ */
+ private void setModelState(boolean loaded, boolean hasValidConfig) {
+ this.loaded = loaded;
+ this.hasValidConfig = hasValidConfig;
+ }
+
+ /**
+ * Returns true if there is a valid contribution to
+ * org.eclipse.ui.intro.config extension point, with a valid Presentation,
+ * and pages.
+ *
+ * @return Returns the hasValidConfig.
+ */
+ public boolean hasValidConfig() {
+ return hasValidConfig;
+ }
+
+ /**
+ * @return Returns the introPartPresentation.
+ */
+ public IntroPartPresentation getPresentation() {
+ return introPartPresentation;
+ }
+
+ public IntroConfigurer getConfigurer() {
+ return configurer;
+ }
+
+ /**
+ * @return Returns the home Page.
+ */
+ public AbstractIntroPage getHomePage() {
+ return homePage;
+ }
+
+ /**
+ * @return Returns the root Page.
+ */
+ public IntroHomePage getRootPage() {
+ return rootPage;
+ }
+
+ /**
+ * @return Returns the standby Page. May return null if standby page is not
+ * defined.
+ */
+ public AbstractIntroPage getStandbyPage() {
+ return standbyPage;
+ }
+
+ /**
+ * @return all pages *excluding* the Home Page. If all pages are needed,
+ * call <code>(AbstractIntroPage[])
+ * getChildrenOfType(IntroElement.ABSTRACT_PAGE);</code>
+ */
+ public IntroPage[] getPages() {
+ return (IntroPage[]) getChildrenOfType(AbstractIntroElement.PAGE);
+ }
+
+ /**
+ * @return Returns the isdynamicIntro.
+ */
+ public boolean isDynamic() {
+ if ("swt".equals(getPresentation().getImplementationKind())) { //$NON-NLS-1$
+ return rootPage != null && rootPage.isDynamic();
+ }
+ return true;
+ }
+
+ /**
+ * @return Returns the currentPageId.
+ */
+ public String getCurrentPageId() {
+ return currentPageId;
+ }
+
+
+ /**
+ * Sets the current page. If the model does not have a page with the passed
+ * id, the message is logged, and the model retains its old current page.
+ *
+ * @param currentPageId
+ * The currentPageId to set. *
+ * @param fireEvent
+ * flag to indicate if event notification is needed.
+ * @return true if the model has a page with the passed id, false otherwise.
+ * If the method fails, the current page remains the same as the
+ * last state.
+ */
+ public boolean setCurrentPageId(String pageId, boolean fireEvent) {
+ if (pageId.equals(currentPageId))
+ // setting to the same page does nothing. Return true because we did
+ // not actually fail. just a no op.
+ return true;
+
+ AbstractIntroPage page = (AbstractIntroPage) findChild(pageId,
+ ABSTRACT_PAGE);
+ if (page == null) {
+ // not a page. Test for root page.
+ if (!pageId.equals(rootPage.getId())) {
+ // not a page nor the home page.
+ Log
+ .warning("Could not set current page to Intro page with id: " + pageId); //$NON-NLS-1$
+ return false;
+ }
+ }
+
+ currentPageId = pageId;
+ if (fireEvent)
+ firePropertyChange(CURRENT_PAGE_PROPERTY_ID);
+ return true;
+ }
+
+ public boolean setCurrentPageId(String pageId) {
+ return setCurrentPageId(pageId, true);
+ }
+
+ public void addPropertyListener(IPropertyListener l) {
+ propChangeListeners.add(l);
+ }
+
+ /**
+ * Fires a property changed event. Made public because it can be used to
+ * trigger a UI refresh.
+ *
+ * @param propertyId
+ * the id of the property that changed
+ */
+ public void firePropertyChange(final int propertyId) {
+ Object[] array = propChangeListeners.getListeners();
+ for (int i = 0; i < array.length; i++) {
+ final IPropertyListener l = (IPropertyListener) array[i];
+ SafeRunner.run(new SafeRunnable() {
+
+ @Override
public void run() {
- l.propertyChanged(this, propertyId);
- }
+ l.propertyChanged(this, propertyId);
+ }
- @Override
+ @Override
public void handleException(Throwable e) {
- super.handleException(e);
- // If an unexpected exception happens, remove it
- // to make sure the workbench keeps running.
- propChangeListeners.remove(l);
- }
- });
- }
- }
-
- public void removePropertyListener(IPropertyListener l) {
- propChangeListeners.remove(l);
- }
-
- /**
- * @return Returns the currentPage. return null if page is not found, or if
- * we are not in a dynamic intro mode.
- */
- public AbstractIntroPage getCurrentPage() {
- if (!isDynamic())
- return null;
- AbstractIntroPage page = (AbstractIntroPage) findChild(currentPageId,
- ABSTRACT_PAGE);
- if (page != null)
- return page;
- // not a page. Test for root page.
- if (currentPageId.equals(rootPage.getId()))
- return rootPage;
- // return null if page is not found.
- return null;
- }
-
- @Override
+ super.handleException(e);
+ // If an unexpected exception happens, remove it
+ // to make sure the workbench keeps running.
+ propChangeListeners.remove(l);
+ }
+ });
+ }
+ }
+
+ public void removePropertyListener(IPropertyListener l) {
+ propChangeListeners.remove(l);
+ }
+
+ /**
+ * @return Returns the currentPage. return null if page is not found, or if
+ * we are not in a dynamic intro mode.
+ */
+ public AbstractIntroPage getCurrentPage() {
+ if (!isDynamic())
+ return null;
+ AbstractIntroPage page = (AbstractIntroPage) findChild(currentPageId,
+ ABSTRACT_PAGE);
+ if (page != null)
+ return page;
+ // not a page. Test for root page.
+ if (currentPageId.equals(rootPage.getId()))
+ return rootPage;
+ // return null if page is not found.
+ return null;
+ }
+
+ @Override
public int getType() {
- return AbstractIntroElement.MODEL_ROOT;
- }
-
-
- /**
- * Assumes that the passed config element has a "content" attribute. Reads
- * it and loads a DOM based on that attribute value. It does not explicitly
- * resolve the resource because this method only loads the introContent and
- * the configExt content files. ie: in plugin.xml. <br>
- * This method also sets the base attribute on the root element in the DOM
- * to enable resolving all resources relative to this DOM.
- *
- * @return
- */
- protected Document loadDOM(IConfigurationElement cfgElement) {
- String content = cfgElement.getAttribute(ATT_CONTENT);
-
- // To support jarring, extract parent folder of where the intro content
- // file is. It is expected that all intro content is in that one parent
- // folder. This works for both content files and configExtension content
- // files.
- Bundle domBundle = BundleUtil
- .getBundleFromConfigurationElement(cfgElement);
- ModelUtil.ensureFileURLsExist(domBundle, content);
-
- // Resolve.
- content = BundleUtil.getResourceLocation(content, cfgElement);
- Document document = new IntroContentParser(content).getDocument();
-
- return document;
- }
-
-
- private String getBase(IConfigurationElement configElement) {
- String content = configElement.getAttribute(ATT_CONTENT);
- return ModelUtil.getParentFolderToString(content);
- }
-
- public String resolveVariables(String text) {
- if (text==null) return null;
- if (text.indexOf('$')== -1)
- return text;
- // resolve
- boolean inVariable=false;
- StringBuilder buf = new StringBuilder();
- int vindex=0;
- for (int i=0; i<text.length(); i++) {
- char c = text.charAt(i);
- if (c=='$') {
- if (!inVariable) {
- inVariable=true;
- vindex=i+1;
- continue;
- }
- inVariable=false;
- String variable=text.substring(vindex, i);
- String value = getVariableValue(variable);
- if (value==null)
- value = "$"+variable+"$"; //$NON-NLS-1$ //$NON-NLS-2$
- buf.append(value);
- continue;
- }
- else if (!inVariable)
- buf.append(c);
- }
- return buf.toString();
- }
-
- private String getVariableValue(String variable) {
- if (variable.equals(VAR_THEME)) {
- if (theme!=null)
- return theme.getPath();
- }
- if (variable.equals(FontSelection.VAR_FONT_STYLE)) {
- return FontSelection.getFontStyle();
- }
- if (variable.equals(VAR_DIRECTION)) {
- if (ProductPreferences.isRTL()) {
- return "rtl"; //$NON-NLS-1$
- } else {
- return "ltr"; //$NON-NLS-1$
- }
- }
-
- if (configurer!=null)
- return configurer.getVariable(variable);
- return null;
- }
-
- public String resolvePath(String extensionId, String path) {
- if (configurer==null) return null;
- return configurer.resolvePath(extensionId, path);
- }
+ return AbstractIntroElement.MODEL_ROOT;
+ }
+
+
+ /**
+ * Assumes that the passed config element has a "content" attribute. Reads
+ * it and loads a DOM based on that attribute value. It does not explicitly
+ * resolve the resource because this method only loads the introContent and
+ * the configExt content files. ie: in plugin.xml. <br>
+ * This method also sets the base attribute on the root element in the DOM
+ * to enable resolving all resources relative to this DOM.
+ *
+ * @return
+ */
+ protected Document loadDOM(IConfigurationElement cfgElement) {
+ String content = cfgElement.getAttribute(ATT_CONTENT);
+
+ // To support jarring, extract parent folder of where the intro content
+ // file is. It is expected that all intro content is in that one parent
+ // folder. This works for both content files and configExtension content
+ // files.
+ Bundle domBundle = BundleUtil
+ .getBundleFromConfigurationElement(cfgElement);
+ ModelUtil.ensureFileURLsExist(domBundle, content);
+
+ // Resolve.
+ content = BundleUtil.getResourceLocation(content, cfgElement);
+ Document document = new IntroContentParser(content).getDocument();
+
+ return document;
+ }
+
+
+ private String getBase(IConfigurationElement configElement) {
+ String content = configElement.getAttribute(ATT_CONTENT);
+ return ModelUtil.getParentFolderToString(content);
+ }
+
+ public String resolveVariables(String text) {
+ if (text==null) return null;
+ if (text.indexOf('$')== -1)
+ return text;
+ // resolve
+ boolean inVariable=false;
+ StringBuilder buf = new StringBuilder();
+ int vindex=0;
+ for (int i=0; i<text.length(); i++) {
+ char c = text.charAt(i);
+ if (c=='$') {
+ if (!inVariable) {
+ inVariable=true;
+ vindex=i+1;
+ continue;
+ }
+ inVariable=false;
+ String variable=text.substring(vindex, i);
+ String value = getVariableValue(variable);
+ if (value==null)
+ value = "$"+variable+"$"; //$NON-NLS-1$ //$NON-NLS-2$
+ buf.append(value);
+ continue;
+ }
+ else if (!inVariable)
+ buf.append(c);
+ }
+ return buf.toString();
+ }
+
+ private String getVariableValue(String variable) {
+ if (variable.equals(VAR_THEME)) {
+ if (theme!=null)
+ return theme.getPath();
+ }
+ if (variable.equals(FontSelection.VAR_FONT_STYLE)) {
+ return FontSelection.getFontStyle();
+ }
+ if (variable.equals(VAR_DIRECTION)) {
+ if (ProductPreferences.isRTL()) {
+ return "rtl"; //$NON-NLS-1$
+ } else {
+ return "ltr"; //$NON-NLS-1$
+ }
+ }
+
+ if (configurer!=null)
+ return configurer.getVariable(variable);
+ return null;
+ }
+
+ public String resolvePath(String extensionId, String path) {
+ if (configurer==null) return null;
+ return configurer.resolvePath(extensionId, path);
+ }
public IntroTheme getTheme() {
@@ -971,11 +971,11 @@ public class IntroModelRoot extends AbstractIntroContainer {
private String getProcessPreference(String key, String pid) {
String result = Platform.getPreferencesService().getString
- (IntroPlugin.PLUGIN_ID, pid + '_' + key, "", null); //$NON-NLS-1$
- if (result.length() == 0) {
- result = Platform.getPreferencesService().getString
- (IntroPlugin.PLUGIN_ID, key, "", null); //$NON-NLS-1$
- }
- return result;
+ (IntroPlugin.PLUGIN_ID, pid + '_' + key, "", null); //$NON-NLS-1$
+ if (result.length() == 0) {
+ result = Platform.getPreferencesService().getString
+ (IntroPlugin.PLUGIN_ID, key, "", null); //$NON-NLS-1$
+ }
+ return result;
}
} \ No newline at end of file
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPage.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPage.java
index a8a3fe21d..92b72c88c 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPage.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPage.java
@@ -22,16 +22,16 @@ import org.w3c.dom.Element;
*/
public class IntroPage extends AbstractIntroPage {
- /**
- * An Intro Part page.
- */
- IntroPage(Element element, Bundle bundle, String base) {
- super(element, bundle, base);
- }
+ /**
+ * An Intro Part page.
+ */
+ IntroPage(Element element, Bundle bundle, String base) {
+ super(element, bundle, base);
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.PAGE;
- }
+ return AbstractIntroElement.PAGE;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPageTitle.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPageTitle.java
index 1ebf704ab..5ed969e59 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPageTitle.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPageTitle.java
@@ -22,22 +22,22 @@ import org.w3c.dom.Element;
*/
public class IntroPageTitle extends IntroText {
- protected static final String TAG_TITLE = "title"; //$NON-NLS-1$
+ protected static final String TAG_TITLE = "title"; //$NON-NLS-1$
- IntroPageTitle(Element element, Bundle bundle) {
- super(element, bundle);
- }
+ IntroPageTitle(Element element, Bundle bundle) {
+ super(element, bundle);
+ }
- /**
- * @return Returns the Title text.
- */
- public String getTitle() {
- return getText();
- }
+ /**
+ * @return Returns the Title text.
+ */
+ public String getTitle() {
+ return getText();
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.PAGE_TITLE;
- }
+ return AbstractIntroElement.PAGE_TITLE;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java
index 1aa8d177b..41666fdd0 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroPartPresentation.java
@@ -400,7 +400,7 @@ public class IntroPartPresentation extends AbstractIntroElement {
try {
if (implementationType.equals(BROWSER_IMPL_KIND))
implementation = //null;
- new BrowserIntroPartImplementation();
+ new BrowserIntroPartImplementation();
else if (implementationType.equals(FORMS_IMPL_KIND))
implementation = new FormIntroPartImplementation();
else
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSearchParticipant.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSearchParticipant.java
index 034131469..824b7c9be 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSearchParticipant.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSearchParticipant.java
@@ -164,13 +164,13 @@ public class IntroSearchParticipant extends SearchParticipant {
TitleAndSummary titleSummary = new TitleAndSummary();
addChildren(children, buf, doc, titleSummary);
String contents = buf.toString();
- if (titleSummary.title != null) {
- addTitle(titleSummary.title, doc);
- }
- if (titleSummary.summary != null) {
- doc.setSummary(titleSummary.summary);
- }
- doc.addContents(contents);
+ if (titleSummary.title != null) {
+ addTitle(titleSummary.title, doc);
+ }
+ if (titleSummary.summary != null) {
+ doc.setSummary(titleSummary.summary);
+ }
+ doc.addContents(contents);
return Status.OK_STATUS;
}
// delegate to the help system
@@ -203,12 +203,12 @@ public class IntroSearchParticipant extends SearchParticipant {
titleSummary.summary = childIntroText.getText();
}
}
- if (child instanceof AbstractIntroContainer) {
+ if (child instanceof AbstractIntroContainer) {
AbstractIntroContainer container = (AbstractIntroContainer) child;
if (!"navigation-links".equals(container.getId())) { //$NON-NLS-1$
- AbstractIntroElement[] cc = container.getChildren();
- addChildren(cc, buf, doc, titleSummary);
- }
+ AbstractIntroElement[] cc = container.getChildren();
+ addChildren(cc, buf, doc, titleSummary);
+ }
}
}
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSeparator.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSeparator.java
index cfb7b3a78..c767f0f9d 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSeparator.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroSeparator.java
@@ -21,14 +21,14 @@ import org.w3c.dom.Element;
* A horizontal ruler element.
*/
public class IntroSeparator extends AbstractBaseIntroElement {
- protected static final String TAG_HR = "hr"; //$NON-NLS-1$
+ protected static final String TAG_HR = "hr"; //$NON-NLS-1$
- IntroSeparator(Element element, Bundle bundle, String base) {
- super(element, bundle);
- }
+ IntroSeparator(Element element, Bundle bundle, String base) {
+ super(element, bundle);
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.HR;
- }
+ return AbstractIntroElement.HR;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroStandbyContentPart.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroStandbyContentPart.java
index 1efa3b58b..b6b0861e7 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroStandbyContentPart.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroStandbyContentPart.java
@@ -23,44 +23,44 @@ import org.eclipse.core.runtime.IConfigurationElement;
*/
public class IntroStandbyContentPart extends AbstractIntroIdElement {
- public static final String TAG_STANDBY_CONTENT_PART = "standbyContentPart"; //$NON-NLS-1$
+ public static final String TAG_STANDBY_CONTENT_PART = "standbyContentPart"; //$NON-NLS-1$
- private static final String ATT_PLUGIN_ID = "pluginId"; //$NON-NLS-1$
- private static final String ATT_CLASS = "class"; //$NON-NLS-1$
+ private static final String ATT_PLUGIN_ID = "pluginId"; //$NON-NLS-1$
+ private static final String ATT_CLASS = "class"; //$NON-NLS-1$
- private String pluginId;
- private String className;
+ private String pluginId;
+ private String className;
- /**
- * Note: model class with public constructor because it is not instantiated
- * by the model root.
- *
- * @param element
- */
- public IntroStandbyContentPart(IConfigurationElement element) {
- super(element);
- pluginId = element.getAttribute(ATT_PLUGIN_ID);
- className = element.getAttribute(ATT_CLASS);
- }
+ /**
+ * Note: model class with public constructor because it is not instantiated
+ * by the model root.
+ *
+ * @param element
+ */
+ public IntroStandbyContentPart(IConfigurationElement element) {
+ super(element);
+ pluginId = element.getAttribute(ATT_PLUGIN_ID);
+ className = element.getAttribute(ATT_CLASS);
+ }
- /**
- * @return Returns the className.
- */
- public String getClassName() {
- return className;
- }
+ /**
+ * @return Returns the className.
+ */
+ public String getClassName() {
+ return className;
+ }
- /**
- * @return Returns the pluginId.
- */
- public String getPluginId() {
- return pluginId;
- }
+ /**
+ * @return Returns the pluginId.
+ */
+ public String getPluginId() {
+ return pluginId;
+ }
- @Override
+ @Override
public int getType() {
- // this model class does not need a type so far.
- return 0;
- }
+ // this model class does not need a type so far.
+ return 0;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroText.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroText.java
index 349568a08..c3b68af90 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroText.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroText.java
@@ -23,59 +23,59 @@ import org.w3c.dom.Node;
*/
public class IntroText extends AbstractBaseIntroElement {
- protected static final String TAG_TEXT = "text"; //$NON-NLS-1$
+ protected static final String TAG_TEXT = "text"; //$NON-NLS-1$
- private String text;
- /**
- * boolean flag which is true if the text element contains CData content.
- * which means we would have to model it as formatted text.
- */
- private boolean isFormatted = false;
+ private String text;
+ /**
+ * boolean flag which is true if the text element contains CData content.
+ * which means we would have to model it as formatted text.
+ */
+ private boolean isFormatted = false;
- IntroText(Element element, Bundle bundle) {
- super(element, bundle);
- Node textNode = element.getFirstChild();
- if (textNode == null)
- return;
- if (textNode.getNodeType() == Node.TEXT_NODE
- || textNode.getNodeType() == Node.CDATA_SECTION_NODE) {
- // we may have a text or a CDATA nodes.
- text = textNode.getNodeValue();
- isFormatted = checkIfFormatted();
- }
- }
+ IntroText(Element element, Bundle bundle) {
+ super(element, bundle);
+ Node textNode = element.getFirstChild();
+ if (textNode == null)
+ return;
+ if (textNode.getNodeType() == Node.TEXT_NODE
+ || textNode.getNodeType() == Node.CDATA_SECTION_NODE) {
+ // we may have a text or a CDATA nodes.
+ text = textNode.getNodeValue();
+ isFormatted = checkIfFormatted();
+ }
+ }
- /**
- * @return Returns the text description.
- */
- public String getText() {
- IntroModelRoot root = getModelRoot();
- if (root!=null)
- return root.resolveVariables(text);
- return text;
- }
+ /**
+ * @return Returns the text description.
+ */
+ public String getText() {
+ IntroModelRoot root = getModelRoot();
+ if (root!=null)
+ return root.resolveVariables(text);
+ return text;
+ }
- @Override
+ @Override
public int getType() {
- return AbstractIntroElement.TEXT;
- }
+ return AbstractIntroElement.TEXT;
+ }
- /**
- * @return true if the content of this text element has any " <" which makes
- * it formatted.
- */
- public boolean checkIfFormatted() {
- if (text == null)
- return false;
- int i = text.indexOf("<"); //$NON-NLS-1$
- return i == -1 ? false : true;
- }
+ /**
+ * @return true if the content of this text element has any " <" which makes
+ * it formatted.
+ */
+ public boolean checkIfFormatted() {
+ if (text == null)
+ return false;
+ int i = text.indexOf("<"); //$NON-NLS-1$
+ return i == -1 ? false : true;
+ }
- /**
- * @return Returns the isFormatted.
- */
- public boolean isFormatted() {
- return isFormatted;
- }
+ /**
+ * @return Returns the isFormatted.
+ */
+ public boolean isFormatted() {
+ return isFormatted;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroURLAction.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroURLAction.java
index 35919289b..ba69b0d05 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroURLAction.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroURLAction.java
@@ -23,42 +23,42 @@ import org.eclipse.core.runtime.IConfigurationElement;
*/
public class IntroURLAction extends AbstractIntroElement {
- public static final String TAG_ACTION = "action"; //$NON-NLS-1$
+ public static final String TAG_ACTION = "action"; //$NON-NLS-1$
- private static final String ATT_NAME = "name"; //$NON-NLS-1$
- private static final String ATT_REPLACES = "replaces"; //$NON-NLS-1$
+ private static final String ATT_NAME = "name"; //$NON-NLS-1$
+ private static final String ATT_REPLACES = "replaces"; //$NON-NLS-1$
- private String name;
- private String replaces;
+ private String name;
+ private String replaces;
- /**
- * Note: model class with public constructor because it is not instantiated
- * by the model root.
- */
- public IntroURLAction(IConfigurationElement element) {
- super(element);
- name = element.getAttribute(ATT_NAME);
- replaces = element.getAttribute(ATT_REPLACES);
- }
+ /**
+ * Note: model class with public constructor because it is not instantiated
+ * by the model root.
+ */
+ public IntroURLAction(IConfigurationElement element) {
+ super(element);
+ name = element.getAttribute(ATT_NAME);
+ replaces = element.getAttribute(ATT_REPLACES);
+ }
- /**
- * @return Returns the className.
- */
- public String getName() {
- return name;
- }
+ /**
+ * @return Returns the className.
+ */
+ public String getName() {
+ return name;
+ }
- /**
- * @return Returns the pluginId.
- */
- public String getReplaceValue() {
- return replaces;
- }
+ /**
+ * @return Returns the pluginId.
+ */
+ public String getReplaceValue() {
+ return replaces;
+ }
- @Override
+ @Override
public int getType() {
- // this model class does not need a type so far.
- return 0;
- }
+ // this model class does not need a type so far.
+ return 0;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/BaseExtensionPointManager.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/BaseExtensionPointManager.java
index b4bf44032..4a8b82e45 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/BaseExtensionPointManager.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/BaseExtensionPointManager.java
@@ -32,244 +32,244 @@ import org.eclipse.ui.internal.intro.impl.util.Util;
*/
public class BaseExtensionPointManager {
- // the config extension id
- protected static final String CONFIG = "org.eclipse.ui.intro.config"; //$NON-NLS-1$
+ // the config extension id
+ protected static final String CONFIG = "org.eclipse.ui.intro.config"; //$NON-NLS-1$
- // the configExtension extension id
- protected static final String CONFIG_EXTENSION = "org.eclipse.ui.intro.configExtension"; //$NON-NLS-1$
+ // the configExtension extension id
+ protected static final String CONFIG_EXTENSION = "org.eclipse.ui.intro.configExtension"; //$NON-NLS-1$
- // the attribute in the config element to specify the intro part id.
- protected static final String ATT_CONFIG_INTRO_ID = "introId"; //$NON-NLS-1$
+ // the attribute in the config element to specify the intro part id.
+ protected static final String ATT_CONFIG_INTRO_ID = "introId"; //$NON-NLS-1$
- // the attribute in the config element to specify the intro part id.
- protected static final String ATT_CONFIG_EXTENSION_CONFIG_ID = "configId"; //$NON-NLS-1$
+ // the attribute in the config element to specify the intro part id.
+ protected static final String ATT_CONFIG_EXTENSION_CONFIG_ID = "configId"; //$NON-NLS-1$
- // the id attribute in any intro element.
- protected static final String ATT_ID = AbstractIntroIdElement.ATT_ID;
+ // the id attribute in any intro element.
+ protected static final String ATT_ID = AbstractIntroIdElement.ATT_ID;
protected Map<String, IntroModelRoot> introModels = new HashMap<>();
- protected IExtensionRegistry registry;
- protected SharedConfigExtensionsManager sharedConfigExtensionsManager;
- private String extensionFilter;
-
- /*
- * Prevent creation.
- */
- protected BaseExtensionPointManager() {
- registry = Platform.getExtensionRegistry();
- }
-
- protected IntroModelRoot loadModel(String attributeName,
- String attributeValue) {
-
- long start = 0;
- if (Log.logPerformance)
- start = System.currentTimeMillis();
-
- // get all Config extension point contributions. There could be more
- // than one config contribution, but there should only be one that maps
- // to the cached intro part id.
- IConfigurationElement introConfig = getIntroConfig(attributeName,
- attributeValue);
-
- // load model with the config elements of the correct contribution. If
- // there are no valid contribution, model stays null.
- if (introConfig != null) {
- // we found matching config. Get all configExtension contributed to
- // this config and pass to model. Load generic config extensions as
- // well.
- String configId = introConfig.getAttribute(ATT_ID);
- IConfigurationElement[] introConfigExtensions = null;
- if (configId == null)
- // if id of config is null, pass empty array.
- introConfigExtensions = new IConfigurationElement[0];
- else
- introConfigExtensions = getIntroConfigExtensions(
- ATT_CONFIG_EXTENSION_CONFIG_ID, configId);
-
- if (Log.logPerformance)
- Util.logPerformanceTime(
- "BEGIN: quering registry for configs took: ", start); //$NON-NLS-1$
-
-
- IntroModelRoot model = new IntroModelRoot(introConfig,
- introConfigExtensions);
- model.loadModel();
- // add the current model to the hash table of models, only if it is
- // not null. They key is the model id, which is the id of the
- // config that defined this model.
- addCachedModel(model.getId(), model);
-
- // now load all generic config extension. ie: standbyPart and
- // command contributions.
- loadSharedConfigExtensions();
-
- if (Log.logPerformance)
- Util
- .logPerformanceTime(
- "loading Intro Model (quering registry/creating & resolving model) took: ", //$NON-NLS-1$
- start);
-
- return model;
- }
- return null;
- }
-
- /**
- * Go through all the config elements and only return the correct config
- * that maps to the correct intro part id. If there is more than one config
- * thats maps to the same intro part id, log the fact, and return the first
- * one. If there are non, return null.
- *
- * @param configElements
- * @return
- */
- protected IConfigurationElement getIntroConfig(String attrributeName,
- String attributeValue) {
-
- IConfigurationElement[] configElements = registry
- .getConfigurationElementsFor(CONFIG);
-
- IConfigurationElement config = getConfigurationFromAttribute(
- configElements, attrributeName, attributeValue);
-
- if (config == null)
- // if there is no valid config, log the fact.
- Log.warning("No Intro configuration found with " + attrributeName //$NON-NLS-1$
- + " of value = " + attributeValue); //$NON-NLS-1$
-
- return config;
- }
-
- /**
- * Go through all the configExtension elements and return an array of all
- * extensions that match the attribute and its value. If there are non,
- * return empty array. This also loads all standby contributions.
- */
- protected IConfigurationElement[] getIntroConfigExtensions(
- String attrributeName, String attributeValue) {
-
- IConfigurationElement[] configExtensionElements = registry
- .getConfigurationElementsFor(CONFIG_EXTENSION);
-
- /*
- * Extension filter is used for performance testing to only load contributions
- * from a specific plug-in (fixed data set).
- */
- if (extensionFilter != null) {
+ protected IExtensionRegistry registry;
+ protected SharedConfigExtensionsManager sharedConfigExtensionsManager;
+ private String extensionFilter;
+
+ /*
+ * Prevent creation.
+ */
+ protected BaseExtensionPointManager() {
+ registry = Platform.getExtensionRegistry();
+ }
+
+ protected IntroModelRoot loadModel(String attributeName,
+ String attributeValue) {
+
+ long start = 0;
+ if (Log.logPerformance)
+ start = System.currentTimeMillis();
+
+ // get all Config extension point contributions. There could be more
+ // than one config contribution, but there should only be one that maps
+ // to the cached intro part id.
+ IConfigurationElement introConfig = getIntroConfig(attributeName,
+ attributeValue);
+
+ // load model with the config elements of the correct contribution. If
+ // there are no valid contribution, model stays null.
+ if (introConfig != null) {
+ // we found matching config. Get all configExtension contributed to
+ // this config and pass to model. Load generic config extensions as
+ // well.
+ String configId = introConfig.getAttribute(ATT_ID);
+ IConfigurationElement[] introConfigExtensions = null;
+ if (configId == null)
+ // if id of config is null, pass empty array.
+ introConfigExtensions = new IConfigurationElement[0];
+ else
+ introConfigExtensions = getIntroConfigExtensions(
+ ATT_CONFIG_EXTENSION_CONFIG_ID, configId);
+
+ if (Log.logPerformance)
+ Util.logPerformanceTime(
+ "BEGIN: quering registry for configs took: ", start); //$NON-NLS-1$
+
+
+ IntroModelRoot model = new IntroModelRoot(introConfig,
+ introConfigExtensions);
+ model.loadModel();
+ // add the current model to the hash table of models, only if it is
+ // not null. They key is the model id, which is the id of the
+ // config that defined this model.
+ addCachedModel(model.getId(), model);
+
+ // now load all generic config extension. ie: standbyPart and
+ // command contributions.
+ loadSharedConfigExtensions();
+
+ if (Log.logPerformance)
+ Util
+ .logPerformanceTime(
+ "loading Intro Model (quering registry/creating & resolving model) took: ", //$NON-NLS-1$
+ start);
+
+ return model;
+ }
+ return null;
+ }
+
+ /**
+ * Go through all the config elements and only return the correct config
+ * that maps to the correct intro part id. If there is more than one config
+ * thats maps to the same intro part id, log the fact, and return the first
+ * one. If there are non, return null.
+ *
+ * @param configElements
+ * @return
+ */
+ protected IConfigurationElement getIntroConfig(String attrributeName,
+ String attributeValue) {
+
+ IConfigurationElement[] configElements = registry
+ .getConfigurationElementsFor(CONFIG);
+
+ IConfigurationElement config = getConfigurationFromAttribute(
+ configElements, attrributeName, attributeValue);
+
+ if (config == null)
+ // if there is no valid config, log the fact.
+ Log.warning("No Intro configuration found with " + attrributeName //$NON-NLS-1$
+ + " of value = " + attributeValue); //$NON-NLS-1$
+
+ return config;
+ }
+
+ /**
+ * Go through all the configExtension elements and return an array of all
+ * extensions that match the attribute and its value. If there are non,
+ * return empty array. This also loads all standby contributions.
+ */
+ protected IConfigurationElement[] getIntroConfigExtensions(
+ String attrributeName, String attributeValue) {
+
+ IConfigurationElement[] configExtensionElements = registry
+ .getConfigurationElementsFor(CONFIG_EXTENSION);
+
+ /*
+ * Extension filter is used for performance testing to only load contributions
+ * from a specific plug-in (fixed data set).
+ */
+ if (extensionFilter != null) {
List<IConfigurationElement> filtered = new ArrayList<>();
- for (int i=0;i<configExtensionElements.length;++i) {
- if (extensionFilter.equals(configExtensionElements[i].getContributor().getName())) {
- filtered.add(configExtensionElements[i]);
- }
- }
- configExtensionElements = filtered.toArray(new IConfigurationElement[filtered.size()]);
- }
-
- IConfigurationElement[] configExtensions = getConfigurationsFromAttribute(
- configExtensionElements, attrributeName, attributeValue);
-
- return configExtensions;
- }
-
- /**
- * Add a model to the cache. This method is private because only this
- * manager class knows how to load an intro model.
- *
- * @param modelId
- * @param model
- */
- protected void addCachedModel(String modelId, IntroModelRoot model) {
- introModels.put(modelId, model);
- }
-
- /**
- * Gets the given model from the cache.
- *
- * @param modelId
- */
- protected IntroModelRoot getCachedModel(String configId) {
- return introModels.get(configId);
- }
-
- /**
- * Go through all the config elements and only return the correct config
- * with an attribute of the given value. If there is more than one
- * configuration element that maps to the attribute value log the fact, and
- * return the first one. If there are non, return null.
- *
- * @param configElements
- * @return
- */
- protected IConfigurationElement getConfigurationFromAttribute(
- IConfigurationElement[] configElements, String attributeName,
- String attributeValue) {
-
- // find all configs with given attribute and attibute value.
- IConfigurationElement[] filteredConfigElements = getConfigurationsFromAttribute(
- configElements, attributeName, attributeValue);
- // now validate that we got only one.
- IConfigurationElement config = ModelLoaderUtil
- .validateSingleContribution(filteredConfigElements, attributeName);
- return config;
- }
-
- /**
- * Go through all the config elements and return an array of matching
- * configs with an attribute of the given value. If there are non, return
- * empty array.
- */
- protected IConfigurationElement[] getConfigurationsFromAttribute(
- IConfigurationElement[] configElements, String attributeName,
- String attributeValue) {
-
- // find all configs with given attribute and attibute value.
+ for (int i=0;i<configExtensionElements.length;++i) {
+ if (extensionFilter.equals(configExtensionElements[i].getContributor().getName())) {
+ filtered.add(configExtensionElements[i]);
+ }
+ }
+ configExtensionElements = filtered.toArray(new IConfigurationElement[filtered.size()]);
+ }
+
+ IConfigurationElement[] configExtensions = getConfigurationsFromAttribute(
+ configExtensionElements, attrributeName, attributeValue);
+
+ return configExtensions;
+ }
+
+ /**
+ * Add a model to the cache. This method is private because only this
+ * manager class knows how to load an intro model.
+ *
+ * @param modelId
+ * @param model
+ */
+ protected void addCachedModel(String modelId, IntroModelRoot model) {
+ introModels.put(modelId, model);
+ }
+
+ /**
+ * Gets the given model from the cache.
+ *
+ * @param modelId
+ */
+ protected IntroModelRoot getCachedModel(String configId) {
+ return introModels.get(configId);
+ }
+
+ /**
+ * Go through all the config elements and only return the correct config
+ * with an attribute of the given value. If there is more than one
+ * configuration element that maps to the attribute value log the fact, and
+ * return the first one. If there are non, return null.
+ *
+ * @param configElements
+ * @return
+ */
+ protected IConfigurationElement getConfigurationFromAttribute(
+ IConfigurationElement[] configElements, String attributeName,
+ String attributeValue) {
+
+ // find all configs with given attribute and attibute value.
+ IConfigurationElement[] filteredConfigElements = getConfigurationsFromAttribute(
+ configElements, attributeName, attributeValue);
+ // now validate that we got only one.
+ IConfigurationElement config = ModelLoaderUtil
+ .validateSingleContribution(filteredConfigElements, attributeName);
+ return config;
+ }
+
+ /**
+ * Go through all the config elements and return an array of matching
+ * configs with an attribute of the given value. If there are non, return
+ * empty array.
+ */
+ protected IConfigurationElement[] getConfigurationsFromAttribute(
+ IConfigurationElement[] configElements, String attributeName,
+ String attributeValue) {
+
+ // find all configs with given attribute and attibute value.
Vector<IConfigurationElement> elements = new Vector<>();
- for (int i = 0; i < configElements.length; i++) {
- String currentAttributeValue = configElements[i]
- .getAttribute(attributeName);
- if (currentAttributeValue != null
- && currentAttributeValue.equals(attributeValue))
- elements.add(configElements[i]);
- }
-
- // now return array.
- IConfigurationElement[] filteredConfigElements = new IConfigurationElement[elements
- .size()];
- elements.copyInto(filteredConfigElements);
-
- return filteredConfigElements;
- }
-
- /**
- * Loads all shared config extennsions (ie: standby parts and commands).
- */
- protected void loadSharedConfigExtensions() {
- sharedConfigExtensionsManager = new SharedConfigExtensionsManager(
- registry);
- sharedConfigExtensionsManager.loadSharedConfigExtensions();
- }
-
-
- /**
- * @return Returns the sharedConfigExtensionsManager.
- */
- public SharedConfigExtensionsManager getSharedConfigExtensionsManager() {
- return sharedConfigExtensionsManager;
- }
-
- /**
- * @return Returns the cached introModels.
- */
+ for (int i = 0; i < configElements.length; i++) {
+ String currentAttributeValue = configElements[i]
+ .getAttribute(attributeName);
+ if (currentAttributeValue != null
+ && currentAttributeValue.equals(attributeValue))
+ elements.add(configElements[i]);
+ }
+
+ // now return array.
+ IConfigurationElement[] filteredConfigElements = new IConfigurationElement[elements
+ .size()];
+ elements.copyInto(filteredConfigElements);
+
+ return filteredConfigElements;
+ }
+
+ /**
+ * Loads all shared config extennsions (ie: standby parts and commands).
+ */
+ protected void loadSharedConfigExtensions() {
+ sharedConfigExtensionsManager = new SharedConfigExtensionsManager(
+ registry);
+ sharedConfigExtensionsManager.loadSharedConfigExtensions();
+ }
+
+
+ /**
+ * @return Returns the sharedConfigExtensionsManager.
+ */
+ public SharedConfigExtensionsManager getSharedConfigExtensionsManager() {
+ return sharedConfigExtensionsManager;
+ }
+
+ /**
+ * @return Returns the cached introModels.
+ */
public Map<String, IntroModelRoot> getIntroModels() {
- return introModels;
- }
-
- /*
- * Internal test hook for restricting which extensions to load.
- */
- public void setExtensionFilter(String pluginId) {
- extensionFilter = pluginId;
- }
+ return introModels;
+ }
+
+ /*
+ * Internal test hook for restricting which extensions to load.
+ */
+ public void setExtensionFilter(String pluginId) {
+ extensionFilter = pluginId;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ExtensionPointManager.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ExtensionPointManager.java
index 2d3fc5101..e310432c6 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ExtensionPointManager.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ExtensionPointManager.java
@@ -28,91 +28,91 @@ import org.eclipse.ui.internal.intro.impl.util.Log;
public class ExtensionPointManager extends BaseExtensionPointManager {
- // singleton instance. Can be retrieved from here or from the Intro Plugin.
- private static ExtensionPointManager inst = new ExtensionPointManager();
-
- // The root model class that represents a full/combined OOBBE config. This
- // model is loaded based on an introId when the customizableIntroPart tries
- // to load a model based on introId. This is different when includes and
- // extension aer resolved because in tnose cases models are being loaded
- // given an id and not an introId.
- private IntroModelRoot currentModel;
-
- // the id of the intro part contribution who's model (config) we are trying
- // to load. The customizableIntroPart loads this id and loads the model that
- // is bound to this intro id (ie: has this id as an introId).
- private String introId;
-
- /*
- * Prevent creation.
- */
- private ExtensionPointManager() {
- super();
- }
-
- /**
- * @return Returns the inst.
- */
- public static ExtensionPointManager getInst() {
- return inst;
- }
-
- /**
- * Load the intro model given the current intro id.
- */
- private void loadCurrentModel() {
- currentModel = loadModel(ATT_CONFIG_INTRO_ID, this.introId);
- }
-
- /**
- * @return Returns the Intro Model root. Note: Prefereed way of getting to
- * the intro model root is throught the intro plugin.
- */
- public IntroModelRoot getCurrentModel() {
- if (currentModel == null)
- // we never loaded this model before, or we tried before and we
- // failed. Load it. Get the correct config element based on
- // config introId, and log any extra contributions.
- loadCurrentModel();
- return currentModel;
- }
-
- /**
- * Load an intro model given a config id.
- *
- * @param configId
- * @return
- */
- public IntroModelRoot getModel(String configId) {
- IntroModelRoot model = getCachedModel(configId);
- if (model == null) {
- // we never loaded this model before, or we tried before and we
- // failed. Load it. Get the correct config element based on
- // config id, and log any extra contributions.
- model = loadModel(ATT_ID, configId);
- }
- return model;
- }
-
- /**
- * @param introPartId
- * The introPartId to set.
- */
- public void setIntroId(String introId) {
- this.introId = introId;
- // we do not have to clean model here. remove cached model, if it
- // exists.
- this.currentModel = null;
- }
-
- public void clear() {
- currentModel = null;
- sharedConfigExtensionsManager = null;
- introModels.clear();
- ExtensionMap.getInstance().clear();
- if (Log.logInfo)
- Log.info("Cleared Intro model"); //$NON-NLS-1$
- }
+ // singleton instance. Can be retrieved from here or from the Intro Plugin.
+ private static ExtensionPointManager inst = new ExtensionPointManager();
+
+ // The root model class that represents a full/combined OOBBE config. This
+ // model is loaded based on an introId when the customizableIntroPart tries
+ // to load a model based on introId. This is different when includes and
+ // extension aer resolved because in tnose cases models are being loaded
+ // given an id and not an introId.
+ private IntroModelRoot currentModel;
+
+ // the id of the intro part contribution who's model (config) we are trying
+ // to load. The customizableIntroPart loads this id and loads the model that
+ // is bound to this intro id (ie: has this id as an introId).
+ private String introId;
+
+ /*
+ * Prevent creation.
+ */
+ private ExtensionPointManager() {
+ super();
+ }
+
+ /**
+ * @return Returns the inst.
+ */
+ public static ExtensionPointManager getInst() {
+ return inst;
+ }
+
+ /**
+ * Load the intro model given the current intro id.
+ */
+ private void loadCurrentModel() {
+ currentModel = loadModel(ATT_CONFIG_INTRO_ID, this.introId);
+ }
+
+ /**
+ * @return Returns the Intro Model root. Note: Prefereed way of getting to
+ * the intro model root is throught the intro plugin.
+ */
+ public IntroModelRoot getCurrentModel() {
+ if (currentModel == null)
+ // we never loaded this model before, or we tried before and we
+ // failed. Load it. Get the correct config element based on
+ // config introId, and log any extra contributions.
+ loadCurrentModel();
+ return currentModel;
+ }
+
+ /**
+ * Load an intro model given a config id.
+ *
+ * @param configId
+ * @return
+ */
+ public IntroModelRoot getModel(String configId) {
+ IntroModelRoot model = getCachedModel(configId);
+ if (model == null) {
+ // we never loaded this model before, or we tried before and we
+ // failed. Load it. Get the correct config element based on
+ // config id, and log any extra contributions.
+ model = loadModel(ATT_ID, configId);
+ }
+ return model;
+ }
+
+ /**
+ * @param introPartId
+ * The introPartId to set.
+ */
+ public void setIntroId(String introId) {
+ this.introId = introId;
+ // we do not have to clean model here. remove cached model, if it
+ // exists.
+ this.currentModel = null;
+ }
+
+ public void clear() {
+ currentModel = null;
+ sharedConfigExtensionsManager = null;
+ introModels.clear();
+ ExtensionMap.getInstance().clear();
+ if (Log.logInfo)
+ Log.info("Cleared Intro model"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/IntroContentParser.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/IntroContentParser.java
index 9941e1291..944629ef5 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/IntroContentParser.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/IntroContentParser.java
@@ -43,157 +43,157 @@ import org.xml.sax.SAXParseException;
*/
public class IntroContentParser {
- private static String TAG_INTRO_CONTENT = "introContent"; //$NON-NLS-1$
- private static String TAG_HTML = "html"; //$NON-NLS-1$
-
- private Document document;
- private boolean hasXHTMLContent;
-
- /**
- * Creates a config parser assuming that the passed content represents a URL
- * to the content file.
- */
- public IntroContentParser(String content) {
- try {
- document = parse(content);
- if (document != null) {
- // xml file is loaded. It can be either XHTML or intro XML.
- Element rootElement = document.getDocumentElement();
- // DocumentType docType = document.getDoctype();
- if (rootElement.getTagName().equals(TAG_INTRO_CONTENT)) {
- // intro xml file.
- hasXHTMLContent = false;
- } else if (rootElement.getTagName().equals(TAG_HTML)) {
- // rely on root element to detect if we have an XHTML file
- // and not on doctype. We need to support xhtml files with
- // no doctype.
- hasXHTMLContent = true;
- } else
- // not intro XML nor XHTML.
- document = null;
- }
- } catch (Exception e) {
- Log.error("Could not load Intro content file: " + content, e); //$NON-NLS-1$
- }
- }
-
-
- private Document parse(String fileURI) {
- Document document = null;
- try {
- DocumentBuilderFactory docFactory = DocumentBuilderFactory
- .newInstance();
- docFactory.setValidating(false);
- // if this is not set, Document.getElementsByTagNameNS() will fail.
- docFactory.setNamespaceAware(true);
- docFactory.setExpandEntityReferences(false);
- DocumentBuilder parser = docFactory.newDocumentBuilder();
+ private static String TAG_INTRO_CONTENT = "introContent"; //$NON-NLS-1$
+ private static String TAG_HTML = "html"; //$NON-NLS-1$
+
+ private Document document;
+ private boolean hasXHTMLContent;
+
+ /**
+ * Creates a config parser assuming that the passed content represents a URL
+ * to the content file.
+ */
+ public IntroContentParser(String content) {
+ try {
+ document = parse(content);
+ if (document != null) {
+ // xml file is loaded. It can be either XHTML or intro XML.
+ Element rootElement = document.getDocumentElement();
+ // DocumentType docType = document.getDoctype();
+ if (rootElement.getTagName().equals(TAG_INTRO_CONTENT)) {
+ // intro xml file.
+ hasXHTMLContent = false;
+ } else if (rootElement.getTagName().equals(TAG_HTML)) {
+ // rely on root element to detect if we have an XHTML file
+ // and not on doctype. We need to support xhtml files with
+ // no doctype.
+ hasXHTMLContent = true;
+ } else
+ // not intro XML nor XHTML.
+ document = null;
+ }
+ } catch (Exception e) {
+ Log.error("Could not load Intro content file: " + content, e); //$NON-NLS-1$
+ }
+ }
+
+
+ private Document parse(String fileURI) {
+ Document document = null;
+ try {
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory
+ .newInstance();
+ docFactory.setValidating(false);
+ // if this is not set, Document.getElementsByTagNameNS() will fail.
+ docFactory.setNamespaceAware(true);
+ docFactory.setExpandEntityReferences(false);
+ DocumentBuilder parser = docFactory.newDocumentBuilder();
parser.setEntityResolver((publicId, systemId) -> new InputSource(new StringReader(""))); //$NON-NLS-1$
- document = parser.parse(fileURI);
- return document;
-
- } catch (SAXParseException spe) {
- StringBuilder buffer = new StringBuilder("IntroParser error in line "); //$NON-NLS-1$
- buffer.append(spe.getLineNumber());
- buffer.append(", uri "); //$NON-NLS-1$
- buffer.append(spe.getSystemId());
- buffer.append("\n"); //$NON-NLS-1$
- buffer.append(spe.getMessage());
-
- // Use the contained exception.
- Exception x = spe;
- if (spe.getException() != null)
- x = spe.getException();
- Log.error(buffer.toString(), x);
-
- } catch (SAXException sxe) {
- Exception x = sxe;
- if (sxe.getException() != null)
- x = sxe.getException();
- Log.error(x.getMessage(), x);
-
- } catch (ParserConfigurationException pce) {
- // Parser with specified options can't be built
- Log.error(pce.getMessage(), pce);
-
- } catch (IOException ioe) {
- Log.error(ioe.getMessage(), ioe);
- }
- return null;
- }
-
-
- /**
- * Returned the DOM representing the intro xml content file. May return null
- * if parsing the file failed.
- *
- * @return Returns the document.
- */
- public Document getDocument() {
- return document;
- }
-
- public boolean hasXHTMLContent() {
- return hasXHTMLContent;
- }
-
-
- public static String convertToString(Document document) {
- try {
- // identity xslt.
- TransformerFactory tFactory = TransformerFactory.newInstance();
- Transformer transformer = tFactory.newTransformer();
-
- DOMSource source = new DOMSource(document);
-
- StringWriter stringWriter = new StringWriter();
- StreamResult result = new StreamResult(stringWriter);
-
- // setup properties, for doctype.
- DocumentType docType = document.getDoctype();
- if (docType != null) {
- String value = docType.getSystemId();
- // transformer.clearParameters();
- transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, value);
- value = document.getDoctype().getPublicId();
- transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, value);
- transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,
- "yes"); //$NON-NLS-1$
- // transformer.setOutputProperty(OutputKeys.MEDIA_TYPE,
- // "text/html");
- // transformer
- // .setOutputProperty(OutputKeys.ENCODING, "iso-8859-1");
- } else
- Log
- .warning("XHTML file used to display this Intro page does not have a Document type defined. " //$NON-NLS-1$
- + "XHTML requires document types to be defined."); //$NON-NLS-1$
-
- transformer.transform(source, result);
- return stringWriter.toString();
-
- } catch (TransformerConfigurationException tce) {
- // Error generated by the parser
- Log.error("Transformer Config error: " + tce.getMessage(), null); //$NON-NLS-1$
- // Use the contained exception, if any
- Throwable x = tce;
- if (tce.getException() != null)
- x = tce.getException();
- Log.error("Transformer Stack trace: ", x); //$NON-NLS-1$
-
- } catch (TransformerException te) {
- // Error generated by the parser
- Log.error("Transformer error: " + te.getMessage(), te); //$NON-NLS-1$
- // Use the contained exception, if any
- Throwable x = te;
- if (te.getException() != null)
- x = te.getException();
- Log.error("Transformer Stack trace: ", x); //$NON-NLS-1$
-
- }
- return null;
-
- }
+ document = parser.parse(fileURI);
+ return document;
+
+ } catch (SAXParseException spe) {
+ StringBuilder buffer = new StringBuilder("IntroParser error in line "); //$NON-NLS-1$
+ buffer.append(spe.getLineNumber());
+ buffer.append(", uri "); //$NON-NLS-1$
+ buffer.append(spe.getSystemId());
+ buffer.append("\n"); //$NON-NLS-1$
+ buffer.append(spe.getMessage());
+
+ // Use the contained exception.
+ Exception x = spe;
+ if (spe.getException() != null)
+ x = spe.getException();
+ Log.error(buffer.toString(), x);
+
+ } catch (SAXException sxe) {
+ Exception x = sxe;
+ if (sxe.getException() != null)
+ x = sxe.getException();
+ Log.error(x.getMessage(), x);
+
+ } catch (ParserConfigurationException pce) {
+ // Parser with specified options can't be built
+ Log.error(pce.getMessage(), pce);
+
+ } catch (IOException ioe) {
+ Log.error(ioe.getMessage(), ioe);
+ }
+ return null;
+ }
+
+
+ /**
+ * Returned the DOM representing the intro xml content file. May return null
+ * if parsing the file failed.
+ *
+ * @return Returns the document.
+ */
+ public Document getDocument() {
+ return document;
+ }
+
+ public boolean hasXHTMLContent() {
+ return hasXHTMLContent;
+ }
+
+
+ public static String convertToString(Document document) {
+ try {
+ // identity xslt.
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ Transformer transformer = tFactory.newTransformer();
+
+ DOMSource source = new DOMSource(document);
+
+ StringWriter stringWriter = new StringWriter();
+ StreamResult result = new StreamResult(stringWriter);
+
+ // setup properties, for doctype.
+ DocumentType docType = document.getDoctype();
+ if (docType != null) {
+ String value = docType.getSystemId();
+ // transformer.clearParameters();
+ transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, value);
+ value = document.getDoctype().getPublicId();
+ transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, value);
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,
+ "yes"); //$NON-NLS-1$
+ // transformer.setOutputProperty(OutputKeys.MEDIA_TYPE,
+ // "text/html");
+ // transformer
+ // .setOutputProperty(OutputKeys.ENCODING, "iso-8859-1");
+ } else
+ Log
+ .warning("XHTML file used to display this Intro page does not have a Document type defined. " //$NON-NLS-1$
+ + "XHTML requires document types to be defined."); //$NON-NLS-1$
+
+ transformer.transform(source, result);
+ return stringWriter.toString();
+
+ } catch (TransformerConfigurationException tce) {
+ // Error generated by the parser
+ Log.error("Transformer Config error: " + tce.getMessage(), null); //$NON-NLS-1$
+ // Use the contained exception, if any
+ Throwable x = tce;
+ if (tce.getException() != null)
+ x = tce.getException();
+ Log.error("Transformer Stack trace: ", x); //$NON-NLS-1$
+
+ } catch (TransformerException te) {
+ // Error generated by the parser
+ Log.error("Transformer error: " + te.getMessage(), te); //$NON-NLS-1$
+ // Use the contained exception, if any
+ Throwable x = te;
+ if (te.getException() != null)
+ x = te.getException();
+ Log.error("Transformer Stack trace: ", x); //$NON-NLS-1$
+
+ }
+ return null;
+
+ }
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ModelLoaderUtil.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ModelLoaderUtil.java
index 0196477a3..c68c02b3d 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ModelLoaderUtil.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/ModelLoaderUtil.java
@@ -30,155 +30,155 @@ import org.w3c.dom.Element;
*/
public class ModelLoaderUtil {
- /**
- * Utility method to validate an elements name.
- *
- * @param element
- * @param validName
- * @return
- */
- public static boolean isValidElementName(IConfigurationElement element,
- String validName) {
-
- if (element.getName().equals(validName))
- return true;
- // bad element name.
- return false;
- }
-
- /**
- * Utility method to verify that there is only a single configElement in the
- * passed array of elements. If the array is empty, null is returned. If
- * there is more than one element in the array, the first one is picked, but
- * this fact is logged. Attribute passed is used for logging.
- *
- * @param configElements
- * @return the first configElement in the array, or null if the array is
- * empty.
- */
- public static IConfigurationElement validateSingleContribution(
- IConfigurationElement[] configElements, String logAttribute) {
-
- int arraySize = configElements.length;
- if (arraySize == 0)
- // No one contributed to extension. return null.
- return null;
-
- // we should only have one, so use first one.
- IConfigurationElement configElement = configElements[0];
- if (Log.logInfo) {
- String msg = "Loading " + getLogString(configElement, logAttribute); //$NON-NLS-1$
- Log.info(msg);
- }
-
- if (arraySize != 1) {
- // we have more than one, warn in the log.
- for (int i = 1; i < arraySize; i++)
- // log each extra extension.
- Log.warning(getLogString(configElements[i], logAttribute)
- + " ignored due to multiple contributions"); //$NON-NLS-1$
- }
- return configElement;
- }
-
- /**
- * Utility method to return a string to display in .log. If logAttribute is
- * not null, its value is also printed.
- */
- public static String getLogString(IConfigurationElement element,
- String logAttribute) {
- StringBuilder buffer = new StringBuilder(element.getName());
- buffer.append(" element"); //$NON-NLS-1$
- if (logAttribute != null) {
- buffer.append(" with "); //$NON-NLS-1$
- buffer.append(logAttribute);
- buffer.append("=\""); //$NON-NLS-1$
- buffer.append(element.getAttribute(logAttribute));
- }
- buffer.append("\" in extension: "); //$NON-NLS-1$
- buffer.append(element.getDeclaringExtension()
- .getExtensionPointUniqueIdentifier());
- buffer.append(" in Bundle: "); //$NON-NLS-1$
- buffer.append(element.getContributor().getName());
-
-
- return buffer.toString();
- }
-
- /**
- * Utility method to return a string to display in .log. If logAttribute is
- * not null, its value is also printed.
- */
- public static String getLogString(Bundle bundle, Element element,
- String logAttribute) {
- StringBuilder buffer = new StringBuilder(element.getNodeName());
- buffer.append(" element"); //$NON-NLS-1$
- if (logAttribute != null) {
- buffer.append(" with "); //$NON-NLS-1$
- buffer.append(logAttribute);
- buffer.append("=\""); //$NON-NLS-1$
- buffer.append(element.getAttribute(logAttribute));
- }
- buffer.append("\" from xml file in Bundle:"); //$NON-NLS-1$
- buffer.append(bundle.getSymbolicName());
-
-
- return buffer.toString();
- }
-
-
-
- /**
- * Util class for creating class instances from plugins.
- *
- * @param pluginId
- * @param className
- * @return
- */
- public static Object createClassInstance(String pluginId, String className) {
- // quick exits.
- if (pluginId == null || className == null)
- return null;
- Bundle bundle = Platform.getBundle(pluginId);
- if (!BundleUtil.bundleHasValidState(bundle))
- return null;
-
- Class<?> aClass;
- Object aObject;
- try {
- aClass = bundle.loadClass(className);
- aObject = aClass.getDeclaredConstructor().newInstance();
- return aObject;
- } catch (Exception e) {
- Log.error("Intro Could not instantiate: " + className + " in " //$NON-NLS-1$ //$NON-NLS-2$
- + pluginId, e);
- return null;
- }
- }
-
-
-
- /**
- * Creates a key for the given element. Returns null if any id is null along
- * the path.
- *
- * @param element
- * @return
- */
- public static StringBuffer createPathToElementKey(
- AbstractIntroIdElement element, boolean full) {
- if (element.getId() == null)
- return null;
- StringBuffer buffer = new StringBuffer(element.getId());
- AbstractBaseIntroElement parent = (AbstractBaseIntroElement) element
- .getParent();
- while (parent != null
- && !parent.isOfType(AbstractIntroElement.MODEL_ROOT)) {
- if (parent.getId() == null)
- return null;
- buffer.insert(0, parent.getId() + "."); //$NON-NLS-1$
- parent = (AbstractBaseIntroElement) parent.getParent();
- }
- return buffer;
- }
+ /**
+ * Utility method to validate an elements name.
+ *
+ * @param element
+ * @param validName
+ * @return
+ */
+ public static boolean isValidElementName(IConfigurationElement element,
+ String validName) {
+
+ if (element.getName().equals(validName))
+ return true;
+ // bad element name.
+ return false;
+ }
+
+ /**
+ * Utility method to verify that there is only a single configElement in the
+ * passed array of elements. If the array is empty, null is returned. If
+ * there is more than one element in the array, the first one is picked, but
+ * this fact is logged. Attribute passed is used for logging.
+ *
+ * @param configElements
+ * @return the first configElement in the array, or null if the array is
+ * empty.
+ */
+ public static IConfigurationElement validateSingleContribution(
+ IConfigurationElement[] configElements, String logAttribute) {
+
+ int arraySize = configElements.length;
+ if (arraySize == 0)
+ // No one contributed to extension. return null.
+ return null;
+
+ // we should only have one, so use first one.
+ IConfigurationElement configElement = configElements[0];
+ if (Log.logInfo) {
+ String msg = "Loading " + getLogString(configElement, logAttribute); //$NON-NLS-1$
+ Log.info(msg);
+ }
+
+ if (arraySize != 1) {
+ // we have more than one, warn in the log.
+ for (int i = 1; i < arraySize; i++)
+ // log each extra extension.
+ Log.warning(getLogString(configElements[i], logAttribute)
+ + " ignored due to multiple contributions"); //$NON-NLS-1$
+ }
+ return configElement;
+ }
+
+ /**
+ * Utility method to return a string to display in .log. If logAttribute is
+ * not null, its value is also printed.
+ */
+ public static String getLogString(IConfigurationElement element,
+ String logAttribute) {
+ StringBuilder buffer = new StringBuilder(element.getName());
+ buffer.append(" element"); //$NON-NLS-1$
+ if (logAttribute != null) {
+ buffer.append(" with "); //$NON-NLS-1$
+ buffer.append(logAttribute);
+ buffer.append("=\""); //$NON-NLS-1$
+ buffer.append(element.getAttribute(logAttribute));
+ }
+ buffer.append("\" in extension: "); //$NON-NLS-1$
+ buffer.append(element.getDeclaringExtension()
+ .getExtensionPointUniqueIdentifier());
+ buffer.append(" in Bundle: "); //$NON-NLS-1$
+ buffer.append(element.getContributor().getName());
+
+
+ return buffer.toString();
+ }
+
+ /**
+ * Utility method to return a string to display in .log. If logAttribute is
+ * not null, its value is also printed.
+ */
+ public static String getLogString(Bundle bundle, Element element,
+ String logAttribute) {
+ StringBuilder buffer = new StringBuilder(element.getNodeName());
+ buffer.append(" element"); //$NON-NLS-1$
+ if (logAttribute != null) {
+ buffer.append(" with "); //$NON-NLS-1$
+ buffer.append(logAttribute);
+ buffer.append("=\""); //$NON-NLS-1$
+ buffer.append(element.getAttribute(logAttribute));
+ }
+ buffer.append("\" from xml file in Bundle:"); //$NON-NLS-1$
+ buffer.append(bundle.getSymbolicName());
+
+
+ return buffer.toString();
+ }
+
+
+
+ /**
+ * Util class for creating class instances from plugins.
+ *
+ * @param pluginId
+ * @param className
+ * @return
+ */
+ public static Object createClassInstance(String pluginId, String className) {
+ // quick exits.
+ if (pluginId == null || className == null)
+ return null;
+ Bundle bundle = Platform.getBundle(pluginId);
+ if (!BundleUtil.bundleHasValidState(bundle))
+ return null;
+
+ Class<?> aClass;
+ Object aObject;
+ try {
+ aClass = bundle.loadClass(className);
+ aObject = aClass.getDeclaredConstructor().newInstance();
+ return aObject;
+ } catch (Exception e) {
+ Log.error("Intro Could not instantiate: " + className + " in " //$NON-NLS-1$ //$NON-NLS-2$
+ + pluginId, e);
+ return null;
+ }
+ }
+
+
+
+ /**
+ * Creates a key for the given element. Returns null if any id is null along
+ * the path.
+ *
+ * @param element
+ * @return
+ */
+ public static StringBuffer createPathToElementKey(
+ AbstractIntroIdElement element, boolean full) {
+ if (element.getId() == null)
+ return null;
+ StringBuffer buffer = new StringBuffer(element.getId());
+ AbstractBaseIntroElement parent = (AbstractBaseIntroElement) element
+ .getParent();
+ while (parent != null
+ && !parent.isOfType(AbstractIntroElement.MODEL_ROOT)) {
+ if (parent.getId() == null)
+ return null;
+ buffer.insert(0, parent.getId() + "."); //$NON-NLS-1$
+ parent = (AbstractBaseIntroElement) parent.getParent();
+ }
+ return buffer;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/SharedConfigExtensionsManager.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/SharedConfigExtensionsManager.java
index 4d1abfe72..0e1252921 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/SharedConfigExtensionsManager.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/loader/SharedConfigExtensionsManager.java
@@ -32,7 +32,7 @@ import org.eclipse.ui.internal.intro.impl.util.Util;
public class SharedConfigExtensionsManager {
- private IExtensionRegistry registry;
+ private IExtensionRegistry registry;
// Holds all standbyPart extensions
private Map<String, IntroStandbyContentPart> standbyParts = new HashMap<>();
@@ -40,87 +40,87 @@ public class SharedConfigExtensionsManager {
// Holds all command extensions
private Map<String, IntroURLAction> commands = new HashMap<>();
- /*
- * Prevent creation.
- */
- protected SharedConfigExtensionsManager(IExtensionRegistry registry) {
- this.registry = registry;
- }
-
- /**
- * Loads all shared config extennsions (ie: standby parts and commands.
- */
- protected void loadSharedConfigExtensions() {
- // simply create model classes for all standbyPart elements under a
- // configExtension.
-
- long start = 0;
- // if we need to log performance, capture time.
- if (Log.logPerformance)
- start = System.currentTimeMillis();
-
- IConfigurationElement[] configExtensionElements = registry
- .getConfigurationElementsFor(BaseExtensionPointManager.CONFIG_EXTENSION);
-
- if (Log.logPerformance)
- Util.logPerformanceTime(
- "quering registry for configExtensions took: ", start); //$NON-NLS-1$
-
- for (int i = 0; i < configExtensionElements.length; i++) {
- IConfigurationElement element = configExtensionElements[i];
- if (!ModelLoaderUtil.isValidElementName(element,
- IntroStandbyContentPart.TAG_STANDBY_CONTENT_PART)
- && !ModelLoaderUtil.isValidElementName(element,
- IntroURLAction.TAG_ACTION))
- // if extension is not a standbypart or command, ignore.
- continue;
- createModelClass(element);
- }
- }
-
-
- /**
- * Create an intro standby part or an intro command model class.
- *
- * @param element
- */
- private void createModelClass(IConfigurationElement element) {
- if (element.getName().equals(
- IntroStandbyContentPart.TAG_STANDBY_CONTENT_PART)) {
- IntroStandbyContentPart standbyPartContent = new IntroStandbyContentPart(
- element);
- if (standbyPartContent.getId() == null)
- // no id, ignore.
- return;
- standbyParts.put(standbyPartContent.getId(), standbyPartContent);
- } else {
- IntroURLAction introURLCommand = new IntroURLAction(element);
- if (introURLCommand.getName() == null
- || introURLCommand.getReplaceValue() == null)
- // no name or resolvedValue, ignore.
- return;
- commands.put(introURLCommand.getName(), introURLCommand);
- }
- }
-
-
-
- /**
- * @return Returns a standbyPart basd on its registred id.
- */
- public IntroStandbyContentPart getStandbyPart(String partId) {
- if (partId == null)
- return null;
- return standbyParts.get(partId);
- }
-
- /**
- * @return Returns the command from its name.
- */
- public IntroURLAction getCommand(String commandName) {
- if (commandName == null)
- return null;
- return commands.get(commandName);
- }
+ /*
+ * Prevent creation.
+ */
+ protected SharedConfigExtensionsManager(IExtensionRegistry registry) {
+ this.registry = registry;
+ }
+
+ /**
+ * Loads all shared config extennsions (ie: standby parts and commands.
+ */
+ protected void loadSharedConfigExtensions() {
+ // simply create model classes for all standbyPart elements under a
+ // configExtension.
+
+ long start = 0;
+ // if we need to log performance, capture time.
+ if (Log.logPerformance)
+ start = System.currentTimeMillis();
+
+ IConfigurationElement[] configExtensionElements = registry
+ .getConfigurationElementsFor(BaseExtensionPointManager.CONFIG_EXTENSION);
+
+ if (Log.logPerformance)
+ Util.logPerformanceTime(
+ "quering registry for configExtensions took: ", start); //$NON-NLS-1$
+
+ for (int i = 0; i < configExtensionElements.length; i++) {
+ IConfigurationElement element = configExtensionElements[i];
+ if (!ModelLoaderUtil.isValidElementName(element,
+ IntroStandbyContentPart.TAG_STANDBY_CONTENT_PART)
+ && !ModelLoaderUtil.isValidElementName(element,
+ IntroURLAction.TAG_ACTION))
+ // if extension is not a standbypart or command, ignore.
+ continue;
+ createModelClass(element);
+ }
+ }
+
+
+ /**
+ * Create an intro standby part or an intro command model class.
+ *
+ * @param element
+ */
+ private void createModelClass(IConfigurationElement element) {
+ if (element.getName().equals(
+ IntroStandbyContentPart.TAG_STANDBY_CONTENT_PART)) {
+ IntroStandbyContentPart standbyPartContent = new IntroStandbyContentPart(
+ element);
+ if (standbyPartContent.getId() == null)
+ // no id, ignore.
+ return;
+ standbyParts.put(standbyPartContent.getId(), standbyPartContent);
+ } else {
+ IntroURLAction introURLCommand = new IntroURLAction(element);
+ if (introURLCommand.getName() == null
+ || introURLCommand.getReplaceValue() == null)
+ // no name or resolvedValue, ignore.
+ return;
+ commands.put(introURLCommand.getName(), introURLCommand);
+ }
+ }
+
+
+
+ /**
+ * @return Returns a standbyPart basd on its registred id.
+ */
+ public IntroStandbyContentPart getStandbyPart(String partId) {
+ if (partId == null)
+ return null;
+ return standbyParts.get(partId);
+ }
+
+ /**
+ * @return Returns the command from its name.
+ */
+ public IntroURLAction getCommand(String commandName) {
+ if (commandName == null)
+ return null;
+ return commands.get(commandName);
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java
index 87e04139e..e75d7651d 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURL.java
@@ -68,184 +68,184 @@ import org.eclipse.ui.intro.config.IntroURLFactory;
public class IntroURL implements IIntroURL {
- /**
- * Intro URL constants.
- */
- public static final String INTRO_PROTOCOL = "http"; //$NON-NLS-1$
- public static final String INTRO_HOST_ID = "org.eclipse.ui.intro"; //$NON-NLS-1$
-
- /**
- * Constants that represent Intro URL actions.
- */
- public static final String SET_STANDBY_MODE = "setStandbyMode"; //$NON-NLS-1$
- public static final String SHOW_STANDBY = "showStandby"; //$NON-NLS-1$
- public static final String CLOSE = "close"; //$NON-NLS-1$
- public static final String SHOW_HELP_TOPIC = "showHelpTopic"; //$NON-NLS-1$
- public static final String SHOW_HELP = "showHelp"; //$NON-NLS-1$
- public static final String OPEN_BROWSER = "openBrowser"; //$NON-NLS-1$
- public static final String OPEN_URL = "openURL"; //$NON-NLS-1$
- public static final String RUN_ACTION = "runAction"; //$NON-NLS-1$
- public static final String SHOW_PAGE = "showPage"; //$NON-NLS-1$
- public static final String SHOW_MESSAGE = "showMessage"; //$NON-NLS-1$
- public static final String NAVIGATE = "navigate"; //$NON-NLS-1$
- public static final String SWITCH_TO_LAUNCH_BAR = "switchToLaunchBar"; //$NON-NLS-1$
- public static final String EXECUTE = "execute"; //$NON-NLS-1$
-
- /**
- * Constants that represent valid action keys.
- */
- public static final String KEY_ID = "id"; //$NON-NLS-1$
- public static final String KEY_PLUGIN_ID = "pluginId"; //$NON-NLS-1$
- public static final String KEY_CLASS = "class"; //$NON-NLS-1$
- public static final String KEY_STANDBY = "standby"; //$NON-NLS-1$
- public static final String KEY_PART_ID = "partId"; //$NON-NLS-1$
- public static final String KEY_INPUT = "input"; //$NON-NLS-1$
- public static final String KEY_MESSAGE = "message"; //$NON-NLS-1$
- public static final String KEY_URL = "url"; //$NON-NLS-1$
- public static final String KEY_DIRECTION = "direction"; //$NON-NLS-1$
- public static final String KEY_EMBED = "embed"; //$NON-NLS-1$
- public static final String KEY_EMBED_TARGET = "embedTarget"; //$NON-NLS-1$
- public static final String KEY_DECODE = "decode"; //$NON-NLS-1$
- public static final String KEY_COMAND = "command"; //$NON-NLS-1$
-
-
- public static final String VALUE_BACKWARD = "backward"; //$NON-NLS-1$
- public static final String VALUE_FORWARD = "forward"; //$NON-NLS-1$
- public static final String VALUE_HOME = "home"; //$NON-NLS-1$
- public static final String VALUE_TRUE = "true"; //$NON-NLS-1$
- public static final String VALUE_FALSE = "false"; //$NON-NLS-1$
+ /**
+ * Intro URL constants.
+ */
+ public static final String INTRO_PROTOCOL = "http"; //$NON-NLS-1$
+ public static final String INTRO_HOST_ID = "org.eclipse.ui.intro"; //$NON-NLS-1$
+
+ /**
+ * Constants that represent Intro URL actions.
+ */
+ public static final String SET_STANDBY_MODE = "setStandbyMode"; //$NON-NLS-1$
+ public static final String SHOW_STANDBY = "showStandby"; //$NON-NLS-1$
+ public static final String CLOSE = "close"; //$NON-NLS-1$
+ public static final String SHOW_HELP_TOPIC = "showHelpTopic"; //$NON-NLS-1$
+ public static final String SHOW_HELP = "showHelp"; //$NON-NLS-1$
+ public static final String OPEN_BROWSER = "openBrowser"; //$NON-NLS-1$
+ public static final String OPEN_URL = "openURL"; //$NON-NLS-1$
+ public static final String RUN_ACTION = "runAction"; //$NON-NLS-1$
+ public static final String SHOW_PAGE = "showPage"; //$NON-NLS-1$
+ public static final String SHOW_MESSAGE = "showMessage"; //$NON-NLS-1$
+ public static final String NAVIGATE = "navigate"; //$NON-NLS-1$
+ public static final String SWITCH_TO_LAUNCH_BAR = "switchToLaunchBar"; //$NON-NLS-1$
+ public static final String EXECUTE = "execute"; //$NON-NLS-1$
+
+ /**
+ * Constants that represent valid action keys.
+ */
+ public static final String KEY_ID = "id"; //$NON-NLS-1$
+ public static final String KEY_PLUGIN_ID = "pluginId"; //$NON-NLS-1$
+ public static final String KEY_CLASS = "class"; //$NON-NLS-1$
+ public static final String KEY_STANDBY = "standby"; //$NON-NLS-1$
+ public static final String KEY_PART_ID = "partId"; //$NON-NLS-1$
+ public static final String KEY_INPUT = "input"; //$NON-NLS-1$
+ public static final String KEY_MESSAGE = "message"; //$NON-NLS-1$
+ public static final String KEY_URL = "url"; //$NON-NLS-1$
+ public static final String KEY_DIRECTION = "direction"; //$NON-NLS-1$
+ public static final String KEY_EMBED = "embed"; //$NON-NLS-1$
+ public static final String KEY_EMBED_TARGET = "embedTarget"; //$NON-NLS-1$
+ public static final String KEY_DECODE = "decode"; //$NON-NLS-1$
+ public static final String KEY_COMAND = "command"; //$NON-NLS-1$
+
+
+ public static final String VALUE_BACKWARD = "backward"; //$NON-NLS-1$
+ public static final String VALUE_FORWARD = "forward"; //$NON-NLS-1$
+ public static final String VALUE_HOME = "home"; //$NON-NLS-1$
+ public static final String VALUE_TRUE = "true"; //$NON-NLS-1$
+ public static final String VALUE_FALSE = "false"; //$NON-NLS-1$
public static final String VALUE_CLOSE = "close"; //$NON-NLS-1$
public static final String VALUE_STANDBY = "standby"; //$NON-NLS-1$
public static final String VALUE_LAUNCHBAR = "launchbar"; //$NON-NLS-1$
- private String action = null;
- private Properties parameters = null;
+ private String action = null;
+ private Properties parameters = null;
- /**
- * Prevent creation. Must be created through an IntroURLParser. This
- * constructor assumed we have a valid intro url.
- *
- * @param url
- */
- IntroURL(String action, Properties parameters) {
- this.action = action;
- this.parameters = parameters;
- }
+ /**
+ * Prevent creation. Must be created through an IntroURLParser. This
+ * constructor assumed we have a valid intro url.
+ *
+ * @param url
+ */
+ IntroURL(String action, Properties parameters) {
+ this.action = action;
+ this.parameters = parameters;
+ }
- /**
- * Executes whatever valid Intro action is embedded in this Intro URL.
- *
- */
- @Override
+ /**
+ * Executes whatever valid Intro action is embedded in this Intro URL.
+ *
+ */
+ @Override
public boolean execute() {
- final boolean[] result = new boolean[1];
- Display display = Display.getCurrent();
-
- BusyIndicator.showWhile(display, () -> result[0] = doExecute());
- return result[0];
- }
-
- protected boolean doExecute() {
- if (Log.logInfo) {
- String msg = StringUtil.concat("Running Intro URL action ", action, //$NON-NLS-1$
- " with parameters: ", parameters.toString()); //$NON-NLS-1$
- Log.info(msg);
- }
-
- // check for all supported Intro actions first.
- if (action.equals(CLOSE))
- return closeIntro();
-
- else if (action.equals(SET_STANDBY_MODE))
- // Sets the state of the intro part. Does not care about passing
- // input to the part.
- return setStandbyState(getParameter(KEY_STANDBY));
-
- else if (action.equals(SHOW_STANDBY))
- return handleStandbyState(getParameter(KEY_PART_ID),
- getParameter(KEY_INPUT));
-
- else if (action.equals(SHOW_HELP))
- // display the full Help System.
- return showHelp();
-
- else if (action.equals(SHOW_HELP_TOPIC))
- // display a Help System Topic. It can be displayed in the Help
- // system window, or embedded as an intro page.
- // return showHelpTopic(getParameter(KEY_ID));
- return showHelpTopic(getParameter(KEY_ID), getParameter(KEY_EMBED),
- getParameter(KEY_EMBED_TARGET));
-
- else if (action.equals(OPEN_BROWSER))
- // display url in external browser
- return openBrowser(getParameter(KEY_URL),
- getParameter(KEY_PLUGIN_ID));
-
- if (action.equals(OPEN_URL))
- // display url embedded in intro browser.
- return openURL(getParameter(KEY_URL), getParameter(KEY_PLUGIN_ID));
-
- else if (action.equals(RUN_ACTION))
- // run an Intro action. Get the pluginId and the class keys. Pass
- // the parameters and the standby state.
- return runAction(getParameter(KEY_PLUGIN_ID),
- getParameter(KEY_CLASS), parameters, getParameter(KEY_STANDBY));
-
- else if (action.equals(EXECUTE))
+ final boolean[] result = new boolean[1];
+ Display display = Display.getCurrent();
+
+ BusyIndicator.showWhile(display, () -> result[0] = doExecute());
+ return result[0];
+ }
+
+ protected boolean doExecute() {
+ if (Log.logInfo) {
+ String msg = StringUtil.concat("Running Intro URL action ", action, //$NON-NLS-1$
+ " with parameters: ", parameters.toString()); //$NON-NLS-1$
+ Log.info(msg);
+ }
+
+ // check for all supported Intro actions first.
+ if (action.equals(CLOSE))
+ return closeIntro();
+
+ else if (action.equals(SET_STANDBY_MODE))
+ // Sets the state of the intro part. Does not care about passing
+ // input to the part.
+ return setStandbyState(getParameter(KEY_STANDBY));
+
+ else if (action.equals(SHOW_STANDBY))
+ return handleStandbyState(getParameter(KEY_PART_ID),
+ getParameter(KEY_INPUT));
+
+ else if (action.equals(SHOW_HELP))
+ // display the full Help System.
+ return showHelp();
+
+ else if (action.equals(SHOW_HELP_TOPIC))
+ // display a Help System Topic. It can be displayed in the Help
+ // system window, or embedded as an intro page.
+ // return showHelpTopic(getParameter(KEY_ID));
+ return showHelpTopic(getParameter(KEY_ID), getParameter(KEY_EMBED),
+ getParameter(KEY_EMBED_TARGET));
+
+ else if (action.equals(OPEN_BROWSER))
+ // display url in external browser
+ return openBrowser(getParameter(KEY_URL),
+ getParameter(KEY_PLUGIN_ID));
+
+ if (action.equals(OPEN_URL))
+ // display url embedded in intro browser.
+ return openURL(getParameter(KEY_URL), getParameter(KEY_PLUGIN_ID));
+
+ else if (action.equals(RUN_ACTION))
+ // run an Intro action. Get the pluginId and the class keys. Pass
+ // the parameters and the standby state.
+ return runAction(getParameter(KEY_PLUGIN_ID),
+ getParameter(KEY_CLASS), parameters, getParameter(KEY_STANDBY));
+
+ else if (action.equals(EXECUTE))
// execute a serialized command
return executeCommand(getParameter(KEY_COMAND), getParameter(KEY_STANDBY));
- else if (action.equals(SHOW_PAGE))
- // display an Intro Page.
- return showPage(getParameter(KEY_ID), getParameter(KEY_STANDBY));
-
- else if (action.equals(SHOW_MESSAGE))
- return showMessage(getParameter(KEY_MESSAGE));
-
- else if (action.equals(NAVIGATE))
- return navigate(getParameter(KEY_DIRECTION));
-
- else if (action.equals(SWITCH_TO_LAUNCH_BAR))
- return switchToLaunchBar();
-
- else
- return handleCustomAction();
- }
-
-
- private boolean closeIntro() {
- // Relies on Workbench.
- return IntroPlugin.closeIntro();
- }
-
- /**
- * Sets the into part to standby, and shows the passed standby part, with
- * the given input. Forces the Intro view to open, if not yet created.
- *
- * @param partId
- * @param input
- */
- private boolean handleStandbyState(String partId, String input) {
- // set intro to standby mode. we know we have a customizable part.
- CustomizableIntroPart introPart = (CustomizableIntroPart) IntroPlugin
- .getIntro();
- if (introPart == null)
- introPart = (CustomizableIntroPart) IntroPlugin.showIntro(true);
- // store the flag to indicate that standbypart is needed.
- introPart.getControl().setData(IIntroConstants.SHOW_STANDBY_PART,
- VALUE_TRUE);
- IntroPlugin.setIntroStandby(true);
- StandbyPart standbyPart = introPart
- .getAdapter(StandbyPart.class);
-
- // We may not have a valid partId or we might fail to instantiate part or
- // create the part content. An empty part will be shown. Signal failure.
- return standbyPart != null && standbyPart.showContentPart(partId, input);
- }
-
- /**
+ else if (action.equals(SHOW_PAGE))
+ // display an Intro Page.
+ return showPage(getParameter(KEY_ID), getParameter(KEY_STANDBY));
+
+ else if (action.equals(SHOW_MESSAGE))
+ return showMessage(getParameter(KEY_MESSAGE));
+
+ else if (action.equals(NAVIGATE))
+ return navigate(getParameter(KEY_DIRECTION));
+
+ else if (action.equals(SWITCH_TO_LAUNCH_BAR))
+ return switchToLaunchBar();
+
+ else
+ return handleCustomAction();
+ }
+
+
+ private boolean closeIntro() {
+ // Relies on Workbench.
+ return IntroPlugin.closeIntro();
+ }
+
+ /**
+ * Sets the into part to standby, and shows the passed standby part, with
+ * the given input. Forces the Intro view to open, if not yet created.
+ *
+ * @param partId
+ * @param input
+ */
+ private boolean handleStandbyState(String partId, String input) {
+ // set intro to standby mode. we know we have a customizable part.
+ CustomizableIntroPart introPart = (CustomizableIntroPart) IntroPlugin
+ .getIntro();
+ if (introPart == null)
+ introPart = (CustomizableIntroPart) IntroPlugin.showIntro(true);
+ // store the flag to indicate that standbypart is needed.
+ introPart.getControl().setData(IIntroConstants.SHOW_STANDBY_PART,
+ VALUE_TRUE);
+ IntroPlugin.setIntroStandby(true);
+ StandbyPart standbyPart = introPart
+ .getAdapter(StandbyPart.class);
+
+ // We may not have a valid partId or we might fail to instantiate part or
+ // create the part content. An empty part will be shown. Signal failure.
+ return standbyPart != null && standbyPart.showContentPart(partId, input);
+ }
+
+ /**
* Set the Workbench Intro Part state. Forces the Intro view to open, if not yet created.
*
* Historically this value was "true" (show standby) or "false" (show normal). In Neon we add
@@ -254,9 +254,9 @@ public class IntroURL implements IIntroURL {
* @param state
* @return true if the intro was shown, or false if the intro could not be shown
*/
- private boolean setStandbyState(String state) {
- if (state == null)
- return false;
+ private boolean setStandbyState(String state) {
+ if (state == null)
+ return false;
if (state.equals(VALUE_CLOSE)) {
return IntroPlugin.closeIntro();
} else if (state.equals(VALUE_LAUNCHBAR)) {
@@ -264,58 +264,58 @@ public class IntroURL implements IIntroURL {
}
boolean standby = state.equals(VALUE_TRUE) || state.equals(VALUE_STANDBY);
- IIntroPart introPart = IntroPlugin.showIntro(standby);
- if (introPart == null)
- return false;
- return true;
- }
-
-
- /**
- * Run an action
- */
- private boolean runAction(String pluginId, String className,
- Properties parameters, String standbyState) {
-
- Object actionObject = ModelLoaderUtil.createClassInstance(pluginId,
- className);
- try {
- if (actionObject instanceof IIntroAction) {
- IIntroAction introAction = (IIntroAction) actionObject;
- IIntroSite site = IntroPlugin.getDefault().getIntroModelRoot()
- .getPresentation().getIntroPart().getIntroSite();
- introAction.run(site, parameters);
- } else if (actionObject instanceof IAction) {
- IAction action = (IAction) actionObject;
- action.run();
-
- } else if (actionObject instanceof IActionDelegate) {
- final IActionDelegate delegate = (IActionDelegate) actionObject;
- if (delegate instanceof IWorkbenchWindowActionDelegate)
- ((IWorkbenchWindowActionDelegate) delegate).init(PlatformUI
- .getWorkbench().getActiveWorkbenchWindow());
- Action proxy = new Action(this.action) {
-
- @Override
+ IIntroPart introPart = IntroPlugin.showIntro(standby);
+ if (introPart == null)
+ return false;
+ return true;
+ }
+
+
+ /**
+ * Run an action
+ */
+ private boolean runAction(String pluginId, String className,
+ Properties parameters, String standbyState) {
+
+ Object actionObject = ModelLoaderUtil.createClassInstance(pluginId,
+ className);
+ try {
+ if (actionObject instanceof IIntroAction) {
+ IIntroAction introAction = (IIntroAction) actionObject;
+ IIntroSite site = IntroPlugin.getDefault().getIntroModelRoot()
+ .getPresentation().getIntroPart().getIntroSite();
+ introAction.run(site, parameters);
+ } else if (actionObject instanceof IAction) {
+ IAction action = (IAction) actionObject;
+ action.run();
+
+ } else if (actionObject instanceof IActionDelegate) {
+ final IActionDelegate delegate = (IActionDelegate) actionObject;
+ if (delegate instanceof IWorkbenchWindowActionDelegate)
+ ((IWorkbenchWindowActionDelegate) delegate).init(PlatformUI
+ .getWorkbench().getActiveWorkbenchWindow());
+ Action proxy = new Action(this.action) {
+
+ @Override
public void run() {
- delegate.run(this);
- }
- };
- proxy.run();
- } else
- // we could not create the class.
- return false;
- // ran action successfully. Now set intro intro standby if needed.
- if (standbyState == null)
- return true;
- return setStandbyState(standbyState);
- } catch (Exception e) {
- Log.error("Could not run action: " + className, e); //$NON-NLS-1$
- return false;
- }
- }
-
- /**
+ delegate.run(this);
+ }
+ };
+ proxy.run();
+ } else
+ // we could not create the class.
+ return false;
+ // ran action successfully. Now set intro intro standby if needed.
+ if (standbyState == null)
+ return true;
+ return setStandbyState(standbyState);
+ } catch (Exception e) {
+ Log.error("Could not run action: " + className, e); //$NON-NLS-1$
+ return false;
+ }
+ }
+
+ /**
* Executes a serialized <code>ParameterizedCommand</code>. Uses
* {@link ICommandService#deserialize(String)} to convert the <code>command</code> argument
* into the parameterized command.
@@ -342,14 +342,14 @@ public class IntroURL implements IIntroURL {
}
}
- private ICommandService getCommandService() {
+ private ICommandService getCommandService() {
IWorkbench wb = PlatformUI.getWorkbench();
if (wb != null) {
Object serviceObject = wb.getAdapter(ICommandService.class);
- if (serviceObject != null) {
- ICommandService service = (ICommandService)serviceObject;
- return service;
- }
+ if (serviceObject != null) {
+ ICommandService service = (ICommandService)serviceObject;
+ return service;
+ }
}
return null;
}
@@ -358,307 +358,307 @@ public class IntroURL implements IIntroURL {
IWorkbench wb = PlatformUI.getWorkbench();
if (wb != null) {
Object serviceObject = wb.getAdapter(IHandlerService.class);
- if (serviceObject != null) {
- IHandlerService service = (IHandlerService)serviceObject;
- return service;
- }
+ if (serviceObject != null) {
+ IHandlerService service = (IHandlerService)serviceObject;
+ return service;
+ }
}
return null;
}
- /**
- * Open a help topic. If embed="true", open the help href as an intro page.
- * If false, open the href in the Help system window. If embedTarget is set,
- * then the Help System topic is embedded instead of the content of the
- * specified div.<br>
- * In the case of SWT presentation, embedd flag is ignored and the topic is
- * opened in the Help system window.
- */
- private boolean showHelpTopic(String href, String embed, String embedTarget) {
- return new ShowHelpURLHandler(this).showHelpTopic(href, embed,
- embedTarget);
- }
-
-
-
- /**
- * Open the help system.
- */
- private boolean showHelp() {
- PlatformUI.getWorkbench().getHelpSystem().displayHelp();
- return true;
- }
-
- /**
- * Launch external browser.
- */
- private boolean openBrowser(String url, String pluginId) {
- // no need to decode url because we will create another url from this
- // url anyway. Resolve the url just in case we are trying to load a
- // plugin relative file.
- url = ModelUtil.resolveURL(url, pluginId);
- return Util.openBrowser(url);
- }
-
-
- /**
- * Show a URL in an intro page. This is the embedded version of the intro
- * action openBrowser(). It is useful when trying to show an html file
- * relative to another plugin. When the presentation is UI forms
- * presentation, this call behaves exactly as the openBrowser intro action.
- */
-
- private boolean openURL(String url, String pluginId) {
- IntroModelRoot model = IntroPlugin.getDefault().getIntroModelRoot();
- String presentationStyle = model.getPresentation()
- .getImplementationKind();
-
- if (presentationStyle.equals(IntroPartPresentation.BROWSER_IMPL_KIND)) {
- // HTML presentation
- url = ModelUtil.resolveURL(url, pluginId);
- BrowserIntroPartImplementation impl = (BrowserIntroPartImplementation) IntroPlugin
- .getDefault().getIntroModelRoot().getPresentation()
- .getIntroPartImplementation();
- Browser browser = impl.getBrowser();
- return browser.setUrl(url);
- }
- // SWT presentation.
+ /**
+ * Open a help topic. If embed="true", open the help href as an intro page.
+ * If false, open the href in the Help system window. If embedTarget is set,
+ * then the Help System topic is embedded instead of the content of the
+ * specified div.<br>
+ * In the case of SWT presentation, embedd flag is ignored and the topic is
+ * opened in the Help system window.
+ */
+ private boolean showHelpTopic(String href, String embed, String embedTarget) {
+ return new ShowHelpURLHandler(this).showHelpTopic(href, embed,
+ embedTarget);
+ }
+
+
+
+ /**
+ * Open the help system.
+ */
+ private boolean showHelp() {
+ PlatformUI.getWorkbench().getHelpSystem().displayHelp();
+ return true;
+ }
+
+ /**
+ * Launch external browser.
+ */
+ private boolean openBrowser(String url, String pluginId) {
+ // no need to decode url because we will create another url from this
+ // url anyway. Resolve the url just in case we are trying to load a
+ // plugin relative file.
+ url = ModelUtil.resolveURL(url, pluginId);
+ return Util.openBrowser(url);
+ }
+
+
+ /**
+ * Show a URL in an intro page. This is the embedded version of the intro
+ * action openBrowser(). It is useful when trying to show an html file
+ * relative to another plugin. When the presentation is UI forms
+ * presentation, this call behaves exactly as the openBrowser intro action.
+ */
+
+ private boolean openURL(String url, String pluginId) {
+ IntroModelRoot model = IntroPlugin.getDefault().getIntroModelRoot();
+ String presentationStyle = model.getPresentation()
+ .getImplementationKind();
+
+ if (presentationStyle.equals(IntroPartPresentation.BROWSER_IMPL_KIND)) {
+ // HTML presentation
+ url = ModelUtil.resolveURL(url, pluginId);
+ BrowserIntroPartImplementation impl = (BrowserIntroPartImplementation) IntroPlugin
+ .getDefault().getIntroModelRoot().getPresentation()
+ .getIntroPartImplementation();
+ Browser browser = impl.getBrowser();
+ return browser.setUrl(url);
+ }
+ // SWT presentation.
return openBrowser(url, pluginId);
- }
-
-
- private boolean showMessage(String message) {
- if (message == null)
- return false;
- DialogUtil.displayInfoMessage(null, message);
- return true;
- }
-
- /**
- * Display an Intro Page.
- * <p>
- * INTRO: revisit picking first page.
- */
- boolean showPage(String pageId, String standbyState) {
- // set the current page id in the model. This will trigger appropriate
- // listener event to the UI. If setting the page in the model fails (ie:
- // the page was not found in the current model, look for it in loaded
- // models. return false if failed.
- // avoid flicker.
- CustomizableIntroPart currentIntroPart = (CustomizableIntroPart) IntroPlugin
- .getIntro();
- currentIntroPart.getControl().setRedraw(false);
-
- IntroModelRoot modelRoot = IntroPlugin.getDefault().getIntroModelRoot();
- boolean success = modelRoot.setCurrentPageId(pageId);
- if (!success)
- success = includePageToShow(modelRoot, pageId);
-
- // we turned drawing off. Turn it on again.
- currentIntroPart.getControl().setRedraw(true);
-
- if (success) {
- // found page. Set the history
- modelRoot.getPresentation().updateHistory(
- modelRoot.getCurrentPage());
- // ran action successfully. Now set intro intro standby if needed.
- if (standbyState == null)
- return true;
- return setStandbyState(standbyState);
- }
- // could not find referenced page.
- return false;
- }
-
- /**
- * Finds the target page and includes it in passed model.
- *
- * @param pageId
- * @return
- */
- private boolean includePageToShow(IntroModelRoot model, String pageId) {
- AbstractIntroPage page = findPageToShow(pageId);
- if (page == null) {
- Log.warning("Could not find an Intro page with id=" + pageId); //$NON-NLS-1$
- return false;
- }
- // now clone the target page because original model should be kept
- // intact. Resolve target page first to resolve its includes
- // properly. Insert presentation shared style at the top of the shared
- // styles list because once reparented, the shared style is lost.
- // Finally, add clone page to current model.
- page.getChildren();
- // current kind.
- String currentPresentationKind = model.getPresentation()
- .getImplementationKind();
- // load shared style corresponding to same presentation kind from target
- // model.
- IntroPartPresentation targetPresentation = ((IntroModelRoot) page
- .getParent()).getPresentation();
- String targetSharedStyle = targetPresentation
- .getSharedStyle(currentPresentationKind);
- // clone.
- AbstractIntroPage clonedPage = null;
- try {
- clonedPage = (AbstractIntroPage) page.clone();
- } catch (CloneNotSupportedException ex) {
- // should never be here.
- Log.error("Failed to clone Intro model node.", ex); //$NON-NLS-1$
- return false;
- }
- // reparent cloned target to current model.
- clonedPage.setParent(model);
- // REVISIT: SWT presentation does not support multiple shared
- // styles.
- if (targetSharedStyle != null)
- // add target model shared style.
- clonedPage.insertStyle(targetSharedStyle, 0);
- model.addChild(clonedPage);
- return model.setCurrentPageId(clonedPage.getId());
- }
-
-
- /**
- * Searches all loaded models for the first page with the given id.
- *
- * @param pageId
- * @return
- */
- private AbstractIntroPage findPageToShow(String pageId) {
+ }
+
+
+ private boolean showMessage(String message) {
+ if (message == null)
+ return false;
+ DialogUtil.displayInfoMessage(null, message);
+ return true;
+ }
+
+ /**
+ * Display an Intro Page.
+ * <p>
+ * INTRO: revisit picking first page.
+ */
+ boolean showPage(String pageId, String standbyState) {
+ // set the current page id in the model. This will trigger appropriate
+ // listener event to the UI. If setting the page in the model fails (ie:
+ // the page was not found in the current model, look for it in loaded
+ // models. return false if failed.
+ // avoid flicker.
+ CustomizableIntroPart currentIntroPart = (CustomizableIntroPart) IntroPlugin
+ .getIntro();
+ currentIntroPart.getControl().setRedraw(false);
+
+ IntroModelRoot modelRoot = IntroPlugin.getDefault().getIntroModelRoot();
+ boolean success = modelRoot.setCurrentPageId(pageId);
+ if (!success)
+ success = includePageToShow(modelRoot, pageId);
+
+ // we turned drawing off. Turn it on again.
+ currentIntroPart.getControl().setRedraw(true);
+
+ if (success) {
+ // found page. Set the history
+ modelRoot.getPresentation().updateHistory(
+ modelRoot.getCurrentPage());
+ // ran action successfully. Now set intro intro standby if needed.
+ if (standbyState == null)
+ return true;
+ return setStandbyState(standbyState);
+ }
+ // could not find referenced page.
+ return false;
+ }
+
+ /**
+ * Finds the target page and includes it in passed model.
+ *
+ * @param pageId
+ * @return
+ */
+ private boolean includePageToShow(IntroModelRoot model, String pageId) {
+ AbstractIntroPage page = findPageToShow(pageId);
+ if (page == null) {
+ Log.warning("Could not find an Intro page with id=" + pageId); //$NON-NLS-1$
+ return false;
+ }
+ // now clone the target page because original model should be kept
+ // intact. Resolve target page first to resolve its includes
+ // properly. Insert presentation shared style at the top of the shared
+ // styles list because once reparented, the shared style is lost.
+ // Finally, add clone page to current model.
+ page.getChildren();
+ // current kind.
+ String currentPresentationKind = model.getPresentation()
+ .getImplementationKind();
+ // load shared style corresponding to same presentation kind from target
+ // model.
+ IntroPartPresentation targetPresentation = ((IntroModelRoot) page
+ .getParent()).getPresentation();
+ String targetSharedStyle = targetPresentation
+ .getSharedStyle(currentPresentationKind);
+ // clone.
+ AbstractIntroPage clonedPage = null;
+ try {
+ clonedPage = (AbstractIntroPage) page.clone();
+ } catch (CloneNotSupportedException ex) {
+ // should never be here.
+ Log.error("Failed to clone Intro model node.", ex); //$NON-NLS-1$
+ return false;
+ }
+ // reparent cloned target to current model.
+ clonedPage.setParent(model);
+ // REVISIT: SWT presentation does not support multiple shared
+ // styles.
+ if (targetSharedStyle != null)
+ // add target model shared style.
+ clonedPage.insertStyle(targetSharedStyle, 0);
+ model.addChild(clonedPage);
+ return model.setCurrentPageId(clonedPage.getId());
+ }
+
+
+ /**
+ * Searches all loaded models for the first page with the given id.
+ *
+ * @param pageId
+ * @return
+ */
+ private AbstractIntroPage findPageToShow(String pageId) {
// check all cached models.
for (IntroModelRoot model : ExtensionPointManager.getInst().getIntroModels().values()) {
- AbstractIntroPage page = (AbstractIntroPage) model.findChild(
- pageId, AbstractIntroElement.ABSTRACT_PAGE);
- if (page != null)
- return page;
- }
- // could not find page in any model.
- return null;
- }
-
- /**
- * Navigate foward in the presentation, whichever one it is.
- *
- * @return
- */
- private boolean navigate(String direction) {
- // set intro to standby mode. we know we have a customizable part.
- CustomizableIntroPart introPart = (CustomizableIntroPart) IntroPlugin
- .getIntro();
- if (introPart == null)
- // intro is closed. Do nothing.
- return false;
-
- IntroPartPresentation presentation = introPart
- .getAdapter(IntroPartPresentation.class);
-
- if (direction.equalsIgnoreCase(VALUE_BACKWARD))
- return presentation.navigateBackward();
- else if (direction.equalsIgnoreCase(VALUE_FORWARD))
- return presentation.navigateForward();
- else if (direction.equalsIgnoreCase(VALUE_HOME))
- return presentation.navigateHome();
- return false;
- }
-
-
- /**
- * @return Returns the action imbedded in this URL.
- */
- @Override
+ AbstractIntroPage page = (AbstractIntroPage) model.findChild(
+ pageId, AbstractIntroElement.ABSTRACT_PAGE);
+ if (page != null)
+ return page;
+ }
+ // could not find page in any model.
+ return null;
+ }
+
+ /**
+ * Navigate foward in the presentation, whichever one it is.
+ *
+ * @return
+ */
+ private boolean navigate(String direction) {
+ // set intro to standby mode. we know we have a customizable part.
+ CustomizableIntroPart introPart = (CustomizableIntroPart) IntroPlugin
+ .getIntro();
+ if (introPart == null)
+ // intro is closed. Do nothing.
+ return false;
+
+ IntroPartPresentation presentation = introPart
+ .getAdapter(IntroPartPresentation.class);
+
+ if (direction.equalsIgnoreCase(VALUE_BACKWARD))
+ return presentation.navigateBackward();
+ else if (direction.equalsIgnoreCase(VALUE_FORWARD))
+ return presentation.navigateForward();
+ else if (direction.equalsIgnoreCase(VALUE_HOME))
+ return presentation.navigateHome();
+ return false;
+ }
+
+
+ /**
+ * @return Returns the action imbedded in this URL.
+ */
+ @Override
public String getAction() {
- return action;
- }
-
- /**
- * Return a parameter defined in the Intro URL. Returns null if the
- * parameter is not defined. If this intro url has a decode=true parameter,
- * then all parameters are returned decoded using UTF-8.
- *
- * @param parameterId
- * @return
- */
- @Override
+ return action;
+ }
+
+ /**
+ * Return a parameter defined in the Intro URL. Returns null if the
+ * parameter is not defined. If this intro url has a decode=true parameter,
+ * then all parameters are returned decoded using UTF-8.
+ *
+ * @param parameterId
+ * @return
+ */
+ @Override
public String getParameter(String parameterId) {
- // make sure to decode only on return, since we may need to recreate the
- // url when handling custom urls.
- String value = parameters.getProperty(parameterId);
- String decode = parameters.getProperty(KEY_DECODE);
-
- if (value != null)
- try {
- if (decode!=null && decode.equalsIgnoreCase(VALUE_TRUE))
- // we are told to decode the parameters of the url through
- // the decode parameter. Assume that parameters are
- // UTF-8 encoded.
- return StringUtil.decode(value, "UTF-8"); //$NON-NLS-1$
- return value;
- } catch (Exception e) {
- // should never be here.
- Log.error("Failed to decode URL: " + parameterId, e); //$NON-NLS-1$
- }
- return value;
- }
-
- private boolean handleCustomAction() {
- IntroURLAction command = ExtensionPointManager.getInst()
- .getSharedConfigExtensionsManager().getCommand(action);
- if (command == null) {
- String message = Messages.IntroURL_badCommand;
- DialogUtil.displayInfoMessage(null, message,
- new Object[] { action });
- return false;
- }
-
- // custom command. execute it.
- StringBuilder url = new StringBuilder();
- url.append("http://org.eclipse.ui.intro/"); //$NON-NLS-1$
- url.append(command.getReplaceValue().trim());
- if (!command.getReplaceValue().contains("?")) //$NON-NLS-1$
- // command does not have parameters.
- url.append("?"); //$NON-NLS-1$
- else
- // command already has parameters.
- url.append("&"); //$NON-NLS-1$
- url.append(retrieveInitialQuery());
- IIntroURL introURL = IntroURLFactory.createIntroURL(url.toString());
- if (introURL != null)
- return introURL.execute();
- return false;
- }
-
-
- /**
- * Recreate the initial query passed to this URL.
- *
- * @return
- */
- private String retrieveInitialQuery() {
- StringBuilder query = new StringBuilder();
- Enumeration keys = parameters.keys();
- while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
- query.append(key);
- query.append("="); //$NON-NLS-1$
- query.append(parameters.get(key));
- if (keys.hasMoreElements())
- query.append("&"); //$NON-NLS-1$
- }
- return query.toString();
- }
-
-
- private boolean switchToLaunchBar() {
- IIntroPart intro = PlatformUI.getWorkbench().getIntroManager()
- .getIntro();
- if (intro == null)
- return false;
-
- CustomizableIntroPart cpart = (CustomizableIntroPart) intro;
- IntroModelRoot modelRoot = IntroPlugin.getDefault().getIntroModelRoot();
- Rectangle bounds = cpart.getControl().getBounds();
- Rectangle startBounds = Geometry.toDisplay(cpart.getControl()
- .getParent(), bounds);
+ // make sure to decode only on return, since we may need to recreate the
+ // url when handling custom urls.
+ String value = parameters.getProperty(parameterId);
+ String decode = parameters.getProperty(KEY_DECODE);
+
+ if (value != null)
+ try {
+ if (decode!=null && decode.equalsIgnoreCase(VALUE_TRUE))
+ // we are told to decode the parameters of the url through
+ // the decode parameter. Assume that parameters are
+ // UTF-8 encoded.
+ return StringUtil.decode(value, "UTF-8"); //$NON-NLS-1$
+ return value;
+ } catch (Exception e) {
+ // should never be here.
+ Log.error("Failed to decode URL: " + parameterId, e); //$NON-NLS-1$
+ }
+ return value;
+ }
+
+ private boolean handleCustomAction() {
+ IntroURLAction command = ExtensionPointManager.getInst()
+ .getSharedConfigExtensionsManager().getCommand(action);
+ if (command == null) {
+ String message = Messages.IntroURL_badCommand;
+ DialogUtil.displayInfoMessage(null, message,
+ new Object[] { action });
+ return false;
+ }
+
+ // custom command. execute it.
+ StringBuilder url = new StringBuilder();
+ url.append("http://org.eclipse.ui.intro/"); //$NON-NLS-1$
+ url.append(command.getReplaceValue().trim());
+ if (!command.getReplaceValue().contains("?")) //$NON-NLS-1$
+ // command does not have parameters.
+ url.append("?"); //$NON-NLS-1$
+ else
+ // command already has parameters.
+ url.append("&"); //$NON-NLS-1$
+ url.append(retrieveInitialQuery());
+ IIntroURL introURL = IntroURLFactory.createIntroURL(url.toString());
+ if (introURL != null)
+ return introURL.execute();
+ return false;
+ }
+
+
+ /**
+ * Recreate the initial query passed to this URL.
+ *
+ * @return
+ */
+ private String retrieveInitialQuery() {
+ StringBuilder query = new StringBuilder();
+ Enumeration keys = parameters.keys();
+ while (keys.hasMoreElements()) {
+ String key = (String) keys.nextElement();
+ query.append(key);
+ query.append("="); //$NON-NLS-1$
+ query.append(parameters.get(key));
+ if (keys.hasMoreElements())
+ query.append("&"); //$NON-NLS-1$
+ }
+ return query.toString();
+ }
+
+
+ private boolean switchToLaunchBar() {
+ IIntroPart intro = PlatformUI.getWorkbench().getIntroManager()
+ .getIntro();
+ if (intro == null)
+ return false;
+
+ CustomizableIntroPart cpart = (CustomizableIntroPart) intro;
+ IntroModelRoot modelRoot = IntroPlugin.getDefault().getIntroModelRoot();
+ Rectangle bounds = cpart.getControl().getBounds();
+ Rectangle startBounds = Geometry.toDisplay(cpart.getControl()
+ .getParent(), bounds);
IntroLaunchBarElement launchBarElement = modelRoot.getPresentation().getLaunchBarElement();
if (launchBarElement == null)
@@ -666,13 +666,13 @@ public class IntroURL implements IIntroURL {
IWorkbenchWindow window = intro.getIntroSite().getWorkbenchWindow();
IntroLaunchBar launchBar = IntroLaunchBar.create(window, modelRoot, launchBarElement);
- PlatformUI.getWorkbench().getIntroManager().setIntroStandby(intro, true);
+ PlatformUI.getWorkbench().getIntroManager().setIntroStandby(intro, true);
- closeIntro();
- Rectangle endBounds = Geometry.toDisplay(launchBar.getControl()
- .getParent(), launchBar.getControl().getBounds());
+ closeIntro();
+ Rectangle endBounds = Geometry.toDisplay(launchBar.getControl()
+ .getParent(), launchBar.getControl().getBounds());
AnimationEngine.createTweakedAnimation(window.getShell(), 400, startBounds, endBounds);
- return true;
- }
+ return true;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURLParser.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURLParser.java
index 19fbfb6a3..7ff95508d 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURLParser.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/IntroURLParser.java
@@ -27,159 +27,159 @@ import org.eclipse.ui.internal.intro.impl.util.Log;
*/
public class IntroURLParser {
- // private String url_string = null;
- private boolean hasProtocol = false;
- private boolean isIntroUrl = false;
-
- private URL url_inst;
-
- /**
- * Constructor that gets the URL to parse.
- */
- public IntroURLParser(String url) {
- // create a URL instance, and parser it for parameters.
- parseUrl(url);
- }
-
- private void parseUrl(String url) {
- if (url == null)
- return;
- url_inst = null;
- try {
- url_inst = new URL(url);
- } catch (MalformedURLException e) {
- // not a valid URL. set state.
- return;
- }
-
- if (url_inst.getProtocol() != null) {
- // URL has some valid protocol. Check to see if it is an intro url.
- hasProtocol = true;
- isIntroUrl = isIntroUrl(url_inst);
- return;
- }
-
- // not an Intro URL. do nothing.
- return;
- }
-
-
- /**
- * @return Returns the hasProtocol.
- */
- public boolean hasProtocol() {
- return hasProtocol;
- }
-
- /**
- * @return Returns the isIntroUrl.
- */
- public boolean hasIntroUrl() {
- return isIntroUrl;
- }
-
-
- /**
- * @return Returns the currebt url Protocol.
- */
- public String getProtocol() {
- return url_inst.getProtocol();
- }
-
-
- /**
- * @return Returns the currebt url Protocol.
- */
- public String getHost() {
- return url_inst.getHost();
- }
-
-
- /**
- * Checks to see if tha passed URL is an Intro URL. An intro URL is an http
- * URL that has the intro plugin id as a host. eg:
- * "http://org.eclipse.ui.intro/test".
- *
- * @param url
- * @return true if url is an intro URL.
- */
- private boolean isIntroUrl(URL url) {
- if (!url.getProtocol().equalsIgnoreCase(IntroURL.INTRO_PROTOCOL))
- // quick exit. If it is not http, url is not an Intro url.
- return false;
-
- if (url.getHost().equalsIgnoreCase(IntroURL.INTRO_HOST_ID))
- return true;
-
- return false;
- }
-
-
-
- /**
- * @return Returns the introURL. Will be null if the parsed URL is not an
- * Intro URL.
- */
- public IntroURL getIntroURL() {
- IntroURL introURL = null;
- if (isIntroUrl) {
- // valid intro URL. Extract the action and parameters.
- String action = getPathAsAction(url_inst);
- Properties parameters = getQueryParameters(url_inst);
-
- // class instance vars are already populated by now.
- introURL = new IntroURL(action, parameters);
- }
- return introURL;
- }
-
-
-
- /**
- * Retruns the path attribute of the passed URL, stripped out of the leading
- * "/". Returns null if the url does not have a path.
- *
- * @param url
- * @return
- */
- private String getPathAsAction(URL url) {
- // get possible action.
- String action = url.getPath();
- // remove leading "/" from path.
- if (action != null)
- action = action.substring(1);
- return action;
- }
-
- /**
- * Retruns the Query part of the URL as an instance of a Properties class.
- *
- * @param url
- * @return
- */
- public Properties getQueryParameters(URL url) {
- // parser all query parameters.
- Properties properties = new Properties();
- String query = url.getQuery();
- if (query == null)
- // we do not have any parameters in this URL, return an empty
- // Properties instance.
- return properties;
-
- // now extract the key/value pairs from the query.
- String[] params = query.split("&"); //$NON-NLS-1$
- for (int i = 0; i < params.length; i++) {
- // for every parameter, ie: key=value pair, create a property
- // entry. we know we have the key as the first string in the array,
- // and the value as the second array.
- String[] keyValuePair = params[i].split("="); //$NON-NLS-1$
- if (keyValuePair.length != 2) {
- Log.warning("Ignoring the following Intro URL parameter: " //$NON-NLS-1$
- + params[i]);
- continue;
- }
-
- String key = urlDecode(keyValuePair[0]);
+ // private String url_string = null;
+ private boolean hasProtocol = false;
+ private boolean isIntroUrl = false;
+
+ private URL url_inst;
+
+ /**
+ * Constructor that gets the URL to parse.
+ */
+ public IntroURLParser(String url) {
+ // create a URL instance, and parser it for parameters.
+ parseUrl(url);
+ }
+
+ private void parseUrl(String url) {
+ if (url == null)
+ return;
+ url_inst = null;
+ try {
+ url_inst = new URL(url);
+ } catch (MalformedURLException e) {
+ // not a valid URL. set state.
+ return;
+ }
+
+ if (url_inst.getProtocol() != null) {
+ // URL has some valid protocol. Check to see if it is an intro url.
+ hasProtocol = true;
+ isIntroUrl = isIntroUrl(url_inst);
+ return;
+ }
+
+ // not an Intro URL. do nothing.
+ return;
+ }
+
+
+ /**
+ * @return Returns the hasProtocol.
+ */
+ public boolean hasProtocol() {
+ return hasProtocol;
+ }
+
+ /**
+ * @return Returns the isIntroUrl.
+ */
+ public boolean hasIntroUrl() {
+ return isIntroUrl;
+ }
+
+
+ /**
+ * @return Returns the currebt url Protocol.
+ */
+ public String getProtocol() {
+ return url_inst.getProtocol();
+ }
+
+
+ /**
+ * @return Returns the currebt url Protocol.
+ */
+ public String getHost() {
+ return url_inst.getHost();
+ }
+
+
+ /**
+ * Checks to see if tha passed URL is an Intro URL. An intro URL is an http
+ * URL that has the intro plugin id as a host. eg:
+ * "http://org.eclipse.ui.intro/test".
+ *
+ * @param url
+ * @return true if url is an intro URL.
+ */
+ private boolean isIntroUrl(URL url) {
+ if (!url.getProtocol().equalsIgnoreCase(IntroURL.INTRO_PROTOCOL))
+ // quick exit. If it is not http, url is not an Intro url.
+ return false;
+
+ if (url.getHost().equalsIgnoreCase(IntroURL.INTRO_HOST_ID))
+ return true;
+
+ return false;
+ }
+
+
+
+ /**
+ * @return Returns the introURL. Will be null if the parsed URL is not an
+ * Intro URL.
+ */
+ public IntroURL getIntroURL() {
+ IntroURL introURL = null;
+ if (isIntroUrl) {
+ // valid intro URL. Extract the action and parameters.
+ String action = getPathAsAction(url_inst);
+ Properties parameters = getQueryParameters(url_inst);
+
+ // class instance vars are already populated by now.
+ introURL = new IntroURL(action, parameters);
+ }
+ return introURL;
+ }
+
+
+
+ /**
+ * Retruns the path attribute of the passed URL, stripped out of the leading
+ * "/". Returns null if the url does not have a path.
+ *
+ * @param url
+ * @return
+ */
+ private String getPathAsAction(URL url) {
+ // get possible action.
+ String action = url.getPath();
+ // remove leading "/" from path.
+ if (action != null)
+ action = action.substring(1);
+ return action;
+ }
+
+ /**
+ * Retruns the Query part of the URL as an instance of a Properties class.
+ *
+ * @param url
+ * @return
+ */
+ public Properties getQueryParameters(URL url) {
+ // parser all query parameters.
+ Properties properties = new Properties();
+ String query = url.getQuery();
+ if (query == null)
+ // we do not have any parameters in this URL, return an empty
+ // Properties instance.
+ return properties;
+
+ // now extract the key/value pairs from the query.
+ String[] params = query.split("&"); //$NON-NLS-1$
+ for (int i = 0; i < params.length; i++) {
+ // for every parameter, ie: key=value pair, create a property
+ // entry. we know we have the key as the first string in the array,
+ // and the value as the second array.
+ String[] keyValuePair = params[i].split("="); //$NON-NLS-1$
+ if (keyValuePair.length != 2) {
+ Log.warning("Ignoring the following Intro URL parameter: " //$NON-NLS-1$
+ + params[i]);
+ continue;
+ }
+
+ String key = urlDecode(keyValuePair[0]);
if (key == null) {
Log.warning("Failed to URL decode key: " + keyValuePair[0]); //$NON-NLS-1$
continue;
@@ -191,13 +191,13 @@ public class IntroURLParser {
continue;
}
- properties.setProperty(key, value);
- }
- return properties;
- }
+ properties.setProperty(key, value);
+ }
+ return properties;
+ }
- /*
+ /*
* Note: This was copied and adapted from org.eclipse.help.internal.util.URLCoder
*/
private static String urlDecode(String encodedURL) {
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/ShowHelpURLHandler.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/ShowHelpURLHandler.java
index 97b30e50a..5eb1d310c 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/ShowHelpURLHandler.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/url/ShowHelpURLHandler.java
@@ -25,109 +25,109 @@ import org.eclipse.ui.internal.intro.impl.presentations.BrowserIntroPartImplemen
import org.eclipse.ui.internal.intro.impl.util.Log;
public class ShowHelpURLHandler {
- private IntroURL introURL = null;
-
- ShowHelpURLHandler(IntroURL url) {
- this.introURL = url;
- }
-
-
-
- public boolean showHelpTopic(String href, String embed, String embedTarget) {
- if (href == null)
- return false;
-
- boolean isEmbedded = (embed != null && embed
- .equals(IntroURL.VALUE_TRUE)) ? true : false;
- if (isEmbedded == false)
- // still false, check the embedTarget. If embedTarget is set, then
- // we
- // have embedded by default.
- isEmbedded = (embedTarget != null) ? true : false;
-
- IntroPartPresentation presentation = IntroPlugin.getDefault()
- .getIntroModelRoot().getPresentation();
- String presentationStyle = presentation.getImplementationKind();
-
- if (isEmbedded
- && presentationStyle
- .equals(IntroPartPresentation.BROWSER_IMPL_KIND)) {
-
- // Embedded is true and we have HTML presentation, show href
- // embedded, either in full page, or in div.
- BrowserIntroPartImplementation impl = (BrowserIntroPartImplementation) presentation
- .getIntroPartImplementation();
- // INTRO: maybe add support for navigation
- href = PlatformUI.getWorkbench().getHelpSystem()
- .resolve(href, true).toExternalForm();
-
- if (embedTarget == null)
- return impl.getBrowser().setUrl(href);
-
- // embedded in Div case.
- IntroModelRoot model = IntroPlugin.getDefault().getIntroModelRoot();
- return handleEmbedURLInDiv(href, embedTarget, model
- .getCurrentPage());
- }
-
- // show href in Help window. SWT presentation is handled here.
- // WorkbenchHelp takes care of error handling.
- PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(href);
- return true;
- }
-
-
- /*
- * Handles the embedded url case. Clone page and insert an IFrame in the
- * target embed div. Note that only one div per page can be specified as an
- * embed div. This is because we need to mangle the name for the cloned
- * page, and the mangled name id pageId_embedTarget.
- */
- private boolean handleEmbedURLInDiv(String href, String embedTarget,
- AbstractIntroPage currentPage) {
-
- // re-use a runtime generated page, if found. Create the mangled id for
- // the page and check if page exists first. If not, create one.
- IntroModelRoot model = (IntroModelRoot) currentPage.getParentPage()
- .getParent();
- String currentPageId = null;
- if (currentPage.isIFramePage())
- currentPageId = currentPage.getUnmangledId();
- else
- currentPageId = currentPage.getId();
- String mangledPageId = currentPageId + "_" + "WITH_IFRAME"; //$NON-NLS-1$ //$NON-NLS-2$
-
- // get current standby state.
- boolean standby = IntroPlugin.isIntroStandby();
- String standbyAsString = standby ? IntroURL.VALUE_TRUE : "false"; //$NON-NLS-1$
-
- AbstractIntroPage pageWithIFrame = (AbstractIntroPage) model.findChild(
- mangledPageId, AbstractIntroElement.ABSTRACT_PAGE);
- if (pageWithIFrame != null) {
- pageWithIFrame.setIFrameURL(href);
- return introURL.showPage(mangledPageId, standbyAsString);
- }
-
- // Page never generated, clone and create.
- AbstractIntroPage clonedPage = null;
- try {
- clonedPage = (AbstractIntroPage) currentPage.clone();
- } catch (CloneNotSupportedException ex) {
- // should never be here.
- Log.error("Failed to clone Intro page: " + currentPage.getId(), ex); //$NON-NLS-1$
- return false;
- }
-
- // embed url as IFrame in target div. We need to find target div in
- // cloned page not in the original page.
- boolean canInjectFrame = clonedPage.injectIFrame(href, embedTarget);
- if (!canInjectFrame)
- // Called method handles error.
- return false;
-
- clonedPage.setId(mangledPageId);
- model.addChild(clonedPage);
- return introURL.showPage(clonedPage.getId(), standbyAsString);
- }
+ private IntroURL introURL = null;
+
+ ShowHelpURLHandler(IntroURL url) {
+ this.introURL = url;
+ }
+
+
+
+ public boolean showHelpTopic(String href, String embed, String embedTarget) {
+ if (href == null)
+ return false;
+
+ boolean isEmbedded = (embed != null && embed
+ .equals(IntroURL.VALUE_TRUE)) ? true : false;
+ if (isEmbedded == false)
+ // still false, check the embedTarget. If embedTarget is set, then
+ // we
+ // have embedded by default.
+ isEmbedded = (embedTarget != null) ? true : false;
+
+ IntroPartPresentation presentation = IntroPlugin.getDefault()
+ .getIntroModelRoot().getPresentation();
+ String presentationStyle = presentation.getImplementationKind();
+
+ if (isEmbedded
+ && presentationStyle
+ .equals(IntroPartPresentation.BROWSER_IMPL_KIND)) {
+
+ // Embedded is true and we have HTML presentation, show href
+ // embedded, either in full page, or in div.
+ BrowserIntroPartImplementation impl = (BrowserIntroPartImplementation) presentation
+ .getIntroPartImplementation();
+ // INTRO: maybe add support for navigation
+ href = PlatformUI.getWorkbench().getHelpSystem()
+ .resolve(href, true).toExternalForm();
+
+ if (embedTarget == null)
+ return impl.getBrowser().setUrl(href);
+
+ // embedded in Div case.
+ IntroModelRoot model = IntroPlugin.getDefault().getIntroModelRoot();
+ return handleEmbedURLInDiv(href, embedTarget, model
+ .getCurrentPage());
+ }
+
+ // show href in Help window. SWT presentation is handled here.
+ // WorkbenchHelp takes care of error handling.
+ PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(href);
+ return true;
+ }
+
+
+ /*
+ * Handles the embedded url case. Clone page and insert an IFrame in the
+ * target embed div. Note that only one div per page can be specified as an
+ * embed div. This is because we need to mangle the name for the cloned
+ * page, and the mangled name id pageId_embedTarget.
+ */
+ private boolean handleEmbedURLInDiv(String href, String embedTarget,
+ AbstractIntroPage currentPage) {
+
+ // re-use a runtime generated page, if found. Create the mangled id for
+ // the page and check if page exists first. If not, create one.
+ IntroModelRoot model = (IntroModelRoot) currentPage.getParentPage()
+ .getParent();
+ String currentPageId = null;
+ if (currentPage.isIFramePage())
+ currentPageId = currentPage.getUnmangledId();
+ else
+ currentPageId = currentPage.getId();
+ String mangledPageId = currentPageId + "_" + "WITH_IFRAME"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ // get current standby state.
+ boolean standby = IntroPlugin.isIntroStandby();
+ String standbyAsString = standby ? IntroURL.VALUE_TRUE : "false"; //$NON-NLS-1$
+
+ AbstractIntroPage pageWithIFrame = (AbstractIntroPage) model.findChild(
+ mangledPageId, AbstractIntroElement.ABSTRACT_PAGE);
+ if (pageWithIFrame != null) {
+ pageWithIFrame.setIFrameURL(href);
+ return introURL.showPage(mangledPageId, standbyAsString);
+ }
+
+ // Page never generated, clone and create.
+ AbstractIntroPage clonedPage = null;
+ try {
+ clonedPage = (AbstractIntroPage) currentPage.clone();
+ } catch (CloneNotSupportedException ex) {
+ // should never be here.
+ Log.error("Failed to clone Intro page: " + currentPage.getId(), ex); //$NON-NLS-1$
+ return false;
+ }
+
+ // embed url as IFrame in target div. We need to find target div in
+ // cloned page not in the original page.
+ boolean canInjectFrame = clonedPage.injectIFrame(href, embedTarget);
+ if (!canInjectFrame)
+ // Called method handles error.
+ return false;
+
+ clonedPage.setId(mangledPageId);
+ model.addChild(clonedPage);
+ return introURL.showPage(clonedPage.getId(), standbyAsString);
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/BundleUtil.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/BundleUtil.java
index 9f4558d10..bc7dfffb5 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/BundleUtil.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/BundleUtil.java
@@ -32,258 +32,258 @@ import org.osgi.framework.Constants;
*/
public class BundleUtil {
- private static String NL_TAG = "$nl$/"; //$NON-NLS-1$
+ private static String NL_TAG = "$nl$/"; //$NON-NLS-1$
private final static String PRODUCT_PLUGIN = "PRODUCT_PLUGIN"; //$NON-NLS-1$
private final static String PLUGINS_ROOT = "PLUGINS_ROOT/"; //$NON-NLS-1$
- /**
- * Utility method to validate the state of a bundle. Log invalid bundles to
- * log file.
- */
- public static boolean bundleHasValidState(Bundle bundle) {
- if (bundle == null || bundle.getState() == Bundle.UNINSTALLED
- || bundle.getState() == Bundle.INSTALLED) {
-
- if (bundle == null)
- Log.error("Intro tried accessing a NULL bundle.", null); //$NON-NLS-1$
- else {
+ /**
+ * Utility method to validate the state of a bundle. Log invalid bundles to
+ * log file.
+ */
+ public static boolean bundleHasValidState(Bundle bundle) {
+ if (bundle == null || bundle.getState() == Bundle.UNINSTALLED
+ || bundle.getState() == Bundle.INSTALLED) {
+
+ if (bundle == null)
+ Log.error("Intro tried accessing a NULL bundle.", null); //$NON-NLS-1$
+ else {
String msg = StringUtil.concat("Intro tried accessing Bundle: ", getBundleHeader( //$NON-NLS-1$
bundle, Constants.BUNDLE_NAME), " vendor: ", //$NON-NLS-1$
getBundleHeader(bundle, Constants.BUNDLE_VENDOR), " bundle state: ", //$NON-NLS-1$
String.valueOf(bundle.getState()));
- Log.error(msg, null);
- }
- return false;
- }
-
- return true;
- }
-
- /**
- * Retrieves the given key from the bundle header.
- *
- * @param bundle
- * @param key
- * @return
- */
- public static String getBundleHeader(Bundle bundle, String key) {
- return bundle.getHeaders().get(key);
- }
-
-
- public static Bundle getBundleFromConfigurationElement(
- IConfigurationElement cfg) {
- return Platform.getBundle(cfg.getContributor().getName());
- }
-
-
- /**
- * Get the resourcelocation, but do not force an $nl$ on it.
- *
- * @param resource
- * @param element
- * @return
- */
- public static String getResourceLocation(String resource,
- IConfigurationElement element) {
- Bundle bundle = getBundleFromConfigurationElement(element);
- return getResolvedResourceLocation(resource, bundle, false);
- }
-
-
- /**
- * Returns the fully qualified location of the passed resource string from
- * the passed plugin id. If the file could not be loaded from the plugin,
- * the resource is returned as is.
- *
- * @param resource
- * @return
- */
- public static String getResolvedResourceLocation(String resource,
- String pluginId) {
- Bundle bundle = Platform.getBundle(pluginId);
- return getResolvedResourceLocation(resource, bundle, true);
- }
-
-
- /**
- * Shorthand util method.
- *
- * @param resource
- * @return
- */
- public static String getResolvedResourceLocation(String resource,
- Bundle bundle) {
- return getResolvedResourceLocation(resource, bundle, true);
- }
-
-
- public static String getResolvedResourceLocation(String base,
- String resource, Bundle bundle) {
- // quick exits.
- if (resource == null)
- return null;
-
- String fullResource = new Path(base).append(resource).toString();
- String resolvedResource = getResolvedResourceLocation(fullResource,
- bundle, true);
-
- if (resolvedResource.equals(fullResource))
- // return resource as is when the resource does not exist.
- return resource;
- return resolvedResource;
- }
-
-
- public static String getResolvedResourceLocation(String resource,
- Bundle bundle, boolean forceNLResolve) {
- // quick exits.
- if (resource == null)
- return null;
-
- if (bundle == null || !bundleHasValidState(bundle))
- return resource;
-
- URL localLocation = null;
- try {
- // resolve PLUGINS_ROOT
- int index = resource.indexOf(PLUGINS_ROOT);
- if (index != -1) {
- resource = resource.substring(index + PLUGINS_ROOT.length());
- index = resource.indexOf('/');
- if (index != -1) {
- String bundleName = resource.substring(0, index);
- if (PRODUCT_PLUGIN.equals(bundleName)) {
- IProduct product = Platform.getProduct();
- if (product != null) {
- Bundle productBundle = product.getDefiningBundle();
- if (productBundle != null) {
- bundleName = productBundle.getSymbolicName();
- }
- }
- }
- resource = resource.substring(index + 1);
- Bundle actualBundle = Platform.getBundle(bundleName);
- if (actualBundle != null) {
- return getResolvedResourceLocation(resource, actualBundle, forceNLResolve);
- }
- }
- }
-
- // we need to resolve this URL.
- String copyResource = resource;
- if (forceNLResolve && !copyResource.startsWith(NL_TAG)) {
- if (copyResource.startsWith("/") //$NON-NLS-1$
- || copyResource.startsWith("\\")) //$NON-NLS-1$
- copyResource = resource.substring(1);
- copyResource = NL_TAG + copyResource;
- }
- IPath resourcePath = new Path(copyResource);
- localLocation = FileLocator.find(bundle, resourcePath, null);
- if (localLocation == null) {
- // localLocation can be null if the passed resource could not
- // be found relative to the plugin. log fact, return resource,
- // as is.
+ Log.error(msg, null);
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Retrieves the given key from the bundle header.
+ *
+ * @param bundle
+ * @param key
+ * @return
+ */
+ public static String getBundleHeader(Bundle bundle, String key) {
+ return bundle.getHeaders().get(key);
+ }
+
+
+ public static Bundle getBundleFromConfigurationElement(
+ IConfigurationElement cfg) {
+ return Platform.getBundle(cfg.getContributor().getName());
+ }
+
+
+ /**
+ * Get the resourcelocation, but do not force an $nl$ on it.
+ *
+ * @param resource
+ * @param element
+ * @return
+ */
+ public static String getResourceLocation(String resource,
+ IConfigurationElement element) {
+ Bundle bundle = getBundleFromConfigurationElement(element);
+ return getResolvedResourceLocation(resource, bundle, false);
+ }
+
+
+ /**
+ * Returns the fully qualified location of the passed resource string from
+ * the passed plugin id. If the file could not be loaded from the plugin,
+ * the resource is returned as is.
+ *
+ * @param resource
+ * @return
+ */
+ public static String getResolvedResourceLocation(String resource,
+ String pluginId) {
+ Bundle bundle = Platform.getBundle(pluginId);
+ return getResolvedResourceLocation(resource, bundle, true);
+ }
+
+
+ /**
+ * Shorthand util method.
+ *
+ * @param resource
+ * @return
+ */
+ public static String getResolvedResourceLocation(String resource,
+ Bundle bundle) {
+ return getResolvedResourceLocation(resource, bundle, true);
+ }
+
+
+ public static String getResolvedResourceLocation(String base,
+ String resource, Bundle bundle) {
+ // quick exits.
+ if (resource == null)
+ return null;
+
+ String fullResource = new Path(base).append(resource).toString();
+ String resolvedResource = getResolvedResourceLocation(fullResource,
+ bundle, true);
+
+ if (resolvedResource.equals(fullResource))
+ // return resource as is when the resource does not exist.
+ return resource;
+ return resolvedResource;
+ }
+
+
+ public static String getResolvedResourceLocation(String resource,
+ Bundle bundle, boolean forceNLResolve) {
+ // quick exits.
+ if (resource == null)
+ return null;
+
+ if (bundle == null || !bundleHasValidState(bundle))
+ return resource;
+
+ URL localLocation = null;
+ try {
+ // resolve PLUGINS_ROOT
+ int index = resource.indexOf(PLUGINS_ROOT);
+ if (index != -1) {
+ resource = resource.substring(index + PLUGINS_ROOT.length());
+ index = resource.indexOf('/');
+ if (index != -1) {
+ String bundleName = resource.substring(0, index);
+ if (PRODUCT_PLUGIN.equals(bundleName)) {
+ IProduct product = Platform.getProduct();
+ if (product != null) {
+ Bundle productBundle = product.getDefiningBundle();
+ if (productBundle != null) {
+ bundleName = productBundle.getSymbolicName();
+ }
+ }
+ }
+ resource = resource.substring(index + 1);
+ Bundle actualBundle = Platform.getBundle(bundleName);
+ if (actualBundle != null) {
+ return getResolvedResourceLocation(resource, actualBundle, forceNLResolve);
+ }
+ }
+ }
+
+ // we need to resolve this URL.
+ String copyResource = resource;
+ if (forceNLResolve && !copyResource.startsWith(NL_TAG)) {
+ if (copyResource.startsWith("/") //$NON-NLS-1$
+ || copyResource.startsWith("\\")) //$NON-NLS-1$
+ copyResource = resource.substring(1);
+ copyResource = NL_TAG + copyResource;
+ }
+ IPath resourcePath = new Path(copyResource);
+ localLocation = FileLocator.find(bundle, resourcePath, null);
+ if (localLocation == null) {
+ // localLocation can be null if the passed resource could not
+ // be found relative to the plugin. log fact, return resource,
+ // as is.
String msg = StringUtil.concat("Could not find resource: ", //$NON-NLS-1$
resource, " in ", getBundleHeader(bundle, Constants.BUNDLE_NAME)); //$NON-NLS-1$
- Log.warning(msg);
- return resource;
- }
- /*
- localLocation = FileLocator.toFileURL(localLocation);
- return localLocation.toExternalForm();
- */
- return toExternalForm(localLocation);
- } catch (Exception e) {
+ Log.warning(msg);
+ return resource;
+ }
+ /*
+ localLocation = FileLocator.toFileURL(localLocation);
+ return localLocation.toExternalForm();
+ */
+ return toExternalForm(localLocation);
+ } catch (Exception e) {
String msg = StringUtil.concat("Failed to load resource: ", //$NON-NLS-1$
resource, " from ", getBundleHeader(bundle, Constants.BUNDLE_NAME)); //$NON-NLS-1$
- Log.error(msg, e);
- return resource;
- }
- }
-
-
-
-
- /** *** used by Intro parser ***** */
- /*
- * Util method to return an URL to a plugin relative resource.
- */
- public static URL getResourceAsURL(String resource, String pluginId) {
- Bundle bundle = Platform.getBundle(pluginId);
- URL localLocation = FileLocator.find(bundle, new Path(
- resource), null);
- return localLocation;
- }
-
-
-
-
- /** ********************* Used by HTML generator ****************** */
- /**
- * Get the absolute path of the given bundle, in the form
- * file:/path_to_plugin
- *
- * @param bundle
- * @return
- */
- public static String getResolvedBundleLocation(Bundle bundle) {
- try {
- URL bundleLocation = bundle.getEntry(""); //$NON-NLS-1$
- if (bundleLocation == null)
- return null;
- /*
- bundleLocation = FileLocator.toFileURL(bundleLocation);
- return bundleLocation.toExternalForm();
- */
- return toExternalForm(bundleLocation);
- } catch (IllegalStateException e) {
- Log.error("Failed to access bundle: " //$NON-NLS-1$
- + bundle.getSymbolicName(), e);
- return null;
- }/* catch (IOException e) {
- Log.error("Failed to resolve URL path for bundle: " //$NON-NLS-1$
- + bundle.getSymbolicName(), e);
- return null;
- } */
- }
-
- /**
- * Get the absolute path of the bundle with id <code>bundleId</code>. If
- * no such bundle is found, return null.
- *
- * @param bundleId
- * @return
- */
- public static String getResolvedBundleLocation(String bundleId) {
- Bundle bundle = Platform.getBundle(bundleId);
- if (bundle == null)
- return null;
- return getResolvedBundleLocation(bundle);
- }
-
- /*
- * Bug 126085 - need to fix up file: protocol
- * to a form that IE7 understands (file:///).
- */
-
- private static String toExternalForm(URL localURL) {
- try {
- localURL = FileLocator.toFileURL(localURL);
- String result = localURL.toExternalForm();
- if (result.startsWith("file:/")) { //$NON-NLS-1$
- if (result.startsWith("file:///")==false) { //$NON-NLS-1$
- result = "file:///"+result.substring(6); //$NON-NLS-1$
- }
- }
- return result;
- }
- catch (IOException e) {
- String msg = "Failed to resolve URL: " //$NON-NLS-1$
- + localURL.toString();
- Log.error(msg, e);
- return localURL.toString();
- }
- }
+ Log.error(msg, e);
+ return resource;
+ }
+ }
+
+
+
+
+ /** *** used by Intro parser ***** */
+ /*
+ * Util method to return an URL to a plugin relative resource.
+ */
+ public static URL getResourceAsURL(String resource, String pluginId) {
+ Bundle bundle = Platform.getBundle(pluginId);
+ URL localLocation = FileLocator.find(bundle, new Path(
+ resource), null);
+ return localLocation;
+ }
+
+
+
+
+ /** ********************* Used by HTML generator ****************** */
+ /**
+ * Get the absolute path of the given bundle, in the form
+ * file:/path_to_plugin
+ *
+ * @param bundle
+ * @return
+ */
+ public static String getResolvedBundleLocation(Bundle bundle) {
+ try {
+ URL bundleLocation = bundle.getEntry(""); //$NON-NLS-1$
+ if (bundleLocation == null)
+ return null;
+ /*
+ bundleLocation = FileLocator.toFileURL(bundleLocation);
+ return bundleLocation.toExternalForm();
+ */
+ return toExternalForm(bundleLocation);
+ } catch (IllegalStateException e) {
+ Log.error("Failed to access bundle: " //$NON-NLS-1$
+ + bundle.getSymbolicName(), e);
+ return null;
+ }/* catch (IOException e) {
+ Log.error("Failed to resolve URL path for bundle: " //$NON-NLS-1$
+ + bundle.getSymbolicName(), e);
+ return null;
+ } */
+ }
+
+ /**
+ * Get the absolute path of the bundle with id <code>bundleId</code>. If
+ * no such bundle is found, return null.
+ *
+ * @param bundleId
+ * @return
+ */
+ public static String getResolvedBundleLocation(String bundleId) {
+ Bundle bundle = Platform.getBundle(bundleId);
+ if (bundle == null)
+ return null;
+ return getResolvedBundleLocation(bundle);
+ }
+
+ /*
+ * Bug 126085 - need to fix up file: protocol
+ * to a form that IE7 understands (file:///).
+ */
+
+ private static String toExternalForm(URL localURL) {
+ try {
+ localURL = FileLocator.toFileURL(localURL);
+ String result = localURL.toExternalForm();
+ if (result.startsWith("file:/")) { //$NON-NLS-1$
+ if (result.startsWith("file:///")==false) { //$NON-NLS-1$
+ result = "file:///"+result.substring(6); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+ catch (IOException e) {
+ String msg = "Failed to resolve URL: " //$NON-NLS-1$
+ + localURL.toString();
+ Log.error(msg, e);
+ return localURL.toString();
+ }
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/FindSupport.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/FindSupport.java
index 9ed616cf9..f11906f22 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/FindSupport.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/FindSupport.java
@@ -53,22 +53,22 @@ public class FindSupport {
return find(bundle, path, null);
}
- /**
- * Proposed API for Platform in Eclispe 3.2.
- * Same as @link #find(Bundle, IPath) except multiple entries can be
- * returned if more than one entry matches the path in the host and
- * any of its fragments.
- *
- * @param bundle
- * @param path
- * @return an array of entries which match the given path. An empty
- * array is returned if no matches are found.
- */
- public static URL[] findEntries(Bundle bundle, IPath path) {
- return findEntries(bundle, path, null);
- }
+ /**
+ * Proposed API for Platform in Eclispe 3.2.
+ * Same as @link #find(Bundle, IPath) except multiple entries can be
+ * returned if more than one entry matches the path in the host and
+ * any of its fragments.
+ *
+ * @param bundle
+ * @param path
+ * @return an array of entries which match the given path. An empty
+ * array is returned if no matches are found.
+ */
+ public static URL[] findEntries(Bundle bundle, IPath path) {
+ return findEntries(bundle, path, null);
+ }
- /**
+ /**
* Proposed API for Platform in Eclipse 3.2. Same as @link #find(Bundle, IPath) except multiple
* entries can be returned if more than one entry matches the path in the host and any of its
* fragments.
@@ -81,16 +81,16 @@ public class FindSupport {
*/
public static URL[] findEntries(Bundle bundle, IPath path, Map<String, String> override) {
List<URL> results = new ArrayList<>(1);
- find(bundle, path, override, results);
- return results.toArray(new URL[results.size()]);
- }
+ find(bundle, path, override, results);
+ return results.toArray(new URL[results.size()]);
+ }
/**
* See doc on @link Platform#find(Bundle, IPath, Map) Platform#find(Bundle, IPath, Map)
*/
public static URL find(Bundle b, IPath path, Map<String, String> override) {
- return find(b, path, override, null);
- }
+ return find(b, path, override, null);
+ }
private static URL find(Bundle b, IPath path, Map<String, String> override, List<URL> multiple) {
if (path == null)
@@ -106,7 +106,7 @@ public class FindSupport {
result = findInPlugin(b, Path.EMPTY, multiple);
if (result == null || multiple != null)
result = findInFragments(b, Path.EMPTY, multiple);
- return result;
+ return result;
}
// Now check for paths without variable substitution
@@ -115,7 +115,7 @@ public class FindSupport {
result = findInPlugin(b, path, multiple);
if (result == null || multiple != null)
result = findInFragments(b, path, multiple);
- return result;
+ return result;
}
// Worry about variable substitution
@@ -230,9 +230,9 @@ public class FindSupport {
private static URL findInPlugin(Bundle b, IPath filePath, List<URL> multiple) {
URL result = b.getEntry(filePath.toString());
- if (result != null && multiple != null)
- multiple.add(result);
- return result;
+ if (result != null && multiple != null)
+ multiple.add(result);
+ return result;
}
private static URL findInFragments(Bundle b, IPath filePath, List<URL> multiple) {
@@ -245,10 +245,10 @@ public class FindSupport {
int i = 0;
while (i < fragments.length && fileURL == null) {
fileURL = fragments[i].getEntry(filePath.toString());
- if (fileURL != null && multiple != null) {
- multiple.add(fileURL);
- fileURL = null;
- }
+ if (fileURL != null && multiple != null) {
+ multiple.add(fileURL);
+ fileURL = null;
+ }
i++;
}
return fileURL;
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/ModelUtil.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/ModelUtil.java
index 97caea031..1a2383df2 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/ModelUtil.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/util/ModelUtil.java
@@ -40,407 +40,407 @@ import org.w3c.dom.NodeList;
*/
public class ModelUtil {
- private static String TAG_BODY = "body"; //$NON-NLS-1$
- private static String TAG_HEAD = "head"; //$NON-NLS-1$
- private static String TAG_BASE = "base"; //$NON-NLS-1$
- public static String TAG_DIV = "div"; //$NON-NLS-1$
- public static String TAG_HEAD_LINK = "link"; //$NON-NLS-1$
- private static String TAG_PARAM = "param"; //$NON-NLS-1$
- private static String ATT_SRC = "src"; //$NON-NLS-1$
- private static String ATT_HREF = "href"; //$NON-NLS-1$
- private static String ATT_CITE = "cite"; //$NON-NLS-1$
- private static String ATT_LONGDESC = "longdesc"; //$NON-NLS-1$
- private static String ATT_DATA = "data"; //$NON-NLS-1$
- private static String ATT_CODEBASE = "codebase"; //$NON-NLS-1$
- private static String ATT_VALUE = "value"; //$NON-NLS-1$
- private static String ATT_VALUE_TYPE = "valuetype"; //$NON-NLS-1$
- private static String ATT_REL = "rel"; //$NON-NLS-1$
- private static String ATT_TYPE = "type"; //$NON-NLS-1$
-
-
-
- /*
- * ********* Model util methods ************************************
- */
-
- /**
- * Checks to see if the passed string is a valid URL (has a protocol), if
- * yes, returns it as is. If no, treats it as a resource relative to the
- * declaring plugin. Return the plugin relative location, fully qualified.
- * Retruns null if the passed string itself is null.
- *
- * @param resource
- * @param pluginDesc
- * @return returns the URL as is if it had a protocol.
- */
- public static String resolveURL(String url, String pluginId) {
- Bundle bundle = null;
- if (pluginId != null)
- // if pluginId is not null, use it.
- bundle = Platform.getBundle(pluginId);
- return resolveURL("", url, bundle); //$NON-NLS-1$
- }
-
-
-
- /**
- * Checks to see if the passed string is a valid URL (has a protocol), if
- * yes, returns it as is. If no, treats it as a resource relative to the
- * declaring plugin. Return the plugin relative location, fully qualified.
- * Retruns null if the passed string itself is null.
- *
- * @param resource
- * @param pluginDesc
- * @return returns the URL as is if it had a protocol.
- */
- public static String resolveURL(String url, IConfigurationElement element) {
- Bundle bundle = BundleUtil.getBundleFromConfigurationElement(element);
- return resolveURL("", url, bundle); //$NON-NLS-1$
- }
-
-
-
- /**
- * @see resolveURL(String url, IConfigurationElement element)
- */
- public static String resolveURL(String base, String url, Bundle bundle) {
- // quick exit
- if (url == null)
- return null;
- IntroURLParser parser = new IntroURLParser(url);
- if (parser.hasProtocol())
- return url;
- // make plugin relative url. Only now we need the bundle.
- return BundleUtil.getResolvedResourceLocation(base, url, bundle);
- }
-
- /**
- * Ensures that a file:// URL exists for the bundle root. This will
- * cause jarred bundles to be extracted into a cache directory.
- */
- public static void ensureFileURLsExist(Bundle bundle, String contentFile) {
- try {
- FileLocator.toFileURL(bundle.getEntry("/")); //$NON-NLS-1$
- } catch (Exception e) {
- if (contentFile != null)
- Log.error("Failed to extract Intro content folder for: " //$NON-NLS-1$
- + contentFile, e);
- }
- }
-
-
- /**
- * Returns the path to the parent folder containing the passed content xml
- * file. It is assumed that the path is a local url representing a content
- * file.
- */
- public static String getParentFolderToString(String contentFilePath) {
- IPath path = getParentFolderPath(contentFilePath);
- return path.toString();
- }
-
-
- /*
- *
- * ******** XHTML DOM util methods *********************************
- */
-
- /**
- * Returns the path to the parent folder containing the passed content xml
- * file. It is assumed that the path is a local url representing a content
- * file.
- */
- public static String getParentFolderOSString(String contentFilePath) {
- IPath path = getParentFolderPath(contentFilePath);
- return path.toOSString();
- }
-
- /**
- * Returns the parent folder of the given path.
- */
- public static IPath getParentFolderPath(String contentFilePath) {
- IPath path = new Path(contentFilePath);
- path = path.removeLastSegments(1).addTrailingSeparator();
- return path;
- }
-
-
-
-
- public static void insertBase(Document dom, String baseURL) {
- // there should only be one head and one base element dom.
- NodeList headList = dom.getElementsByTagName(TAG_HEAD);
- Element head = (Element) headList.item(0);
- NodeList baseList = head.getElementsByTagName(TAG_BASE);
- if (baseList.getLength() == 0) {
- // insert a base element, since one is not defined already.
- Element base = dom.createElement(TAG_BASE);
- base.setAttribute(ATT_HREF, baseURL);
- head.insertBefore(base, head.getFirstChild());
- }
- }
-
-
- public static Element getBase(Document dom) {
- // there should only be one head and one base element dom.
- NodeList headList = dom.getElementsByTagName(TAG_HEAD);
- Element head = (Element) headList.item(0);
- NodeList baseList = head.getElementsByTagName(TAG_BASE);
- if (baseList.getLength() == 0)
- // no base defined, signal failure.
- return null;
-
- return (Element) baseList.item(baseList.getLength() - 1);
-
- }
-
-
- // <link rel="stylesheet" href="shared.css" type="text/css" />
- public static void insertStyle(Document dom, String cssUrl) {
- // there should only be one head and one base element dom.
- NodeList headList = dom.getElementsByTagName(TAG_HEAD);
- Element head = null;
- // Element base = getBase(dom);
- NodeList styleList = null;
- // there can be more than one style. DO not add style if it exists.
- if (headList.getLength() >= 1) {
- head = (Element) headList.item(0);
- styleList = head.getElementsByTagName(TAG_HEAD_LINK);
- for (int i = 0; i < styleList.getLength(); i++) {
- Element style = (Element) styleList.item(0);
- String styleString = style.getAttribute(ATT_HREF);
- if (styleString.equals(cssUrl))
- return;
- }
- }
-
- // insert the style, since it is not defined.
- Element styleToAdd = dom.createElement(TAG_HEAD_LINK);
- styleToAdd.setAttribute(ATT_HREF, cssUrl);
- styleToAdd.setAttribute(ATT_REL, "stylesheet"); //$NON-NLS-1$
- styleToAdd.setAttribute(ATT_TYPE, "text/css"); //$NON-NLS-1$
- if (styleList != null && styleList.getLength() >= 1)
- styleList.item(0).getParentNode().insertBefore(styleToAdd,
- styleList.item(0));
- else
- head.appendChild(styleToAdd);
-
- }
-
- /**
- * Returns a reference to the body of the DOM.
- *
- * @param dom
- * @return
- */
- public static Element getBodyElement(Document dom) {
- // there should only be one body element dom.
- NodeList bodyList = dom.getElementsByTagName(TAG_BODY);
- Element body = (Element) bodyList.item(0);
- return body;
- }
-
-
-
- public static Element createElement(Document dom, String elementName,
- Properties attributes) {
-
- // make sure to create element with any namespace uri to enable finding
- // it again using Dom.getElementsByTagNameNS()
- Element element = dom.createElementNS("", elementName); //$NON-NLS-1$
- if (attributes != null) {
- Enumeration e = attributes.keys();
- while (e.hasMoreElements()) {
- String key = (String) e.nextElement();
- element.setAttribute(key, attributes.getProperty(key));
- }
- }
- return element;
- }
-
- public static Element createAndAppendChild(Element parentElement,
- String elementName, Properties attributes) {
-
- Element element = createElement(parentElement.getOwnerDocument(),
- elementName, attributes);
- parentElement.appendChild(element);
- return element;
- }
-
-
-
- /**
- * Returns an Element array of all first level descendant Elements with a
- * given tag name, in the order in which they are encountered in the DOM.
- * Unlike the JAXP apis, which returns preorder traversal of this Element
- * tree, this method filters out children deeper than first level child
- * nodes.
- */
- public static Element[] getElementsByTagName(Element parent, String tagName) {
- NodeList allChildElements = parent.getElementsByTagName(tagName);
+ private static String TAG_BODY = "body"; //$NON-NLS-1$
+ private static String TAG_HEAD = "head"; //$NON-NLS-1$
+ private static String TAG_BASE = "base"; //$NON-NLS-1$
+ public static String TAG_DIV = "div"; //$NON-NLS-1$
+ public static String TAG_HEAD_LINK = "link"; //$NON-NLS-1$
+ private static String TAG_PARAM = "param"; //$NON-NLS-1$
+ private static String ATT_SRC = "src"; //$NON-NLS-1$
+ private static String ATT_HREF = "href"; //$NON-NLS-1$
+ private static String ATT_CITE = "cite"; //$NON-NLS-1$
+ private static String ATT_LONGDESC = "longdesc"; //$NON-NLS-1$
+ private static String ATT_DATA = "data"; //$NON-NLS-1$
+ private static String ATT_CODEBASE = "codebase"; //$NON-NLS-1$
+ private static String ATT_VALUE = "value"; //$NON-NLS-1$
+ private static String ATT_VALUE_TYPE = "valuetype"; //$NON-NLS-1$
+ private static String ATT_REL = "rel"; //$NON-NLS-1$
+ private static String ATT_TYPE = "type"; //$NON-NLS-1$
+
+
+
+ /*
+ * ********* Model util methods ************************************
+ */
+
+ /**
+ * Checks to see if the passed string is a valid URL (has a protocol), if
+ * yes, returns it as is. If no, treats it as a resource relative to the
+ * declaring plugin. Return the plugin relative location, fully qualified.
+ * Retruns null if the passed string itself is null.
+ *
+ * @param resource
+ * @param pluginDesc
+ * @return returns the URL as is if it had a protocol.
+ */
+ public static String resolveURL(String url, String pluginId) {
+ Bundle bundle = null;
+ if (pluginId != null)
+ // if pluginId is not null, use it.
+ bundle = Platform.getBundle(pluginId);
+ return resolveURL("", url, bundle); //$NON-NLS-1$
+ }
+
+
+
+ /**
+ * Checks to see if the passed string is a valid URL (has a protocol), if
+ * yes, returns it as is. If no, treats it as a resource relative to the
+ * declaring plugin. Return the plugin relative location, fully qualified.
+ * Retruns null if the passed string itself is null.
+ *
+ * @param resource
+ * @param pluginDesc
+ * @return returns the URL as is if it had a protocol.
+ */
+ public static String resolveURL(String url, IConfigurationElement element) {
+ Bundle bundle = BundleUtil.getBundleFromConfigurationElement(element);
+ return resolveURL("", url, bundle); //$NON-NLS-1$
+ }
+
+
+
+ /**
+ * @see resolveURL(String url, IConfigurationElement element)
+ */
+ public static String resolveURL(String base, String url, Bundle bundle) {
+ // quick exit
+ if (url == null)
+ return null;
+ IntroURLParser parser = new IntroURLParser(url);
+ if (parser.hasProtocol())
+ return url;
+ // make plugin relative url. Only now we need the bundle.
+ return BundleUtil.getResolvedResourceLocation(base, url, bundle);
+ }
+
+ /**
+ * Ensures that a file:// URL exists for the bundle root. This will
+ * cause jarred bundles to be extracted into a cache directory.
+ */
+ public static void ensureFileURLsExist(Bundle bundle, String contentFile) {
+ try {
+ FileLocator.toFileURL(bundle.getEntry("/")); //$NON-NLS-1$
+ } catch (Exception e) {
+ if (contentFile != null)
+ Log.error("Failed to extract Intro content folder for: " //$NON-NLS-1$
+ + contentFile, e);
+ }
+ }
+
+
+ /**
+ * Returns the path to the parent folder containing the passed content xml
+ * file. It is assumed that the path is a local url representing a content
+ * file.
+ */
+ public static String getParentFolderToString(String contentFilePath) {
+ IPath path = getParentFolderPath(contentFilePath);
+ return path.toString();
+ }
+
+
+ /*
+ *
+ * ******** XHTML DOM util methods *********************************
+ */
+
+ /**
+ * Returns the path to the parent folder containing the passed content xml
+ * file. It is assumed that the path is a local url representing a content
+ * file.
+ */
+ public static String getParentFolderOSString(String contentFilePath) {
+ IPath path = getParentFolderPath(contentFilePath);
+ return path.toOSString();
+ }
+
+ /**
+ * Returns the parent folder of the given path.
+ */
+ public static IPath getParentFolderPath(String contentFilePath) {
+ IPath path = new Path(contentFilePath);
+ path = path.removeLastSegments(1).addTrailingSeparator();
+ return path;
+ }
+
+
+
+
+ public static void insertBase(Document dom, String baseURL) {
+ // there should only be one head and one base element dom.
+ NodeList headList = dom.getElementsByTagName(TAG_HEAD);
+ Element head = (Element) headList.item(0);
+ NodeList baseList = head.getElementsByTagName(TAG_BASE);
+ if (baseList.getLength() == 0) {
+ // insert a base element, since one is not defined already.
+ Element base = dom.createElement(TAG_BASE);
+ base.setAttribute(ATT_HREF, baseURL);
+ head.insertBefore(base, head.getFirstChild());
+ }
+ }
+
+
+ public static Element getBase(Document dom) {
+ // there should only be one head and one base element dom.
+ NodeList headList = dom.getElementsByTagName(TAG_HEAD);
+ Element head = (Element) headList.item(0);
+ NodeList baseList = head.getElementsByTagName(TAG_BASE);
+ if (baseList.getLength() == 0)
+ // no base defined, signal failure.
+ return null;
+
+ return (Element) baseList.item(baseList.getLength() - 1);
+
+ }
+
+
+ // <link rel="stylesheet" href="shared.css" type="text/css" />
+ public static void insertStyle(Document dom, String cssUrl) {
+ // there should only be one head and one base element dom.
+ NodeList headList = dom.getElementsByTagName(TAG_HEAD);
+ Element head = null;
+ // Element base = getBase(dom);
+ NodeList styleList = null;
+ // there can be more than one style. DO not add style if it exists.
+ if (headList.getLength() >= 1) {
+ head = (Element) headList.item(0);
+ styleList = head.getElementsByTagName(TAG_HEAD_LINK);
+ for (int i = 0; i < styleList.getLength(); i++) {
+ Element style = (Element) styleList.item(0);
+ String styleString = style.getAttribute(ATT_HREF);
+ if (styleString.equals(cssUrl))
+ return;
+ }
+ }
+
+ // insert the style, since it is not defined.
+ Element styleToAdd = dom.createElement(TAG_HEAD_LINK);
+ styleToAdd.setAttribute(ATT_HREF, cssUrl);
+ styleToAdd.setAttribute(ATT_REL, "stylesheet"); //$NON-NLS-1$
+ styleToAdd.setAttribute(ATT_TYPE, "text/css"); //$NON-NLS-1$
+ if (styleList != null && styleList.getLength() >= 1)
+ styleList.item(0).getParentNode().insertBefore(styleToAdd,
+ styleList.item(0));
+ else
+ head.appendChild(styleToAdd);
+
+ }
+
+ /**
+ * Returns a reference to the body of the DOM.
+ *
+ * @param dom
+ * @return
+ */
+ public static Element getBodyElement(Document dom) {
+ // there should only be one body element dom.
+ NodeList bodyList = dom.getElementsByTagName(TAG_BODY);
+ Element body = (Element) bodyList.item(0);
+ return body;
+ }
+
+
+
+ public static Element createElement(Document dom, String elementName,
+ Properties attributes) {
+
+ // make sure to create element with any namespace uri to enable finding
+ // it again using Dom.getElementsByTagNameNS()
+ Element element = dom.createElementNS("", elementName); //$NON-NLS-1$
+ if (attributes != null) {
+ Enumeration e = attributes.keys();
+ while (e.hasMoreElements()) {
+ String key = (String) e.nextElement();
+ element.setAttribute(key, attributes.getProperty(key));
+ }
+ }
+ return element;
+ }
+
+ public static Element createAndAppendChild(Element parentElement,
+ String elementName, Properties attributes) {
+
+ Element element = createElement(parentElement.getOwnerDocument(),
+ elementName, attributes);
+ parentElement.appendChild(element);
+ return element;
+ }
+
+
+
+ /**
+ * Returns an Element array of all first level descendant Elements with a
+ * given tag name, in the order in which they are encountered in the DOM.
+ * Unlike the JAXP apis, which returns preorder traversal of this Element
+ * tree, this method filters out children deeper than first level child
+ * nodes.
+ */
+ public static Element[] getElementsByTagName(Element parent, String tagName) {
+ NodeList allChildElements = parent.getElementsByTagName(tagName);
Vector<Element> vector = new Vector<>();
- for (int i = 0; i < allChildElements.getLength(); i++) {
- // we know that the nodelist is of elements.
- Element aElement = (Element) allChildElements.item(i);
- if (aElement.getParentNode().equals(parent))
- // first level child element. add it.
- vector.add(aElement);
- }
- Element[] filteredElements = new Element[vector.size()];
- vector.copyInto(filteredElements);
- return filteredElements;
- }
-
- /**
- * Same as getElementsByTagName(Element parent, String tagName) but the
- * parent element is assumed to be the root of the document.
- *
- * @see getElementsByTagName(Element parent, String tagName)
- */
- public static Element[] getElementsByTagName(Document dom, String tagName) {
- NodeList allChildElements = dom.getElementsByTagName(tagName);
+ for (int i = 0; i < allChildElements.getLength(); i++) {
+ // we know that the nodelist is of elements.
+ Element aElement = (Element) allChildElements.item(i);
+ if (aElement.getParentNode().equals(parent))
+ // first level child element. add it.
+ vector.add(aElement);
+ }
+ Element[] filteredElements = new Element[vector.size()];
+ vector.copyInto(filteredElements);
+ return filteredElements;
+ }
+
+ /**
+ * Same as getElementsByTagName(Element parent, String tagName) but the
+ * parent element is assumed to be the root of the document.
+ *
+ * @see getElementsByTagName(Element parent, String tagName)
+ */
+ public static Element[] getElementsByTagName(Document dom, String tagName) {
+ NodeList allChildElements = dom.getElementsByTagName(tagName);
Vector<Element> vector = new Vector<>();
- for (int i = 0; i < allChildElements.getLength(); i++) {
- // we know that the nodelist is of elements.
- Element aElement = (Element) allChildElements.item(i);
- if (aElement.getParentNode().equals(dom.getDocumentElement()))
- // first level child element. add it. Cant use getParent
- // here.
- vector.add(aElement);
- }
- Element[] filteredElements = new Element[vector.size()];
- vector.copyInto(filteredElements);
- return filteredElements;
- }
-
-
- /*
- * Util method similar to DOM getElementById() method, but it works without
- * an id attribute being specified. Deep searches all children in this
- * container's DOM for the first child with the given id. The element
- * retrieved must have the passed local name. Note that in an XHTML file
- * (aka DOM) elements should have a unique id within the scope of a
- * document. We use local name because this allows for finding intro
- * anchors, includes and dynamic content element regardless of whether or
- * not an xmlns was used in the xml.
- */
- public static Element getElementById(Document dom, String id,
- String localElementName) {
-
- NodeList children = dom.getElementsByTagNameNS("*", localElementName); //$NON-NLS-1$
- for (int i = 0; i < children.getLength(); i++) {
- Element element = (Element) children.item(i);
- if (element.getAttribute("id").equals(id)) //$NON-NLS-1$
- return element;
- }
- // non found.
- return null;
-
- }
-
- public static Element getElementById(Document dom, String id) {
- return getElementById(dom, id, "*"); //$NON-NLS-1$
- }
-
- public static void updateResourceAttributes(Element element,
- AbstractIntroPage page) {
- updateResourceAttributes(element, page.getBase(), page.getBundle());
- }
-
-
- public static void updateResourceAttributes(Element element,
- IntroExtensionContent extensionContent) {
- updateResourceAttributes(element, extensionContent.getBase(),
- extensionContent.getBundle());
- }
-
- /**
- * Updates all the resource attributes of the passed element to point to a
- * local resolved url.
- *
- * @param element
- * @param extensionContent
- */
- private static void updateResourceAttributes(Element element, String base,
- Bundle bundle) {
- // doUpdateResourceAttributes(element, base, bundle);
- NodeList children = element.getElementsByTagName("*"); //$NON-NLS-1$
- for (int i = 0; i < children.getLength(); i++) {
- Element child = (Element) children.item(i);
- doUpdateResourceAttributes(child, base, bundle);
- }
- }
-
- private static void doUpdateResourceAttributes(Element element,
- String base, Bundle bundle) {
- qualifyAttribute(element, ATT_SRC, base, bundle);
- qualifyAttribute(element, ATT_HREF, base, bundle);
- qualifyAttribute(element, ATT_CITE, base, bundle);
- qualifyAttribute(element, ATT_LONGDESC, base, bundle);
- qualifyAttribute(element, ATT_CODEBASE, base, bundle);
- qualifyAttribute(element, ATT_DATA, base, bundle);
- qualifyValueAttribute(element, base, bundle);
- }
-
- private static void qualifyAttribute(Element element, String attributeName,
- String base, Bundle bundle) {
- if (element.hasAttribute(attributeName)) {
- String attributeValue = element.getAttribute(attributeName);
- if (new IntroURLParser(attributeValue).hasProtocol())
- return;
-
- // resolve the resource against the nl mechanism.
- String attributePath = BundleUtil.getResolvedResourceLocation(base,
- attributeValue, bundle);
- element.setAttribute(attributeName, attributePath);
- }
- }
-
- private static void qualifyValueAttribute(Element element, String base,
- Bundle bundle) {
- if (element.hasAttribute(ATT_VALUE)
- && element.hasAttribute(ATT_VALUE_TYPE)
- && element.getAttribute(ATT_VALUE_TYPE).equals("ref") //$NON-NLS-1$
- && element.getLocalName().equals(TAG_PARAM)) {
- String value = element.getAttribute(ATT_VALUE);
- if (new IntroURLParser(value).hasProtocol())
- return;
- // resolve the resource against the nl mechanism.
- String attributePath = BundleUtil.getResolvedResourceLocation(base,
- value, bundle);
- element.setAttribute(ATT_VALUE, attributePath);
- }
- }
-
-
- /**
- * Returns an array version of the passed NodeList. Used to work around DOM
- * design issues.
- */
- public static Node[] getArray(NodeList nodeList) {
- Node[] nodes = new Node[nodeList.getLength()];
- for (int i = 0; i < nodeList.getLength(); i++)
- nodes[i] = nodeList.item(i);
- return nodes;
- }
-
-
- /**
- * Remove all instances of the element from the DOM.
- *
- */
- public static void removeAllElements(Document dom, String elementLocalName) {
- // get all elements in DOM and remove them.
- NodeList elements = dom.getElementsByTagNameNS("*", //$NON-NLS-1$
- elementLocalName);
- // get the array version of the nodelist to work around DOM api design.
- Node[] elementsArray = ModelUtil.getArray(elements);
- for (int i = 0; i < elementsArray.length; i++) {
- Node element = elementsArray[i];
- element.getParentNode().removeChild(element);
- }
-
- }
+ for (int i = 0; i < allChildElements.getLength(); i++) {
+ // we know that the nodelist is of elements.
+ Element aElement = (Element) allChildElements.item(i);
+ if (aElement.getParentNode().equals(dom.getDocumentElement()))
+ // first level child element. add it. Cant use getParent
+ // here.
+ vector.add(aElement);
+ }
+ Element[] filteredElements = new Element[vector.size()];
+ vector.copyInto(filteredElements);
+ return filteredElements;
+ }
+
+
+ /*
+ * Util method similar to DOM getElementById() method, but it works without
+ * an id attribute being specified. Deep searches all children in this
+ * container's DOM for the first child with the given id. The element
+ * retrieved must have the passed local name. Note that in an XHTML file
+ * (aka DOM) elements should have a unique id within the scope of a
+ * document. We use local name because this allows for finding intro
+ * anchors, includes and dynamic content element regardless of whether or
+ * not an xmlns was used in the xml.
+ */
+ public static Element getElementById(Document dom, String id,
+ String localElementName) {
+
+ NodeList children = dom.getElementsByTagNameNS("*", localElementName); //$NON-NLS-1$
+ for (int i = 0; i < children.getLength(); i++) {
+ Element element = (Element) children.item(i);
+ if (element.getAttribute("id").equals(id)) //$NON-NLS-1$
+ return element;
+ }
+ // non found.
+ return null;
+
+ }
+
+ public static Element getElementById(Document dom, String id) {
+ return getElementById(dom, id, "*"); //$NON-NLS-1$
+ }
+
+ public static void updateResourceAttributes(Element element,
+ AbstractIntroPage page) {
+ updateResourceAttributes(element, page.getBase(), page.getBundle());
+ }
+
+
+ public static void updateResourceAttributes(Element element,
+ IntroExtensionContent extensionContent) {
+ updateResourceAttributes(element, extensionContent.getBase(),
+ extensionContent.getBundle());
+ }
+
+ /**
+ * Updates all the resource attributes of the passed element to point to a
+ * local resolved url.
+ *
+ * @param element
+ * @param extensionContent
+ */
+ private static void updateResourceAttributes(Element element, String base,
+ Bundle bundle) {
+ // doUpdateResourceAttributes(element, base, bundle);
+ NodeList children = element.getElementsByTagName("*"); //$NON-NLS-1$
+ for (int i = 0; i < children.getLength(); i++) {
+ Element child = (Element) children.item(i);
+ doUpdateResourceAttributes(child, base, bundle);
+ }
+ }
+
+ private static void doUpdateResourceAttributes(Element element,
+ String base, Bundle bundle) {
+ qualifyAttribute(element, ATT_SRC, base, bundle);
+ qualifyAttribute(element, ATT_HREF, base, bundle);
+ qualifyAttribute(element, ATT_CITE, base, bundle);
+ qualifyAttribute(element, ATT_LONGDESC, base, bundle);
+ qualifyAttribute(element, ATT_CODEBASE, base, bundle);
+ qualifyAttribute(element, ATT_DATA, base, bundle);
+ qualifyValueAttribute(element, base, bundle);
+ }
+
+ private static void qualifyAttribute(Element element, String attributeName,
+ String base, Bundle bundle) {
+ if (element.hasAttribute(attributeName)) {
+ String attributeValue = element.getAttribute(attributeName);
+ if (new IntroURLParser(attributeValue).hasProtocol())
+ return;
+
+ // resolve the resource against the nl mechanism.
+ String attributePath = BundleUtil.getResolvedResourceLocation(base,
+ attributeValue, bundle);
+ element.setAttribute(attributeName, attributePath);
+ }
+ }
+
+ private static void qualifyValueAttribute(Element element, String base,
+ Bundle bundle) {
+ if (element.hasAttribute(ATT_VALUE)
+ && element.hasAttribute(ATT_VALUE_TYPE)
+ && element.getAttribute(ATT_VALUE_TYPE).equals("ref") //$NON-NLS-1$
+ && element.getLocalName().equals(TAG_PARAM)) {
+ String value = element.getAttribute(ATT_VALUE);
+ if (new IntroURLParser(value).hasProtocol())
+ return;
+ // resolve the resource against the nl mechanism.
+ String attributePath = BundleUtil.getResolvedResourceLocation(base,
+ value, bundle);
+ element.setAttribute(ATT_VALUE, attributePath);
+ }
+ }
+
+
+ /**
+ * Returns an array version of the passed NodeList. Used to work around DOM
+ * design issues.
+ */
+ public static Node[] getArray(NodeList nodeList) {
+ Node[] nodes = new Node[nodeList.getLength()];
+ for (int i = 0; i < nodeList.getLength(); i++)
+ nodes[i] = nodeList.item(i);
+ return nodes;
+ }
+
+
+ /**
+ * Remove all instances of the element from the DOM.
+ *
+ */
+ public static void removeAllElements(Document dom, String elementLocalName) {
+ // get all elements in DOM and remove them.
+ NodeList elements = dom.getElementsByTagNameNS("*", //$NON-NLS-1$
+ elementLocalName);
+ // get the array version of the nodelist to work around DOM api design.
+ Node[] elementsArray = ModelUtil.getArray(elements);
+ for (int i = 0; i < elementsArray.length; i++) {
+ Node element = elementsArray[i];
+ element.getParentNode().removeChild(element);
+ }
+
+ }
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/viewer/IntroModelContentProvider.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/viewer/IntroModelContentProvider.java
index 151e3c761..6703f1e9b 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/viewer/IntroModelContentProvider.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/viewer/IntroModelContentProvider.java
@@ -21,63 +21,63 @@ import org.eclipse.ui.internal.intro.impl.model.AbstractIntroElement;
public class IntroModelContentProvider implements ITreeContentProvider {
- @Override
+ @Override
public Object[] getChildren(Object element) {
- AbstractIntroElement introElement = null;
- if (element instanceof AbstractIntroElement)
- // synch the resource first.
- introElement = (AbstractIntroElement) element;
+ AbstractIntroElement introElement = null;
+ if (element instanceof AbstractIntroElement)
+ // synch the resource first.
+ introElement = (AbstractIntroElement) element;
- if (introElement != null
- && introElement
- .isOfType(AbstractIntroElement.ABSTRACT_CONTAINER))
- return ((AbstractIntroContainer) introElement).getChildren();
+ if (introElement != null
+ && introElement
+ .isOfType(AbstractIntroElement.ABSTRACT_CONTAINER))
+ return ((AbstractIntroContainer) introElement).getChildren();
- return new Object[0];
- }
+ return new Object[0];
+ }
- @Override
+ @Override
public Object getParent(Object element) {
- AbstractIntroElement introElement = null;
- if (element instanceof AbstractIntroElement) {
- // synch the resource first.
- introElement = (AbstractIntroElement) element;
- return introElement.getParent();
- }
- return null;
- }
+ AbstractIntroElement introElement = null;
+ if (element instanceof AbstractIntroElement) {
+ // synch the resource first.
+ introElement = (AbstractIntroElement) element;
+ return introElement.getParent();
+ }
+ return null;
+ }
- @Override
+ @Override
public boolean hasChildren(Object element) {
- AbstractIntroElement introElement = null;
- if (element instanceof AbstractIntroElement)
- // synch the resource first.
- introElement = (AbstractIntroElement) element;
- if (introElement != null
- && introElement
- .isOfType(AbstractIntroElement.ABSTRACT_CONTAINER))
- return true;
- return false;
- }
-
-
- @Override
+ AbstractIntroElement introElement = null;
+ if (element instanceof AbstractIntroElement)
+ // synch the resource first.
+ introElement = (AbstractIntroElement) element;
+ if (introElement != null
+ && introElement
+ .isOfType(AbstractIntroElement.ABSTRACT_CONTAINER))
+ return true;
+ return false;
+ }
+
+
+ @Override
public Object[] getElements(Object element) {
- return getChildren(element);
- }
+ return getChildren(element);
+ }
- @Override
+ @Override
public void dispose() {
- // nothing to dispose
- }
+ // nothing to dispose
+ }
- @Override
+ @Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
+ // do nothing
- }
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/viewer/IntroModelLabelProvider.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/viewer/IntroModelLabelProvider.java
index cf51f2daf..5183ceb09 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/viewer/IntroModelLabelProvider.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/viewer/IntroModelLabelProvider.java
@@ -36,111 +36,111 @@ import org.eclipse.ui.internal.intro.impl.util.ImageUtil;
public class IntroModelLabelProvider extends LabelProvider {
- // Images created in this ILabelProvider
+ // Images created in this ILabelProvider
- static {
- ImageUtil.registerImage(ImageUtil.INTRO_MODEL_CONTAINER,
- "container_obj.png"); //$NON-NLS-1$
- ImageUtil.registerImage(ImageUtil.INTRO_MODEL_LEAF, "topic.png"); //$NON-NLS-1$
- }
+ static {
+ ImageUtil.registerImage(ImageUtil.INTRO_MODEL_CONTAINER,
+ "container_obj.png"); //$NON-NLS-1$
+ ImageUtil.registerImage(ImageUtil.INTRO_MODEL_LEAF, "topic.png"); //$NON-NLS-1$
+ }
- public IntroModelLabelProvider() {
- super();
- }
+ public IntroModelLabelProvider() {
+ super();
+ }
- @Override
+ @Override
public Image getImage(Object element) {
- Image image = null;
- AbstractIntroElement introElement = null;
- if (element instanceof AbstractIntroElement)
- // synch the resource first.
- introElement = (AbstractIntroElement) element;
- if (introElement == null)
- return null;
+ Image image = null;
+ AbstractIntroElement introElement = null;
+ if (element instanceof AbstractIntroElement)
+ // synch the resource first.
+ introElement = (AbstractIntroElement) element;
+ if (introElement == null)
+ return null;
- int elementType = introElement.getType();
- switch (elementType) {
- case AbstractIntroElement.GROUP:
- case AbstractIntroElement.PAGE:
- case AbstractIntroElement.HOME_PAGE:
- image = ImageUtil.getImage(ImageUtil.INTRO_MODEL_CONTAINER);
- break;
- default:
- image = ImageUtil.getImage(ImageUtil.INTRO_MODEL_LEAF);
- break;
- }
- return image;
- }
+ int elementType = introElement.getType();
+ switch (elementType) {
+ case AbstractIntroElement.GROUP:
+ case AbstractIntroElement.PAGE:
+ case AbstractIntroElement.HOME_PAGE:
+ image = ImageUtil.getImage(ImageUtil.INTRO_MODEL_CONTAINER);
+ break;
+ default:
+ image = ImageUtil.getImage(ImageUtil.INTRO_MODEL_LEAF);
+ break;
+ }
+ return image;
+ }
- @Override
+ @Override
public String getText(Object element) {
- String label = null;
- AbstractIntroElement introElement = null;
- if (element instanceof AbstractIntroElement)
- // synch the resource first.
- introElement = (AbstractIntroElement) element;
- if (introElement == null)
- return null;
+ String label = null;
+ AbstractIntroElement introElement = null;
+ if (element instanceof AbstractIntroElement)
+ // synch the resource first.
+ introElement = (AbstractIntroElement) element;
+ if (introElement == null)
+ return null;
- int elementType = introElement.getType();
- switch (elementType) {
- case AbstractIntroElement.GROUP:
- label = "GROUP: " + ((IntroGroup) introElement).getId(); //$NON-NLS-1$
- break;
- case AbstractIntroElement.LINK:
- label = "LINK: " + ((IntroLink) introElement).getLabel(); //$NON-NLS-1$
- break;
- case AbstractIntroElement.TEXT:
- label = "TEXT: " + ((IntroText) introElement).getText(); //$NON-NLS-1$
- break;
- case AbstractIntroElement.IMAGE:
- label = "IMAGE: " + ((IntroImage) introElement).getId(); //$NON-NLS-1$
- break;
- case AbstractIntroElement.HR:
- label = "HR: " + ((IntroSeparator) introElement).getId(); //$NON-NLS-1$
- break;
- case AbstractIntroElement.HTML:
- label = "HTML: " + ((IntroHTML) introElement).getId(); //$NON-NLS-1$
- break;
- case AbstractIntroElement.INCLUDE:
- label = "Unresolved INCLUDE: " //$NON-NLS-1$
- + ((IntroInclude) introElement).getPath();
- break;
- case AbstractIntroElement.PAGE:
- label = "PAGE: " + ((AbstractIntroPage) introElement).getId(); //$NON-NLS-1$
- break;
- case AbstractIntroElement.HOME_PAGE:
- label = "HOME PAGE: " //$NON-NLS-1$
- + ((AbstractIntroPage) introElement).getId();
- break;
- case AbstractIntroElement.PRESENTATION:
- label = "PRESENTATION: " //$NON-NLS-1$
- + ((IntroPartPresentation) introElement)
- .getImplementationKind();
- break;
- case AbstractIntroElement.CONTENT_PROVIDER:
- label = "CONTENT PROVIDER: " //$NON-NLS-1$
- + ((IntroContentProvider) introElement).getClassName();
- break;
- case AbstractIntroElement.CONTAINER_EXTENSION:
- label = "Unresolved ConfigExtension: " //$NON-NLS-1$
- + ((IntroExtensionContent) introElement).getPath();
- break;
- case AbstractIntroElement.ANCHOR:
- label = "ANCHOR: " //$NON-NLS-1$
- + getPath(introElement.getParent(), ((IntroAnchor) introElement).getId());
- break;
- case AbstractIntroElement.PAGE_TITLE:
- label = "Title: " //$NON-NLS-1$
- + ((IntroPageTitle) introElement).getTitle();
- break;
- default:
- label = super.getText(element);
- break;
- }
- return label;
- }
+ int elementType = introElement.getType();
+ switch (elementType) {
+ case AbstractIntroElement.GROUP:
+ label = "GROUP: " + ((IntroGroup) introElement).getId(); //$NON-NLS-1$
+ break;
+ case AbstractIntroElement.LINK:
+ label = "LINK: " + ((IntroLink) introElement).getLabel(); //$NON-NLS-1$
+ break;
+ case AbstractIntroElement.TEXT:
+ label = "TEXT: " + ((IntroText) introElement).getText(); //$NON-NLS-1$
+ break;
+ case AbstractIntroElement.IMAGE:
+ label = "IMAGE: " + ((IntroImage) introElement).getId(); //$NON-NLS-1$
+ break;
+ case AbstractIntroElement.HR:
+ label = "HR: " + ((IntroSeparator) introElement).getId(); //$NON-NLS-1$
+ break;
+ case AbstractIntroElement.HTML:
+ label = "HTML: " + ((IntroHTML) introElement).getId(); //$NON-NLS-1$
+ break;
+ case AbstractIntroElement.INCLUDE:
+ label = "Unresolved INCLUDE: " //$NON-NLS-1$
+ + ((IntroInclude) introElement).getPath();
+ break;
+ case AbstractIntroElement.PAGE:
+ label = "PAGE: " + ((AbstractIntroPage) introElement).getId(); //$NON-NLS-1$
+ break;
+ case AbstractIntroElement.HOME_PAGE:
+ label = "HOME PAGE: " //$NON-NLS-1$
+ + ((AbstractIntroPage) introElement).getId();
+ break;
+ case AbstractIntroElement.PRESENTATION:
+ label = "PRESENTATION: " //$NON-NLS-1$
+ + ((IntroPartPresentation) introElement)
+ .getImplementationKind();
+ break;
+ case AbstractIntroElement.CONTENT_PROVIDER:
+ label = "CONTENT PROVIDER: " //$NON-NLS-1$
+ + ((IntroContentProvider) introElement).getClassName();
+ break;
+ case AbstractIntroElement.CONTAINER_EXTENSION:
+ label = "Unresolved ConfigExtension: " //$NON-NLS-1$
+ + ((IntroExtensionContent) introElement).getPath();
+ break;
+ case AbstractIntroElement.ANCHOR:
+ label = "ANCHOR: " //$NON-NLS-1$
+ + getPath(introElement.getParent(), ((IntroAnchor) introElement).getId());
+ break;
+ case AbstractIntroElement.PAGE_TITLE:
+ label = "Title: " //$NON-NLS-1$
+ + ((IntroPageTitle) introElement).getTitle();
+ break;
+ default:
+ label = super.getText(element);
+ break;
+ }
+ return label;
+ }
private String getPath(AbstractIntroElement introElement, String suffix) {
if (introElement == null || introElement instanceof IntroModelRoot) {
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/EmptyStandbyContentPart.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/EmptyStandbyContentPart.java
index 7591a4c59..a19b24bc9 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/EmptyStandbyContentPart.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/EmptyStandbyContentPart.java
@@ -32,66 +32,66 @@ import org.eclipse.ui.intro.config.IStandbyContentPart;
public class EmptyStandbyContentPart implements IStandbyContentPart {
- private Composite contentComposite;
- private Text contentText;
+ private Composite contentComposite;
+ private Text contentText;
- @Override
+ @Override
public void createPartControl(Composite parent, FormToolkit toolkit) {
- contentComposite = toolkit.createComposite(parent);
- contentComposite.setLayout(new GridLayout());
- // Util.highlight(contentComposite, SWT.COLOR_YELLOW);
-
- String text = Messages.EmptyStandbyContentPart_text;
- Label label = toolkit.createLabel(contentComposite, text, SWT.WRAP);
- label.setFont(PageStyleManager.getBannerFont());
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- label.setLayoutData(gd);
-
- contentText = toolkit.createText(contentComposite, " ", SWT.MULTI //$NON-NLS-1$
- | SWT.WRAP);
- GridData textGd = new GridData(GridData.FILL_BOTH);
- contentText.setLayoutData(textGd);
- }
-
- @Override
+ contentComposite = toolkit.createComposite(parent);
+ contentComposite.setLayout(new GridLayout());
+ // Util.highlight(contentComposite, SWT.COLOR_YELLOW);
+
+ String text = Messages.EmptyStandbyContentPart_text;
+ Label label = toolkit.createLabel(contentComposite, text, SWT.WRAP);
+ label.setFont(PageStyleManager.getBannerFont());
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ label.setLayoutData(gd);
+
+ contentText = toolkit.createText(contentComposite, " ", SWT.MULTI //$NON-NLS-1$
+ | SWT.WRAP);
+ GridData textGd = new GridData(GridData.FILL_BOTH);
+ contentText.setLayoutData(textGd);
+ }
+
+ @Override
public Control getControl() {
- return contentComposite;
- }
+ return contentComposite;
+ }
- public void setMessage(String message) {
- if (message != null) {
- contentText.setText(message);
- contentComposite.layout();
- }
- }
+ public void setMessage(String message) {
+ if (message != null) {
+ contentText.setText(message);
+ contentComposite.layout();
+ }
+ }
- @Override
+ @Override
public void init(IIntroPart introPart, IMemento memento) {
- // no-op
- }
+ // no-op
+ }
- @Override
+ @Override
public void setInput(Object input) {
- if (input != null)
- setMessage((String) input);
- else
- setMessage(""); //$NON-NLS-1$
- }
+ if (input != null)
+ setMessage((String) input);
+ else
+ setMessage(""); //$NON-NLS-1$
+ }
- @Override
+ @Override
public void setFocus() {
- // no-op
- }
+ // no-op
+ }
- @Override
+ @Override
public void dispose() {
- // no-op
- }
+ // no-op
+ }
- @Override
+ @Override
public void saveState(IMemento memento) {
- // no-op
- }
+ // no-op
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java
index 512a19cc4..e7fa089b0 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/parts/StandbyPart.java
@@ -61,403 +61,403 @@ import org.eclipse.ui.intro.config.IStandbyContentPart;
*/
public class StandbyPart implements IIntroConstants {
- private FormToolkit toolkit;
- private IntroModelRoot model;
- protected ImageHyperlink returnLink;
- protected Control separator;
- private Composite container;
- protected Composite content;
- private IIntroPart introPart;
- private EmptyStandbyContentPart emptyPart;
- private IMemento memento;
+ private FormToolkit toolkit;
+ private IntroModelRoot model;
+ protected ImageHyperlink returnLink;
+ protected Control separator;
+ private Composite container;
+ protected Composite content;
+ private IIntroPart introPart;
+ private EmptyStandbyContentPart emptyPart;
+ private IMemento memento;
private Map<String, ControlKey> cachedContentParts = new HashMap<>();
- private ControlKey cachedControlKey;
+ private ControlKey cachedControlKey;
- class StandbyLayout extends Layout {
+ class StandbyLayout extends Layout {
- private int VGAP = 9;
- private int VMARGIN = 5;
- private int HMARGIN = 5;
- private int SEPARATOR_HEIGHT = 1;
+ private int VGAP = 9;
+ private int VMARGIN = 5;
+ private int HMARGIN = 5;
+ private int SEPARATOR_HEIGHT = 1;
- @Override
+ @Override
protected Point computeSize(Composite composite, int wHint, int hHint,
- boolean flushCache) {
- Point lsize = returnLink.computeSize(SWT.DEFAULT, SWT.DEFAULT,
- flushCache);
- Point csize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT,
- flushCache);
- int width = Math.max(lsize.x + 2 * HMARGIN, csize.x);
- int height = VMARGIN + lsize.y + VGAP + SEPARATOR_HEIGHT + csize.y;
- return new Point(width, height);
- }
-
- @Override
+ boolean flushCache) {
+ Point lsize = returnLink.computeSize(SWT.DEFAULT, SWT.DEFAULT,
+ flushCache);
+ Point csize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT,
+ flushCache);
+ int width = Math.max(lsize.x + 2 * HMARGIN, csize.x);
+ int height = VMARGIN + lsize.y + VGAP + SEPARATOR_HEIGHT + csize.y;
+ return new Point(width, height);
+ }
+
+ @Override
protected void layout(Composite composite, boolean flushCache) {
- Rectangle carea = composite.getClientArea();
- int lwidth = carea.width - HMARGIN * 2;
- Point lsize = returnLink.computeSize(lwidth, SWT.DEFAULT,
- flushCache);
- int x = HMARGIN;
- int y = VMARGIN;
- returnLink.setBounds(x, y, lsize.x, lsize.y);
- x = 0;
- y += lsize.y + VGAP;
- separator.setBounds(x, y, carea.width, SEPARATOR_HEIGHT);
- y += SEPARATOR_HEIGHT;
- content.setBounds(x, y, carea.width, carea.height - VMARGIN
- - lsize.y - VGAP - SEPARATOR_HEIGHT);
- }
- }
-
- /**
- * @param parent
- */
- public StandbyPart(IntroModelRoot model) {
- this.model = model;
- }
-
-
- public void init(IIntroPart introPart, IMemento memento) {
- this.introPart = introPart;
- this.memento = memento;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.intro.IIntroPart#saveState(org.eclipse.ui.IMemento)
- */
- private IMemento getMemento(IMemento memento, String key) {
- if (memento == null)
- return null;
- return memento.getChild(key);
- }
-
- public void createPartControl(Composite parent) {
- toolkit = new FormToolkit(parent.getDisplay());
- // parent container. Has custom layout. Has return link and content
- // stack composite.
- container = toolkit.createComposite(parent);
- container.setLayout(new StandbyLayout());
-
- // return hyper link.
- ImageUtil.registerImage(ImageUtil.BACK, "full/elcl16/home_nav.png"); //$NON-NLS-1$
- returnLink = toolkit.createImageHyperlink(container, SWT.WRAP
- | SWT.CENTER);
- returnLink.setImage(ImageUtil.getImage(ImageUtil.BACK));
- returnLink.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
+ Rectangle carea = composite.getClientArea();
+ int lwidth = carea.width - HMARGIN * 2;
+ Point lsize = returnLink.computeSize(lwidth, SWT.DEFAULT,
+ flushCache);
+ int x = HMARGIN;
+ int y = VMARGIN;
+ returnLink.setBounds(x, y, lsize.x, lsize.y);
+ x = 0;
+ y += lsize.y + VGAP;
+ separator.setBounds(x, y, carea.width, SEPARATOR_HEIGHT);
+ y += SEPARATOR_HEIGHT;
+ content.setBounds(x, y, carea.width, carea.height - VMARGIN
+ - lsize.y - VGAP - SEPARATOR_HEIGHT);
+ }
+ }
+
+ /**
+ * @param parent
+ */
+ public StandbyPart(IntroModelRoot model) {
+ this.model = model;
+ }
+
+
+ public void init(IIntroPart introPart, IMemento memento) {
+ this.introPart = introPart;
+ this.memento = memento;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.intro.IIntroPart#saveState(org.eclipse.ui.IMemento)
+ */
+ private IMemento getMemento(IMemento memento, String key) {
+ if (memento == null)
+ return null;
+ return memento.getChild(key);
+ }
+
+ public void createPartControl(Composite parent) {
+ toolkit = new FormToolkit(parent.getDisplay());
+ // parent container. Has custom layout. Has return link and content
+ // stack composite.
+ container = toolkit.createComposite(parent);
+ container.setLayout(new StandbyLayout());
+
+ // return hyper link.
+ ImageUtil.registerImage(ImageUtil.BACK, "full/elcl16/home_nav.png"); //$NON-NLS-1$
+ returnLink = toolkit.createImageHyperlink(container, SWT.WRAP
+ | SWT.CENTER);
+ returnLink.setImage(ImageUtil.getImage(ImageUtil.BACK));
+ returnLink.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
public void linkActivated(HyperlinkEvent e) {
- doReturn();
- }
- });
-
- // create horizontal separator
- separator = toolkit.createCompositeSeparator(container);
- // content stack container
- content = toolkit.createComposite(container);
- StackLayout slayout = new StackLayout();
- slayout.marginWidth = slayout.marginHeight = 0;
- content.setLayout(slayout);
-
- boolean success = false;
- if (memento != null) {
- success = restoreState(memento);
- if (!success)
- // add empty standby content.
- addAndShowEmptyPart(Messages.StandbyPart_canNotRestore);
- }
-
- updateReturnLinkLabel();
- }
-
- /**
- * Empty content part used as backup for failures.
- *
- */
- private void addAndShowEmptyPart(String message) {
- if (emptyPart == null)
- emptyPart = new EmptyStandbyContentPart();
- addStandbyContentPart(EMPTY_STANDBY_CONTENT_PART, emptyPart);
- emptyPart.setMessage(message);
- setTopControl(EMPTY_STANDBY_CONTENT_PART);
- }
-
- /**
- * Tries to create the last content part viewed, based on content part id..
- *
- * @param memento
- * @return
- */
- private boolean restoreState(IMemento memento) {
- String contentPartId = memento
- .getString(MEMENTO_STANDBY_CONTENT_PART_ID_ATT);
- if (contentPartId == null)
- return false;
- // create the cached content part. Content parts are responsible for
- // storing and reading their input state.
- return showContentPart(contentPartId, null);
- }
-
-
- /**
- * Sets the into part to standby, and shows the passed standby part, with
- * the given input.
- *
- * @param partId
- * @param input
- */
- public boolean showContentPart(String partId, String input) {
- // Get the IntroStandbyContentPart that maps to the given partId.
- IntroStandbyContentPart standbyPartContent = ExtensionPointManager
- .getInst().getSharedConfigExtensionsManager()
- .getStandbyPart(partId);
-
- if (standbyPartContent != null) {
- String standbyContentClassName = standbyPartContent.getClassName();
- String pluginId = standbyPartContent.getPluginId();
-
- Object standbyContentObject = ModelLoaderUtil.createClassInstance(
- pluginId, standbyContentClassName);
- if (standbyContentObject instanceof IStandbyContentPart) {
- IStandbyContentPart contentPart = (IStandbyContentPart) standbyContentObject;
- Control c = addStandbyContentPart(partId, contentPart);
- if (c != null) {
- try {
- setTopControl(partId);
- setInput(input);
- return true;
- } catch (Exception e) {
- Log.error("Failed to set the input: " + input //$NON-NLS-1$
- + " on standby part: " + partId, e); //$NON-NLS-1$
- }
- }
-
- // failed to create the standby part, show empty part and signal
- // failure.
- String message = NLS.bind(Messages.StandbyPart_failedToCreate,
- partId);
- addAndShowEmptyPart(message);
- return false;
-
- }
- }
-
- // no content part defined with the passed partId, show empty part and
- // signal failure.
- String message = NLS.bind(Messages.StandbyPart_nonDefined, partId);
- addAndShowEmptyPart(message);
- return false;
- }
-
- /**
- * Creates a standbyContent part in the stack only if one is not already
- * created. The partId is used as tke key in the cache. The value is an
- * instance of ControlKey that wraps a control/StandbyPart pair along with
- * the corresponding part id. This is needed to retrive the control of a
- * given standby part. The IMemento should be passed to the StandbyPart when
- * it is initialized.
- *
- * @param standbyContent
- */
- public Control addStandbyContentPart(String partId,
- IStandbyContentPart standbyContent) {
-
- ControlKey controlKey = getCachedContent(partId);
- if (controlKey == null) {
-
- try {
- standbyContent.init(introPart, getMemento(memento,
- MEMENTO_STANDBY_CONTENT_PART_TAG));
- standbyContent.createPartControl(content, toolkit);
- } catch (Exception e) {
- // a standby content part throws a PartInitException, log fact.
- Log.error(
- "Failed to create part for standby part: " + partId, e); //$NON-NLS-1$
- return null;
- }
-
- Control control = standbyContent.getControl();
- controlKey = new ControlKey(control, standbyContent, partId);
- cachedContentParts.put(partId, controlKey);
- if (partId.equals(EMPTY_STANDBY_CONTENT_PART))
- // just in case it was created explicity, reuse it.
- emptyPart = (EmptyStandbyContentPart) standbyContent;
-
- if (controlKey.getControl() == null) {
- // control is null. This means that interface was not
- // implemented properly. log fact.
+ doReturn();
+ }
+ });
+
+ // create horizontal separator
+ separator = toolkit.createCompositeSeparator(container);
+ // content stack container
+ content = toolkit.createComposite(container);
+ StackLayout slayout = new StackLayout();
+ slayout.marginWidth = slayout.marginHeight = 0;
+ content.setLayout(slayout);
+
+ boolean success = false;
+ if (memento != null) {
+ success = restoreState(memento);
+ if (!success)
+ // add empty standby content.
+ addAndShowEmptyPart(Messages.StandbyPart_canNotRestore);
+ }
+
+ updateReturnLinkLabel();
+ }
+
+ /**
+ * Empty content part used as backup for failures.
+ *
+ */
+ private void addAndShowEmptyPart(String message) {
+ if (emptyPart == null)
+ emptyPart = new EmptyStandbyContentPart();
+ addStandbyContentPart(EMPTY_STANDBY_CONTENT_PART, emptyPart);
+ emptyPart.setMessage(message);
+ setTopControl(EMPTY_STANDBY_CONTENT_PART);
+ }
+
+ /**
+ * Tries to create the last content part viewed, based on content part id..
+ *
+ * @param memento
+ * @return
+ */
+ private boolean restoreState(IMemento memento) {
+ String contentPartId = memento
+ .getString(MEMENTO_STANDBY_CONTENT_PART_ID_ATT);
+ if (contentPartId == null)
+ return false;
+ // create the cached content part. Content parts are responsible for
+ // storing and reading their input state.
+ return showContentPart(contentPartId, null);
+ }
+
+
+ /**
+ * Sets the into part to standby, and shows the passed standby part, with
+ * the given input.
+ *
+ * @param partId
+ * @param input
+ */
+ public boolean showContentPart(String partId, String input) {
+ // Get the IntroStandbyContentPart that maps to the given partId.
+ IntroStandbyContentPart standbyPartContent = ExtensionPointManager
+ .getInst().getSharedConfigExtensionsManager()
+ .getStandbyPart(partId);
+
+ if (standbyPartContent != null) {
+ String standbyContentClassName = standbyPartContent.getClassName();
+ String pluginId = standbyPartContent.getPluginId();
+
+ Object standbyContentObject = ModelLoaderUtil.createClassInstance(
+ pluginId, standbyContentClassName);
+ if (standbyContentObject instanceof IStandbyContentPart) {
+ IStandbyContentPart contentPart = (IStandbyContentPart) standbyContentObject;
+ Control c = addStandbyContentPart(partId, contentPart);
+ if (c != null) {
+ try {
+ setTopControl(partId);
+ setInput(input);
+ return true;
+ } catch (Exception e) {
+ Log.error("Failed to set the input: " + input //$NON-NLS-1$
+ + " on standby part: " + partId, e); //$NON-NLS-1$
+ }
+ }
+
+ // failed to create the standby part, show empty part and signal
+ // failure.
+ String message = NLS.bind(Messages.StandbyPart_failedToCreate,
+ partId);
+ addAndShowEmptyPart(message);
+ return false;
+
+ }
+ }
+
+ // no content part defined with the passed partId, show empty part and
+ // signal failure.
+ String message = NLS.bind(Messages.StandbyPart_nonDefined, partId);
+ addAndShowEmptyPart(message);
+ return false;
+ }
+
+ /**
+ * Creates a standbyContent part in the stack only if one is not already
+ * created. The partId is used as tke key in the cache. The value is an
+ * instance of ControlKey that wraps a control/StandbyPart pair along with
+ * the corresponding part id. This is needed to retrive the control of a
+ * given standby part. The IMemento should be passed to the StandbyPart when
+ * it is initialized.
+ *
+ * @param standbyContent
+ */
+ public Control addStandbyContentPart(String partId,
+ IStandbyContentPart standbyContent) {
+
+ ControlKey controlKey = getCachedContent(partId);
+ if (controlKey == null) {
+
+ try {
+ standbyContent.init(introPart, getMemento(memento,
+ MEMENTO_STANDBY_CONTENT_PART_TAG));
+ standbyContent.createPartControl(content, toolkit);
+ } catch (Exception e) {
+ // a standby content part throws a PartInitException, log fact.
+ Log.error(
+ "Failed to create part for standby part: " + partId, e); //$NON-NLS-1$
+ return null;
+ }
+
+ Control control = standbyContent.getControl();
+ controlKey = new ControlKey(control, standbyContent, partId);
+ cachedContentParts.put(partId, controlKey);
+ if (partId.equals(EMPTY_STANDBY_CONTENT_PART))
+ // just in case it was created explicity, reuse it.
+ emptyPart = (EmptyStandbyContentPart) standbyContent;
+
+ if (controlKey.getControl() == null) {
+ // control is null. This means that interface was not
+ // implemented properly. log fact.
String message = StringUtil.concat("Standby Content part: ", partId, //$NON-NLS-1$
" has a null Control defined. This prevents the part from being displayed."); //$NON-NLS-1$
- Log.error(message, null);
- return null;
- }
- }
-
- return controlKey.getControl();
- }
-
-
-
- public void setInput(Object input) {
- IStandbyContentPart standbyContent = cachedControlKey.getContentPart();
- standbyContent.setInput(input);
- updateReturnLinkLabel();
- container.layout();
- }
-
-
- public void setTopControl(String key) {
- cachedControlKey = getCachedContent(key);
- if (cachedControlKey != null) {
- setTopControl(cachedControlKey.getControl());
- }
- }
-
- private void setTopControl(Control c) {
- StackLayout layout = (StackLayout) content.getLayout();
- layout.topControl = c;
- if (c instanceof Composite)
- ((Composite) c).layout();
- content.layout();
- container.layout();
- }
-
- private void updateReturnLinkLabel() {
- String linkText = Messages.StandbyPart_returnToIntro;
- returnLink.setText(linkText);
- AbstractIntroPage page = model.getCurrentPage();
- if (page == null)
- // page will be null in static intro.
- return;
-
- String toolTip = Messages.StandbyPart_returnTo;
- if (page.getTitle() != null)
- toolTip += " " + page.getTitle(); //$NON-NLS-1$
-
- returnLink.setToolTipText(toolTip);
- }
-
- protected void doReturn() {
- // remove the flag to indicate that standbypart is no longer needed.
- ((CustomizableIntroPart) introPart).getControl().setData(
- IIntroConstants.SHOW_STANDBY_PART, null);
- IntroPlugin.setIntroStandby(false);
- }
-
- /**
- * Calls dispose on all cached IStandbyContentParts.
- *
- */
- public void dispose() {
+ Log.error(message, null);
+ return null;
+ }
+ }
+
+ return controlKey.getControl();
+ }
+
+
+
+ public void setInput(Object input) {
+ IStandbyContentPart standbyContent = cachedControlKey.getContentPart();
+ standbyContent.setInput(input);
+ updateReturnLinkLabel();
+ container.layout();
+ }
+
+
+ public void setTopControl(String key) {
+ cachedControlKey = getCachedContent(key);
+ if (cachedControlKey != null) {
+ setTopControl(cachedControlKey.getControl());
+ }
+ }
+
+ private void setTopControl(Control c) {
+ StackLayout layout = (StackLayout) content.getLayout();
+ layout.topControl = c;
+ if (c instanceof Composite)
+ ((Composite) c).layout();
+ content.layout();
+ container.layout();
+ }
+
+ private void updateReturnLinkLabel() {
+ String linkText = Messages.StandbyPart_returnToIntro;
+ returnLink.setText(linkText);
+ AbstractIntroPage page = model.getCurrentPage();
+ if (page == null)
+ // page will be null in static intro.
+ return;
+
+ String toolTip = Messages.StandbyPart_returnTo;
+ if (page.getTitle() != null)
+ toolTip += " " + page.getTitle(); //$NON-NLS-1$
+
+ returnLink.setToolTipText(toolTip);
+ }
+
+ protected void doReturn() {
+ // remove the flag to indicate that standbypart is no longer needed.
+ ((CustomizableIntroPart) introPart).getControl().setData(
+ IIntroConstants.SHOW_STANDBY_PART, null);
+ IntroPlugin.setIntroStandby(false);
+ }
+
+ /**
+ * Calls dispose on all cached IStandbyContentParts.
+ *
+ */
+ public void dispose() {
for (ControlKey controlKey : cachedContentParts.values()) {
- controlKey.getContentPart().dispose();
- }
- toolkit.dispose();
- }
-
- /**
- * Save the current state of the standby part. It stores the cached content
- * part id for later creating it on restart. It also creates another
- * subclass momento to also give the standby content part its own name
- * space. This was momentos saved by different content parts will not
- * conflict.
- *
- * @param memento
- * the memento in which to store state information
- */
- public void saveState(IMemento memento) {
- // save cached content part id.
- if (cachedControlKey != null) {
- String contentPartId = cachedControlKey.getContentPartId();
- if (contentPartId == EMPTY_STANDBY_CONTENT_PART)
- // do not create memento for empty standby.
- return;
- memento.putString(MEMENTO_STANDBY_CONTENT_PART_ID_ATT,
- contentPartId);
- // give standby part its own child to create a name space for
- // IStandbyPartContent contribution momentos.
- IMemento standbyContentPartMemento = memento
- .createChild(MEMENTO_STANDBY_CONTENT_PART_TAG);
- // pass new memento to correct standby part.
- IStandbyContentPart standbyContentpart = cachedControlKey
- .getContentPart();
- if (standbyContentpart != null)
- standbyContentpart.saveState(standbyContentPartMemento);
- }
- }
-
-
- /*
- * Set focus on the IStandbyContentPart that corresponds to the top control
- * in the stack.
- *
- * @see org.eclipse.ui.internal.intro.impl.parts.IStandbyContentPart#setFocus()
- */
- public void setFocus() {
- // grab foxus first, then delegate. This way if content part does
- // nothing on focus, part still works.
- returnLink.setFocus();
- if (cachedControlKey != null)
- cachedControlKey.getContentPart().setFocus();
- }
-
-
-
- /**
- * Checks the standby cache stack if we have already created a similar
- * IStandbyContentPart. If not, returns null.
- *
- * @param standbyContent
- * @return
- */
- private ControlKey getCachedContent(String key) {
- if (cachedContentParts.containsKey(key))
- return cachedContentParts.get(key);
- return null;
- }
-
- /*
- * Model class to wrap Control and IStandbyContentPart pairs, along with the
- * representing ID..
- */
- class ControlKey {
-
- Control c;
- IStandbyContentPart part;
- String contentPartId;
-
- ControlKey(Control c, IStandbyContentPart part, String contentPartId) {
- this.c = c;
- this.part = part;
- this.contentPartId = contentPartId;
- }
-
- /**
- * @return Returns the c.
- */
- public Control getControl() {
- return c;
- }
-
- /**
- * @return Returns the content part.
- */
- public IStandbyContentPart getContentPart() {
- return part;
- }
-
- /**
- * @return Returns the part id.
- */
- public String getContentPartId() {
- return contentPartId;
- }
- }
+ controlKey.getContentPart().dispose();
+ }
+ toolkit.dispose();
+ }
+
+ /**
+ * Save the current state of the standby part. It stores the cached content
+ * part id for later creating it on restart. It also creates another
+ * subclass momento to also give the standby content part its own name
+ * space. This was momentos saved by different content parts will not
+ * conflict.
+ *
+ * @param memento
+ * the memento in which to store state information
+ */
+ public void saveState(IMemento memento) {
+ // save cached content part id.
+ if (cachedControlKey != null) {
+ String contentPartId = cachedControlKey.getContentPartId();
+ if (contentPartId == EMPTY_STANDBY_CONTENT_PART)
+ // do not create memento for empty standby.
+ return;
+ memento.putString(MEMENTO_STANDBY_CONTENT_PART_ID_ATT,
+ contentPartId);
+ // give standby part its own child to create a name space for
+ // IStandbyPartContent contribution momentos.
+ IMemento standbyContentPartMemento = memento
+ .createChild(MEMENTO_STANDBY_CONTENT_PART_TAG);
+ // pass new memento to correct standby part.
+ IStandbyContentPart standbyContentpart = cachedControlKey
+ .getContentPart();
+ if (standbyContentpart != null)
+ standbyContentpart.saveState(standbyContentPartMemento);
+ }
+ }
+
+
+ /*
+ * Set focus on the IStandbyContentPart that corresponds to the top control
+ * in the stack.
+ *
+ * @see org.eclipse.ui.internal.intro.impl.parts.IStandbyContentPart#setFocus()
+ */
+ public void setFocus() {
+ // grab foxus first, then delegate. This way if content part does
+ // nothing on focus, part still works.
+ returnLink.setFocus();
+ if (cachedControlKey != null)
+ cachedControlKey.getContentPart().setFocus();
+ }
+
+
+
+ /**
+ * Checks the standby cache stack if we have already created a similar
+ * IStandbyContentPart. If not, returns null.
+ *
+ * @param standbyContent
+ * @return
+ */
+ private ControlKey getCachedContent(String key) {
+ if (cachedContentParts.containsKey(key))
+ return cachedContentParts.get(key);
+ return null;
+ }
+
+ /*
+ * Model class to wrap Control and IStandbyContentPart pairs, along with the
+ * representing ID..
+ */
+ class ControlKey {
+
+ Control c;
+ IStandbyContentPart part;
+ String contentPartId;
+
+ ControlKey(Control c, IStandbyContentPart part, String contentPartId) {
+ this.c = c;
+ this.part = part;
+ this.contentPartId = contentPartId;
+ }
+
+ /**
+ * @return Returns the c.
+ */
+ public Control getControl() {
+ return c;
+ }
+
+ /**
+ * @return Returns the content part.
+ */
+ public IStandbyContentPart getContentPart() {
+ return part;
+ }
+
+ /**
+ * @return Returns the part id.
+ */
+ public String getContentPartId() {
+ return contentPartId;
+ }
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java
index 5e15fa1e1..07091885c 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartImplementation.java
@@ -77,89 +77,89 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class BrowserIntroPartImplementation extends
- AbstractIntroPartImplementation implements IPropertyListener,
- IIntroContentProviderSite {
+ AbstractIntroPartImplementation implements IPropertyListener,
+ IIntroContentProviderSite {
- private final class ReduceAction extends Action {
+ private final class ReduceAction extends Action {
{
- setToolTipText(Messages.Browser_reduce_tooltip);
- setImageDescriptor(ImageUtil
- .createImageDescriptor("full/elcl16/reduce_font.png")); //$NON-NLS-1$
- setDisabledImageDescriptor(ImageUtil
- .createImageDescriptor("full/dlcl16/reduce_font.png")); //$NON-NLS-1$
- int scalePercent = FontSelection.getScalePercentage();
- setEnabled(scalePercent > -40);
- }
+ setToolTipText(Messages.Browser_reduce_tooltip);
+ setImageDescriptor(ImageUtil
+ .createImageDescriptor("full/elcl16/reduce_font.png")); //$NON-NLS-1$
+ setDisabledImageDescriptor(ImageUtil
+ .createImageDescriptor("full/dlcl16/reduce_font.png")); //$NON-NLS-1$
+ int scalePercent = FontSelection.getScalePercentage();
+ setEnabled(scalePercent > -40);
+ }
@Override
public void run() {
- int scalePercent = FontSelection.getScalePercentage();
- FontSelection.setScalePercentage(scalePercent - 20);
- restartIntro();
- }
+ int scalePercent = FontSelection.getScalePercentage();
+ FontSelection.setScalePercentage(scalePercent - 20);
+ restartIntro();
+ }
}
private final class MagnifyAction extends Action {
{
- setToolTipText(Messages.Browser_magnify_tooltip);
- setImageDescriptor(ImageUtil
- .createImageDescriptor("full/elcl16/magnify_font.png")); //$NON-NLS-1$
- setDisabledImageDescriptor(ImageUtil
- .createImageDescriptor("full/dlcl16/magnify_font.png")); //$NON-NLS-1$
- int scalePercent = FontSelection.getScalePercentage();
- setEnabled(scalePercent < 100);
- }
+ setToolTipText(Messages.Browser_magnify_tooltip);
+ setImageDescriptor(ImageUtil
+ .createImageDescriptor("full/elcl16/magnify_font.png")); //$NON-NLS-1$
+ setDisabledImageDescriptor(ImageUtil
+ .createImageDescriptor("full/dlcl16/magnify_font.png")); //$NON-NLS-1$
+ int scalePercent = FontSelection.getScalePercentage();
+ setEnabled(scalePercent < 100);
+ }
@Override
public void run() {
- int scalePercent = FontSelection.getScalePercentage();
- FontSelection.setScalePercentage(scalePercent + SCALE_INCREMENT);
- restartIntro();
- }
+ int scalePercent = FontSelection.getScalePercentage();
+ FontSelection.setScalePercentage(scalePercent + SCALE_INCREMENT);
+ restartIntro();
+ }
}
private static final int SCALE_INCREMENT = 20;
// the browser widget that will display the intro content
- protected Browser browser = null;
+ protected Browser browser = null;
- // the HTML generator used to generate dynamic content
- private IntroHTMLGenerator htmlGenerator = null;
+ // the HTML generator used to generate dynamic content
+ private IntroHTMLGenerator htmlGenerator = null;
- private String savedContent = null;
+ private String savedContent = null;
- private Action openBrowserAction = new Action() {
+ private Action openBrowserAction = new Action() {
- {
- setToolTipText(Messages.IntroPart_openExternal_tooltip);
- setImageDescriptor(ImageUtil
- .createImageDescriptor("topic.png")); //$NON-NLS-1$
- }
+ {
+ setToolTipText(Messages.IntroPart_openExternal_tooltip);
+ setImageDescriptor(ImageUtil
+ .createImageDescriptor("topic.png")); //$NON-NLS-1$
+ }
- @Override
+ @Override
public void run() {
- // Save the html to a file and open it in an external browser
- File tempFile;
+ // Save the html to a file and open it in an external browser
+ File tempFile;
try {
tempFile = File.createTempFile("intro",".html"); //$NON-NLS-1$//$NON-NLS-2$
- tempFile.deleteOnExit();
- try (BufferedWriter out = new BufferedWriter(new
- FileWriter(tempFile))) {
- out.write(savedContent);
- }
- IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
- IWebBrowser browser = support.getExternalBrowser();
- browser.openURL(tempFile.toURI().toURL());
+ tempFile.deleteOnExit();
+ try (BufferedWriter out = new BufferedWriter(new
+ FileWriter(tempFile))) {
+ out.write(savedContent);
+ }
+ IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
+ IWebBrowser browser = support.getExternalBrowser();
+ browser.openURL(tempFile.toURI().toURL());
} catch (IOException e) {
} catch (PartInitException e) {
}
- }
- };
+ }
+ };
- private void restartIntro() {
+ private void restartIntro() {
IIntroManager manager = PlatformUI.getWorkbench().getIntroManager();
IIntroPart part = manager.getIntro();
if (part != null && part instanceof CustomizableIntroPart) {
@@ -181,252 +181,252 @@ public class BrowserIntroPartImplementation extends
}
}
- protected BrowserIntroPartLocationListener urlListener = new BrowserIntroPartLocationListener(
- this);
+ protected BrowserIntroPartLocationListener urlListener = new BrowserIntroPartLocationListener(
+ this);
- // internal performance test hook
- private boolean isFinishedLoading;
+ // internal performance test hook
+ private boolean isFinishedLoading;
private boolean resizeActionsAdded = false;
- @Override
+ @Override
protected void updateNavigationActionsState() {
- if (getModel().isDynamic()) {
- forwardAction.setEnabled(history.canNavigateForward());
- backAction.setEnabled(history.canNavigateBackward());
- return;
- }
-
- // in static html intro, use browser history.
- forwardAction.setEnabled(browser.isForwardEnabled());
- backAction.setEnabled(browser.isBackEnabled());
- }
-
-
- /**
- * create the browser and set it's contents
- */
- @Override
+ if (getModel().isDynamic()) {
+ forwardAction.setEnabled(history.canNavigateForward());
+ backAction.setEnabled(history.canNavigateBackward());
+ return;
+ }
+
+ // in static html intro, use browser history.
+ forwardAction.setEnabled(browser.isForwardEnabled());
+ backAction.setEnabled(browser.isBackEnabled());
+ }
+
+
+ /**
+ * create the browser and set it's contents
+ */
+ @Override
public void createPartControl(Composite parent) {
- long start = 0;
- if (Log.logPerformance)
- start = System.currentTimeMillis();
+ long start = 0;
+ if (Log.logPerformance)
+ start = System.currentTimeMillis();
- browser = new Browser(parent, SWT.NONE);
+ browser = new Browser(parent, SWT.NONE);
- // add a location listener on the browser so we can intercept
- // LocationEvents. Responsible for intercepting URLs and updating UI
- // with history.
- browser.addLocationListener(urlListener);
+ // add a location listener on the browser so we can intercept
+ // LocationEvents. Responsible for intercepting URLs and updating UI
+ // with history.
+ browser.addLocationListener(urlListener);
- // add a location listener that will clear a flag at the end of any
- // navigation to a page. This is used in conjunction with the location
- // listener to filter out redundant navigations due to frames.
- browser.addProgressListener(new ProgressListener() {
+ // add a location listener that will clear a flag at the end of any
+ // navigation to a page. This is used in conjunction with the location
+ // listener to filter out redundant navigations due to frames.
+ browser.addProgressListener(new ProgressListener() {
- @Override
+ @Override
public void changed(ProgressEvent event) {
- // no-op
- }
+ // no-op
+ }
- @Override
+ @Override
public void completed(ProgressEvent event) {
- urlListener.flagEndOfNavigation();
- urlListener.flagEndOfFrameNavigation();
- urlListener.flagRemovedTempUrl();
- if (!getModel().isDynamic())
- updateNavigationActionsState();
- }
- });
-
- // Enable IE pop-up menu only in debug mode.
- browser.addListener(SWT.MenuDetect, event -> {
- if (IntroPlugin.getDefault().isDebugging())
- event.doit = true;
- else
- event.doit = false;
+ urlListener.flagEndOfNavigation();
+ urlListener.flagEndOfFrameNavigation();
+ urlListener.flagRemovedTempUrl();
+ if (!getModel().isDynamic())
+ updateNavigationActionsState();
+ }
});
- // if we are logging performance, log actual UI creation time for
- // browser.
- if (Log.logPerformance)
- Util.logPerformanceTime("creating a new Browser() took:", start); //$NON-NLS-1$
-
- addToolBarActions();
-
- if (!getModel().hasValidConfig()) {
- browser.setText(Messages.Browser_invalidConfig);
- return;
- }
-
- // root page is what decides if the model is dynamic or not.
- if (getModel().isDynamic())
- handleDynamicIntro();
- else
- handleStaticIntro();
- }
-
-
-
- private void handleDynamicIntro() {
- AbstractIntroPage homePage = getModel().getHomePage();
- // check cache state, and populate url page if needed.
- String cachedPage = getCachedCurrentPage();
- if (cachedPage != null) {
- // we have a cached state. handle appropriately
- if (History.isURL(cachedPage)) {
- // set the URL the browser should display
- boolean success = browser.setUrl(cachedPage);
- if (!success) {
- Log.error("Unable to set the following ULR in browser: " //$NON-NLS-1$
- + cachedPage, null);
- return;
- }
- history.updateHistory(cachedPage);
- } else {
- // Generate HTML for the cached page, and set it on the browser.
- getModel().setCurrentPageId(cachedPage, false);
- // generateDynamicContentForPage(getModel().getCurrentPage());
- history.updateHistory(getModel().getCurrentPage());
- }
-
- } else {
- // No cached page. Generate HTML for the home page, and set it
- // on the browser.
- // generateDynamicContentForPage(homePage);
- history.updateHistory(homePage);
- }
- // INTRO: all setText calls above are commented out because calling
- // setText twice causes problems. revisit when swt bug is fixed.
-
- // Add this presentation as a listener to model
- // only in dynamic case, for now.
- getModel().addPropertyListener(this);
- }
-
-
- /**
- * Generate dynamic HTML for the provided page, and set it in the browser
- * widget. A cache is used for performance and for having a correct dynamic
- * content life cycle. This method also updates the navigation history.
- *
- * @param page
- * the page to generate HTML for
- */
- private boolean generateContentForPage(AbstractIntroPage page) {
- String content = null;
- if (!page.isDynamic()) {
- browser.setUrl(page.getUrl());
- return true;
- }
-
- if (page.isXHTMLPage())
- content = generateXHTMLPage(page, this);
- else {
- HTMLElement html = getHTMLGenerator().generateHTMLforPage(page,
- this);
- if (html != null) {
- IntroModelRoot root = getModel();
- if (root!=null) {
- IntroTheme theme = root.getTheme();
+ // Enable IE pop-up menu only in debug mode.
+ browser.addListener(SWT.MenuDetect, event -> {
+ if (IntroPlugin.getDefault().isDebugging())
+ event.doit = true;
+ else
+ event.doit = false;
+ });
+
+ // if we are logging performance, log actual UI creation time for
+ // browser.
+ if (Log.logPerformance)
+ Util.logPerformanceTime("creating a new Browser() took:", start); //$NON-NLS-1$
+
+ addToolBarActions();
+
+ if (!getModel().hasValidConfig()) {
+ browser.setText(Messages.Browser_invalidConfig);
+ return;
+ }
+
+ // root page is what decides if the model is dynamic or not.
+ if (getModel().isDynamic())
+ handleDynamicIntro();
+ else
+ handleStaticIntro();
+ }
+
+
+
+ private void handleDynamicIntro() {
+ AbstractIntroPage homePage = getModel().getHomePage();
+ // check cache state, and populate url page if needed.
+ String cachedPage = getCachedCurrentPage();
+ if (cachedPage != null) {
+ // we have a cached state. handle appropriately
+ if (History.isURL(cachedPage)) {
+ // set the URL the browser should display
+ boolean success = browser.setUrl(cachedPage);
+ if (!success) {
+ Log.error("Unable to set the following ULR in browser: " //$NON-NLS-1$
+ + cachedPage, null);
+ return;
+ }
+ history.updateHistory(cachedPage);
+ } else {
+ // Generate HTML for the cached page, and set it on the browser.
+ getModel().setCurrentPageId(cachedPage, false);
+ // generateDynamicContentForPage(getModel().getCurrentPage());
+ history.updateHistory(getModel().getCurrentPage());
+ }
+
+ } else {
+ // No cached page. Generate HTML for the home page, and set it
+ // on the browser.
+ // generateDynamicContentForPage(homePage);
+ history.updateHistory(homePage);
+ }
+ // INTRO: all setText calls above are commented out because calling
+ // setText twice causes problems. revisit when swt bug is fixed.
+
+ // Add this presentation as a listener to model
+ // only in dynamic case, for now.
+ getModel().addPropertyListener(this);
+ }
+
+
+ /**
+ * Generate dynamic HTML for the provided page, and set it in the browser
+ * widget. A cache is used for performance and for having a correct dynamic
+ * content life cycle. This method also updates the navigation history.
+ *
+ * @param page
+ * the page to generate HTML for
+ */
+ private boolean generateContentForPage(AbstractIntroPage page) {
+ String content = null;
+ if (!page.isDynamic()) {
+ browser.setUrl(page.getUrl());
+ return true;
+ }
+
+ if (page.isXHTMLPage())
+ content = generateXHTMLPage(page, this);
+ else {
+ HTMLElement html = getHTMLGenerator().generateHTMLforPage(page,
+ this);
+ if (html != null) {
+ IntroModelRoot root = getModel();
+ if (root!=null) {
+ IntroTheme theme = root.getTheme();
Map props = theme!=null?theme.getProperties():null;
- if (props!=null) {
- String value = (String)props.get("standardSupport"); //$NON-NLS-1$
- String doctype=null;
+ if (props!=null) {
+ String value = (String)props.get("standardSupport"); //$NON-NLS-1$
+ String doctype=null;
if ("html5".equalsIgnoreCase(value)) //$NON-NLS-1$
doctype = "<!DOCTYPE html>\n"; //$NON-NLS-1$
else if ("strict".equalsIgnoreCase(value)) //$NON-NLS-1$
- doctype = generateDoctype(true);
- else if ("loose".equalsIgnoreCase(value)) //$NON-NLS-1$
- doctype = generateDoctype(false);
- if (doctype!=null)
- content = doctype+html.toString();
- }
- }
- if (content==null)
- content = html.toString();
- }
- }
-
- if (content == null) {
- // there was an error generating the html. log an error
- Log.error("Error generating HTML content for page", null); //$NON-NLS-1$
- return false;
- }
-
- // set the browser's HTML.
- boolean success = false;
- if (browser != null) {
- long start = 0;
- if (Log.logPerformance)
- start = System.currentTimeMillis();
- browser.addLocationListener(new LocationAdapter() {
- @Override
+ doctype = generateDoctype(true);
+ else if ("loose".equalsIgnoreCase(value)) //$NON-NLS-1$
+ doctype = generateDoctype(false);
+ if (doctype!=null)
+ content = doctype+html.toString();
+ }
+ }
+ if (content==null)
+ content = html.toString();
+ }
+ }
+
+ if (content == null) {
+ // there was an error generating the html. log an error
+ Log.error("Error generating HTML content for page", null); //$NON-NLS-1$
+ return false;
+ }
+
+ // set the browser's HTML.
+ boolean success = false;
+ if (browser != null) {
+ long start = 0;
+ if (Log.logPerformance)
+ start = System.currentTimeMillis();
+ browser.addLocationListener(new LocationAdapter() {
+ @Override
public void changed(LocationEvent event) {
- if (event.top) {
- isFinishedLoading = true;
- }
- }
- });
- success = browser.setText(content);
- if (Log.logPerformance)
- Util
- .logPerformanceTime("setText() on the browser took:", start); //$NON-NLS-1$
-
- if (!success)
- Log.error("Unable to set HTML on the browser", null); //$NON-NLS-1$
- }
-
-
- // print the HTML if we are in debug mode and have tracing turned on
- if (IntroPlugin.getDefault().isDebugging()) {
- String printHtml = Platform
- .getDebugOption("org.eclipse.ui.intro/trace/printHTML"); //$NON-NLS-1$
- if (printHtml != null && printHtml.equalsIgnoreCase("true")) { //$NON-NLS-1$
- System.out.println(content);
- }
- if (IntroPlugin.DEBUG_TOOLBAR) {
- savedContent = content;
- }
-
- }
- return success;
- }
-
- /**
- * Generate an XHTML page as a string.
- * <ul>
- * <li> Create any dynamic content providers, if there are any. We do this
- * by replacing each content provider with a div with the same id. The div
- * is the parent of the dynamic content.</li>
- * <li>Use xslt to flatten the DOM for the page, and create a string.</li>
- * <li>Re-inject the contentProviders into the DOM to recreate the original
- * state of the DOM. DOM could not have been cloned since cloning a DOM
- * removes the docType.</li>
- * </ul>
- * Note: Resolving dynamic content is done at the UI level, consistant with
- * SWT presentation.
- */
- public String generateXHTMLPage(AbstractIntroPage page,
- IIntroContentProviderSite site) {
- // get/cache all content provider elements in DOM.
- Document dom = page.getResolvedDocument();
- NodeList nodes = dom.getElementsByTagNameNS("*", //$NON-NLS-1$
- IntroContentProvider.TAG_CONTENT_PROVIDER);
- // get the array version of the nodelist to work around DOM api design.
- Node[] contentProviderElements = ModelUtil.getArray(nodes);
-
- // this modifies the DOM.
- resolveDynamicContent(page, site);
- String content = IntroContentParser.convertToString(dom);
-
- // this restores the DOM to its original state.
- reinjectDynamicContent(dom, contentProviderElements);
- return content;
- }
-
- private String generateDoctype(boolean strict) {
- StringWriter swriter = new StringWriter();
+ if (event.top) {
+ isFinishedLoading = true;
+ }
+ }
+ });
+ success = browser.setText(content);
+ if (Log.logPerformance)
+ Util
+ .logPerformanceTime("setText() on the browser took:", start); //$NON-NLS-1$
+
+ if (!success)
+ Log.error("Unable to set HTML on the browser", null); //$NON-NLS-1$
+ }
+
+
+ // print the HTML if we are in debug mode and have tracing turned on
+ if (IntroPlugin.getDefault().isDebugging()) {
+ String printHtml = Platform
+ .getDebugOption("org.eclipse.ui.intro/trace/printHTML"); //$NON-NLS-1$
+ if (printHtml != null && printHtml.equalsIgnoreCase("true")) { //$NON-NLS-1$
+ System.out.println(content);
+ }
+ if (IntroPlugin.DEBUG_TOOLBAR) {
+ savedContent = content;
+ }
+
+ }
+ return success;
+ }
+
+ /**
+ * Generate an XHTML page as a string.
+ * <ul>
+ * <li> Create any dynamic content providers, if there are any. We do this
+ * by replacing each content provider with a div with the same id. The div
+ * is the parent of the dynamic content.</li>
+ * <li>Use xslt to flatten the DOM for the page, and create a string.</li>
+ * <li>Re-inject the contentProviders into the DOM to recreate the original
+ * state of the DOM. DOM could not have been cloned since cloning a DOM
+ * removes the docType.</li>
+ * </ul>
+ * Note: Resolving dynamic content is done at the UI level, consistant with
+ * SWT presentation.
+ */
+ public String generateXHTMLPage(AbstractIntroPage page,
+ IIntroContentProviderSite site) {
+ // get/cache all content provider elements in DOM.
+ Document dom = page.getResolvedDocument();
+ NodeList nodes = dom.getElementsByTagNameNS("*", //$NON-NLS-1$
+ IntroContentProvider.TAG_CONTENT_PROVIDER);
+ // get the array version of the nodelist to work around DOM api design.
+ Node[] contentProviderElements = ModelUtil.getArray(nodes);
+
+ // this modifies the DOM.
+ resolveDynamicContent(page, site);
+ String content = IntroContentParser.convertToString(dom);
+
+ // this restores the DOM to its original state.
+ reinjectDynamicContent(dom, contentProviderElements);
+ return content;
+ }
+
+ private String generateDoctype(boolean strict) {
+ StringWriter swriter = new StringWriter();
try (PrintWriter writer = new PrintWriter(swriter)) {
if (strict) {
writer.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\""); //$NON-NLS-1$
@@ -436,395 +436,395 @@ public class BrowserIntroPartImplementation extends
writer.println("\t\t\t\"http://www.w3.org/TR/html4/loose.dtd\">"); //$NON-NLS-1$
}
}
- return swriter.toString();
- }
-
- /**
- * Resolve the dynamic content in the page. Resolving dynamic content will
- * alter the original page DOM. Dynamic content tags are removed once
- * resolved to have clean xhtml.
- */
- private Document resolveDynamicContent(AbstractIntroPage page,
- IIntroContentProviderSite site) {
- Document dom = page.getResolvedDocument();
-
- // get all content provider elements in DOM.
- NodeList contentProviders = dom.getElementsByTagNameNS("*", //$NON-NLS-1$
- IntroContentProvider.TAG_CONTENT_PROVIDER);
-
- // get the array version of the nodelist to work around DOM api design.
- Node[] nodes = ModelUtil.getArray(contentProviders);
- for (int i = 0; i < nodes.length; i++) {
- Element contentProviderElement = (Element) nodes[i];
- IntroContentProvider provider = new IntroContentProvider(
- contentProviderElement, page.getBundle());
- provider.setParent(page);
- // If we've already loaded the content provider for this element,
- // retrieve it, otherwise load the class.
- IIntroXHTMLContentProvider providerClass = (IIntroXHTMLContentProvider) ContentProviderManager
- .getInst().getContentProvider(provider);
- if (providerClass == null)
- // content provider never created before, create it.
- providerClass = (IIntroXHTMLContentProvider) ContentProviderManager
- .getInst().createContentProvider(provider, site);
-
- if (providerClass != null) {
- // create a div with the same id as the contentProvider, pass it
- // as the parent to create the specialized content, and then
- // replace the contentProvider element with this div.
- Properties att = new Properties();
- att.setProperty(IIntroHTMLConstants.ATTRIBUTE_ID, provider
- .getId());
- Element contentDiv = ModelUtil.createElement(dom,
- ModelUtil.TAG_DIV, att);
- providerClass.createContent(provider.getId(), contentDiv);
-
- contentProviderElement.getParentNode().replaceChild(contentDiv,
- contentProviderElement);
- } else {
- // we couldn't load the content provider, so add any alternate
- // text content if there is any.
- // INTRO: do it. 3.0 intro content style uses text element as
- // alt text. We can load XHTML content here.
- }
- }
- return dom;
- }
-
-
- private void reinjectDynamicContent(Document dom,
- Node[] contentProviderElements) {
- for (int i = 0; i < contentProviderElements.length; i++) {
- // for each cached contentProvider, find replacement div in DOM and
- // re-subsitute.
- Element contentProviderElement = (Element) contentProviderElements[i];
- Element contentProviderDiv = ModelUtil.getElementById(dom,
- contentProviderElement
- .getAttribute(IIntroHTMLConstants.ATTRIBUTE_ID),
- ModelUtil.TAG_DIV);
- contentProviderDiv.getParentNode().replaceChild(
- contentProviderElement, contentProviderDiv);
- }
- }
-
-
-
- /**
- * Return the cached IntroHTMLGenerator
- *
- * @return
- */
- private IntroHTMLGenerator getHTMLGenerator() {
- if (htmlGenerator == null)
- htmlGenerator = new IntroHTMLGenerator();
-
- return htmlGenerator;
- }
-
- @Override
+ return swriter.toString();
+ }
+
+ /**
+ * Resolve the dynamic content in the page. Resolving dynamic content will
+ * alter the original page DOM. Dynamic content tags are removed once
+ * resolved to have clean xhtml.
+ */
+ private Document resolveDynamicContent(AbstractIntroPage page,
+ IIntroContentProviderSite site) {
+ Document dom = page.getResolvedDocument();
+
+ // get all content provider elements in DOM.
+ NodeList contentProviders = dom.getElementsByTagNameNS("*", //$NON-NLS-1$
+ IntroContentProvider.TAG_CONTENT_PROVIDER);
+
+ // get the array version of the nodelist to work around DOM api design.
+ Node[] nodes = ModelUtil.getArray(contentProviders);
+ for (int i = 0; i < nodes.length; i++) {
+ Element contentProviderElement = (Element) nodes[i];
+ IntroContentProvider provider = new IntroContentProvider(
+ contentProviderElement, page.getBundle());
+ provider.setParent(page);
+ // If we've already loaded the content provider for this element,
+ // retrieve it, otherwise load the class.
+ IIntroXHTMLContentProvider providerClass = (IIntroXHTMLContentProvider) ContentProviderManager
+ .getInst().getContentProvider(provider);
+ if (providerClass == null)
+ // content provider never created before, create it.
+ providerClass = (IIntroXHTMLContentProvider) ContentProviderManager
+ .getInst().createContentProvider(provider, site);
+
+ if (providerClass != null) {
+ // create a div with the same id as the contentProvider, pass it
+ // as the parent to create the specialized content, and then
+ // replace the contentProvider element with this div.
+ Properties att = new Properties();
+ att.setProperty(IIntroHTMLConstants.ATTRIBUTE_ID, provider
+ .getId());
+ Element contentDiv = ModelUtil.createElement(dom,
+ ModelUtil.TAG_DIV, att);
+ providerClass.createContent(provider.getId(), contentDiv);
+
+ contentProviderElement.getParentNode().replaceChild(contentDiv,
+ contentProviderElement);
+ } else {
+ // we couldn't load the content provider, so add any alternate
+ // text content if there is any.
+ // INTRO: do it. 3.0 intro content style uses text element as
+ // alt text. We can load XHTML content here.
+ }
+ }
+ return dom;
+ }
+
+
+ private void reinjectDynamicContent(Document dom,
+ Node[] contentProviderElements) {
+ for (int i = 0; i < contentProviderElements.length; i++) {
+ // for each cached contentProvider, find replacement div in DOM and
+ // re-subsitute.
+ Element contentProviderElement = (Element) contentProviderElements[i];
+ Element contentProviderDiv = ModelUtil.getElementById(dom,
+ contentProviderElement
+ .getAttribute(IIntroHTMLConstants.ATTRIBUTE_ID),
+ ModelUtil.TAG_DIV);
+ contentProviderDiv.getParentNode().replaceChild(
+ contentProviderElement, contentProviderDiv);
+ }
+ }
+
+
+
+ /**
+ * Return the cached IntroHTMLGenerator
+ *
+ * @return
+ */
+ private IntroHTMLGenerator getHTMLGenerator() {
+ if (htmlGenerator == null)
+ htmlGenerator = new IntroHTMLGenerator();
+
+ return htmlGenerator;
+ }
+
+ @Override
protected void addToolBarActions() {
- // Handle menus:
- IActionBars actionBars = getIntroPart().getIntroSite().getActionBars();
- IToolBarManager toolBarManager = actionBars.getToolBarManager();
- actionBars.setGlobalActionHandler(ActionFactory.FORWARD.getId(),
- forwardAction);
- actionBars.setGlobalActionHandler(ActionFactory.BACK.getId(),
- backAction);
- if (IntroPlugin.DEBUG_TOOLBAR) {
- toolBarManager.add(viewIntroModelAction);
- toolBarManager.add(openBrowserAction);
- }
- toolBarManager.add(new Separator(IntroConfigurer.TB_ADDITIONS));
- toolBarManager.add(homeAction);
- toolBarManager.add(backAction);
- toolBarManager.add(forwardAction);
- toolBarManager.update(true);
- IntroTheme theme = getModel().getTheme();
- boolean createZoomButtons = theme != null && theme.isScalable() && !resizeActionsAdded
- &&FontSelection.FONT_RELATIVE.equals(FontSelection.getFontStyle());
- if (createZoomButtons) {
- toolBarManager.add(new ReduceAction());
- toolBarManager.add(new MagnifyAction());
- }
- actionBars.updateActionBars();
- updateNavigationActionsState();
- }
-
- public void dynamicStandbyStateChanged(boolean standby,
- boolean isStandbyPartNeeded) {
-
- if (isStandbyPartNeeded)
- // we have a standby part, nothing more to do in presentation.
- return;
-
- if (history.currentLocationIsUrl())
- // last page disaplyed was a url. It is already set in the browser
- // and stored in history. Nothing more to do.
- return;
-
-
-
- // presentation is shown here. toggle standby page. No need to update
- // history here.
- IntroModelRoot model = getModel();
+ // Handle menus:
+ IActionBars actionBars = getIntroPart().getIntroSite().getActionBars();
+ IToolBarManager toolBarManager = actionBars.getToolBarManager();
+ actionBars.setGlobalActionHandler(ActionFactory.FORWARD.getId(),
+ forwardAction);
+ actionBars.setGlobalActionHandler(ActionFactory.BACK.getId(),
+ backAction);
+ if (IntroPlugin.DEBUG_TOOLBAR) {
+ toolBarManager.add(viewIntroModelAction);
+ toolBarManager.add(openBrowserAction);
+ }
+ toolBarManager.add(new Separator(IntroConfigurer.TB_ADDITIONS));
+ toolBarManager.add(homeAction);
+ toolBarManager.add(backAction);
+ toolBarManager.add(forwardAction);
+ toolBarManager.update(true);
+ IntroTheme theme = getModel().getTheme();
+ boolean createZoomButtons = theme != null && theme.isScalable() && !resizeActionsAdded
+ &&FontSelection.FONT_RELATIVE.equals(FontSelection.getFontStyle());
+ if (createZoomButtons) {
+ toolBarManager.add(new ReduceAction());
+ toolBarManager.add(new MagnifyAction());
+ }
+ actionBars.updateActionBars();
+ updateNavigationActionsState();
+ }
+
+ public void dynamicStandbyStateChanged(boolean standby,
+ boolean isStandbyPartNeeded) {
+
+ if (isStandbyPartNeeded)
+ // we have a standby part, nothing more to do in presentation.
+ return;
+
+ if (history.currentLocationIsUrl())
+ // last page disaplyed was a url. It is already set in the browser
+ // and stored in history. Nothing more to do.
+ return;
+
+
+
+ // presentation is shown here. toggle standby page. No need to update
+ // history here.
+ IntroModelRoot model = getModel();
AbstractIntroPage homePage = model.getHomePage();
- AbstractIntroPage standbyPage = model.getStandbyPage();
- if (standbyPage == null)
- standbyPage = homePage;
-
- if (standby) {
- generateContentForPage(standbyPage);
- } else {
- // REVISIT: If cached page is the standby page and we are not
- // initially in standby mode, it means standby was forced on
- // intro view on close. react.
- AbstractIntroPage currentPage = model.getCurrentPage();
+ AbstractIntroPage standbyPage = model.getStandbyPage();
+ if (standbyPage == null)
+ standbyPage = homePage;
+
+ if (standby) {
+ generateContentForPage(standbyPage);
+ } else {
+ // REVISIT: If cached page is the standby page and we are not
+ // initially in standby mode, it means standby was forced on
+ // intro view on close. react.
+ AbstractIntroPage currentPage = model.getCurrentPage();
if (currentPage == null || standbyPage.getId().equals(currentPage)) {
- model.setCurrentPageId(model.getHomePage().getId());
+ model.setCurrentPageId(model.getHomePage().getId());
}
- generateContentForPage(currentPage);
- }
- }
+ generateContentForPage(currentPage);
+ }
+ }
- /**
- * Handle model property changes. Property listeners are only added in the
- * dynamic case.
- *
- * @see org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.Object,
- * int)
- */
- @Override
+ /**
+ * Handle model property changes. Property listeners are only added in the
+ * dynamic case.
+ *
+ * @see org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.Object,
+ * int)
+ */
+ @Override
public void propertyChanged(Object source, int propId) {
- if (propId == IntroModelRoot.CURRENT_PAGE_PROPERTY_ID) {
- String pageId = getModel().getCurrentPageId();
- if (pageId == null || pageId.equals("")) //$NON-NLS-1$
- // page ID was not set properly. exit.
- return;
- // update the presentation's content based on the model changes
- updateContent();
- }
- }
-
- @Override
+ if (propId == IntroModelRoot.CURRENT_PAGE_PROPERTY_ID) {
+ String pageId = getModel().getCurrentPageId();
+ if (pageId == null || pageId.equals("")) //$NON-NLS-1$
+ // page ID was not set properly. exit.
+ return;
+ // update the presentation's content based on the model changes
+ updateContent();
+ }
+ }
+
+ @Override
public void setFocus() {
- browser.setFocus();
- }
+ browser.setFocus();
+ }
- @Override
+ @Override
public void dispose() {
- browser.dispose();
- }
+ browser.dispose();
+ }
- /**
- * Regenerate the dynamic content for the current page
- */
- protected void updateContent() {
- generateContentForPage(getModel().getCurrentPage());
- }
+ /**
+ * Regenerate the dynamic content for the current page
+ */
+ protected void updateContent() {
+ generateContentForPage(getModel().getCurrentPage());
+ }
- @Override
+ @Override
public void reflow(IIntroContentProvider provider, boolean incremental) {
- updateContent();
- }
-
- /**
- * Override parent behavior to handle the case when we have a static page.
- * This can happen in both the static intro case, or in the dynamic when the
- * last visited page is the dynamic browser is an http: page, and not an
- * intro page.
- */
- @Override
+ updateContent();
+ }
+
+ /**
+ * Override parent behavior to handle the case when we have a static page.
+ * This can happen in both the static intro case, or in the dynamic when the
+ * last visited page is the dynamic browser is an http: page, and not an
+ * intro page.
+ */
+ @Override
protected void saveCurrentPage(IMemento memento) {
- if (memento == null)
- return;
- // Handle the case where we are on a static page.
- // browser.getURL() returns the empty string if there is no current URL
- // and returns "about:blank" if we are on a dynamic page
- if (browser != null && browser.getUrl() != null
- && browser.getUrl().length() > 0
- && !(browser.getUrl().equals("about:blank")) //$NON-NLS-1$
- && !(browser.getUrl().equals("file:///"))) { //$NON-NLS-1$
-
- String currentURL = browser.getUrl();
- if (currentURL != null) {
- memento.putString(IIntroConstants.MEMENTO_CURRENT_PAGE_ATT,
- currentURL);
- }
- } else {
- super.saveCurrentPage(memento);
- }
- }
-
-
- @Override
+ if (memento == null)
+ return;
+ // Handle the case where we are on a static page.
+ // browser.getURL() returns the empty string if there is no current URL
+ // and returns "about:blank" if we are on a dynamic page
+ if (browser != null && browser.getUrl() != null
+ && browser.getUrl().length() > 0
+ && !(browser.getUrl().equals("about:blank")) //$NON-NLS-1$
+ && !(browser.getUrl().equals("file:///"))) { //$NON-NLS-1$
+
+ String currentURL = browser.getUrl();
+ if (currentURL != null) {
+ memento.putString(IIntroConstants.MEMENTO_CURRENT_PAGE_ATT,
+ currentURL);
+ }
+ } else {
+ super.saveCurrentPage(memento);
+ }
+ }
+
+
+ @Override
public boolean navigateBackward() {
- boolean success = false;
- if (getModel().isDynamic()) {
- // dynamic case. Uses navigation history.
- if (history.canNavigateBackward()) {
- history.navigateHistoryBackward();
- // guard against unnecessary History updates.
- urlListener.flagStartOfNavigation();
- if (history.currentLocationIsUrl()) {
- success = browser.setUrl(history.getCurrentLocationAsUrl());
- } else {
- // we need to regen HTML. We can not use setting current
- // page to trigger regen for one case: navigating back from
- // a url will not trigger regen since current page would be
- // the same.
- AbstractIntroPage page = history.getCurrentLocationAsPage();
- getModel().setCurrentPageId(page.getId(), false);
- success = generateContentForPage(page);
- }
- } else
- success = false;
- // update history only in dynamic case.
- updateNavigationActionsState();
- } else
- // static HTML case. use browser real Back.
- success = browser.back();
-
- return success;
- }
-
-
- @Override
+ boolean success = false;
+ if (getModel().isDynamic()) {
+ // dynamic case. Uses navigation history.
+ if (history.canNavigateBackward()) {
+ history.navigateHistoryBackward();
+ // guard against unnecessary History updates.
+ urlListener.flagStartOfNavigation();
+ if (history.currentLocationIsUrl()) {
+ success = browser.setUrl(history.getCurrentLocationAsUrl());
+ } else {
+ // we need to regen HTML. We can not use setting current
+ // page to trigger regen for one case: navigating back from
+ // a url will not trigger regen since current page would be
+ // the same.
+ AbstractIntroPage page = history.getCurrentLocationAsPage();
+ getModel().setCurrentPageId(page.getId(), false);
+ success = generateContentForPage(page);
+ }
+ } else
+ success = false;
+ // update history only in dynamic case.
+ updateNavigationActionsState();
+ } else
+ // static HTML case. use browser real Back.
+ success = browser.back();
+
+ return success;
+ }
+
+
+ @Override
public boolean navigateForward() {
- boolean success = false;
- if (getModel().isDynamic()) {
- // dynamic case. Uses navigation history.
- if (history.canNavigateForward()) {
- history.navigateHistoryForward();
- // guard against unnecessary History updates.
- urlListener.flagStartOfNavigation();
- if (history.currentLocationIsUrl()) {
- success = browser.setUrl(history.getCurrentLocationAsUrl());
- } else {
- AbstractIntroPage page = history.getCurrentLocationAsPage();
- getModel().setCurrentPageId(page.getId(), false);
- success = generateContentForPage(page);
- }
- } else
- success = false;
- // update history only in dynamic case.
- updateNavigationActionsState();
- } else
- // static HTML case. use browser real Forward.
- success = browser.forward();
-
- return success;
- }
-
- @Override
+ boolean success = false;
+ if (getModel().isDynamic()) {
+ // dynamic case. Uses navigation history.
+ if (history.canNavigateForward()) {
+ history.navigateHistoryForward();
+ // guard against unnecessary History updates.
+ urlListener.flagStartOfNavigation();
+ if (history.currentLocationIsUrl()) {
+ success = browser.setUrl(history.getCurrentLocationAsUrl());
+ } else {
+ AbstractIntroPage page = history.getCurrentLocationAsPage();
+ getModel().setCurrentPageId(page.getId(), false);
+ success = generateContentForPage(page);
+ }
+ } else
+ success = false;
+ // update history only in dynamic case.
+ updateNavigationActionsState();
+ } else
+ // static HTML case. use browser real Forward.
+ success = browser.forward();
+
+ return success;
+ }
+
+ @Override
public boolean navigateHome() {
- // Home is URL of root page in static case, and root page in
- // dynamic.
- AbstractIntroPage rootPage = getModel().getHomePage();
- boolean success = false;
- if (getModel().isDynamic()) {
- // special case for when workbench is started with a cached URL. We
- // set the url in the browser, but current page is Home Page, and so
- // setting the root page will not fire an event. So, force a
- // generation
- // of root page.
- if (history.currentLocationIsUrl())
- generateContentForPage(rootPage);
-
- success = getModel().setCurrentPageId(rootPage.getId());
- updateHistory(rootPage);
-
- } else {
- String location = rootPage.getUrl();
- success = browser.setUrl(location);
- updateHistory(location);
- }
-
- return success;
- }
-
- @Override
+ // Home is URL of root page in static case, and root page in
+ // dynamic.
+ AbstractIntroPage rootPage = getModel().getHomePage();
+ boolean success = false;
+ if (getModel().isDynamic()) {
+ // special case for when workbench is started with a cached URL. We
+ // set the url in the browser, but current page is Home Page, and so
+ // setting the root page will not fire an event. So, force a
+ // generation
+ // of root page.
+ if (history.currentLocationIsUrl())
+ generateContentForPage(rootPage);
+
+ success = getModel().setCurrentPageId(rootPage.getId());
+ updateHistory(rootPage);
+
+ } else {
+ String location = rootPage.getUrl();
+ success = browser.setUrl(location);
+ updateHistory(location);
+ }
+
+ return success;
+ }
+
+ @Override
protected void handleRegistryChanged(IRegistryChangeEvent event) {
- if (getModel().isDynamic()) {
- // null generator first.
- htmlGenerator = null;
- // Add this presentation as a listener to model only in dynamic
- // case.
- getModel().addPropertyListener(this);
- getModel().firePropertyChange(
- IntroModelRoot.CURRENT_PAGE_PROPERTY_ID);
- }
- }
-
-
- @Override
+ if (getModel().isDynamic()) {
+ // null generator first.
+ htmlGenerator = null;
+ // Add this presentation as a listener to model only in dynamic
+ // case.
+ getModel().addPropertyListener(this);
+ getModel().firePropertyChange(
+ IntroModelRoot.CURRENT_PAGE_PROPERTY_ID);
+ }
+ }
+
+
+ @Override
protected void doStandbyStateChanged(boolean standby,
- boolean isStandbyPartNeeded) {
- // if we have a standby part, regardless if standby state, disable
- // actions. Same behavior for static html.
- if (isStandbyPartNeeded | standby) {
- homeAction.setEnabled(false);
- forwardAction.setEnabled(false);
- backAction.setEnabled(false);
- } else {
- homeAction.setEnabled(true);
- updateNavigationActionsState();
- }
-
- if (getModel().isDynamic())
- dynamicStandbyStateChanged(standby, isStandbyPartNeeded);
- else
- staticStandbyStateChanged(standby);
- }
-
-
-
- // ***************** Static Intro *****************
- private void handleStaticIntro() {
- // We have a static case. Set the url on the browser to be the url
- // defined in the root page. But first check memento if we can
- // restore last visited page.
- String url = getCachedCurrentPage();
- if (!History.isURL(url))
- // no cached state, or invalid state.
- url = getModel().getHomePage().getUrl();
-
- if (url == null) {
- // We have no content to display. log an error
- Log.error("Url is null; no content to display in browser", null); //$NON-NLS-1$
- return;
- }
- // set the URL the browser should display
- boolean success = browser.setUrl(url);
- if (!success) {
- Log.error("Unable to set the following ULR in browser: " + url, //$NON-NLS-1$
- null);
- return;
- }
- }
-
- public void staticStandbyStateChanged(boolean standby) {
- AbstractIntroPage homePage = getModel().getHomePage();
- AbstractIntroPage standbyPage = getModel().getStandbyPage();
- if (standbyPage == null)
- standbyPage = homePage;
-
- if (standby)
- browser.setUrl(standbyPage.getUrl());
- else
- browser.setUrl(homePage.getUrl());
- }
-
-
- public Browser getBrowser() {
- return browser;
- }
-
- /*
- * Internal performance test hook.
- */
- public boolean isFinishedLoading() {
- return isFinishedLoading;
- }
+ boolean isStandbyPartNeeded) {
+ // if we have a standby part, regardless if standby state, disable
+ // actions. Same behavior for static html.
+ if (isStandbyPartNeeded | standby) {
+ homeAction.setEnabled(false);
+ forwardAction.setEnabled(false);
+ backAction.setEnabled(false);
+ } else {
+ homeAction.setEnabled(true);
+ updateNavigationActionsState();
+ }
+
+ if (getModel().isDynamic())
+ dynamicStandbyStateChanged(standby, isStandbyPartNeeded);
+ else
+ staticStandbyStateChanged(standby);
+ }
+
+
+
+ // ***************** Static Intro *****************
+ private void handleStaticIntro() {
+ // We have a static case. Set the url on the browser to be the url
+ // defined in the root page. But first check memento if we can
+ // restore last visited page.
+ String url = getCachedCurrentPage();
+ if (!History.isURL(url))
+ // no cached state, or invalid state.
+ url = getModel().getHomePage().getUrl();
+
+ if (url == null) {
+ // We have no content to display. log an error
+ Log.error("Url is null; no content to display in browser", null); //$NON-NLS-1$
+ return;
+ }
+ // set the URL the browser should display
+ boolean success = browser.setUrl(url);
+ if (!success) {
+ Log.error("Unable to set the following ULR in browser: " + url, //$NON-NLS-1$
+ null);
+ return;
+ }
+ }
+
+ public void staticStandbyStateChanged(boolean standby) {
+ AbstractIntroPage homePage = getModel().getHomePage();
+ AbstractIntroPage standbyPage = getModel().getStandbyPage();
+ if (standbyPage == null)
+ standbyPage = homePage;
+
+ if (standby)
+ browser.setUrl(standbyPage.getUrl());
+ else
+ browser.setUrl(homePage.getUrl());
+ }
+
+
+ public Browser getBrowser() {
+ return browser;
+ }
+
+ /*
+ * Internal performance test hook.
+ */
+ public boolean isFinishedLoading() {
+ return isFinishedLoading;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartLocationListener.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartLocationListener.java
index 1448cdd50..0afa75b9f 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartLocationListener.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/BrowserIntroPartLocationListener.java
@@ -27,155 +27,155 @@ import org.eclipse.ui.internal.intro.impl.model.url.IntroURLParser;
*/
public class BrowserIntroPartLocationListener implements LocationListener {
- private BrowserIntroPartImplementation implementation;
+ private BrowserIntroPartImplementation implementation;
- /**
- * Takes the implementation as an input.
- */
- public BrowserIntroPartLocationListener(
- BrowserIntroPartImplementation implementation) {
- this.implementation = implementation;
- }
+ /**
+ * Takes the implementation as an input.
+ */
+ public BrowserIntroPartLocationListener(
+ BrowserIntroPartImplementation implementation) {
+ this.implementation = implementation;
+ }
- @Override
+ @Override
public void changed(LocationEvent event) {
- String url = event.location;
- if (url == null)
- return;
-
- // guard against unnecessary History updates.
- Browser browser = (Browser) event.getSource();
- if (browser.getData("navigation") != null //$NON-NLS-1$
- && browser.getData("navigation").equals("true")) //$NON-NLS-1$ //$NON-NLS-2$
- return;
-
- IntroModelRoot model = implementation.getModel();
- IntroURLParser parser = new IntroURLParser(url);
- if (!parser.hasProtocol() || parser.getHost() == null
- || parser.getHost().equals("")) //$NON-NLS-1$
- // This will filter out two navigation events fired by the browser
- // on a setText. (about:blank and
- // res://C:\WINDOWS\System32\shdoclc.dll/navcancl.htm on windows,
- // and file:/// on Linux)
- return;
-
- if (model.isDynamic()) {
- // Update the history even with real URLs. Note that if we have
- // multiple embedded URL navigations due to frames, the
- // frameNavigation flag filters them. This flag is set here, and is
- // cleared by a progress listener, when all the frame navigation is
- // completed. We need to update history only in dynamic case. In
- // static case, the browser keeps the history.
- if (browser.getData("frameNavigation") != null) { //$NON-NLS-1$
- // this is at least the second frame navigation, remove last
- // history since it was added just as a filler.
- if (event.top == false && browser.getData("tempUrl") != null //$NON-NLS-1$
- && browser.getData("tempUrl").equals("true")) { //$NON-NLS-1$ //$NON-NLS-2$
- implementation.getHistory().removeLastHistory();
- flagRemovedTempUrl();
- }
- }
-
- if (event.top == true) {
- // we are navigating to a regular fully qualified URL. Event.top
- // is true.
- flagStartOfFrameNavigation();
- implementation.updateHistory(url);
- }
-
- if (browser.getData("frameNavigation") == null //$NON-NLS-1$
- && event.top == false) {
- // a new url navigation that is not in a top frame. It can
- // be a navigation url due to frames, it can be due to a true
- // single Frame navigation (when you click on a link inside a
- // Frame) or it is an embedded Help System topic navigation.
- AbstractIntroPage currentPage = model.getCurrentPage();
- if (currentPage.isIFramePage()) {
- // it is an embedded Help System topic navigation. we are
- // navigating to an injected iframe since event.top is
- // false. Set the iframe url of the current iframe page, and
- // add it
- // to history.
- currentPage.setIFrameURL(url);
- implementation.updateHistory(currentPage);
- } else {
- flagStartOfFrameNavigation();
- flagStoredTempUrl();
- implementation.updateHistory(url);
- }
- }
-
- }
- return;
- }
-
- /**
- * Intercept any LocationEvents on the browser. If the event location is a
- * valid IntroURL, cancel the event and execute the intro action that is
- * embedded in the URL
- */
- @Override
+ String url = event.location;
+ if (url == null)
+ return;
+
+ // guard against unnecessary History updates.
+ Browser browser = (Browser) event.getSource();
+ if (browser.getData("navigation") != null //$NON-NLS-1$
+ && browser.getData("navigation").equals("true")) //$NON-NLS-1$ //$NON-NLS-2$
+ return;
+
+ IntroModelRoot model = implementation.getModel();
+ IntroURLParser parser = new IntroURLParser(url);
+ if (!parser.hasProtocol() || parser.getHost() == null
+ || parser.getHost().equals("")) //$NON-NLS-1$
+ // This will filter out two navigation events fired by the browser
+ // on a setText. (about:blank and
+ // res://C:\WINDOWS\System32\shdoclc.dll/navcancl.htm on windows,
+ // and file:/// on Linux)
+ return;
+
+ if (model.isDynamic()) {
+ // Update the history even with real URLs. Note that if we have
+ // multiple embedded URL navigations due to frames, the
+ // frameNavigation flag filters them. This flag is set here, and is
+ // cleared by a progress listener, when all the frame navigation is
+ // completed. We need to update history only in dynamic case. In
+ // static case, the browser keeps the history.
+ if (browser.getData("frameNavigation") != null) { //$NON-NLS-1$
+ // this is at least the second frame navigation, remove last
+ // history since it was added just as a filler.
+ if (event.top == false && browser.getData("tempUrl") != null //$NON-NLS-1$
+ && browser.getData("tempUrl").equals("true")) { //$NON-NLS-1$ //$NON-NLS-2$
+ implementation.getHistory().removeLastHistory();
+ flagRemovedTempUrl();
+ }
+ }
+
+ if (event.top == true) {
+ // we are navigating to a regular fully qualified URL. Event.top
+ // is true.
+ flagStartOfFrameNavigation();
+ implementation.updateHistory(url);
+ }
+
+ if (browser.getData("frameNavigation") == null //$NON-NLS-1$
+ && event.top == false) {
+ // a new url navigation that is not in a top frame. It can
+ // be a navigation url due to frames, it can be due to a true
+ // single Frame navigation (when you click on a link inside a
+ // Frame) or it is an embedded Help System topic navigation.
+ AbstractIntroPage currentPage = model.getCurrentPage();
+ if (currentPage.isIFramePage()) {
+ // it is an embedded Help System topic navigation. we are
+ // navigating to an injected iframe since event.top is
+ // false. Set the iframe url of the current iframe page, and
+ // add it
+ // to history.
+ currentPage.setIFrameURL(url);
+ implementation.updateHistory(currentPage);
+ } else {
+ flagStartOfFrameNavigation();
+ flagStoredTempUrl();
+ implementation.updateHistory(url);
+ }
+ }
+
+ }
+ return;
+ }
+
+ /**
+ * Intercept any LocationEvents on the browser. If the event location is a
+ * valid IntroURL, cancel the event and execute the intro action that is
+ * embedded in the URL
+ */
+ @Override
public void changing(LocationEvent event) {
- String url = event.location;
- if (url == null)
- return;
+ String url = event.location;
+ if (url == null)
+ return;
- IntroModelRoot model = implementation.getModel();
- IntroURLParser parser = new IntroURLParser(url);
- if (parser.hasIntroUrl()) {
- // stop URL first.
- event.doit = false;
- // execute the action embedded in the IntroURL
- IntroURL introURL = parser.getIntroURL();
- introURL.execute();
+ IntroModelRoot model = implementation.getModel();
+ IntroURLParser parser = new IntroURLParser(url);
+ if (parser.hasIntroUrl()) {
+ // stop URL first.
+ event.doit = false;
+ // execute the action embedded in the IntroURL
+ IntroURL introURL = parser.getIntroURL();
+ introURL.execute();
- // In the case of dynamic Intro, guard against extra Frame
- // navigations. This can happen in the case of intro injected
- // IFrames or Frames included through intro xml content.
- // INTRO: user defined iframes in Intro pages are not properly
- // supported here, only Help system injected iframes.
- if (model.isDynamic()) {
- if ((introURL.getParameter(IntroURL.KEY_EMBED_TARGET) != null)
- && introURL.getAction().equals(IntroURL.SHOW_PAGE))
- flagStartOfNavigation();
- }
- return;
- }
+ // In the case of dynamic Intro, guard against extra Frame
+ // navigations. This can happen in the case of intro injected
+ // IFrames or Frames included through intro xml content.
+ // INTRO: user defined iframes in Intro pages are not properly
+ // supported here, only Help system injected iframes.
+ if (model.isDynamic()) {
+ if ((introURL.getParameter(IntroURL.KEY_EMBED_TARGET) != null)
+ && introURL.getAction().equals(IntroURL.SHOW_PAGE))
+ flagStartOfNavigation();
+ }
+ return;
+ }
- }
+ }
- public void flagStartOfFrameNavigation() {
- if (implementation.getBrowser().getData("frameNavigation") == null) //$NON-NLS-1$
- implementation.getBrowser().setData("frameNavigation", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ public void flagStartOfFrameNavigation() {
+ if (implementation.getBrowser().getData("frameNavigation") == null) //$NON-NLS-1$
+ implementation.getBrowser().setData("frameNavigation", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- public void flagEndOfFrameNavigation() {
- implementation.getBrowser().setData("frameNavigation", null); //$NON-NLS-1$
- }
+ public void flagEndOfFrameNavigation() {
+ implementation.getBrowser().setData("frameNavigation", null); //$NON-NLS-1$
+ }
- public void flagStartOfNavigation() {
- if (implementation.getBrowser().getData("navigation") == null) //$NON-NLS-1$
- implementation.getBrowser().setData("navigation", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ public void flagStartOfNavigation() {
+ if (implementation.getBrowser().getData("navigation") == null) //$NON-NLS-1$
+ implementation.getBrowser().setData("navigation", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- public void flagEndOfNavigation() {
- implementation.getBrowser().setData("navigation", null); //$NON-NLS-1$
- }
+ public void flagEndOfNavigation() {
+ implementation.getBrowser().setData("navigation", null); //$NON-NLS-1$
+ }
- public void flagStoredTempUrl() {
- if (implementation.getBrowser().getData("tempUrl") == null) //$NON-NLS-1$
- implementation.getBrowser().setData("tempUrl", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- }
+ public void flagStoredTempUrl() {
+ if (implementation.getBrowser().getData("tempUrl") == null) //$NON-NLS-1$
+ implementation.getBrowser().setData("tempUrl", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
- public void flagRemovedTempUrl() {
- implementation.getBrowser().setData("tempUrl", null); //$NON-NLS-1$
- }
+ public void flagRemovedTempUrl() {
+ implementation.getBrowser().setData("tempUrl", null); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/FormIntroPartImplementation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/FormIntroPartImplementation.java
index 88d8ed9dd..3bd213d4f 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/FormIntroPartImplementation.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/FormIntroPartImplementation.java
@@ -55,498 +55,498 @@ import org.eclipse.ui.intro.config.IntroConfigurer;
* This is a UI Forms based implementation of an Intro Part Presentation.
*/
public class FormIntroPartImplementation extends
- AbstractIntroPartImplementation implements IIntroContentProviderSite,
- IPropertyListener {
-
- private FormToolkit toolkit;
- private ScrolledPageBook mainPageBook;
- private PageForm pageForm;
- private PageFormWithNavigation pageFormWithNav;
- // cache model instance for reuse.
- private IntroModelRoot model = getModel();
- private SharedStyleManager sharedStyleManager;
-
- // static SWT Intro. This is the link shown on the center of a page in a
- // static SWT intro.
- private Hyperlink welcomeLink;
-
- static {
- // REVISIT: register all common images here. Even if this part
- // implementation is created again, the images will remain in plugin
- // registry.
- ImageUtil.registerImage(ImageUtil.DEFAULT_ROOT_LINK, "overview_48.png"); //$NON-NLS-1$
- ImageUtil.registerImage(ImageUtil.DEFAULT_SMALL_ROOT_LINK,
- "overview_32.png"); //$NON-NLS-1$
- ImageUtil.registerImage(ImageUtil.DEFAULT_FORM_BG, "form_banner.png"); //$NON-NLS-1$
- ImageUtil.registerImage(ImageUtil.DEFAULT_LINK, "welcome_item.gif"); //$NON-NLS-1$
- }
-
- @Override
+ AbstractIntroPartImplementation implements IIntroContentProviderSite,
+ IPropertyListener {
+
+ private FormToolkit toolkit;
+ private ScrolledPageBook mainPageBook;
+ private PageForm pageForm;
+ private PageFormWithNavigation pageFormWithNav;
+ // cache model instance for reuse.
+ private IntroModelRoot model = getModel();
+ private SharedStyleManager sharedStyleManager;
+
+ // static SWT Intro. This is the link shown on the center of a page in a
+ // static SWT intro.
+ private Hyperlink welcomeLink;
+
+ static {
+ // REVISIT: register all common images here. Even if this part
+ // implementation is created again, the images will remain in plugin
+ // registry.
+ ImageUtil.registerImage(ImageUtil.DEFAULT_ROOT_LINK, "overview_48.png"); //$NON-NLS-1$
+ ImageUtil.registerImage(ImageUtil.DEFAULT_SMALL_ROOT_LINK,
+ "overview_32.png"); //$NON-NLS-1$
+ ImageUtil.registerImage(ImageUtil.DEFAULT_FORM_BG, "form_banner.png"); //$NON-NLS-1$
+ ImageUtil.registerImage(ImageUtil.DEFAULT_LINK, "welcome_item.gif"); //$NON-NLS-1$
+ }
+
+ @Override
protected void updateNavigationActionsState() {
- if (getModel().isDynamic()) {
- forwardAction.setEnabled(history.canNavigateForward());
- backAction.setEnabled(history.canNavigateBackward());
- return;
- }
- // no actions are added in static swt.
- }
+ if (getModel().isDynamic()) {
+ forwardAction.setEnabled(history.canNavigateForward());
+ backAction.setEnabled(history.canNavigateBackward());
+ return;
+ }
+ // no actions are added in static swt.
+ }
- public FormIntroPartImplementation() {
- // Shared style manager
- sharedStyleManager = new SharedStyleManager(getModel());
- }
+ public FormIntroPartImplementation() {
+ // Shared style manager
+ sharedStyleManager = new SharedStyleManager(getModel());
+ }
- @Override
+ @Override
public void createPartControl(Composite container) {
- if (getModel().isDynamic())
- dynamicCreatePartControl(container);
- else {
- staticCreatePartControl(container);
- }
- }
-
-
-
- /*
- * create dynamic UI forms Intro, ie: swt intro.
- */
- private void dynamicCreatePartControl(Composite container) {
- // Create single toolkit instance, which is disposed of on dispose of
- // intro part. also define background of all presentation.
- toolkit = new FormToolkit(container.getDisplay());
- // Define presentation title color
- Color bg = sharedStyleManager.getColor(toolkit, "bg"); //$NON-NLS-1$
- if (bg != null) {
- toolkit.setBackground(bg);
- }
- toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(
- HyperlinkSettings.UNDERLINE_HOVER);
-
- // Define presentation title color and image.
- Form mainForm = toolkit.createForm(container);
- Color fg = sharedStyleManager.getColor(toolkit, "title.fg"); //$NON-NLS-1$
- if (fg != null)
- mainForm.setForeground(fg);
- Image bgImage = sharedStyleManager.getImage("title.image", null, null); //$NON-NLS-1$
- if (bgImage != null) {
- mainForm.setBackgroundImage(bgImage);
- String repeat = sharedStyleManager
- .getProperty("title.image.repeat"); //$NON-NLS-1$
- if (repeat != null && repeat.equalsIgnoreCase("true")) //$NON-NLS-1$
-
- mainForm.setBackgroundImageTiled(true);
- }
-
- mainPageBook = createMainPageBook(toolkit, mainForm);
- // Add this presentation as a listener to model.
- getModel().addPropertyListener(this);
-
- addToolBarActions();
- }
-
-
- /**
- * The main page book that holds Intro pages. It has two pages, one that
- * holds the home page, and one that holds all other pages. If the
- * presentation is configured to not show the home page with the Home Page
- * layout, then this page book will only have one page.
- *
- * @param toolkit
- * @param form
- * @return
- */
- private ScrolledPageBook createMainPageBook(FormToolkit toolkit, Form form) {
- // get body and create page book in it. Body has GridLayout.
- Composite body = form.getBody();
- body.setLayout(new GridLayout());
- // make sure page book expands h and v.
- ScrolledPageBook pageBook = toolkit.createPageBook(body, SWT.V_SCROLL
- | SWT.H_SCROLL);
- pageBook.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // Create root page in root page layout form, only if needed.
- if (sharedStyleManager.useCustomHomePagelayout()) {
- // if we do not have a root page form, create one
- RootPageForm rootPageForm = new RootPageForm(toolkit, model, form);
- rootPageForm.createPartControl(pageBook, sharedStyleManager);
- rootPageForm.setContentProviderSite(this);
- }
-
- // Create the two Page forms .
- pageForm = new PageForm(toolkit, model, form);
- pageForm.setContentProviderSite(this);
- pageForm.createPartControl(pageBook, sharedStyleManager);
-
- pageFormWithNav = new PageFormWithNavigation(toolkit, model, form);
- pageFormWithNav.setContentProviderSite(this);
- pageFormWithNav.createPartControl(pageBook, sharedStyleManager);
-
- // now determine which page to show. Show it and add it to history.
- // if the cached page is a URL ignore it. We do not want to launch a
- // browser on startup.
- String cachedPage = getCachedCurrentPage();
- if (cachedPage != null & !History.isURL(cachedPage))
- // this will create the page in the page form.
- model.setCurrentPageId(cachedPage);
-
- AbstractIntroPage pageToShow = getModel().getCurrentPage();
- // load style manager here to test for navigation.
- PageStyleManager styleManager = new PageStyleManager(pageToShow,
- sharedStyleManager.getProperties());
- boolean pageHasNavigation = styleManager.showHomePageNavigation();
- if (pageToShow != null) {
- if (pageBook.hasPage(pageToShow.getId()))
- // we are showing Home Page.
- pageBook.showPage(pageToShow.getId());
- else {
- if (pageHasNavigation) {
- // page or Home Page with a page layout and navigation, set
- // the page id to the static PageFormWithNavigation id.
- // first create the correct content.
- pageFormWithNav.showPage(pageToShow, sharedStyleManager);
- // then show the page
- pageBook
- .showPage(PageFormWithNavigation.PAGE_FORM_WITH_NAVIGATION_ID);
- } else {
- // page or Home Page with a regular page layout, set the
- // page id to the static PageForm id. first create the
- // correct content.
- pageForm.showPage(pageToShow, sharedStyleManager);
- // then show the page
- pageBook.showPage(PageForm.PAGE_FORM_ID);
- }
- }
- updateHistory(pageToShow);
- }
-
- return pageBook;
- }
-
- @Override
+ if (getModel().isDynamic())
+ dynamicCreatePartControl(container);
+ else {
+ staticCreatePartControl(container);
+ }
+ }
+
+
+
+ /*
+ * create dynamic UI forms Intro, ie: swt intro.
+ */
+ private void dynamicCreatePartControl(Composite container) {
+ // Create single toolkit instance, which is disposed of on dispose of
+ // intro part. also define background of all presentation.
+ toolkit = new FormToolkit(container.getDisplay());
+ // Define presentation title color
+ Color bg = sharedStyleManager.getColor(toolkit, "bg"); //$NON-NLS-1$
+ if (bg != null) {
+ toolkit.setBackground(bg);
+ }
+ toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(
+ HyperlinkSettings.UNDERLINE_HOVER);
+
+ // Define presentation title color and image.
+ Form mainForm = toolkit.createForm(container);
+ Color fg = sharedStyleManager.getColor(toolkit, "title.fg"); //$NON-NLS-1$
+ if (fg != null)
+ mainForm.setForeground(fg);
+ Image bgImage = sharedStyleManager.getImage("title.image", null, null); //$NON-NLS-1$
+ if (bgImage != null) {
+ mainForm.setBackgroundImage(bgImage);
+ String repeat = sharedStyleManager
+ .getProperty("title.image.repeat"); //$NON-NLS-1$
+ if (repeat != null && repeat.equalsIgnoreCase("true")) //$NON-NLS-1$
+
+ mainForm.setBackgroundImageTiled(true);
+ }
+
+ mainPageBook = createMainPageBook(toolkit, mainForm);
+ // Add this presentation as a listener to model.
+ getModel().addPropertyListener(this);
+
+ addToolBarActions();
+ }
+
+
+ /**
+ * The main page book that holds Intro pages. It has two pages, one that
+ * holds the home page, and one that holds all other pages. If the
+ * presentation is configured to not show the home page with the Home Page
+ * layout, then this page book will only have one page.
+ *
+ * @param toolkit
+ * @param form
+ * @return
+ */
+ private ScrolledPageBook createMainPageBook(FormToolkit toolkit, Form form) {
+ // get body and create page book in it. Body has GridLayout.
+ Composite body = form.getBody();
+ body.setLayout(new GridLayout());
+ // make sure page book expands h and v.
+ ScrolledPageBook pageBook = toolkit.createPageBook(body, SWT.V_SCROLL
+ | SWT.H_SCROLL);
+ pageBook.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // Create root page in root page layout form, only if needed.
+ if (sharedStyleManager.useCustomHomePagelayout()) {
+ // if we do not have a root page form, create one
+ RootPageForm rootPageForm = new RootPageForm(toolkit, model, form);
+ rootPageForm.createPartControl(pageBook, sharedStyleManager);
+ rootPageForm.setContentProviderSite(this);
+ }
+
+ // Create the two Page forms .
+ pageForm = new PageForm(toolkit, model, form);
+ pageForm.setContentProviderSite(this);
+ pageForm.createPartControl(pageBook, sharedStyleManager);
+
+ pageFormWithNav = new PageFormWithNavigation(toolkit, model, form);
+ pageFormWithNav.setContentProviderSite(this);
+ pageFormWithNav.createPartControl(pageBook, sharedStyleManager);
+
+ // now determine which page to show. Show it and add it to history.
+ // if the cached page is a URL ignore it. We do not want to launch a
+ // browser on startup.
+ String cachedPage = getCachedCurrentPage();
+ if (cachedPage != null & !History.isURL(cachedPage))
+ // this will create the page in the page form.
+ model.setCurrentPageId(cachedPage);
+
+ AbstractIntroPage pageToShow = getModel().getCurrentPage();
+ // load style manager here to test for navigation.
+ PageStyleManager styleManager = new PageStyleManager(pageToShow,
+ sharedStyleManager.getProperties());
+ boolean pageHasNavigation = styleManager.showHomePageNavigation();
+ if (pageToShow != null) {
+ if (pageBook.hasPage(pageToShow.getId()))
+ // we are showing Home Page.
+ pageBook.showPage(pageToShow.getId());
+ else {
+ if (pageHasNavigation) {
+ // page or Home Page with a page layout and navigation, set
+ // the page id to the static PageFormWithNavigation id.
+ // first create the correct content.
+ pageFormWithNav.showPage(pageToShow, sharedStyleManager);
+ // then show the page
+ pageBook
+ .showPage(PageFormWithNavigation.PAGE_FORM_WITH_NAVIGATION_ID);
+ } else {
+ // page or Home Page with a regular page layout, set the
+ // page id to the static PageForm id. first create the
+ // correct content.
+ pageForm.showPage(pageToShow, sharedStyleManager);
+ // then show the page
+ pageBook.showPage(PageForm.PAGE_FORM_ID);
+ }
+ }
+ updateHistory(pageToShow);
+ }
+
+ return pageBook;
+ }
+
+ @Override
public void dispose() {
- if (toolkit != null)
- toolkit.dispose();
- }
-
- /**
- * Handle model property changes. The UI is notified here of a change to the
- * current page in the model. This happens if an intro URL showPage method
- * is executed.
- *
- * @see org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.Object,
- * int)
- */
- @Override
+ if (toolkit != null)
+ toolkit.dispose();
+ }
+
+ /**
+ * Handle model property changes. The UI is notified here of a change to the
+ * current page in the model. This happens if an intro URL showPage method
+ * is executed.
+ *
+ * @see org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.Object,
+ * int)
+ */
+ @Override
public void propertyChanged(Object source, int propId) {
- if (propId == IntroModelRoot.CURRENT_PAGE_PROPERTY_ID) {
- String pageId = getModel().getCurrentPageId();
- if (pageId == null || pageId.equals("")) //$NON-NLS-1$
- // If page ID was not set properly. exit.
- return;
+ if (propId == IntroModelRoot.CURRENT_PAGE_PROPERTY_ID) {
+ String pageId = getModel().getCurrentPageId();
+ if (pageId == null || pageId.equals("")) //$NON-NLS-1$
+ // If page ID was not set properly. exit.
+ return;
- showPage(getModel().getCurrentPage());
- }
- }
+ showPage(getModel().getCurrentPage());
+ }
+ }
- @Override
+ @Override
protected void addToolBarActions() {
- // Handle menus:
- IActionBars actionBars = getIntroPart().getIntroSite().getActionBars();
- IToolBarManager toolBarManager = actionBars.getToolBarManager();
- actionBars.setGlobalActionHandler(ActionFactory.FORWARD.getId(),
- forwardAction);
- actionBars.setGlobalActionHandler(ActionFactory.BACK.getId(),
- backAction);
- toolBarManager.add(new Separator(IntroConfigurer.TB_ADDITIONS));
- toolBarManager.add(homeAction);
- toolBarManager.add(backAction);
- toolBarManager.add(forwardAction);
- if (IntroPlugin.DEBUG_TOOLBAR) {
- toolBarManager.add(viewIntroModelAction);
- }
- toolBarManager.update(true);
- actionBars.updateActionBars();
- updateNavigationActionsState();
- }
-
- @Override
+ // Handle menus:
+ IActionBars actionBars = getIntroPart().getIntroSite().getActionBars();
+ IToolBarManager toolBarManager = actionBars.getToolBarManager();
+ actionBars.setGlobalActionHandler(ActionFactory.FORWARD.getId(),
+ forwardAction);
+ actionBars.setGlobalActionHandler(ActionFactory.BACK.getId(),
+ backAction);
+ toolBarManager.add(new Separator(IntroConfigurer.TB_ADDITIONS));
+ toolBarManager.add(homeAction);
+ toolBarManager.add(backAction);
+ toolBarManager.add(forwardAction);
+ if (IntroPlugin.DEBUG_TOOLBAR) {
+ toolBarManager.add(viewIntroModelAction);
+ }
+ toolBarManager.update(true);
+ actionBars.updateActionBars();
+ updateNavigationActionsState();
+ }
+
+ @Override
protected void doStandbyStateChanged(boolean standby,
- boolean isStandbyPartNeeded) {
- if (getModel().isDynamic())
- dynamicStandbyStateChanged(standby, isStandbyPartNeeded);
- else
- staticStandbyStateChanged(standby);
- }
-
-
- public void dynamicStandbyStateChanged(boolean standby,
- boolean isStandbyPartNeeded) {
- // handle action enablement first
- if (isStandbyPartNeeded | standby) {
- homeAction.setEnabled(false);
- forwardAction.setEnabled(false);
- backAction.setEnabled(false);
- } else {
- homeAction.setEnabled(true);
- updateNavigationActionsState();
- }
-
- if (isStandbyPartNeeded)
- // we have a standby part, nothing more to do in presentation.
- return;
-
- // try to show a cached page.
- AbstractIntroPage pageToShow = null;
- if (standby) {
- // we are in standby. Show standby page, in PageForm.
- pageToShow = getModel().getStandbyPage();
- if (pageToShow == null)
- pageToShow = getModel().getHomePage();
- } else
- // if we are showing a regular intro page, or if the Home Page
- // has a regular page layout, set the page id to the static PageForm
- // id.
- pageToShow = getModel().getCurrentPage();
-
- showPage(pageToShow);
- }
-
- private boolean showPage(AbstractIntroPage pageToShow) {
- boolean pageisCached = showCachedPage(pageToShow);
-
- if (!pageToShow.isDynamic()) {
- Util.openBrowser(pageToShow.getUrl());
- return true;
- }
-
- if (!pageisCached) {
- // page has not been shown before.
- // load style manager here to test for navigation.
- PageStyleManager styleManager = new PageStyleManager(pageToShow,
- sharedStyleManager.getProperties());
- boolean pageHasNavigation = styleManager.showHomePageNavigation();
- if (pageHasNavigation) {
- // page or Home Page with a regular page layout, set the
- // page id to the static PageFormWithNavigation id. first
- // create the correct content.
- pageFormWithNav.showPage(pageToShow, sharedStyleManager);
- // then show the page
- mainPageBook
- .showPage(PageFormWithNavigation.PAGE_FORM_WITH_NAVIGATION_ID);
- } else {
- // page or Home Page with a regular page layout, set the
- // page id to the static PageFormWithNavigation id. first
- // create the correct content.
- pageForm.showPage(pageToShow, sharedStyleManager);
- // then show the page
- mainPageBook.showPage(PageForm.PAGE_FORM_ID);
- }
- }
-
- return true;
- }
-
- private boolean showCachedPage(AbstractIntroPage page) {
- String formPageId = null;
- if (pageForm.hasPage(page.getId())) {
- pageForm.showPage(page, sharedStyleManager);
- formPageId = PageForm.PAGE_FORM_ID;
- } else if (pageFormWithNav.hasPage(page.getId())) {
- pageFormWithNav.showPage(page, sharedStyleManager);
- formPageId = PageFormWithNavigation.PAGE_FORM_WITH_NAVIGATION_ID;
- } else if (mainPageBook.hasPage(page.getId()))
- formPageId = page.getId();
- else
- return false;
-
- mainPageBook.showPage(formPageId);
- return true;
- }
-
- private void removeCachedPage(AbstractIntroPage page) {
- if (pageForm.hasPage(page.getId()))
- pageForm.removePage(page.getId());
- else if (pageFormWithNav.hasPage(page.getId()))
- pageFormWithNav.removePage(page.getId());
- else if (mainPageBook.hasPage(page.getId()))
- mainPageBook.removePage(page.getId());
- else
- return;
- }
-
-
- /**
- * Clear page cache for the page that contains this provider. Remove the
- * form from the correct pagebook that refers to the page we need to
- * refresh. This will force a call to createContents on all content
- * providers the next time this page needs to be displayed.
- *
- * @see org.eclipse.ui.intro.config.IIntroContentProviderSite#reflow(org.eclipse.ui.intro.config.IIntroContentProvider,
- * boolean)
- */
- @Override
+ boolean isStandbyPartNeeded) {
+ if (getModel().isDynamic())
+ dynamicStandbyStateChanged(standby, isStandbyPartNeeded);
+ else
+ staticStandbyStateChanged(standby);
+ }
+
+
+ public void dynamicStandbyStateChanged(boolean standby,
+ boolean isStandbyPartNeeded) {
+ // handle action enablement first
+ if (isStandbyPartNeeded | standby) {
+ homeAction.setEnabled(false);
+ forwardAction.setEnabled(false);
+ backAction.setEnabled(false);
+ } else {
+ homeAction.setEnabled(true);
+ updateNavigationActionsState();
+ }
+
+ if (isStandbyPartNeeded)
+ // we have a standby part, nothing more to do in presentation.
+ return;
+
+ // try to show a cached page.
+ AbstractIntroPage pageToShow = null;
+ if (standby) {
+ // we are in standby. Show standby page, in PageForm.
+ pageToShow = getModel().getStandbyPage();
+ if (pageToShow == null)
+ pageToShow = getModel().getHomePage();
+ } else
+ // if we are showing a regular intro page, or if the Home Page
+ // has a regular page layout, set the page id to the static PageForm
+ // id.
+ pageToShow = getModel().getCurrentPage();
+
+ showPage(pageToShow);
+ }
+
+ private boolean showPage(AbstractIntroPage pageToShow) {
+ boolean pageisCached = showCachedPage(pageToShow);
+
+ if (!pageToShow.isDynamic()) {
+ Util.openBrowser(pageToShow.getUrl());
+ return true;
+ }
+
+ if (!pageisCached) {
+ // page has not been shown before.
+ // load style manager here to test for navigation.
+ PageStyleManager styleManager = new PageStyleManager(pageToShow,
+ sharedStyleManager.getProperties());
+ boolean pageHasNavigation = styleManager.showHomePageNavigation();
+ if (pageHasNavigation) {
+ // page or Home Page with a regular page layout, set the
+ // page id to the static PageFormWithNavigation id. first
+ // create the correct content.
+ pageFormWithNav.showPage(pageToShow, sharedStyleManager);
+ // then show the page
+ mainPageBook
+ .showPage(PageFormWithNavigation.PAGE_FORM_WITH_NAVIGATION_ID);
+ } else {
+ // page or Home Page with a regular page layout, set the
+ // page id to the static PageFormWithNavigation id. first
+ // create the correct content.
+ pageForm.showPage(pageToShow, sharedStyleManager);
+ // then show the page
+ mainPageBook.showPage(PageForm.PAGE_FORM_ID);
+ }
+ }
+
+ return true;
+ }
+
+ private boolean showCachedPage(AbstractIntroPage page) {
+ String formPageId = null;
+ if (pageForm.hasPage(page.getId())) {
+ pageForm.showPage(page, sharedStyleManager);
+ formPageId = PageForm.PAGE_FORM_ID;
+ } else if (pageFormWithNav.hasPage(page.getId())) {
+ pageFormWithNav.showPage(page, sharedStyleManager);
+ formPageId = PageFormWithNavigation.PAGE_FORM_WITH_NAVIGATION_ID;
+ } else if (mainPageBook.hasPage(page.getId()))
+ formPageId = page.getId();
+ else
+ return false;
+
+ mainPageBook.showPage(formPageId);
+ return true;
+ }
+
+ private void removeCachedPage(AbstractIntroPage page) {
+ if (pageForm.hasPage(page.getId()))
+ pageForm.removePage(page.getId());
+ else if (pageFormWithNav.hasPage(page.getId()))
+ pageFormWithNav.removePage(page.getId());
+ else if (mainPageBook.hasPage(page.getId()))
+ mainPageBook.removePage(page.getId());
+ else
+ return;
+ }
+
+
+ /**
+ * Clear page cache for the page that contains this provider. Remove the
+ * form from the correct pagebook that refers to the page we need to
+ * refresh. This will force a call to createContents on all content
+ * providers the next time this page needs to be displayed.
+ *
+ * @see org.eclipse.ui.intro.config.IIntroContentProviderSite#reflow(org.eclipse.ui.intro.config.IIntroContentProvider,
+ * boolean)
+ */
+ @Override
public void reflow(IIntroContentProvider provider, boolean incremental) {
- AbstractIntroPage page = ContentProviderManager.getInst()
- .getContentProviderParentPage(provider);
- if (incremental) {
- if (pageForm.hasPage(page.getId()))
- pageForm.reflow();
- else if (pageFormWithNav.hasPage(page.getId()))
- pageFormWithNav.reflow();
- else if (mainPageBook.hasPage(page.getId()))
- mainPageBook.reflow(true);
- }
- else {
- removeCachedPage(page);
- showPage(model.getCurrentPage());
- }
- }
-
- @Override
+ AbstractIntroPage page = ContentProviderManager.getInst()
+ .getContentProviderParentPage(provider);
+ if (incremental) {
+ if (pageForm.hasPage(page.getId()))
+ pageForm.reflow();
+ else if (pageFormWithNav.hasPage(page.getId()))
+ pageFormWithNav.reflow();
+ else if (mainPageBook.hasPage(page.getId()))
+ mainPageBook.reflow(true);
+ }
+ else {
+ removeCachedPage(page);
+ showPage(model.getCurrentPage());
+ }
+ }
+
+ @Override
public void setFocus() {
- if (model.isDynamic()) {
- if (mainPageBook.getCurrentPage() != null)
- mainPageBook.getCurrentPage().setFocus();
- }
- }
+ if (model.isDynamic()) {
+ if (mainPageBook.getCurrentPage() != null)
+ mainPageBook.getCurrentPage().setFocus();
+ }
+ }
- @Override
+ @Override
public boolean navigateBackward() {
- boolean success = false;
- if (getModel().isDynamic()) {
- // dynamic case. Uses navigation history.
- if (history.canNavigateBackward()) {
- history.navigateHistoryBackward();
- if (history.currentLocationIsUrl())
- success = Util.openBrowser(history
- .getCurrentLocationAsUrl());
- else {
- // Set current page, and this will triger regen.
- CustomizableIntroPart currentIntroPart = (CustomizableIntroPart) IntroPlugin
- .getIntro();
- currentIntroPart.getControl().setRedraw(false);
- success = getModel().setCurrentPageId(
- history.getCurrentLocationAsPage().getId());
- currentIntroPart.getControl().setRedraw(true);
- }
- }
- }
-
- updateNavigationActionsState();
- return success;
- }
-
- @Override
+ boolean success = false;
+ if (getModel().isDynamic()) {
+ // dynamic case. Uses navigation history.
+ if (history.canNavigateBackward()) {
+ history.navigateHistoryBackward();
+ if (history.currentLocationIsUrl())
+ success = Util.openBrowser(history
+ .getCurrentLocationAsUrl());
+ else {
+ // Set current page, and this will triger regen.
+ CustomizableIntroPart currentIntroPart = (CustomizableIntroPart) IntroPlugin
+ .getIntro();
+ currentIntroPart.getControl().setRedraw(false);
+ success = getModel().setCurrentPageId(
+ history.getCurrentLocationAsPage().getId());
+ currentIntroPart.getControl().setRedraw(true);
+ }
+ }
+ }
+
+ updateNavigationActionsState();
+ return success;
+ }
+
+ @Override
public boolean navigateForward() {
- boolean success = false;
-
- if (getModel().isDynamic()) {
- // dynamic case. Uses navigation history.
- if (history.canNavigateForward()) {
- history.navigateHistoryForward();
- if (history.currentLocationIsUrl())
- success = Util.openBrowser(history
- .getCurrentLocationAsUrl());
- else {
- // Set current page, and this will triger regen.
- CustomizableIntroPart currentIntroPart = (CustomizableIntroPart) IntroPlugin
- .getIntro();
- currentIntroPart.getControl().setRedraw(false);
- success = getModel().setCurrentPageId(
- history.getCurrentLocationAsPage().getId());
- currentIntroPart.getControl().setRedraw(true);
- }
- }
- }
- updateNavigationActionsState();
- return success;
- }
-
- @Override
+ boolean success = false;
+
+ if (getModel().isDynamic()) {
+ // dynamic case. Uses navigation history.
+ if (history.canNavigateForward()) {
+ history.navigateHistoryForward();
+ if (history.currentLocationIsUrl())
+ success = Util.openBrowser(history
+ .getCurrentLocationAsUrl());
+ else {
+ // Set current page, and this will triger regen.
+ CustomizableIntroPart currentIntroPart = (CustomizableIntroPart) IntroPlugin
+ .getIntro();
+ currentIntroPart.getControl().setRedraw(false);
+ success = getModel().setCurrentPageId(
+ history.getCurrentLocationAsPage().getId());
+ currentIntroPart.getControl().setRedraw(true);
+ }
+ }
+ }
+ updateNavigationActionsState();
+ return success;
+ }
+
+ @Override
public boolean navigateHome() {
- AbstractIntroPage homePage = getModel().getHomePage();
- if (getModel().isDynamic()) {
- CustomizableIntroPart currentIntroPart = (CustomizableIntroPart) IntroPlugin
- .getIntro();
- currentIntroPart.getControl().setRedraw(false);
- boolean success = false;
- success = getModel().setCurrentPageId(homePage.getId());
- updateHistory(homePage);
- currentIntroPart.getControl().setRedraw(true);
- return success;
- }
- // static model. Nothing to do.
- return false;
- }
-
- @Override
+ AbstractIntroPage homePage = getModel().getHomePage();
+ if (getModel().isDynamic()) {
+ CustomizableIntroPart currentIntroPart = (CustomizableIntroPart) IntroPlugin
+ .getIntro();
+ currentIntroPart.getControl().setRedraw(false);
+ boolean success = false;
+ success = getModel().setCurrentPageId(homePage.getId());
+ updateHistory(homePage);
+ currentIntroPart.getControl().setRedraw(true);
+ return success;
+ }
+ // static model. Nothing to do.
+ return false;
+ }
+
+ @Override
protected void handleRegistryChanged(IRegistryChangeEvent event) {
- if (getModel().isDynamic()) {
- IntroPlugin.closeIntro();
- IntroPlugin.showIntro(false);
- }
- }
-
-
-
- // *********** Static case ******************
- /*
- * create static UI forms Intro. For this, we only launch the url of the
- * root page.
- */
- private void staticCreatePartControl(Composite parent) {
- toolkit = new FormToolkit(parent.getDisplay());
- toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(
- HyperlinkSettings.UNDERLINE_HOVER);
-
- // create a page that has only one link. The URL and tooltip will be set
- // by the standby listener.
- welcomeLink = createStaticPage(parent);
- }
-
-
- private Hyperlink createStaticPage(Composite parent) {
- Form mainForm = toolkit.createForm(parent);
- Composite body = mainForm.getBody();
-
- GridLayout gl = new GridLayout();
- body.setLayout(gl);
- String label = Messages.StaticHTML_welcome;
- Hyperlink link = toolkit.createHyperlink(body, label, SWT.WRAP);
- link.setFont(PageStyleManager.getHeaderFont());
- GridData gd = new GridData(GridData.GRAB_HORIZONTAL
- | GridData.GRAB_VERTICAL);
- gd.horizontalAlignment = GridData.CENTER;
- gd.verticalAlignment = GridData.CENTER;
- link.setLayoutData(gd);
- link.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
+ if (getModel().isDynamic()) {
+ IntroPlugin.closeIntro();
+ IntroPlugin.showIntro(false);
+ }
+ }
+
+
+
+ // *********** Static case ******************
+ /*
+ * create static UI forms Intro. For this, we only launch the url of the
+ * root page.
+ */
+ private void staticCreatePartControl(Composite parent) {
+ toolkit = new FormToolkit(parent.getDisplay());
+ toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(
+ HyperlinkSettings.UNDERLINE_HOVER);
+
+ // create a page that has only one link. The URL and tooltip will be set
+ // by the standby listener.
+ welcomeLink = createStaticPage(parent);
+ }
+
+
+ private Hyperlink createStaticPage(Composite parent) {
+ Form mainForm = toolkit.createForm(parent);
+ Composite body = mainForm.getBody();
+
+ GridLayout gl = new GridLayout();
+ body.setLayout(gl);
+ String label = Messages.StaticHTML_welcome;
+ Hyperlink link = toolkit.createHyperlink(body, label, SWT.WRAP);
+ link.setFont(PageStyleManager.getHeaderFont());
+ GridData gd = new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.GRAB_VERTICAL);
+ gd.horizontalAlignment = GridData.CENTER;
+ gd.verticalAlignment = GridData.CENTER;
+ link.setLayoutData(gd);
+ link.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
public void linkActivated(HyperlinkEvent e) {
- Hyperlink link = (Hyperlink) e.getSource();
- Util.openBrowser((String) link.getHref());
- return;
- }
- });
-
- return link;
- }
-
- public void staticStandbyStateChanged(boolean standby) {
- AbstractIntroPage homePage = getModel().getHomePage();
- AbstractIntroPage standbyPage = getModel().getStandbyPage();
- if (standbyPage == null)
- standbyPage = homePage;
-
- if (standby) {
- welcomeLink.setHref(standbyPage.getUrl());
- welcomeLink.setToolTipText(standbyPage.getUrl());
- } else {
- welcomeLink.setHref(homePage.getUrl());
- welcomeLink.setToolTipText(homePage.getUrl());
- }
- }
+ Hyperlink link = (Hyperlink) e.getSource();
+ Util.openBrowser((String) link.getHref());
+ return;
+ }
+ });
+
+ return link;
+ }
+
+ public void staticStandbyStateChanged(boolean standby) {
+ AbstractIntroPage homePage = getModel().getHomePage();
+ AbstractIntroPage standbyPage = getModel().getStandbyPage();
+ if (standbyPage == null)
+ standbyPage = homePage;
+
+ if (standby) {
+ welcomeLink.setHref(standbyPage.getUrl());
+ welcomeLink.setToolTipText(standbyPage.getUrl());
+ } else {
+ welcomeLink.setHref(homePage.getUrl());
+ welcomeLink.setToolTipText(homePage.getUrl());
+ }
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/TextIntroPartImplementation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/TextIntroPartImplementation.java
index 0d3ff888a..acd2da523 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/TextIntroPartImplementation.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/presentations/TextIntroPartImplementation.java
@@ -28,55 +28,55 @@ import org.eclipse.ui.intro.config.IIntroContentProvider;
* model and prints the content of pages. It is used for debugging.
*/
public class TextIntroPartImplementation extends
- AbstractIntroPartImplementation {
+ AbstractIntroPartImplementation {
- @Override
+ @Override
public void doStandbyStateChanged(boolean standby,
- boolean isStandbyPartNeeded) {
- // no-op
- }
+ boolean isStandbyPartNeeded) {
+ // no-op
+ }
- @Override
+ @Override
public void createPartControl(Composite container) {
- Text text = new Text(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- IntroModelRoot model = IntroPlugin.getDefault().getIntroModelRoot();
- IntroModelSerializer serializer = new IntroModelSerializer(model);
- text.setText(serializer.toString());
- addToolBarActions();
- }
+ Text text = new Text(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ IntroModelRoot model = IntroPlugin.getDefault().getIntroModelRoot();
+ IntroModelSerializer serializer = new IntroModelSerializer(model);
+ text.setText(serializer.toString());
+ addToolBarActions();
+ }
- @Override
+ @Override
protected void updateNavigationActionsState() {
- // no-op
- }
+ // no-op
+ }
- @Override
+ @Override
public void setFocus() {
- // no-op
- }
+ // no-op
+ }
- @Override
+ @Override
public boolean navigateBackward() {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
public boolean navigateForward() {
- return false;
- }
+ return false;
+ }
- @Override
+ @Override
protected void handleRegistryChanged(IRegistryChangeEvent event) {
- // no-op
- }
+ // no-op
+ }
- @Override
+ @Override
public boolean navigateHome() {
- return false;
- }
+ return false;
+ }
- public void reflow(IIntroContentProvider provider, boolean incremental) {
- // no-op
- }
+ public void reflow(IIntroContentProvider provider, boolean incremental) {
+ // no-op
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageContentForm.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageContentForm.java
index d7005c7f6..dc2dd1bf0 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageContentForm.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageContentForm.java
@@ -32,121 +32,121 @@ import org.eclipse.ui.intro.config.IIntroContentProviderSite;
*/
public class PageContentForm implements IIntroConstants {
- private FormToolkit toolkit;
- private IntroModelRoot model;
- private PageStyleManager styleManager;
- // composite to control reflow.
- private Composite contentComposite;
-
- // the page we are modeling here.
- private AbstractIntroPage page;
-
- // site is cached to hand down to the PageWidgetFactory for creating the UI
- // for content providers..
- private IIntroContentProviderSite site;
-
-
- public PageContentForm(FormToolkit toolkit, IntroModelRoot modelRoot) {
- this.toolkit = toolkit;
- this.model = modelRoot;
- page = model.getCurrentPage();
- }
-
- public PageContentForm(FormToolkit toolkit, IntroModelRoot modelRoot,
- AbstractIntroPage page) {
- this(toolkit, modelRoot);
- this.page = page;
- }
-
-
- /**
- * Create the form for the root page. Number of columns there is equal to
- * the number of links. Every image link does not cache a model object for
- * data retrieval..
- *
- * @param pageBook
- */
- public void createPartControl(ScrolledPageBook contentPageBook,
- PageStyleManager pageStyleManager) {
- styleManager = pageStyleManager;
-
- // categoriesComposite has Table Layout with one col. Holds page
- // description and composite with all other children.
- contentComposite = contentPageBook.createPage(page.getId());
- // Util.highlight(contentComposite, SWT.COLOR_GREEN);
- TableWrapLayout layout = new TableWrapLayout();
- layout.topMargin = 15;
- layout.leftMargin = 15;
- layout.rightMargin = 15;
- layout.bottomMargin = 15;
- layout.verticalSpacing = 15;
- contentComposite.setLayout(layout);
-
- if (styleManager.getPageDescription() != null) {
- Label label = toolkit.createLabel(contentComposite, styleManager
- .getPageDescription(), SWT.WRAP);
- label.setFont(PageStyleManager.getBannerFont());
- TableWrapData td = new TableWrapData();
- td.align = TableWrapData.FILL;
- label.setLayoutData(td);
- }
-
- // Store the sub-title data for this composite from this page's
- // subtitle. Make sure you do this before creating the page content to
- // filter out page sub-title from content area.
- contentComposite.setData(PAGE_SUBTITLE, styleManager.getPageSubTitle());
-
- createPageChildren(page, contentComposite);
-
- styleManager = null;
- }
-
- private void createPageChildren(AbstractIntroPage page, Composite parent) {
- // setup page composite/layout
- PageWidgetFactory factory = new PageWidgetFactory(toolkit, styleManager);
- factory.setContentProviderSite(site);
- Composite pageComposite = createPageTableComposite(factory, toolkit, styleManager, parent);
- // now add all children
- AbstractIntroElement[] children = page.getChildren();
- for (int i = 0; i < children.length; i++)
- factory.createIntroElement(pageComposite, children[i]);
-
- }
-
- /**
- * Creates a composite with TableWrapLayout to hold all page children. The
- * default number of columns is 1.
- *
- * @param parent
- * @return
- */
- static Composite createPageTableComposite(PageWidgetFactory factory, FormToolkit toolkit,
- PageStyleManager styleManager, Composite parent) {
- Composite client = toolkit.createComposite(parent);
- TableWrapLayout layout = new TableWrapLayout();
- layout.topMargin = 0;
- layout.bottomMargin = 0;
- layout.leftMargin = 0;
- layout.rightMargin = 0;
- int numColumns = styleManager.getPageNumberOfColumns();
- layout.numColumns = numColumns == 0 ? 1 : numColumns;
- layout.horizontalSpacing = styleManager.getPageHorizantalSpacing();
- layout.verticalSpacing = styleManager.getPageVerticalSpacing();
- client.setLayout(layout);
-
- // parent has TableWrapLayout, and so update layout of this child.
- TableWrapData td = new TableWrapData(TableWrapData.FILL,
- TableWrapData.FILL);
- // td.align = TableWrapData.FILL;
- td.grabHorizontal = true;
- client.setLayoutData(td);
- return client;
- }
-
-
- public void setContentProviderSite(IIntroContentProviderSite site) {
- this.site = site;
- }
+ private FormToolkit toolkit;
+ private IntroModelRoot model;
+ private PageStyleManager styleManager;
+ // composite to control reflow.
+ private Composite contentComposite;
+
+ // the page we are modeling here.
+ private AbstractIntroPage page;
+
+ // site is cached to hand down to the PageWidgetFactory for creating the UI
+ // for content providers..
+ private IIntroContentProviderSite site;
+
+
+ public PageContentForm(FormToolkit toolkit, IntroModelRoot modelRoot) {
+ this.toolkit = toolkit;
+ this.model = modelRoot;
+ page = model.getCurrentPage();
+ }
+
+ public PageContentForm(FormToolkit toolkit, IntroModelRoot modelRoot,
+ AbstractIntroPage page) {
+ this(toolkit, modelRoot);
+ this.page = page;
+ }
+
+
+ /**
+ * Create the form for the root page. Number of columns there is equal to
+ * the number of links. Every image link does not cache a model object for
+ * data retrieval..
+ *
+ * @param pageBook
+ */
+ public void createPartControl(ScrolledPageBook contentPageBook,
+ PageStyleManager pageStyleManager) {
+ styleManager = pageStyleManager;
+
+ // categoriesComposite has Table Layout with one col. Holds page
+ // description and composite with all other children.
+ contentComposite = contentPageBook.createPage(page.getId());
+ // Util.highlight(contentComposite, SWT.COLOR_GREEN);
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.topMargin = 15;
+ layout.leftMargin = 15;
+ layout.rightMargin = 15;
+ layout.bottomMargin = 15;
+ layout.verticalSpacing = 15;
+ contentComposite.setLayout(layout);
+
+ if (styleManager.getPageDescription() != null) {
+ Label label = toolkit.createLabel(contentComposite, styleManager
+ .getPageDescription(), SWT.WRAP);
+ label.setFont(PageStyleManager.getBannerFont());
+ TableWrapData td = new TableWrapData();
+ td.align = TableWrapData.FILL;
+ label.setLayoutData(td);
+ }
+
+ // Store the sub-title data for this composite from this page's
+ // subtitle. Make sure you do this before creating the page content to
+ // filter out page sub-title from content area.
+ contentComposite.setData(PAGE_SUBTITLE, styleManager.getPageSubTitle());
+
+ createPageChildren(page, contentComposite);
+
+ styleManager = null;
+ }
+
+ private void createPageChildren(AbstractIntroPage page, Composite parent) {
+ // setup page composite/layout
+ PageWidgetFactory factory = new PageWidgetFactory(toolkit, styleManager);
+ factory.setContentProviderSite(site);
+ Composite pageComposite = createPageTableComposite(factory, toolkit, styleManager, parent);
+ // now add all children
+ AbstractIntroElement[] children = page.getChildren();
+ for (int i = 0; i < children.length; i++)
+ factory.createIntroElement(pageComposite, children[i]);
+
+ }
+
+ /**
+ * Creates a composite with TableWrapLayout to hold all page children. The
+ * default number of columns is 1.
+ *
+ * @param parent
+ * @return
+ */
+ static Composite createPageTableComposite(PageWidgetFactory factory, FormToolkit toolkit,
+ PageStyleManager styleManager, Composite parent) {
+ Composite client = toolkit.createComposite(parent);
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.topMargin = 0;
+ layout.bottomMargin = 0;
+ layout.leftMargin = 0;
+ layout.rightMargin = 0;
+ int numColumns = styleManager.getPageNumberOfColumns();
+ layout.numColumns = numColumns == 0 ? 1 : numColumns;
+ layout.horizontalSpacing = styleManager.getPageHorizantalSpacing();
+ layout.verticalSpacing = styleManager.getPageVerticalSpacing();
+ client.setLayout(layout);
+
+ // parent has TableWrapLayout, and so update layout of this child.
+ TableWrapData td = new TableWrapData(TableWrapData.FILL,
+ TableWrapData.FILL);
+ // td.align = TableWrapData.FILL;
+ td.grabHorizontal = true;
+ client.setLayoutData(td);
+ return client;
+ }
+
+
+ public void setContentProviderSite(IIntroContentProviderSite site) {
+ this.site = site;
+ }
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageForm.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageForm.java
index d553faa8c..47e6e3cf6 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageForm.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageForm.java
@@ -39,145 +39,145 @@ import org.eclipse.ui.intro.config.IIntroContentProviderSite;
*/
public class PageForm implements IIntroConstants {
- protected FormToolkit toolkit;
- private ScrolledPageBook categoryPageBook;
- protected IntroModelRoot model;
- private Form parentForm;
- protected Form pageForm;
- // private SharedStyleManager sharedStyleManager;
+ protected FormToolkit toolkit;
+ private ScrolledPageBook categoryPageBook;
+ protected IntroModelRoot model;
+ private Form parentForm;
+ protected Form pageForm;
+ // private SharedStyleManager sharedStyleManager;
- // Id to this page. There is only a single instance of this page in the
- // main page book.
- public static String PAGE_FORM_ID = "pageFormId"; //$NON-NLS-1$
+ // Id to this page. There is only a single instance of this page in the
+ // main page book.
+ public static String PAGE_FORM_ID = "pageFormId"; //$NON-NLS-1$
- // site is cached to hand down to the PageWidgetFactory for creating the UI
- // for content providers..
- private IIntroContentProviderSite site;
+ // site is cached to hand down to the PageWidgetFactory for creating the UI
+ // for content providers..
+ private IIntroContentProviderSite site;
- protected HyperlinkAdapter hyperlinkAdapter = new HyperlinkAdapter() {
+ protected HyperlinkAdapter hyperlinkAdapter = new HyperlinkAdapter() {
- @Override
+ @Override
public void linkActivated(HyperlinkEvent e) {
- String url = (String) e.getHref();
- IntroURLParser parser = new IntroURLParser(url);
- if (parser.hasIntroUrl()) {
- // execute the action embedded in the IntroURL
- parser.getIntroURL().execute();
- return;
- } else if (parser.hasProtocol()) {
- Util.openBrowser(url);
- return;
- }
- DialogUtil.displayInfoMessage(((Control) e.getSource()).getShell(),
- Messages.HyperlinkAdapter_urlIs + " " + url); //$NON-NLS-1$
- }
-
- @Override
+ String url = (String) e.getHref();
+ IntroURLParser parser = new IntroURLParser(url);
+ if (parser.hasIntroUrl()) {
+ // execute the action embedded in the IntroURL
+ parser.getIntroURL().execute();
+ return;
+ } else if (parser.hasProtocol()) {
+ Util.openBrowser(url);
+ return;
+ }
+ DialogUtil.displayInfoMessage(((Control) e.getSource()).getShell(),
+ Messages.HyperlinkAdapter_urlIs + " " + url); //$NON-NLS-1$
+ }
+
+ @Override
public void linkEntered(HyperlinkEvent e) {
- }
+ }
- @Override
+ @Override
public void linkExited(HyperlinkEvent e) {
- }
- };
-
- /**
- *
- */
- public PageForm(FormToolkit toolkit, IntroModelRoot modelRoot,
- Form parentForm) {
- this.toolkit = toolkit;
- this.model = modelRoot;
- this.parentForm = parentForm;
- }
-
- /**
- * Create a Form for holding pages without navigation.
- *
- * @param pageBook
- */
- public void createPartControl(ScrolledPageBook mainPageBook,
- SharedStyleManager sharedStyleManager) {
-
- // Cash the shared style manager. We need to pass it around to category
- // forms. So, do not null it!
- // this.sharedStyleManager = sharedStyleManager;
-
- // creating page in Main page book.
- pageForm = toolkit.createForm(mainPageBook.getContainer());
- mainPageBook.registerPage(getId(), pageForm);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- pageForm.getBody().setLayout(layout);
- // Util.highlight(pageForm.getBody(), SWT.COLOR_RED);
-
- // Get form body. Form body is one column grid layout. Add page book
- // and navigation UI to it.
- categoryPageBook = toolkit.createPageBook(pageForm.getBody(),
- SWT.H_SCROLL | SWT.V_SCROLL);
- categoryPageBook.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // pageForm.setText(rootPageStyleManager.getPageSubTitle());
- }
-
-
- protected String getId() {
- return PAGE_FORM_ID;
- }
-
-
-
- /**
- * This method is called when the current page changes. It creates the
- * PageContentForm if necessary, and handles showing the page in the Page
- * Book. It creates a model PageContentForm for the current page.
- *
- * @param pageID
- */
- public void showPage(AbstractIntroPage page,
- SharedStyleManager sharedStyleManager) {
-
- if (!categoryPageBook.hasPage(page.getId())) {
- // if we do not have a category form for this page create one.
- PageContentForm categoryForm = new PageContentForm(toolkit, model,
- page);
- categoryForm.setContentProviderSite(site);
- // load style manager only once, here.
- PageStyleManager styleManager = new PageStyleManager(page,
- sharedStyleManager.getProperties());
- categoryForm.createPartControl(categoryPageBook, styleManager);
- }
- categoryPageBook.showPage(page.getId());
-
- // Get cached page subtitle from control data.
- Composite pageComposite = (Composite) categoryPageBook.getCurrentPage();
- // update main Form title.
- parentForm.setText(model.getCurrentPage().getTitle());
- // update this page form's title, ie: Page subtitle, if it exists.
- pageForm.setText((String) pageComposite.getData(PAGE_SUBTITLE));
-
- // TODO need to transfer focus to the first link in
- // the page somehow; we may need IIntroPage interface with
- // a few methods like 'setFocus()' etc.
- // DG
- }
-
- public void reflow() {
- categoryPageBook.reflow(true);
- }
-
- public boolean hasPage(String pageId) {
- return categoryPageBook.hasPage(pageId);
- }
-
- public void removePage(String pageId) {
- categoryPageBook.removePage(pageId);
- }
-
- public void setContentProviderSite(IIntroContentProviderSite site) {
- this.site = site;
- }
+ }
+ };
+
+ /**
+ *
+ */
+ public PageForm(FormToolkit toolkit, IntroModelRoot modelRoot,
+ Form parentForm) {
+ this.toolkit = toolkit;
+ this.model = modelRoot;
+ this.parentForm = parentForm;
+ }
+
+ /**
+ * Create a Form for holding pages without navigation.
+ *
+ * @param pageBook
+ */
+ public void createPartControl(ScrolledPageBook mainPageBook,
+ SharedStyleManager sharedStyleManager) {
+
+ // Cash the shared style manager. We need to pass it around to category
+ // forms. So, do not null it!
+ // this.sharedStyleManager = sharedStyleManager;
+
+ // creating page in Main page book.
+ pageForm = toolkit.createForm(mainPageBook.getContainer());
+ mainPageBook.registerPage(getId(), pageForm);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ pageForm.getBody().setLayout(layout);
+ // Util.highlight(pageForm.getBody(), SWT.COLOR_RED);
+
+ // Get form body. Form body is one column grid layout. Add page book
+ // and navigation UI to it.
+ categoryPageBook = toolkit.createPageBook(pageForm.getBody(),
+ SWT.H_SCROLL | SWT.V_SCROLL);
+ categoryPageBook.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // pageForm.setText(rootPageStyleManager.getPageSubTitle());
+ }
+
+
+ protected String getId() {
+ return PAGE_FORM_ID;
+ }
+
+
+
+ /**
+ * This method is called when the current page changes. It creates the
+ * PageContentForm if necessary, and handles showing the page in the Page
+ * Book. It creates a model PageContentForm for the current page.
+ *
+ * @param pageID
+ */
+ public void showPage(AbstractIntroPage page,
+ SharedStyleManager sharedStyleManager) {
+
+ if (!categoryPageBook.hasPage(page.getId())) {
+ // if we do not have a category form for this page create one.
+ PageContentForm categoryForm = new PageContentForm(toolkit, model,
+ page);
+ categoryForm.setContentProviderSite(site);
+ // load style manager only once, here.
+ PageStyleManager styleManager = new PageStyleManager(page,
+ sharedStyleManager.getProperties());
+ categoryForm.createPartControl(categoryPageBook, styleManager);
+ }
+ categoryPageBook.showPage(page.getId());
+
+ // Get cached page subtitle from control data.
+ Composite pageComposite = (Composite) categoryPageBook.getCurrentPage();
+ // update main Form title.
+ parentForm.setText(model.getCurrentPage().getTitle());
+ // update this page form's title, ie: Page subtitle, if it exists.
+ pageForm.setText((String) pageComposite.getData(PAGE_SUBTITLE));
+
+ // TODO need to transfer focus to the first link in
+ // the page somehow; we may need IIntroPage interface with
+ // a few methods like 'setFocus()' etc.
+ // DG
+ }
+
+ public void reflow() {
+ categoryPageBook.reflow(true);
+ }
+
+ public boolean hasPage(String pageId) {
+ return categoryPageBook.hasPage(pageId);
+ }
+
+ public void removePage(String pageId) {
+ categoryPageBook.removePage(pageId);
+ }
+
+ public void setContentProviderSite(IIntroContentProviderSite site) {
+ this.site = site;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageFormWithNavigation.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageFormWithNavigation.java
index e1f8e72f4..fa2cd6cd0 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageFormWithNavigation.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageFormWithNavigation.java
@@ -35,97 +35,97 @@ import org.eclipse.ui.internal.intro.impl.util.ImageUtil;
*/
public class PageFormWithNavigation extends PageForm {
- private PageStyleManager rootPageStyleManager;
-
- // Id to this page. There is only a single instance of this page in the
- // main page book.
- public static String PAGE_FORM_WITH_NAVIGATION_ID = "pageFormWithNavigationId"; //$NON-NLS-1$
-
-
- /**
- *
- */
- public PageFormWithNavigation(FormToolkit toolkit,
- IntroModelRoot modelRoot, Form parentForm) {
- super(toolkit, modelRoot, parentForm);
- }
-
- /**
- * Extend parent behavior and add navigation.
- *
- * @param pageBook
- */
- @Override
+ private PageStyleManager rootPageStyleManager;
+
+ // Id to this page. There is only a single instance of this page in the
+ // main page book.
+ public static String PAGE_FORM_WITH_NAVIGATION_ID = "pageFormWithNavigationId"; //$NON-NLS-1$
+
+
+ /**
+ *
+ */
+ public PageFormWithNavigation(FormToolkit toolkit,
+ IntroModelRoot modelRoot, Form parentForm) {
+ super(toolkit, modelRoot, parentForm);
+ }
+
+ /**
+ * Extend parent behavior and add navigation.
+ *
+ * @param pageBook
+ */
+ @Override
public void createPartControl(ScrolledPageBook mainPageBook,
- SharedStyleManager sharedStyleManager) {
-
- super.createPartControl(mainPageBook, sharedStyleManager);
-
- // Create a style manager from shared style manager. We only need it
- // for the UI navigation composite.
- rootPageStyleManager = new PageStyleManager(model.getHomePage(),
- sharedStyleManager.getProperties());
-
- // Now create Navigation bar.
- Composite navigationComposite = toolkit.createComposite(pageForm
- .getBody());
- navigationComposite.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_CENTER));
- int numberOfLinks = model.getRootPage().getLinks().length;
- GridLayout layout = new GridLayout();
- layout.numColumns = numberOfLinks;
- navigationComposite.setLayout(layout);
- createSmallNavigator(navigationComposite, model.getRootPage()
- .getLinks());
-
- pageForm.setText(rootPageStyleManager.getPageSubTitle());
- }
-
- /**
- * Override parent id.
- */
- @Override
+ SharedStyleManager sharedStyleManager) {
+
+ super.createPartControl(mainPageBook, sharedStyleManager);
+
+ // Create a style manager from shared style manager. We only need it
+ // for the UI navigation composite.
+ rootPageStyleManager = new PageStyleManager(model.getHomePage(),
+ sharedStyleManager.getProperties());
+
+ // Now create Navigation bar.
+ Composite navigationComposite = toolkit.createComposite(pageForm
+ .getBody());
+ navigationComposite.setLayoutData(new GridData(
+ GridData.HORIZONTAL_ALIGN_CENTER));
+ int numberOfLinks = model.getRootPage().getLinks().length;
+ GridLayout layout = new GridLayout();
+ layout.numColumns = numberOfLinks;
+ navigationComposite.setLayout(layout);
+ createSmallNavigator(navigationComposite, model.getRootPage()
+ .getLinks());
+
+ pageForm.setText(rootPageStyleManager.getPageSubTitle());
+ }
+
+ /**
+ * Override parent id.
+ */
+ @Override
protected String getId() {
- return PAGE_FORM_WITH_NAVIGATION_ID;
- }
-
- private void createSmallNavigator(Composite parent, IntroLink[] links) {
- for (int i = 0; i < links.length; i++) {
- Control c = createImageHyperlink(parent, links[i]);
- c.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
- }
- for (int i = 0; i < links.length; i++) {
- Label text = toolkit.createLabel(parent, links[i].getLabel());
- text.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
- text.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- }
- }
-
- /**
- * Creates an Image Hyperlink from an IntroLink. Model object is NOT cached.
- *
- * @param body
- * @param link
- */
- private Control createImageHyperlink(Composite body, IntroLink link) {
- ImageHyperlink imageLink = toolkit.createImageHyperlink(body, SWT.NULL);
-
- // set link image.
- Image image = rootPageStyleManager.getImage(link, "small-link-icon", //$NON-NLS-1$
- ImageUtil.DEFAULT_SMALL_ROOT_LINK);
- imageLink.setImage(image);
-
- // set link hover image.
- image = rootPageStyleManager.getImage(link, "small-hover-icon", null); //$NON-NLS-1$
- imageLink.setHoverImage(image);
- imageLink.setToolTipText(link.getLabel());
- // each link is centered in cell.
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- imageLink.setLayoutData(gd);
- imageLink.setHref(link.getUrl());
- imageLink.addHyperlinkListener(hyperlinkAdapter);
- return imageLink;
- }
+ return PAGE_FORM_WITH_NAVIGATION_ID;
+ }
+
+ private void createSmallNavigator(Composite parent, IntroLink[] links) {
+ for (int i = 0; i < links.length; i++) {
+ Control c = createImageHyperlink(parent, links[i]);
+ c.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
+ }
+ for (int i = 0; i < links.length; i++) {
+ Label text = toolkit.createLabel(parent, links[i].getLabel());
+ text.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
+ text.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ }
+ }
+
+ /**
+ * Creates an Image Hyperlink from an IntroLink. Model object is NOT cached.
+ *
+ * @param body
+ * @param link
+ */
+ private Control createImageHyperlink(Composite body, IntroLink link) {
+ ImageHyperlink imageLink = toolkit.createImageHyperlink(body, SWT.NULL);
+
+ // set link image.
+ Image image = rootPageStyleManager.getImage(link, "small-link-icon", //$NON-NLS-1$
+ ImageUtil.DEFAULT_SMALL_ROOT_LINK);
+ imageLink.setImage(image);
+
+ // set link hover image.
+ image = rootPageStyleManager.getImage(link, "small-hover-icon", null); //$NON-NLS-1$
+ imageLink.setHoverImage(image);
+ imageLink.setToolTipText(link.getLabel());
+ // each link is centered in cell.
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
+ imageLink.setLayoutData(gd);
+ imageLink.setHref(link.getUrl());
+ imageLink.addHyperlinkListener(hyperlinkAdapter);
+ return imageLink;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java
index 31d0baa24..4a5461bad 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageStyleManager.java
@@ -42,510 +42,510 @@ import org.osgi.framework.Bundle;
public class PageStyleManager extends SharedStyleManager {
- private AbstractIntroPage page;
+ private AbstractIntroPage page;
private Map<Properties, StyleContext> altStyleContexts = new HashMap<>();
- private IntroModelRoot root;
-
-
- /**
- * Constructor used when page styles need to be loaded. The plugin's bundle
- * is retrieved from the page model class. The default properties are
- * assumed to be the presentation shared properties. The inherrited
- * properties are properties that we got from included and extension styles.
- *
- * @param modelRoot
- */
- public PageStyleManager(AbstractIntroPage page, Properties sharedProperties) {
- this.page = page;
- context = new StyleContext();
- context.bundle = page.getBundle();
-
- // honor shared-style.
- if (page.injectSharedStyle())
- properties = new Properties(sharedProperties);
- else
- properties = new Properties();
- String altStyle = page.getAltStyle();
- if (altStyle != null) {
- load(properties, altStyle, context);
- }
-
- // AltStyles Hashtable has alt-styles as keys, the bundles as
- // values.
+ private IntroModelRoot root;
+
+
+ /**
+ * Constructor used when page styles need to be loaded. The plugin's bundle
+ * is retrieved from the page model class. The default properties are
+ * assumed to be the presentation shared properties. The inherrited
+ * properties are properties that we got from included and extension styles.
+ *
+ * @param modelRoot
+ */
+ public PageStyleManager(AbstractIntroPage page, Properties sharedProperties) {
+ this.page = page;
+ context = new StyleContext();
+ context.bundle = page.getBundle();
+
+ // honor shared-style.
+ if (page.injectSharedStyle())
+ properties = new Properties(sharedProperties);
+ else
+ properties = new Properties();
+ String altStyle = page.getAltStyle();
+ if (altStyle != null) {
+ load(properties, altStyle, context);
+ }
+
+ // AltStyles Hashtable has alt-styles as keys, the bundles as
+ // values.
Map<String, Bundle> altStyles = page.getAltStyles();
- if (altStyles != null) {
+ if (altStyles != null) {
for (Entry<String, Bundle> entry : altStyles.entrySet()) {
String style = entry.getKey();
- Properties inheritedProperties = new Properties();
+ Properties inheritedProperties = new Properties();
Bundle bundle = entry.getValue();
- StyleContext sc = new StyleContext();
- sc.bundle = bundle;
- load(inheritedProperties, style, sc);
- altStyleContexts.put(inheritedProperties, sc);
- }
- }
+ StyleContext sc = new StyleContext();
+ sc.bundle = bundle;
+ load(inheritedProperties, style, sc);
+ altStyleContexts.put(inheritedProperties, sc);
+ }
+ }
- // cache root
- root = (IntroModelRoot) page.getParentPage().getParent();
- }
+ // cache root
+ root = (IntroModelRoot) page.getParentPage().getParent();
+ }
- // Override parent method to include alt-styles. Use implicit keys as well.
- @Override
+ // Override parent method to include alt-styles. Use implicit keys as well.
+ @Override
public String getProperty(String key) {
- return getProperty(key, true);
- }
-
- // Override parent method to include alt-styles. If useImplicit is true, we
- // try to resolve a key without its pageId.
- private String getProperty(String key, boolean useImplicitKey) {
- Properties aProperties = findPropertyOwner(key);
- String value = super.doGetProperty(aProperties, key);
- if (useImplicitKey) {
- if (value == null && page.getId() != null
- && key.startsWith(page.getId())) {
- // did not find the key as-is. Trim pageId and try again.
- String relativeKey = key.substring(page.getId().length());
- return getProperty(relativeKey);
- }
- }
- return value;
- }
-
-
- /**
- * Finds a Properties that represents an inherited shared style, or this
- * current pages style. If the given key is not found, the pageId is trimmed
- * from the begining of the key, and the key is looked up again. If key does
- * not start with a pageId, lookup only the key as is.
- *
- * @param key
- * @return
- */
- private Properties findPropertyOwner(String key) {
- // search for the key in this page's properties first.
- if (properties.containsKey(key))
- return properties;
-
- // search inherited properties second.
+ return getProperty(key, true);
+ }
+
+ // Override parent method to include alt-styles. If useImplicit is true, we
+ // try to resolve a key without its pageId.
+ private String getProperty(String key, boolean useImplicitKey) {
+ Properties aProperties = findPropertyOwner(key);
+ String value = super.doGetProperty(aProperties, key);
+ if (useImplicitKey) {
+ if (value == null && page.getId() != null
+ && key.startsWith(page.getId())) {
+ // did not find the key as-is. Trim pageId and try again.
+ String relativeKey = key.substring(page.getId().length());
+ return getProperty(relativeKey);
+ }
+ }
+ return value;
+ }
+
+
+ /**
+ * Finds a Properties that represents an inherited shared style, or this
+ * current pages style. If the given key is not found, the pageId is trimmed
+ * from the begining of the key, and the key is looked up again. If key does
+ * not start with a pageId, lookup only the key as is.
+ *
+ * @param key
+ * @return
+ */
+ private Properties findPropertyOwner(String key) {
+ // search for the key in this page's properties first.
+ if (properties.containsKey(key))
+ return properties;
+
+ // search inherited properties second.
for (Properties aProperties : altStyleContexts.keySet()) {
- if (aProperties.containsKey(key))
- return aProperties;
- }
- // we did not find the key. Return the local properties anyway.
- return properties;
- }
+ if (aProperties.containsKey(key))
+ return aProperties;
+ }
+ // we did not find the key. Return the local properties anyway.
+ return properties;
+ }
- /**
- * Finds the context from which this key was loaded. If the key is not from
- * an inherited alt style, then use the context corresponding to this page.
- *
- * @param key
- * @return
- */
+ /**
+ * Finds the context from which this key was loaded. If the key is not from
+ * an inherited alt style, then use the context corresponding to this page.
+ *
+ * @param key
+ * @return
+ */
- @Override
+ @Override
protected StyleContext getAssociatedContext(String key) {
- Properties aProperties = findPropertyOwner(key);
- StyleContext context = altStyleContexts.get(aProperties);
- if (context != null)
- return context;
- return super.getAssociatedContext(key);
- }
-
-
- /*
- * For number of columns, do not return 1 as the default, to allow for
- * further processing. At the root page level, getting a 0 as ncolumns means
- * that the number of columns is the number of children. At the page level,
- * default is 1.
- */
- public int getPageNumberOfColumns() {
- return getIntProperty(page, ".layout.ncolumns", 0); //$NON-NLS-1$
- }
-
-
- public int getNumberOfColumns(IntroGroup group) {
- return getIntProperty(group, ".layout.ncolumns", 0); //$NON-NLS-1$
- }
-
- public boolean getEqualWidth(IntroGroup group) {
- return getBooleanProperty(group, ".layout.equalWidth", false); //$NON-NLS-1$
- }
-
- public int getPageVerticalSpacing() {
- return getIntProperty(page, ".layout.vspacing", 5); //$NON-NLS-1$
- }
-
- public int getVerticalSpacing(IntroGroup group) {
- return getIntProperty(group, ".layout.vspacing", 5); //$NON-NLS-1$
- }
-
- public int getPageHorizantalSpacing() {
- return getIntProperty(page, ".layout.hspacing", 5); //$NON-NLS-1$
- }
-
- public int getHorizantalSpacing(IntroGroup group) {
- return getIntProperty(group, ".layout.hspacing", 5); //$NON-NLS-1$
- }
-
- public int getColSpan(AbstractBaseIntroElement element) {
- return getIntProperty(element, ".layout.colspan", 1); //$NON-NLS-1$
- }
-
- public int getRowSpan(AbstractBaseIntroElement element) {
- return getIntProperty(element, ".layout.rowspan", 1); //$NON-NLS-1$
- }
-
- private int getIntProperty(AbstractBaseIntroElement element,
- String qualifier, int defaultValue) {
- StringBuffer buff = ModelLoaderUtil.createPathToElementKey(element, true);
- if (buff == null)
- return defaultValue;
- String key = buff.append(qualifier).toString();
- return getIntProperty(key, defaultValue);
- }
-
- private boolean getBooleanProperty(AbstractBaseIntroElement element,
- String qualifier, boolean defaultValue) {
- StringBuffer buff = ModelLoaderUtil.createPathToElementKey(element, true);
- if (buff == null)
- return defaultValue;
- String key = buff.append(qualifier).toString();
- return getBooleanProperty(key, defaultValue);
- }
-
- private int getIntProperty(String key, int defaulValue) {
- int intValue = defaulValue;
- String value = getProperty(key);
- if (value == null)
- return intValue;
-
- try {
- intValue = Integer.parseInt(value);
- } catch (NumberFormatException e) {
- Log.error("Failed to parse key: " + key + " as an integer.", e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return intValue;
- }
-
- private boolean getBooleanProperty(String key, boolean defaultValue) {
- boolean booleanValue = defaultValue;
- String value = getProperty(key);
- if (value != null)
- booleanValue = value.equalsIgnoreCase("true"); //$NON-NLS-1$
- return booleanValue;
- }
-
-
- /**
- * Finds the description text of the given group. Looks for the Text child
- * element whos id is specified as follows:
- * <p>
- * <pageId>. <path_to_group>.description-id= <id of child description Text
- * element>
- * </p>
- * If not found, use the default description style.
- *
- * Returns null if no default style found, or any id in path is null.
- *
- * @param group
- * @return
- */
- public String getDescription(IntroGroup group) {
- StringBuffer buff = ModelLoaderUtil.createPathToElementKey(group, true);
- if (buff == null)
- return null;
- String key = buff.append(".description-id").toString(); //$NON-NLS-1$
- return doGetDescription(group, key);
- }
-
-
- /**
- * Finds the description text of the associated page. Looks for the Text
- * child element whos id is specified as follows:
- * <p>
- * <pageId>.description-id= <id of child description Text element>
- * </p>
- * If not found, use the default description style.
- *
- * Returns null if no default style found, or any id in path is null.
- *
- * @param group
- * @return
- */
- public String getPageDescription() {
- if (page.getId() == null)
- return null;
- String key = page.getId() + ".description-id"; //$NON-NLS-1$
- return doGetDescription(page, key);
- }
-
- private String doGetDescription(AbstractIntroContainer parent, String key) {
- String path = getProperty(key);
- String description = null;
- if (path != null)
- description = findTextFromPath(parent, path);
- if (description != null)
- return description;
- return findTextFromStyleId(parent, getDescriptionStyleId());
- }
-
- private String getDescriptionStyleId() {
- String key = "description-style-id"; //$NON-NLS-1$
- return getProperty(key);
- }
-
- /**
- * Finds the subtitle of the associated page. Looks for the Text child
- * element whose id is specified as follows:
- * <p>
- * <pageId>.description-id= <id of child description Text element>
- * </p>
- * If not found, use the default description style.
- *
- * @param group
- * @return
- */
- public String getPageSubTitle() {
- String key = page.getId() + ".subtitle-id"; //$NON-NLS-1$
- String path = getProperty(key);
- String description = null;
- if (path != null)
- description = findTextFromPath(page, path);
- if (description != null)
- return description;
- return findTextFromStyleId(page, getPageSubTitleStyleId());
- }
-
- private String getPageSubTitleStyleId() {
- String key = "subtitle-style-id"; //$NON-NLS-1$
- return getProperty(key);
- }
-
- private String findTextFromPath(AbstractIntroContainer parent, String path) {
- AbstractIntroElement child = parent.findTarget(root, path);
- if (child != null && child.isOfType(AbstractIntroElement.TEXT)) {
- makeFiltered(child);
- return ((IntroText) child).getText();
- }
- return null;
- }
-
- /**
- * Returns the first direct child text element with the given style-id.
- *
- * @return
- */
- private String findTextFromStyleId(AbstractIntroContainer parent,
- String styleId) {
- IntroText[] allText = (IntroText[]) parent
- .getChildrenOfType(AbstractIntroElement.TEXT);
- for (int i = 0; i < allText.length; i++) {
- if (allText[i].getStyleId() == null)
- // not all elements have style id.
- continue;
- if (allText[i].getStyleId().equals(styleId)) {
- makeFiltered(allText[i]);
- return allText[i].getText();
- }
- }
- return null;
- }
-
- /**
- * Util method to check model type, and filter model element out if it is of
- * the correct type.
- *
- * @param element
- */
- private AbstractIntroElement makeFiltered(AbstractIntroElement element) {
- if (element.isOfType(AbstractIntroElement.BASE_ELEMENT))
- ((AbstractBaseIntroElement) element).setFilterState(true);
- return element;
- }
-
-
-
- public boolean getShowLinkDescription() {
- String key = page.getId() + ".show-link-description"; //$NON-NLS-1$
- String value = getProperty(key);
- if (value == null) {
- key = ".show-link-description"; //$NON-NLS-1$
- value = getProperty(key);
- }
- if (value == null)
- value = "true"; //$NON-NLS-1$
- return value.toLowerCase().equals("true"); //$NON-NLS-1$
- }
-
- public boolean showHomePageNavigation() {
- String key = page.getId() + ".show-home-page-navigation"; //$NON-NLS-1$
- String value = getProperty(key);
- if (value == null) {
- key = ".show-home-page-navigation"; //$NON-NLS-1$
- value = getProperty(key);
- }
- if (value == null)
- value = "true"; //$NON-NLS-1$
- return value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
-
-
- public Color getColor(FormToolkit toolkit, AbstractBaseIntroElement element) {
- StringBuffer buff = ModelLoaderUtil.createPathToElementKey(element, true);
- if (buff == null)
- return null;
- String key = buff.append(".font.fg").toString(); //$NON-NLS-1$
- return getColor(toolkit, key);
- }
-
- public Color getBackgrond(FormToolkit toolkit, AbstractBaseIntroElement element) {
- StringBuffer buff = ModelLoaderUtil.createPathToElementKey(element, true);
- if (buff == null)
- return null;
- String key = buff.append(".bg").toString(); //$NON-NLS-1$
- return getColor(toolkit, key);
- }
-
- public boolean isBold(IntroText text) {
- String value = null;
- /*
- StringBuffer buff = ModelLoaderUtil.createPathToElementKey(text, true);
- if (buff != null) {
- String key = buff.append(".font.bold").toString(); //$NON-NLS-1$
- value = getProperty(key);
- if (value != null)
- return value.toLowerCase().equals("true"); //$NON-NLS-1$
- else {
- buff = ModelLoaderUtil.createPathToElementKey(text, true);
- }
- }
- */
- value = getPropertyValue(text, ".font.bold"); //$NON-NLS-1$
- if (value == null) {
- // bold is not specified by ID. Check to see if there is a style-id
- // specified for bold.
- value = getProperty("bold-style-id"); //$NON-NLS-1$
- if (value != null && text.getStyleId() != null)
- return text.getStyleId().equals(value);
- }
- return false;
- }
-
- private String getPropertyValue(AbstractIntroIdElement element, String suffix) {
- StringBuffer buff = ModelLoaderUtil.createPathToElementKey(element, true);
- if (buff != null) {
- String key = buff.append(suffix).toString();
- String value = getProperty(key);
- if (value != null)
- return value;
- // try the page.id key
- buff = ModelLoaderUtil.createPathToElementKey(element, false);
- if (buff!= null) {
- key = buff.append(suffix).toString();
- value = getProperty(key);
- return value;
- }
- }
- return null;
- }
-
- public static Font getBannerFont() {
- return JFaceResources.getBannerFont();
- }
-
- public static Font getHeaderFont() {
- return JFaceResources.getHeaderFont();
- }
-
- /**
- * Retrieves an image for a link in a page. If not found, uses the page's
- * default link image. If still not found, uses the passed default.
- *
- * @param link
- * @param qualifier
- * @return
- */
- public Image getImage(IntroLink link, String qualifier, String defaultKey) {
- // try the Id first
- String key = createImageByIdKey(page, link, qualifier);
- String value = getProperty(key, false);
- if (value==null) {
- key = createImageKey(page, link, qualifier);
- // special case where we have to handle this because extended code does
- // not go through getProperty() in this method.
- value = getProperty(key, false);
- }
- if (value == null && page.getId() != null
- && key.startsWith(page.getId()))
- // did not use the key as-is. Trim pageId and try again.
- key = key.substring(page.getId().length());
-
- // pageKey can not become an implicit key.
- String pageKey = createImageKey(page, null, qualifier);
-
- return getImage(key, pageKey, defaultKey);
- }
-
- private String createImageKey(AbstractIntroPage page, IntroLink link,
- String qualifier) {
- StringBuffer buff = null;
- if (link != null) {
- buff = ModelLoaderUtil.createPathToElementKey(link, true);
- if (buff == null)
- return ""; //$NON-NLS-1$
- } else {
- buff = new StringBuffer();
- buff.append(page.getId());
- }
- buff.append("."); //$NON-NLS-1$
- buff.append(qualifier);
- return buff.toString();
- }
-
- private String createImageByIdKey(AbstractIntroPage page, IntroLink link,
- String qualifier) {
- if (link==null || link.getId()==null)
- return ""; //$NON-NLS-1$
- StringBuilder buff = new StringBuilder();
- buff.append(page.getId());
- buff.append("."); //$NON-NLS-1$
- buff.append(link.getId());
- buff.append("."); //$NON-NLS-1$
- buff.append(qualifier);
- return buff.toString();
- }
-
- public Image getImage(IntroImage introImage) {
- String imageLocation = introImage.getSrcAsIs();
- StringBuffer buff = ModelLoaderUtil.createPathToElementKey(introImage, true);
- String key;
- if (buff == null) {
- key = "//" + imageLocation; //$NON-NLS-1$
- } else {
- key = buff!=null?buff.toString():null;
- }
- if (ImageUtil.hasImage(key))
- return ImageUtil.getImage(key);
- // key not already registered.
- if (buff != null) {
- StyleContext acontext = getAssociatedContext(key);
- if (acontext.inTheme) {
- ImageUtil.registerImage(key, acontext.path, imageLocation);
- return ImageUtil.getImage(key);
- }
- }
- Bundle bundle = introImage.getBundle();
+ Properties aProperties = findPropertyOwner(key);
+ StyleContext context = altStyleContexts.get(aProperties);
+ if (context != null)
+ return context;
+ return super.getAssociatedContext(key);
+ }
+
+
+ /*
+ * For number of columns, do not return 1 as the default, to allow for
+ * further processing. At the root page level, getting a 0 as ncolumns means
+ * that the number of columns is the number of children. At the page level,
+ * default is 1.
+ */
+ public int getPageNumberOfColumns() {
+ return getIntProperty(page, ".layout.ncolumns", 0); //$NON-NLS-1$
+ }
+
+
+ public int getNumberOfColumns(IntroGroup group) {
+ return getIntProperty(group, ".layout.ncolumns", 0); //$NON-NLS-1$
+ }
+
+ public boolean getEqualWidth(IntroGroup group) {
+ return getBooleanProperty(group, ".layout.equalWidth", false); //$NON-NLS-1$
+ }
+
+ public int getPageVerticalSpacing() {
+ return getIntProperty(page, ".layout.vspacing", 5); //$NON-NLS-1$
+ }
+
+ public int getVerticalSpacing(IntroGroup group) {
+ return getIntProperty(group, ".layout.vspacing", 5); //$NON-NLS-1$
+ }
+
+ public int getPageHorizantalSpacing() {
+ return getIntProperty(page, ".layout.hspacing", 5); //$NON-NLS-1$
+ }
+
+ public int getHorizantalSpacing(IntroGroup group) {
+ return getIntProperty(group, ".layout.hspacing", 5); //$NON-NLS-1$
+ }
+
+ public int getColSpan(AbstractBaseIntroElement element) {
+ return getIntProperty(element, ".layout.colspan", 1); //$NON-NLS-1$
+ }
+
+ public int getRowSpan(AbstractBaseIntroElement element) {
+ return getIntProperty(element, ".layout.rowspan", 1); //$NON-NLS-1$
+ }
+
+ private int getIntProperty(AbstractBaseIntroElement element,
+ String qualifier, int defaultValue) {
+ StringBuffer buff = ModelLoaderUtil.createPathToElementKey(element, true);
+ if (buff == null)
+ return defaultValue;
+ String key = buff.append(qualifier).toString();
+ return getIntProperty(key, defaultValue);
+ }
+
+ private boolean getBooleanProperty(AbstractBaseIntroElement element,
+ String qualifier, boolean defaultValue) {
+ StringBuffer buff = ModelLoaderUtil.createPathToElementKey(element, true);
+ if (buff == null)
+ return defaultValue;
+ String key = buff.append(qualifier).toString();
+ return getBooleanProperty(key, defaultValue);
+ }
+
+ private int getIntProperty(String key, int defaulValue) {
+ int intValue = defaulValue;
+ String value = getProperty(key);
+ if (value == null)
+ return intValue;
+
+ try {
+ intValue = Integer.parseInt(value);
+ } catch (NumberFormatException e) {
+ Log.error("Failed to parse key: " + key + " as an integer.", e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return intValue;
+ }
+
+ private boolean getBooleanProperty(String key, boolean defaultValue) {
+ boolean booleanValue = defaultValue;
+ String value = getProperty(key);
+ if (value != null)
+ booleanValue = value.equalsIgnoreCase("true"); //$NON-NLS-1$
+ return booleanValue;
+ }
+
+
+ /**
+ * Finds the description text of the given group. Looks for the Text child
+ * element whos id is specified as follows:
+ * <p>
+ * <pageId>. <path_to_group>.description-id= <id of child description Text
+ * element>
+ * </p>
+ * If not found, use the default description style.
+ *
+ * Returns null if no default style found, or any id in path is null.
+ *
+ * @param group
+ * @return
+ */
+ public String getDescription(IntroGroup group) {
+ StringBuffer buff = ModelLoaderUtil.createPathToElementKey(group, true);
+ if (buff == null)
+ return null;
+ String key = buff.append(".description-id").toString(); //$NON-NLS-1$
+ return doGetDescription(group, key);
+ }
+
+
+ /**
+ * Finds the description text of the associated page. Looks for the Text
+ * child element whos id is specified as follows:
+ * <p>
+ * <pageId>.description-id= <id of child description Text element>
+ * </p>
+ * If not found, use the default description style.
+ *
+ * Returns null if no default style found, or any id in path is null.
+ *
+ * @param group
+ * @return
+ */
+ public String getPageDescription() {
+ if (page.getId() == null)
+ return null;
+ String key = page.getId() + ".description-id"; //$NON-NLS-1$
+ return doGetDescription(page, key);
+ }
+
+ private String doGetDescription(AbstractIntroContainer parent, String key) {
+ String path = getProperty(key);
+ String description = null;
+ if (path != null)
+ description = findTextFromPath(parent, path);
+ if (description != null)
+ return description;
+ return findTextFromStyleId(parent, getDescriptionStyleId());
+ }
+
+ private String getDescriptionStyleId() {
+ String key = "description-style-id"; //$NON-NLS-1$
+ return getProperty(key);
+ }
+
+ /**
+ * Finds the subtitle of the associated page. Looks for the Text child
+ * element whose id is specified as follows:
+ * <p>
+ * <pageId>.description-id= <id of child description Text element>
+ * </p>
+ * If not found, use the default description style.
+ *
+ * @param group
+ * @return
+ */
+ public String getPageSubTitle() {
+ String key = page.getId() + ".subtitle-id"; //$NON-NLS-1$
+ String path = getProperty(key);
+ String description = null;
+ if (path != null)
+ description = findTextFromPath(page, path);
+ if (description != null)
+ return description;
+ return findTextFromStyleId(page, getPageSubTitleStyleId());
+ }
+
+ private String getPageSubTitleStyleId() {
+ String key = "subtitle-style-id"; //$NON-NLS-1$
+ return getProperty(key);
+ }
+
+ private String findTextFromPath(AbstractIntroContainer parent, String path) {
+ AbstractIntroElement child = parent.findTarget(root, path);
+ if (child != null && child.isOfType(AbstractIntroElement.TEXT)) {
+ makeFiltered(child);
+ return ((IntroText) child).getText();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the first direct child text element with the given style-id.
+ *
+ * @return
+ */
+ private String findTextFromStyleId(AbstractIntroContainer parent,
+ String styleId) {
+ IntroText[] allText = (IntroText[]) parent
+ .getChildrenOfType(AbstractIntroElement.TEXT);
+ for (int i = 0; i < allText.length; i++) {
+ if (allText[i].getStyleId() == null)
+ // not all elements have style id.
+ continue;
+ if (allText[i].getStyleId().equals(styleId)) {
+ makeFiltered(allText[i]);
+ return allText[i].getText();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Util method to check model type, and filter model element out if it is of
+ * the correct type.
+ *
+ * @param element
+ */
+ private AbstractIntroElement makeFiltered(AbstractIntroElement element) {
+ if (element.isOfType(AbstractIntroElement.BASE_ELEMENT))
+ ((AbstractBaseIntroElement) element).setFilterState(true);
+ return element;
+ }
+
+
+
+ public boolean getShowLinkDescription() {
+ String key = page.getId() + ".show-link-description"; //$NON-NLS-1$
+ String value = getProperty(key);
+ if (value == null) {
+ key = ".show-link-description"; //$NON-NLS-1$
+ value = getProperty(key);
+ }
+ if (value == null)
+ value = "true"; //$NON-NLS-1$
+ return value.toLowerCase().equals("true"); //$NON-NLS-1$
+ }
+
+ public boolean showHomePageNavigation() {
+ String key = page.getId() + ".show-home-page-navigation"; //$NON-NLS-1$
+ String value = getProperty(key);
+ if (value == null) {
+ key = ".show-home-page-navigation"; //$NON-NLS-1$
+ value = getProperty(key);
+ }
+ if (value == null)
+ value = "true"; //$NON-NLS-1$
+ return value.equalsIgnoreCase("true"); //$NON-NLS-1$
+ }
+
+
+ public Color getColor(FormToolkit toolkit, AbstractBaseIntroElement element) {
+ StringBuffer buff = ModelLoaderUtil.createPathToElementKey(element, true);
+ if (buff == null)
+ return null;
+ String key = buff.append(".font.fg").toString(); //$NON-NLS-1$
+ return getColor(toolkit, key);
+ }
+
+ public Color getBackgrond(FormToolkit toolkit, AbstractBaseIntroElement element) {
+ StringBuffer buff = ModelLoaderUtil.createPathToElementKey(element, true);
+ if (buff == null)
+ return null;
+ String key = buff.append(".bg").toString(); //$NON-NLS-1$
+ return getColor(toolkit, key);
+ }
+
+ public boolean isBold(IntroText text) {
+ String value = null;
+ /*
+ StringBuffer buff = ModelLoaderUtil.createPathToElementKey(text, true);
+ if (buff != null) {
+ String key = buff.append(".font.bold").toString(); //$NON-NLS-1$
+ value = getProperty(key);
+ if (value != null)
+ return value.toLowerCase().equals("true"); //$NON-NLS-1$
+ else {
+ buff = ModelLoaderUtil.createPathToElementKey(text, true);
+ }
+ }
+ */
+ value = getPropertyValue(text, ".font.bold"); //$NON-NLS-1$
+ if (value == null) {
+ // bold is not specified by ID. Check to see if there is a style-id
+ // specified for bold.
+ value = getProperty("bold-style-id"); //$NON-NLS-1$
+ if (value != null && text.getStyleId() != null)
+ return text.getStyleId().equals(value);
+ }
+ return false;
+ }
+
+ private String getPropertyValue(AbstractIntroIdElement element, String suffix) {
+ StringBuffer buff = ModelLoaderUtil.createPathToElementKey(element, true);
+ if (buff != null) {
+ String key = buff.append(suffix).toString();
+ String value = getProperty(key);
+ if (value != null)
+ return value;
+ // try the page.id key
+ buff = ModelLoaderUtil.createPathToElementKey(element, false);
+ if (buff!= null) {
+ key = buff.append(suffix).toString();
+ value = getProperty(key);
+ return value;
+ }
+ }
+ return null;
+ }
+
+ public static Font getBannerFont() {
+ return JFaceResources.getBannerFont();
+ }
+
+ public static Font getHeaderFont() {
+ return JFaceResources.getHeaderFont();
+ }
+
+ /**
+ * Retrieves an image for a link in a page. If not found, uses the page's
+ * default link image. If still not found, uses the passed default.
+ *
+ * @param link
+ * @param qualifier
+ * @return
+ */
+ public Image getImage(IntroLink link, String qualifier, String defaultKey) {
+ // try the Id first
+ String key = createImageByIdKey(page, link, qualifier);
+ String value = getProperty(key, false);
+ if (value==null) {
+ key = createImageKey(page, link, qualifier);
+ // special case where we have to handle this because extended code does
+ // not go through getProperty() in this method.
+ value = getProperty(key, false);
+ }
+ if (value == null && page.getId() != null
+ && key.startsWith(page.getId()))
+ // did not use the key as-is. Trim pageId and try again.
+ key = key.substring(page.getId().length());
+
+ // pageKey can not become an implicit key.
+ String pageKey = createImageKey(page, null, qualifier);
+
+ return getImage(key, pageKey, defaultKey);
+ }
+
+ private String createImageKey(AbstractIntroPage page, IntroLink link,
+ String qualifier) {
+ StringBuffer buff = null;
+ if (link != null) {
+ buff = ModelLoaderUtil.createPathToElementKey(link, true);
+ if (buff == null)
+ return ""; //$NON-NLS-1$
+ } else {
+ buff = new StringBuffer();
+ buff.append(page.getId());
+ }
+ buff.append("."); //$NON-NLS-1$
+ buff.append(qualifier);
+ return buff.toString();
+ }
+
+ private String createImageByIdKey(AbstractIntroPage page, IntroLink link,
+ String qualifier) {
+ if (link==null || link.getId()==null)
+ return ""; //$NON-NLS-1$
+ StringBuilder buff = new StringBuilder();
+ buff.append(page.getId());
+ buff.append("."); //$NON-NLS-1$
+ buff.append(link.getId());
+ buff.append("."); //$NON-NLS-1$
+ buff.append(qualifier);
+ return buff.toString();
+ }
+
+ public Image getImage(IntroImage introImage) {
+ String imageLocation = introImage.getSrcAsIs();
+ StringBuffer buff = ModelLoaderUtil.createPathToElementKey(introImage, true);
+ String key;
+ if (buff == null) {
+ key = "//" + imageLocation; //$NON-NLS-1$
+ } else {
+ key = buff!=null?buff.toString():null;
+ }
+ if (ImageUtil.hasImage(key))
+ return ImageUtil.getImage(key);
+ // key not already registered.
+ if (buff != null) {
+ StyleContext acontext = getAssociatedContext(key);
+ if (acontext.inTheme) {
+ ImageUtil.registerImage(key, acontext.path, imageLocation);
+ return ImageUtil.getImage(key);
+ }
+ }
+ Bundle bundle = introImage.getBundle();
if (FileLocator.find(bundle, new Path(imageLocation), null) == null) {
return null;
}
- ImageUtil.registerImage(key, bundle, imageLocation);
- return ImageUtil.getImage(key);
+ ImageUtil.registerImage(key, bundle, imageLocation);
+ return ImageUtil.getImage(key);
- }
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageWidgetFactory.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageWidgetFactory.java
index 97247091e..e91f3dee9 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageWidgetFactory.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/PageWidgetFactory.java
@@ -57,442 +57,442 @@ import org.eclipse.ui.intro.config.IIntroContentProviderSite;
*/
public class PageWidgetFactory {
- protected HyperlinkAdapter hyperlinkAdapter = new HyperlinkAdapter() {
+ protected HyperlinkAdapter hyperlinkAdapter = new HyperlinkAdapter() {
- @Override
+ @Override
public void linkActivated(HyperlinkEvent e) {
- String url = (String) e.getHref();
- IntroURLParser parser = new IntroURLParser(url);
- if (parser.hasIntroUrl()) {
- // execute the action embedded in the IntroURL
- parser.getIntroURL().execute();
- return;
- } else if (parser.hasProtocol()) {
- Util.openBrowser(url);
- return;
- }
- DialogUtil.displayInfoMessage(((Control) e.getSource()).getShell(),
- Messages.HyperlinkAdapter_urlIs + " " + url); //$NON-NLS-1$
- }
-
- @Override
+ String url = (String) e.getHref();
+ IntroURLParser parser = new IntroURLParser(url);
+ if (parser.hasIntroUrl()) {
+ // execute the action embedded in the IntroURL
+ parser.getIntroURL().execute();
+ return;
+ } else if (parser.hasProtocol()) {
+ Util.openBrowser(url);
+ return;
+ }
+ DialogUtil.displayInfoMessage(((Control) e.getSource()).getShell(),
+ Messages.HyperlinkAdapter_urlIs + " " + url); //$NON-NLS-1$
+ }
+
+ @Override
public void linkEntered(HyperlinkEvent e) {
- }
+ }
- @Override
+ @Override
public void linkExited(HyperlinkEvent e) {
- }
- };
-
-
- protected FormToolkit toolkit;
- protected PageStyleManager styleManager;
- protected IIntroContentProviderSite site;
-
-
- /*
- * protect bad creation.
- */
- protected PageWidgetFactory(FormToolkit toolkit,
- PageStyleManager styleManager) {
- this.toolkit = toolkit;
- this.styleManager = styleManager;
- }
-
- public void setContentProviderSite(IIntroContentProviderSite site) {
- this.site = site;
- }
-
- public void createIntroElement(Composite parent,
- AbstractIntroElement element) {
- // check if this element is filtered, and if yes, do not create it.
- boolean isFiltered = getFilterState(element);
- if (isFiltered)
- return;
-
- Control c = null;
- switch (element.getType()) {
- case AbstractIntroElement.GROUP:
- IntroGroup group = (IntroGroup) element;
- c = createGroup(parent, group);
- updateLayoutData(c, element);
- // c must be a composite.
- Composite newParent = (Composite) c;
- if (c instanceof Section)
- // client is a composite also.
- newParent = (Composite) ((Section) newParent).getClient();
- AbstractIntroElement[] children = group.getChildren();
- for (int i = 0; i < children.length; i++)
- createIntroElement(newParent, children[i]);
- break;
- case AbstractIntroElement.LINK:
- IntroLink link = (IntroLink) element;
- c = createImageHyperlink(parent, link);
- updateLayoutData(c, element);
- break;
- case AbstractIntroElement.TEXT:
- IntroText text = (IntroText) element;
- c = createText(parent, text);
- updateLayoutData(c, element);
- break;
- case AbstractIntroElement.IMAGE:
- IntroImage image = (IntroImage) element;
- c = createImage(parent, image);
- if (c!=null)
- updateLayoutData(c, element);
- break;
- case AbstractIntroElement.HTML:
- IntroHTML html = (IntroHTML) element;
- if (html.isInlined()) {
- IntroText htmlText = html.getIntroText();
- if (htmlText != null)
- c = createText(parent, htmlText);
- else {
- IntroImage htmlImage = html.getIntroImage();
- if (htmlImage != null)
- c = createImage(parent, htmlImage);
- }
- } else {
- // embedded HTML, so we can show it from a link.
- String embddedLink = html.getSrc();
- if (embddedLink == null)
- break;
+ }
+ };
+
+
+ protected FormToolkit toolkit;
+ protected PageStyleManager styleManager;
+ protected IIntroContentProviderSite site;
+
+
+ /*
+ * protect bad creation.
+ */
+ protected PageWidgetFactory(FormToolkit toolkit,
+ PageStyleManager styleManager) {
+ this.toolkit = toolkit;
+ this.styleManager = styleManager;
+ }
+
+ public void setContentProviderSite(IIntroContentProviderSite site) {
+ this.site = site;
+ }
+
+ public void createIntroElement(Composite parent,
+ AbstractIntroElement element) {
+ // check if this element is filtered, and if yes, do not create it.
+ boolean isFiltered = getFilterState(element);
+ if (isFiltered)
+ return;
+
+ Control c = null;
+ switch (element.getType()) {
+ case AbstractIntroElement.GROUP:
+ IntroGroup group = (IntroGroup) element;
+ c = createGroup(parent, group);
+ updateLayoutData(c, element);
+ // c must be a composite.
+ Composite newParent = (Composite) c;
+ if (c instanceof Section)
+ // client is a composite also.
+ newParent = (Composite) ((Section) newParent).getClient();
+ AbstractIntroElement[] children = group.getChildren();
+ for (int i = 0; i < children.length; i++)
+ createIntroElement(newParent, children[i]);
+ break;
+ case AbstractIntroElement.LINK:
+ IntroLink link = (IntroLink) element;
+ c = createImageHyperlink(parent, link);
+ updateLayoutData(c, element);
+ break;
+ case AbstractIntroElement.TEXT:
+ IntroText text = (IntroText) element;
+ c = createText(parent, text);
+ updateLayoutData(c, element);
+ break;
+ case AbstractIntroElement.IMAGE:
+ IntroImage image = (IntroImage) element;
+ c = createImage(parent, image);
+ if (c!=null)
+ updateLayoutData(c, element);
+ break;
+ case AbstractIntroElement.HTML:
+ IntroHTML html = (IntroHTML) element;
+ if (html.isInlined()) {
+ IntroText htmlText = html.getIntroText();
+ if (htmlText != null)
+ c = createText(parent, htmlText);
+ else {
+ IntroImage htmlImage = html.getIntroImage();
+ if (htmlImage != null)
+ c = createImage(parent, htmlImage);
+ }
+ } else {
+ // embedded HTML, so we can show it from a link.
+ String embddedLink = html.getSrc();
+ if (embddedLink == null)
+ break;
String linkText = StringUtil.concat(
"<p><a href=\"http://org.eclipse.ui.intro/openBrowser?url=", //$NON-NLS-1$
embddedLink, "\">", //$NON-NLS-1$
Messages.HTML_embeddedLink, "</a></p>"); //$NON-NLS-1$
- linkText = generateFormText(linkText);
- c = createFormText(parent, linkText, null);
- }
- if (c != null)
- updateLayoutData(c, element);
- break;
- case AbstractIntroElement.CONTENT_PROVIDER:
- IntroContentProvider provider = (IntroContentProvider) element;
- c = createContentProvider(parent, provider);
- updateLayoutData(c, element);
- break;
- case AbstractIntroElement.HR:
- IntroSeparator sep = (IntroSeparator)element;
- c = createSeparator(parent, sep);
- updateLayoutData(c, element);
- break;
-
- default:
- break;
- }
- }
-
-
- private void updateLayoutData(Control c, AbstractIntroElement element) {
- TableWrapData currentTd = (TableWrapData) c.getLayoutData();
- if (currentTd == null) {
- currentTd = new TableWrapData(TableWrapData.FILL,
- TableWrapData.FILL);
- currentTd.grabHorizontal = true;
- c.setLayoutData(currentTd);
- }
-
- currentTd.colspan = styleManager
- .getColSpan((AbstractBaseIntroElement) element);
- currentTd.rowspan = styleManager
- .getRowSpan((AbstractBaseIntroElement) element);
-
- }
-
- private Composite createGroup(Composite parent, IntroGroup group) {
- String label = group.getLabel();
- String description = styleManager.getDescription(group);
- boolean expandable = group.isExpandable();
- boolean expanded = group.isExpanded();
- Composite client = null;
- Composite control = null;
- if (description != null || label != null || expandable) {
- int style = description != null ? Section.DESCRIPTION : SWT.NULL;
- if (expandable)
- style |= ExpandableComposite.TWISTIE | ExpandableComposite.FOCUS_TITLE | ExpandableComposite.CLIENT_INDENT;
- if (expanded)
- style |= ExpandableComposite.EXPANDED;
- Section section = toolkit.createSection(parent, style);
- if (label != null)
- section.setText(label);
- if (description != null)
- section.setDescription(description);
- colorControl(section, group);
- client = toolkit.createComposite(section, SWT.WRAP);
- section.setClient(client);
- control = section;
- } else {
- client = toolkit.createComposite(parent, SWT.WRAP);
- control = client;
- }
-
- TableWrapLayout layout = new TableWrapLayout();
- int numColumns = styleManager.getNumberOfColumns(group);
- numColumns = numColumns < 1 ? 1 : numColumns;
- layout.numColumns = numColumns;
- layout.makeColumnsEqualWidth = styleManager.getEqualWidth(group);
- layout.verticalSpacing = styleManager.getVerticalSpacing(group);
- layout.horizontalSpacing = styleManager.getHorizantalSpacing(group);
- client.setLayout(layout);
- // Util.highlight(client, SWT.COLOR_YELLOW);
- return control;
- }
-
- /**
- * Creates an Image Hyperlink from an IntroLink. Model object is NOT cached.
- *
- * @param body
- * @param link
- */
- private Control createImageHyperlink(Composite parent, IntroLink link) {
- Control control;
- Hyperlink linkControl;
- boolean showLinkDescription = styleManager.getShowLinkDescription();
- Image linkImage = styleManager.getImage(link, "link-icon", //$NON-NLS-1$
- ImageUtil.DEFAULT_LINK);
-
- if (showLinkDescription && link.getText() != null) {
- Composite container = toolkit.createComposite(parent);
- TableWrapLayout layout = new TableWrapLayout();
- layout.leftMargin = layout.rightMargin = 0;
- layout.topMargin = layout.bottomMargin = 0;
- layout.verticalSpacing = 0;
- layout.numColumns = 2;
- container.setLayout(layout);
-
- //Label ilabel = toolkit.createLabel(container, null);
- ImageHyperlink ilabel = toolkit.createImageHyperlink(container, SWT.NULL);
- ilabel.setImage(linkImage);
- ilabel.setHoverImage(styleManager.getImage(link, "hover-icon", //$NON-NLS-1$
- null));
- ilabel.setHref(link.getUrl());
- ilabel.addHyperlinkListener(hyperlinkAdapter);
- TableWrapData td = new TableWrapData();
- td.valign = TableWrapData.TOP;
- td.rowspan = 2;
- ilabel.setLayoutData(td);
-
- linkControl = toolkit.createHyperlink(container, null, SWT.WRAP);
- td = new TableWrapData(TableWrapData.LEFT, TableWrapData.BOTTOM);
- td.grabVertical = true;
- linkControl.setLayoutData(td);
- // Util.highlight(linkControl, SWT.COLOR_RED);
- // Util.highlight(container, SWT.COLOR_DARK_YELLOW);
-
- Control desc = createText(container, link.getIntroText());
- td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
- td.grabHorizontal = true;
- td.grabVertical = true;
- desc.setLayoutData(td);
- control = container;
- } else {
- ImageHyperlink imageLink = toolkit.createImageHyperlink(parent,
- SWT.WRAP | SWT.CENTER);
- imageLink.setImage(linkImage);
- imageLink.setHoverImage(styleManager.getImage(link, "hover-icon", //$NON-NLS-1$
- null));
- TableWrapData td = new TableWrapData();
- td.grabHorizontal = true;
- imageLink.setLayoutData(td);
- linkControl = imageLink;
- control = linkControl;
- }
- linkControl.setText(link.getLabel());
- linkControl.setFont(PageStyleManager.getBannerFont());
- colorControl(linkControl, link);
- linkControl.setHref(link.getUrl());
- linkControl.addHyperlinkListener(hyperlinkAdapter);
- // Util.highlight(linkControl, SWT.COLOR_DARK_YELLOW);
- return control;
- }
-
- /**
- * Creates a forms Text or FormattedText.
- *
- * @param body
- * @param link
- */
- protected Control createText(Composite parent, IntroText text) {
- Color fg = styleManager.getColor(toolkit, text);
- boolean isBold = styleManager.isBold(text);
- // formatted case. If text is alredy formatted, the bold property is
- // ignored.
- if (text.isFormatted())
- return createFormText(parent, generateFormText(text.getText()), fg);
-
- // non formatted case.
- if (isBold)
- return createFormText(parent, generateBoldFormText(text.getText()),
- fg);
- return createText(parent, StringUtil.normalizeWhiteSpace(text.getText()), fg);
- }
-
- private Control createFormText(Composite parent, String text, Color fg) {
- FormText formText = toolkit.createFormText(parent, false);
- formText.addHyperlinkListener(hyperlinkAdapter);
- try {
- formText.setText(text, true, true);
- } catch (SWTError e) {
- Log.error(e.getMessage(), e);
- return createText(parent, text, fg);
- }
- if (fg != null)
- formText.setForeground(fg);
- return formText;
- }
-
-
- private Control createText(Composite parent, String text, Color fg) {
- Label label = toolkit.createLabel(parent, text, SWT.WRAP);
- if (fg != null)
- label.setForeground(fg);
- return label;
- }
-
-
-
- protected Control createImage(Composite parent, IntroImage image) {
- Label ilabel = null;
- Image imageFile = styleManager.getImage(image);
- if (imageFile != null) {
- ilabel = toolkit.createLabel(parent, null, SWT.LEFT);
- ilabel.setImage(imageFile);
- if (image.getAlt() != null)
- ilabel.setToolTipText(image.getAlt());
- }
- // for images, do not use default layout. Grab horizontal is not what we
- // want.
- if (ilabel!=null) {
- TableWrapData td = new TableWrapData();
- ilabel.setLayoutData(td);
- }
- return ilabel;
- }
-
- public Control createContentProvider(Composite parent,
- IntroContentProvider provider) {
- // If we've already loaded the content provider for this element,
- // retrieve it, otherwise load the class.
- // Create parent composite to hold dynamic content, and set layout
- // accordingly.
- Composite container = toolkit.createComposite(parent);
- TableWrapLayout layout = new TableWrapLayout();
- layout.topMargin = 0;
- layout.bottomMargin = 0;
- layout.leftMargin = 0;
- layout.rightMargin = 0;
- container.setLayout(layout);
- container.setData(provider);
-
-
- IIntroContentProvider providerClass = ContentProviderManager.getInst()
- .getContentProvider(provider);
- if (providerClass == null)
- // content provider never created before, create it.
- providerClass = ContentProviderManager.getInst()
- .createContentProvider(provider, site);
-
- if (providerClass != null) {
- try {
- providerClass.createContent(provider.getId(), container,
- toolkit);
- } catch (Exception e) {
- Log.error(
- "Failed to create the content of Intro model content provider: " //$NON-NLS-1$
- + provider.getClassName(), e);
- // null provider.
- providerClass = null;
- }
- }
-
- if (providerClass == null) {
- // we failed to create a provider class, create the embedded text.
- IntroText text = provider.getIntroText();
- if (text != null)
- createText(container, text);
- }
- return container;
- }
-
- protected Control createSeparator(Composite parent, IntroSeparator sep) {
- String key = sep.getParentPage().getId()+".separator.fg"; //$NON-NLS-1$
- Color fg = styleManager.getColor(toolkit, key);
- //Composite l = toolkit.createCompositeSeparator(parent);
- Composite l = new Composite(parent, SWT.NULL);
- if (fg!=null)
- l.setBackground(fg);
- else
- l.setBackground(toolkit.getColors().getColor(IFormColors.SEPARATOR));
- TableWrapData td = new TableWrapData(TableWrapData.FILL,
- TableWrapData.FILL);
- td.grabHorizontal = true;
- td.maxHeight = 1;
- l.setLayoutData(td);
- return l;
- }
-
- private void colorControl(Control elementControl,
- AbstractBaseIntroElement element) {
- Color fg = styleManager.getColor(toolkit, element);
- if (fg != null)
- elementControl.setForeground(fg);
- Color bg = styleManager.getBackgrond(toolkit, element);
- if (bg != null)
- elementControl.setBackground(bg);
- }
-
-
- /*
- * creates form text on a formatted string. A formatted string is any string
- * that has a " <" in it. If it starts with a <p> then it is assumed that
- * the text if a proper UI forms formatted text. If not, the <p> tag is
- * added.
- */
- private String generateFormText(String text) {
- StringBuilder sbuf = new StringBuilder();
- sbuf.append("<form>"); //$NON-NLS-1$
- if (text.startsWith("<p>")) //$NON-NLS-1$
- sbuf.append(text);
- else {
- sbuf.append("<p>"); //$NON-NLS-1$
- sbuf.append(text);
- sbuf.append("</p>"); //$NON-NLS-1$
- }
- sbuf.append("</form>"); //$NON-NLS-1$
- return sbuf.toString();
- }
-
- /**
- * Will be only called for non formatted text.
- *
- * @param text
- * @return
- */
- private String generateBoldFormText(String text) {
- StringBuilder sbuf = new StringBuilder();
- sbuf.append("<form>"); //$NON-NLS-1$
- sbuf.append("<p>"); //$NON-NLS-1$
- sbuf.append("<b>"); //$NON-NLS-1$
- sbuf.append(text);
- sbuf.append("</b>"); //$NON-NLS-1$
- sbuf.append("</p>"); //$NON-NLS-1$
- sbuf.append("</form>"); //$NON-NLS-1$
- return sbuf.toString();
- }
-
- /**
- * Check the filter state of the element. Only base elements have the filter
- * attribute.
- *
- * @param element
- * @return
- */
- private boolean getFilterState(AbstractIntroElement element) {
- if (element.isOfType(AbstractIntroElement.BASE_ELEMENT))
- return ((AbstractBaseIntroElement) element).isFiltered();
- return false;
- }
+ linkText = generateFormText(linkText);
+ c = createFormText(parent, linkText, null);
+ }
+ if (c != null)
+ updateLayoutData(c, element);
+ break;
+ case AbstractIntroElement.CONTENT_PROVIDER:
+ IntroContentProvider provider = (IntroContentProvider) element;
+ c = createContentProvider(parent, provider);
+ updateLayoutData(c, element);
+ break;
+ case AbstractIntroElement.HR:
+ IntroSeparator sep = (IntroSeparator)element;
+ c = createSeparator(parent, sep);
+ updateLayoutData(c, element);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+
+ private void updateLayoutData(Control c, AbstractIntroElement element) {
+ TableWrapData currentTd = (TableWrapData) c.getLayoutData();
+ if (currentTd == null) {
+ currentTd = new TableWrapData(TableWrapData.FILL,
+ TableWrapData.FILL);
+ currentTd.grabHorizontal = true;
+ c.setLayoutData(currentTd);
+ }
+
+ currentTd.colspan = styleManager
+ .getColSpan((AbstractBaseIntroElement) element);
+ currentTd.rowspan = styleManager
+ .getRowSpan((AbstractBaseIntroElement) element);
+
+ }
+
+ private Composite createGroup(Composite parent, IntroGroup group) {
+ String label = group.getLabel();
+ String description = styleManager.getDescription(group);
+ boolean expandable = group.isExpandable();
+ boolean expanded = group.isExpanded();
+ Composite client = null;
+ Composite control = null;
+ if (description != null || label != null || expandable) {
+ int style = description != null ? Section.DESCRIPTION : SWT.NULL;
+ if (expandable)
+ style |= ExpandableComposite.TWISTIE | ExpandableComposite.FOCUS_TITLE | ExpandableComposite.CLIENT_INDENT;
+ if (expanded)
+ style |= ExpandableComposite.EXPANDED;
+ Section section = toolkit.createSection(parent, style);
+ if (label != null)
+ section.setText(label);
+ if (description != null)
+ section.setDescription(description);
+ colorControl(section, group);
+ client = toolkit.createComposite(section, SWT.WRAP);
+ section.setClient(client);
+ control = section;
+ } else {
+ client = toolkit.createComposite(parent, SWT.WRAP);
+ control = client;
+ }
+
+ TableWrapLayout layout = new TableWrapLayout();
+ int numColumns = styleManager.getNumberOfColumns(group);
+ numColumns = numColumns < 1 ? 1 : numColumns;
+ layout.numColumns = numColumns;
+ layout.makeColumnsEqualWidth = styleManager.getEqualWidth(group);
+ layout.verticalSpacing = styleManager.getVerticalSpacing(group);
+ layout.horizontalSpacing = styleManager.getHorizantalSpacing(group);
+ client.setLayout(layout);
+ // Util.highlight(client, SWT.COLOR_YELLOW);
+ return control;
+ }
+
+ /**
+ * Creates an Image Hyperlink from an IntroLink. Model object is NOT cached.
+ *
+ * @param body
+ * @param link
+ */
+ private Control createImageHyperlink(Composite parent, IntroLink link) {
+ Control control;
+ Hyperlink linkControl;
+ boolean showLinkDescription = styleManager.getShowLinkDescription();
+ Image linkImage = styleManager.getImage(link, "link-icon", //$NON-NLS-1$
+ ImageUtil.DEFAULT_LINK);
+
+ if (showLinkDescription && link.getText() != null) {
+ Composite container = toolkit.createComposite(parent);
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.leftMargin = layout.rightMargin = 0;
+ layout.topMargin = layout.bottomMargin = 0;
+ layout.verticalSpacing = 0;
+ layout.numColumns = 2;
+ container.setLayout(layout);
+
+ //Label ilabel = toolkit.createLabel(container, null);
+ ImageHyperlink ilabel = toolkit.createImageHyperlink(container, SWT.NULL);
+ ilabel.setImage(linkImage);
+ ilabel.setHoverImage(styleManager.getImage(link, "hover-icon", //$NON-NLS-1$
+ null));
+ ilabel.setHref(link.getUrl());
+ ilabel.addHyperlinkListener(hyperlinkAdapter);
+ TableWrapData td = new TableWrapData();
+ td.valign = TableWrapData.TOP;
+ td.rowspan = 2;
+ ilabel.setLayoutData(td);
+
+ linkControl = toolkit.createHyperlink(container, null, SWT.WRAP);
+ td = new TableWrapData(TableWrapData.LEFT, TableWrapData.BOTTOM);
+ td.grabVertical = true;
+ linkControl.setLayoutData(td);
+ // Util.highlight(linkControl, SWT.COLOR_RED);
+ // Util.highlight(container, SWT.COLOR_DARK_YELLOW);
+
+ Control desc = createText(container, link.getIntroText());
+ td = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
+ td.grabHorizontal = true;
+ td.grabVertical = true;
+ desc.setLayoutData(td);
+ control = container;
+ } else {
+ ImageHyperlink imageLink = toolkit.createImageHyperlink(parent,
+ SWT.WRAP | SWT.CENTER);
+ imageLink.setImage(linkImage);
+ imageLink.setHoverImage(styleManager.getImage(link, "hover-icon", //$NON-NLS-1$
+ null));
+ TableWrapData td = new TableWrapData();
+ td.grabHorizontal = true;
+ imageLink.setLayoutData(td);
+ linkControl = imageLink;
+ control = linkControl;
+ }
+ linkControl.setText(link.getLabel());
+ linkControl.setFont(PageStyleManager.getBannerFont());
+ colorControl(linkControl, link);
+ linkControl.setHref(link.getUrl());
+ linkControl.addHyperlinkListener(hyperlinkAdapter);
+ // Util.highlight(linkControl, SWT.COLOR_DARK_YELLOW);
+ return control;
+ }
+
+ /**
+ * Creates a forms Text or FormattedText.
+ *
+ * @param body
+ * @param link
+ */
+ protected Control createText(Composite parent, IntroText text) {
+ Color fg = styleManager.getColor(toolkit, text);
+ boolean isBold = styleManager.isBold(text);
+ // formatted case. If text is alredy formatted, the bold property is
+ // ignored.
+ if (text.isFormatted())
+ return createFormText(parent, generateFormText(text.getText()), fg);
+
+ // non formatted case.
+ if (isBold)
+ return createFormText(parent, generateBoldFormText(text.getText()),
+ fg);
+ return createText(parent, StringUtil.normalizeWhiteSpace(text.getText()), fg);
+ }
+
+ private Control createFormText(Composite parent, String text, Color fg) {
+ FormText formText = toolkit.createFormText(parent, false);
+ formText.addHyperlinkListener(hyperlinkAdapter);
+ try {
+ formText.setText(text, true, true);
+ } catch (SWTError e) {
+ Log.error(e.getMessage(), e);
+ return createText(parent, text, fg);
+ }
+ if (fg != null)
+ formText.setForeground(fg);
+ return formText;
+ }
+
+
+ private Control createText(Composite parent, String text, Color fg) {
+ Label label = toolkit.createLabel(parent, text, SWT.WRAP);
+ if (fg != null)
+ label.setForeground(fg);
+ return label;
+ }
+
+
+
+ protected Control createImage(Composite parent, IntroImage image) {
+ Label ilabel = null;
+ Image imageFile = styleManager.getImage(image);
+ if (imageFile != null) {
+ ilabel = toolkit.createLabel(parent, null, SWT.LEFT);
+ ilabel.setImage(imageFile);
+ if (image.getAlt() != null)
+ ilabel.setToolTipText(image.getAlt());
+ }
+ // for images, do not use default layout. Grab horizontal is not what we
+ // want.
+ if (ilabel!=null) {
+ TableWrapData td = new TableWrapData();
+ ilabel.setLayoutData(td);
+ }
+ return ilabel;
+ }
+
+ public Control createContentProvider(Composite parent,
+ IntroContentProvider provider) {
+ // If we've already loaded the content provider for this element,
+ // retrieve it, otherwise load the class.
+ // Create parent composite to hold dynamic content, and set layout
+ // accordingly.
+ Composite container = toolkit.createComposite(parent);
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.topMargin = 0;
+ layout.bottomMargin = 0;
+ layout.leftMargin = 0;
+ layout.rightMargin = 0;
+ container.setLayout(layout);
+ container.setData(provider);
+
+
+ IIntroContentProvider providerClass = ContentProviderManager.getInst()
+ .getContentProvider(provider);
+ if (providerClass == null)
+ // content provider never created before, create it.
+ providerClass = ContentProviderManager.getInst()
+ .createContentProvider(provider, site);
+
+ if (providerClass != null) {
+ try {
+ providerClass.createContent(provider.getId(), container,
+ toolkit);
+ } catch (Exception e) {
+ Log.error(
+ "Failed to create the content of Intro model content provider: " //$NON-NLS-1$
+ + provider.getClassName(), e);
+ // null provider.
+ providerClass = null;
+ }
+ }
+
+ if (providerClass == null) {
+ // we failed to create a provider class, create the embedded text.
+ IntroText text = provider.getIntroText();
+ if (text != null)
+ createText(container, text);
+ }
+ return container;
+ }
+
+ protected Control createSeparator(Composite parent, IntroSeparator sep) {
+ String key = sep.getParentPage().getId()+".separator.fg"; //$NON-NLS-1$
+ Color fg = styleManager.getColor(toolkit, key);
+ //Composite l = toolkit.createCompositeSeparator(parent);
+ Composite l = new Composite(parent, SWT.NULL);
+ if (fg!=null)
+ l.setBackground(fg);
+ else
+ l.setBackground(toolkit.getColors().getColor(IFormColors.SEPARATOR));
+ TableWrapData td = new TableWrapData(TableWrapData.FILL,
+ TableWrapData.FILL);
+ td.grabHorizontal = true;
+ td.maxHeight = 1;
+ l.setLayoutData(td);
+ return l;
+ }
+
+ private void colorControl(Control elementControl,
+ AbstractBaseIntroElement element) {
+ Color fg = styleManager.getColor(toolkit, element);
+ if (fg != null)
+ elementControl.setForeground(fg);
+ Color bg = styleManager.getBackgrond(toolkit, element);
+ if (bg != null)
+ elementControl.setBackground(bg);
+ }
+
+
+ /*
+ * creates form text on a formatted string. A formatted string is any string
+ * that has a " <" in it. If it starts with a <p> then it is assumed that
+ * the text if a proper UI forms formatted text. If not, the <p> tag is
+ * added.
+ */
+ private String generateFormText(String text) {
+ StringBuilder sbuf = new StringBuilder();
+ sbuf.append("<form>"); //$NON-NLS-1$
+ if (text.startsWith("<p>")) //$NON-NLS-1$
+ sbuf.append(text);
+ else {
+ sbuf.append("<p>"); //$NON-NLS-1$
+ sbuf.append(text);
+ sbuf.append("</p>"); //$NON-NLS-1$
+ }
+ sbuf.append("</form>"); //$NON-NLS-1$
+ return sbuf.toString();
+ }
+
+ /**
+ * Will be only called for non formatted text.
+ *
+ * @param text
+ * @return
+ */
+ private String generateBoldFormText(String text) {
+ StringBuilder sbuf = new StringBuilder();
+ sbuf.append("<form>"); //$NON-NLS-1$
+ sbuf.append("<p>"); //$NON-NLS-1$
+ sbuf.append("<b>"); //$NON-NLS-1$
+ sbuf.append(text);
+ sbuf.append("</b>"); //$NON-NLS-1$
+ sbuf.append("</p>"); //$NON-NLS-1$
+ sbuf.append("</form>"); //$NON-NLS-1$
+ return sbuf.toString();
+ }
+
+ /**
+ * Check the filter state of the element. Only base elements have the filter
+ * attribute.
+ *
+ * @param element
+ * @return
+ */
+ private boolean getFilterState(AbstractIntroElement element) {
+ if (element.isOfType(AbstractIntroElement.BASE_ELEMENT))
+ return ((AbstractBaseIntroElement) element).isFiltered();
+ return false;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/RootPageForm.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/RootPageForm.java
index cbd8c7289..683360d98 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/RootPageForm.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/RootPageForm.java
@@ -52,298 +52,298 @@ import org.eclipse.ui.intro.config.IIntroContentProviderSite;
*/
public class RootPageForm implements IIntroConstants {
- private FormToolkit toolkit;
- private IntroHomePage rootPage;
- private Form parentForm;
- protected Label descriptionLabel;
- private PageStyleManager rootPageStyleManager;
- private IIntroContentProviderSite site;
+ private FormToolkit toolkit;
+ private IntroHomePage rootPage;
+ private Form parentForm;
+ protected Label descriptionLabel;
+ private PageStyleManager rootPageStyleManager;
+ private IIntroContentProviderSite site;
private PageWidgetFactory factory;
- class PageComposite extends Composite {
+ class PageComposite extends Composite {
- public PageComposite(Composite parent, int style) {
- super(parent, style);
- }
+ public PageComposite(Composite parent, int style) {
+ super(parent, style);
+ }
- // Do not allow composite to take wHint as-is - layout manager
- // can reject the hint and compute larger width.
- @Override
+ // Do not allow composite to take wHint as-is - layout manager
+ // can reject the hint and compute larger width.
+ @Override
public Point computeSize(int wHint, int hHint, boolean changed) {
- return ((RootPageLayout) getLayout()).computeSize(this, wHint,
- hHint, changed);
- }
- }
+ return ((RootPageLayout) getLayout()).computeSize(this, wHint,
+ hHint, changed);
+ }
+ }
- class RootPageLayout extends Layout {
+ class RootPageLayout extends Layout {
- // gap between link composite and description label.
- private int VERTICAL_SPACING = 20;
+ // gap between link composite and description label.
+ private int VERTICAL_SPACING = 20;
- private int LABEL_MARGIN_WIDTH = 5;
+ private int LABEL_MARGIN_WIDTH = 5;
- /*
- * Custom layout for Root Page Composite.
- */
- @Override
+ /*
+ * Custom layout for Root Page Composite.
+ */
+ @Override
protected Point computeSize(Composite composite, int wHint, int hHint,
- boolean flushCache) {
- int innerWHint = wHint;
- if (wHint != SWT.DEFAULT)
- innerWHint -= LABEL_MARGIN_WIDTH + LABEL_MARGIN_WIDTH;
- Control[] children = composite.getChildren();
- Point s1 = children[0].computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point s2 = children[1].computeSize(innerWHint, SWT.DEFAULT);
- s2.x += LABEL_MARGIN_WIDTH;
- int height = 2 * (s2.y + VERTICAL_SPACING + s1.y / 2);
- Point size = new Point(Math.max(s1.x, s2.x), height + 5);
- return size;
- }
+ boolean flushCache) {
+ int innerWHint = wHint;
+ if (wHint != SWT.DEFAULT)
+ innerWHint -= LABEL_MARGIN_WIDTH + LABEL_MARGIN_WIDTH;
+ Control[] children = composite.getChildren();
+ Point s1 = children[0].computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point s2 = children[1].computeSize(innerWHint, SWT.DEFAULT);
+ s2.x += LABEL_MARGIN_WIDTH;
+ int height = 2 * (s2.y + VERTICAL_SPACING + s1.y / 2);
+ Point size = new Point(Math.max(s1.x, s2.x), height + 5);
+ return size;
+ }
- @Override
+ @Override
protected void layout(Composite composite, boolean flushCache) {
- Control[] children = composite.getChildren();
- Rectangle carea = composite.getClientArea();
- Control content = children[0];
- Control label = children[1];
- Point contentSize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point labelSize = label.computeSize(carea.width - 2
- - LABEL_MARGIN_WIDTH * 2, SWT.DEFAULT);
- content.setBounds(carea.width / 2 - contentSize.x / 2, carea.height
- / 2 - contentSize.y / 2, contentSize.x, contentSize.y);
- label.setBounds(LABEL_MARGIN_WIDTH, content.getLocation().y
- + contentSize.y + VERTICAL_SPACING, carea.width
- - LABEL_MARGIN_WIDTH * 2, labelSize.y);
- }
- }
+ Control[] children = composite.getChildren();
+ Rectangle carea = composite.getClientArea();
+ Control content = children[0];
+ Control label = children[1];
+ Point contentSize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point labelSize = label.computeSize(carea.width - 2
+ - LABEL_MARGIN_WIDTH * 2, SWT.DEFAULT);
+ content.setBounds(carea.width / 2 - contentSize.x / 2, carea.height
+ / 2 - contentSize.y / 2, contentSize.x, contentSize.y);
+ label.setBounds(LABEL_MARGIN_WIDTH, content.getLocation().y
+ + contentSize.y + VERTICAL_SPACING, carea.width
+ - LABEL_MARGIN_WIDTH * 2, labelSize.y);
+ }
+ }
- private HyperlinkAdapter hyperlinkAdapter = new HyperlinkAdapter() {
+ private HyperlinkAdapter hyperlinkAdapter = new HyperlinkAdapter() {
- @Override
+ @Override
public void linkActivated(HyperlinkEvent e) {
- ImageHyperlink imageLink = (ImageHyperlink) e.getSource();
- IntroLink introLink = (IntroLink) imageLink.getData(INTRO_LINK);
- IntroURLParser parser = new IntroURLParser(introLink.getUrl());
- if (parser.hasIntroUrl()) {
- // execute the action embedded in the IntroURL
- parser.getIntroURL().execute();
- return;
- } else if (parser.hasProtocol()) {
- Util.openBrowser(introLink.getUrl());
- return;
- }
- DialogUtil.displayInfoMessage(imageLink.getShell(),
- Messages.HyperlinkAdapter_urlIs + introLink.getUrl());
- }
+ ImageHyperlink imageLink = (ImageHyperlink) e.getSource();
+ IntroLink introLink = (IntroLink) imageLink.getData(INTRO_LINK);
+ IntroURLParser parser = new IntroURLParser(introLink.getUrl());
+ if (parser.hasIntroUrl()) {
+ // execute the action embedded in the IntroURL
+ parser.getIntroURL().execute();
+ return;
+ } else if (parser.hasProtocol()) {
+ Util.openBrowser(introLink.getUrl());
+ return;
+ }
+ DialogUtil.displayInfoMessage(imageLink.getShell(),
+ Messages.HyperlinkAdapter_urlIs + introLink.getUrl());
+ }
- @Override
+ @Override
public void linkEntered(HyperlinkEvent e) {
- ImageHyperlink imageLink = (ImageHyperlink) e.getSource();
- IntroLink introLink = (IntroLink) imageLink.getData(INTRO_LINK);
- updateDescription(introLink.getText());
- }
+ ImageHyperlink imageLink = (ImageHyperlink) e.getSource();
+ IntroLink introLink = (IntroLink) imageLink.getData(INTRO_LINK);
+ updateDescription(introLink.getText());
+ }
- @Override
+ @Override
public void linkExited(HyperlinkEvent e) {
- // empty text on exit.
- updateDescription(""); //$NON-NLS-1$
- }
+ // empty text on exit.
+ updateDescription(""); //$NON-NLS-1$
+ }
- private void updateDescription(String text) {
- if (text == null)
- text = ""; //$NON-NLS-1$
- descriptionLabel.setText(text);
- descriptionLabel.getParent().layout();
- }
- };
+ private void updateDescription(String text) {
+ if (text == null)
+ text = ""; //$NON-NLS-1$
+ descriptionLabel.setText(text);
+ descriptionLabel.getParent().layout();
+ }
+ };
- /**
- *
- */
- public RootPageForm(FormToolkit toolkit, IntroModelRoot modelRoot,
- Form parentForm) {
- this.toolkit = toolkit;
- this.rootPage = modelRoot.getRootPage();
- this.parentForm = parentForm;
- }
+ /**
+ *
+ */
+ public RootPageForm(FormToolkit toolkit, IntroModelRoot modelRoot,
+ Form parentForm) {
+ this.toolkit = toolkit;
+ this.rootPage = modelRoot.getRootPage();
+ this.parentForm = parentForm;
+ }
- /**
- * Create the form for the root page. Number of columns there is equal to
- * the number of links.
- *
- * @param pageBook
- */
- public void createPartControl(ScrolledPageBook mainPageBook,
- SharedStyleManager shardStyleManager) {
- // first, create the root page style manager from shared style manager.
- rootPageStyleManager = new PageStyleManager(rootPage, shardStyleManager
- .getProperties());
+ /**
+ * Create the form for the root page. Number of columns there is equal to
+ * the number of links.
+ *
+ * @param pageBook
+ */
+ public void createPartControl(ScrolledPageBook mainPageBook,
+ SharedStyleManager shardStyleManager) {
+ // first, create the root page style manager from shared style manager.
+ rootPageStyleManager = new PageStyleManager(rootPage, shardStyleManager
+ .getProperties());
- // Set title of Main form from root page title.
- parentForm.setText(rootPage.getTitle());
+ // Set title of Main form from root page title.
+ parentForm.setText(rootPage.getTitle());
- // Composite for full root page. It has custom layout, and two
- // children: the content composite and the description label.
- Composite rootPageComposite = new PageComposite(mainPageBook
- .getContainer(), SWT.NULL);
- toolkit.adapt(rootPageComposite);
+ // Composite for full root page. It has custom layout, and two
+ // children: the content composite and the description label.
+ Composite rootPageComposite = new PageComposite(mainPageBook
+ .getContainer(), SWT.NULL);
+ toolkit.adapt(rootPageComposite);
- mainPageBook.registerPage(rootPage.getId(), rootPageComposite);
- rootPageComposite.setLayout(new RootPageLayout());
- // Util.highlight(pageComposite, SWT.COLOR_DARK_CYAN);
+ mainPageBook.registerPage(rootPage.getId(), rootPageComposite);
+ rootPageComposite.setLayout(new RootPageLayout());
+ // Util.highlight(pageComposite, SWT.COLOR_DARK_CYAN);
- // create the contents composite in the center of the root page.
- createRootPageContent(rootPageComposite);
+ // create the contents composite in the center of the root page.
+ createRootPageContent(rootPageComposite);
- // create description label for links description.
- descriptionLabel = createHoverLabel(rootPageComposite);
+ // create description label for links description.
+ descriptionLabel = createHoverLabel(rootPageComposite);
- // Clear memory. No need for style manager any more.
- rootPageStyleManager = null;
- }
+ // Clear memory. No need for style manager any more.
+ rootPageStyleManager = null;
+ }
- /**
- * Creates content of the root page.
- */
- private void createRootPageContent(Composite rootPageComposite) {
- // setup page composite/layout
- Composite contentComposite = toolkit.createComposite(rootPageComposite);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- contentComposite.setLayoutData(gd);
- AbstractIntroElement[] children = (AbstractIntroElement[]) rootPage
- .getChildrenOfType(AbstractIntroElement.GROUP
- | AbstractIntroElement.LINK | AbstractIntroElement.CONTENT_PROVIDER);
- int numChildren = children.length;
- GridLayout layout = new GridLayout();
- // separate links a bit more.
- layout.horizontalSpacing = rootPageStyleManager
- .getPageHorizantalSpacing();
- layout.verticalSpacing = rootPageStyleManager.getPageVerticalSpacing();
- // set number of columns.
- int numColumns = rootPageStyleManager.getPageNumberOfColumns();
- numColumns = numColumns == 0 ? numChildren : numColumns;
- layout.numColumns = numColumns;
- layout.horizontalSpacing = rootPageStyleManager
- .getPageHorizantalSpacing();
- layout.verticalSpacing = rootPageStyleManager.getPageVerticalSpacing();
- contentComposite.setLayout(layout);
- for (int i = 0; i < children.length; i++) {
- if (((AbstractBaseIntroElement) children[i]).isFiltered())
- continue;
- if (children[i].getType() == AbstractIntroElement.GROUP)
- createGroupContent(contentComposite, (IntroGroup) children[i]);
- else if (children[i].getType() == AbstractIntroElement.LINK)
- createImageHyperlink(contentComposite, (IntroLink) children[i]);
- else if (children[i].getType() == AbstractIntroElement.CONTENT_PROVIDER)
- createContentProvider(contentComposite, (IntroContentProvider)children[i]);
- }
- }
+ /**
+ * Creates content of the root page.
+ */
+ private void createRootPageContent(Composite rootPageComposite) {
+ // setup page composite/layout
+ Composite contentComposite = toolkit.createComposite(rootPageComposite);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
+ contentComposite.setLayoutData(gd);
+ AbstractIntroElement[] children = (AbstractIntroElement[]) rootPage
+ .getChildrenOfType(AbstractIntroElement.GROUP
+ | AbstractIntroElement.LINK | AbstractIntroElement.CONTENT_PROVIDER);
+ int numChildren = children.length;
+ GridLayout layout = new GridLayout();
+ // separate links a bit more.
+ layout.horizontalSpacing = rootPageStyleManager
+ .getPageHorizantalSpacing();
+ layout.verticalSpacing = rootPageStyleManager.getPageVerticalSpacing();
+ // set number of columns.
+ int numColumns = rootPageStyleManager.getPageNumberOfColumns();
+ numColumns = numColumns == 0 ? numChildren : numColumns;
+ layout.numColumns = numColumns;
+ layout.horizontalSpacing = rootPageStyleManager
+ .getPageHorizantalSpacing();
+ layout.verticalSpacing = rootPageStyleManager.getPageVerticalSpacing();
+ contentComposite.setLayout(layout);
+ for (int i = 0; i < children.length; i++) {
+ if (((AbstractBaseIntroElement) children[i]).isFiltered())
+ continue;
+ if (children[i].getType() == AbstractIntroElement.GROUP)
+ createGroupContent(contentComposite, (IntroGroup) children[i]);
+ else if (children[i].getType() == AbstractIntroElement.LINK)
+ createImageHyperlink(contentComposite, (IntroLink) children[i]);
+ else if (children[i].getType() == AbstractIntroElement.CONTENT_PROVIDER)
+ createContentProvider(contentComposite, (IntroContentProvider)children[i]);
+ }
+ }
- /**
- * Creates content of the root page.
- */
- private void createGroupContent(Composite parent, IntroGroup group) {
- AbstractIntroElement[] children = (AbstractIntroElement[]) group
- .getChildrenOfType(AbstractIntroElement.GROUP
- | AbstractIntroElement.LINK |
- AbstractIntroElement.CONTENT_PROVIDER);
- int numChildren = children.length;
- // setup page composite/layout
- Composite contentComposite = toolkit.createComposite(parent);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- gd.horizontalSpan = rootPageStyleManager.getColSpan(group);
- gd.verticalSpan = rootPageStyleManager.getRowSpan(group);
- contentComposite.setLayoutData(gd);
- GridLayout layout = new GridLayout();
- // separate links a bit more.
- layout.horizontalSpacing = 20;
- // set number of columns.
- int numColumns = rootPageStyleManager.getNumberOfColumns(group);
- numColumns = numColumns < 1 ? numChildren : numColumns;
- layout.numColumns = numColumns;
- layout.verticalSpacing = rootPageStyleManager.getVerticalSpacing(group);
- layout.horizontalSpacing = rootPageStyleManager
- .getHorizantalSpacing(group);
- contentComposite.setLayout(layout);
- for (int i = 0; i < children.length; i++) {
- if (((AbstractBaseIntroElement) children[i]).isFiltered())
- continue;
- if (children[i].getType() == AbstractIntroElement.GROUP)
- createGroupContent(contentComposite, (IntroGroup) children[i]);
- else if (children[i].getType() == AbstractIntroElement.LINK)
- createImageHyperlink(contentComposite, (IntroLink) children[i]);
- else if (children[i].getType() == AbstractIntroElement.CONTENT_PROVIDER)
- createContentProvider(contentComposite, (IntroContentProvider)children[i]);
- }
- }
+ /**
+ * Creates content of the root page.
+ */
+ private void createGroupContent(Composite parent, IntroGroup group) {
+ AbstractIntroElement[] children = (AbstractIntroElement[]) group
+ .getChildrenOfType(AbstractIntroElement.GROUP
+ | AbstractIntroElement.LINK |
+ AbstractIntroElement.CONTENT_PROVIDER);
+ int numChildren = children.length;
+ // setup page composite/layout
+ Composite contentComposite = toolkit.createComposite(parent);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
+ gd.horizontalSpan = rootPageStyleManager.getColSpan(group);
+ gd.verticalSpan = rootPageStyleManager.getRowSpan(group);
+ contentComposite.setLayoutData(gd);
+ GridLayout layout = new GridLayout();
+ // separate links a bit more.
+ layout.horizontalSpacing = 20;
+ // set number of columns.
+ int numColumns = rootPageStyleManager.getNumberOfColumns(group);
+ numColumns = numColumns < 1 ? numChildren : numColumns;
+ layout.numColumns = numColumns;
+ layout.verticalSpacing = rootPageStyleManager.getVerticalSpacing(group);
+ layout.horizontalSpacing = rootPageStyleManager
+ .getHorizantalSpacing(group);
+ contentComposite.setLayout(layout);
+ for (int i = 0; i < children.length; i++) {
+ if (((AbstractBaseIntroElement) children[i]).isFiltered())
+ continue;
+ if (children[i].getType() == AbstractIntroElement.GROUP)
+ createGroupContent(contentComposite, (IntroGroup) children[i]);
+ else if (children[i].getType() == AbstractIntroElement.LINK)
+ createImageHyperlink(contentComposite, (IntroLink) children[i]);
+ else if (children[i].getType() == AbstractIntroElement.CONTENT_PROVIDER)
+ createContentProvider(contentComposite, (IntroContentProvider)children[i]);
+ }
+ }
- /**
- * Creates an Image Hyperlink from an IntroLink. Model object is cached in
- * link.
- *
- * @param body
- * @param link
- */
- private void createImageHyperlink(Composite parent, IntroLink link) {
- // create the container composite that will hold the imageHyperLink and
- // the label for the description.
- Composite container = toolkit.createComposite(parent);
- // Util.highlight(container, SWT.COLOR_CYAN);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- gd.horizontalSpan = rootPageStyleManager.getColSpan(link);
- gd.verticalSpan = rootPageStyleManager.getRowSpan(link);
- container.setLayoutData(gd);
+ /**
+ * Creates an Image Hyperlink from an IntroLink. Model object is cached in
+ * link.
+ *
+ * @param body
+ * @param link
+ */
+ private void createImageHyperlink(Composite parent, IntroLink link) {
+ // create the container composite that will hold the imageHyperLink and
+ // the label for the description.
+ Composite container = toolkit.createComposite(parent);
+ // Util.highlight(container, SWT.COLOR_CYAN);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
+ gd.horizontalSpan = rootPageStyleManager.getColSpan(link);
+ gd.verticalSpan = rootPageStyleManager.getRowSpan(link);
+ container.setLayoutData(gd);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- container.setLayout(layout);
- ImageHyperlink imageLink = toolkit.createImageHyperlink(container,
- SWT.NULL);
- imageLink.setImage(rootPageStyleManager.getImage(link, "link-icon", //$NON-NLS-1$
- ImageUtil.DEFAULT_ROOT_LINK));
- imageLink.setHoverImage(rootPageStyleManager.getImage(link,
- "hover-icon", null)); //$NON-NLS-1$
- // each link is centered in cell.
- gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- imageLink.setLayoutData(gd);
- // cache the intro link model object for description and URL.
- imageLink.setData(INTRO_LINK, link);
- imageLink.addHyperlinkListener(hyperlinkAdapter);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ container.setLayout(layout);
+ ImageHyperlink imageLink = toolkit.createImageHyperlink(container,
+ SWT.NULL);
+ imageLink.setImage(rootPageStyleManager.getImage(link, "link-icon", //$NON-NLS-1$
+ ImageUtil.DEFAULT_ROOT_LINK));
+ imageLink.setHoverImage(rootPageStyleManager.getImage(link,
+ "hover-icon", null)); //$NON-NLS-1$
+ // each link is centered in cell.
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
+ imageLink.setLayoutData(gd);
+ // cache the intro link model object for description and URL.
+ imageLink.setData(INTRO_LINK, link);
+ imageLink.addHyperlinkListener(hyperlinkAdapter);
- // description label.
- Label linkLabel = toolkit.createLabel(container, link.getLabel());
- gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
- linkLabel.setFont(PageStyleManager.getBannerFont());
- linkLabel.setLayoutData(gd);
- }
+ // description label.
+ Label linkLabel = toolkit.createLabel(container, link.getLabel());
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
+ linkLabel.setFont(PageStyleManager.getBannerFont());
+ linkLabel.setLayoutData(gd);
+ }
- /**
- * Creates a label to display the link description when you hover over a
- * hyperlink.
- *
- * @param body
- */
- private Label createHoverLabel(Composite body) {
- Label label = toolkit.createLabel(body, "", SWT.WRAP); //$NON-NLS-1$
- String key = StringUtil.concat(rootPage.getId(), ".", "hover-text.fg"); //$NON-NLS-1$ //$NON-NLS-2$
- Color fg = rootPageStyleManager.getColor(toolkit, key);
- if (fg == null)
- fg = toolkit.getColors().getColor(IFormColors.TITLE);
- label.setForeground(fg);
- label.setAlignment(SWT.CENTER);
- label.setFont(PageStyleManager.getBannerFont());
- return label;
- }
+ /**
+ * Creates a label to display the link description when you hover over a
+ * hyperlink.
+ *
+ * @param body
+ */
+ private Label createHoverLabel(Composite body) {
+ Label label = toolkit.createLabel(body, "", SWT.WRAP); //$NON-NLS-1$
+ String key = StringUtil.concat(rootPage.getId(), ".", "hover-text.fg"); //$NON-NLS-1$ //$NON-NLS-2$
+ Color fg = rootPageStyleManager.getColor(toolkit, key);
+ if (fg == null)
+ fg = toolkit.getColors().getColor(IFormColors.TITLE);
+ label.setForeground(fg);
+ label.setAlignment(SWT.CENTER);
+ label.setFont(PageStyleManager.getBannerFont());
+ return label;
+ }
- private void createContentProvider(Composite parent, IntroContentProvider providerElement) {
- if (factory==null) {
- factory = new PageWidgetFactory(toolkit, rootPageStyleManager);
- factory.setContentProviderSite(site);
- }
- factory.createContentProvider(parent, providerElement);
- }
- public void setContentProviderSite(IIntroContentProviderSite site) {
- this.site = site;
- }
+ private void createContentProvider(Composite parent, IntroContentProvider providerElement) {
+ if (factory==null) {
+ factory = new PageWidgetFactory(toolkit, rootPageStyleManager);
+ factory.setContentProviderSite(site);
+ }
+ factory.createContentProvider(parent, providerElement);
+ }
+ public void setContentProviderSite(IIntroContentProviderSite site) {
+ this.site = site;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/SharedStyleManager.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/SharedStyleManager.java
index 5dcfcb22e..301c3a8c5 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/SharedStyleManager.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/swt/SharedStyleManager.java
@@ -31,205 +31,205 @@ import org.osgi.framework.Bundle;
public class SharedStyleManager {
- protected Properties properties;
- protected StyleContext context;
-
- class StyleContext {
- IPath path;
- Bundle bundle;
- boolean inTheme;
- }
-
- SharedStyleManager() {
- // no-op
- }
-
- /**
- * Constructor used when shared styles need to be loaded. The bundle is
- * retrieved from the model root.
- *
- * @param modelRoot
- */
- public SharedStyleManager(IntroModelRoot modelRoot) {
- context = new StyleContext();
- context.bundle = modelRoot.getBundle();
- properties = new Properties();
- String [] sharedStyles = modelRoot.getPresentation()
- .getImplementationStyles();
- if (sharedStyles != null) {
- for (int i=0; i<sharedStyles.length; i++)
- load(properties, sharedStyles[i], context);
- }
- }
-
- protected void load(Properties properties, String style, StyleContext context) {
- if (style == null)
- return;
- try {
- URL styleURL = new URL(style);
- try (InputStream is = styleURL.openStream()) {
- properties.load(is);
- }
- context.path = new Path(style).removeLastSegments(1);
- String t = (String)properties.get("theme"); //$NON-NLS-1$
- if (t!=null && t.trim().equalsIgnoreCase("true")) //$NON-NLS-1$
- context.inTheme = true;
- } catch (Exception e) {
- Log.error("Could not load SWT style: " + style, e); //$NON-NLS-1$
- }
- }
-
-
- /**
- * Get the property from the shared properties.
- *
- * @param key
- * @return
- */
- public String getProperty(String key) {
- return doGetProperty(properties, key);
- }
-
- /*
- * Utility method to trim properties retrieval.
- */
- protected String doGetProperty(Properties aProperties, String key) {
- String value = aProperties.getProperty(key);
- if (value != null)
- // trim the properties as trailing balnnks cause problems.
- value = value.trim();
- return value;
- }
-
-
- protected RGB getRGB(String key) {
- String value = getProperty(key);
- if (value == null)
- return null;
- return parseRGB(value);
- }
-
- /**
- * A utility method that creates RGB object from a value encoded in the
- * following format: #rrggbb, where r, g and b are hex color values in the
- * range from 00 to ff.
- *
- * @param value
- * @return
- */
-
- public static RGB parseRGB(String value) {
- if (value.charAt(0) == '#') {
- // HEX
- try {
- int r = Integer.parseInt(value.substring(1, 3), 16);
- int g = Integer.parseInt(value.substring(3, 5), 16);
- int b = Integer.parseInt(value.substring(5, 7), 16);
- return new RGB(r, g, b);
- } catch (NumberFormatException e) {
- Log.error("Failed to parser: " + value + " as an integer", e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return null;
- }
-
-
-
- /**
- * Finds the bundle from which this key was loaded. This is the bundle from
- * which shared styles where loaded.
- *
- * @param key
- * @return
- */
- protected Bundle getAssociatedBundle(String key) {
- return context.bundle;
- }
-
- protected StyleContext getAssociatedContext(String key) {
- return context;
- }
-
-
-
- /**
- * @return Returns the properties.
- */
- public Properties getProperties() {
- return properties;
- }
-
-
- /**
- *
- *
- * @param toolkit
- * @param key
- * @return color. May return null.
- */
- public Color getColor(FormToolkit toolkit, String key) {
- FormColors colors = toolkit.getColors();
- Color color = colors.getColor(key);
- if (color == null) {
- RGB rgb = getRGB(key);
- if (rgb != null)
- color = colors.createColor(key, rgb);
- }
- return color;
- }
-
-
-
- /**
- * Retrieve an image from this page's properties, given a key.
- *
- * @param key
- * @param defaultPageKey
- * @param defaultKey
- * @return
- */
- public Image getImage(String key, String defaultPageKey, String defaultKey) {
- String currentKey = key;
- String value = getProperty(currentKey);
- if (value == null && defaultPageKey != null) {
- currentKey = defaultPageKey;
- value = getProperty(defaultPageKey);
- }
- if (value != null) {
- if (ImageUtil.hasImage(currentKey))
- return ImageUtil.getImage(currentKey);
- // try to register the image.
- StyleContext ccontext = getAssociatedContext(currentKey);
- if (ccontext.inTheme) {
- // if 'theme' key is set, load image
- // relative to the file, not relative to the bundle
- ImageUtil.registerImage(currentKey, ccontext.path, value);
- }
- else {
- Bundle bundle = ccontext.bundle;
- if (bundle == null)
- // it means that we are getting a key defined in this page's
- // styles. (ie: not an inherited style).
- bundle = this.context.bundle;
- ImageUtil.registerImage(currentKey, bundle, value);
- }
- Image image = ImageUtil.getImage(currentKey);
- if (image != null)
- return image;
- }
- // try default. We know default is already registered,
- if (defaultKey != null)
- return ImageUtil.getImage(defaultKey);
- return null;
- }
-
-
- public boolean useCustomHomePagelayout() {
- String key = "home-page-custom-layout"; //$NON-NLS-1$
- String value = getProperty(key);
- if (value == null)
- value = "true"; //$NON-NLS-1$
- return value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
+ protected Properties properties;
+ protected StyleContext context;
+
+ class StyleContext {
+ IPath path;
+ Bundle bundle;
+ boolean inTheme;
+ }
+
+ SharedStyleManager() {
+ // no-op
+ }
+
+ /**
+ * Constructor used when shared styles need to be loaded. The bundle is
+ * retrieved from the model root.
+ *
+ * @param modelRoot
+ */
+ public SharedStyleManager(IntroModelRoot modelRoot) {
+ context = new StyleContext();
+ context.bundle = modelRoot.getBundle();
+ properties = new Properties();
+ String [] sharedStyles = modelRoot.getPresentation()
+ .getImplementationStyles();
+ if (sharedStyles != null) {
+ for (int i=0; i<sharedStyles.length; i++)
+ load(properties, sharedStyles[i], context);
+ }
+ }
+
+ protected void load(Properties properties, String style, StyleContext context) {
+ if (style == null)
+ return;
+ try {
+ URL styleURL = new URL(style);
+ try (InputStream is = styleURL.openStream()) {
+ properties.load(is);
+ }
+ context.path = new Path(style).removeLastSegments(1);
+ String t = (String)properties.get("theme"); //$NON-NLS-1$
+ if (t!=null && t.trim().equalsIgnoreCase("true")) //$NON-NLS-1$
+ context.inTheme = true;
+ } catch (Exception e) {
+ Log.error("Could not load SWT style: " + style, e); //$NON-NLS-1$
+ }
+ }
+
+
+ /**
+ * Get the property from the shared properties.
+ *
+ * @param key
+ * @return
+ */
+ public String getProperty(String key) {
+ return doGetProperty(properties, key);
+ }
+
+ /*
+ * Utility method to trim properties retrieval.
+ */
+ protected String doGetProperty(Properties aProperties, String key) {
+ String value = aProperties.getProperty(key);
+ if (value != null)
+ // trim the properties as trailing balnnks cause problems.
+ value = value.trim();
+ return value;
+ }
+
+
+ protected RGB getRGB(String key) {
+ String value = getProperty(key);
+ if (value == null)
+ return null;
+ return parseRGB(value);
+ }
+
+ /**
+ * A utility method that creates RGB object from a value encoded in the
+ * following format: #rrggbb, where r, g and b are hex color values in the
+ * range from 00 to ff.
+ *
+ * @param value
+ * @return
+ */
+
+ public static RGB parseRGB(String value) {
+ if (value.charAt(0) == '#') {
+ // HEX
+ try {
+ int r = Integer.parseInt(value.substring(1, 3), 16);
+ int g = Integer.parseInt(value.substring(3, 5), 16);
+ int b = Integer.parseInt(value.substring(5, 7), 16);
+ return new RGB(r, g, b);
+ } catch (NumberFormatException e) {
+ Log.error("Failed to parser: " + value + " as an integer", e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return null;
+ }
+
+
+
+ /**
+ * Finds the bundle from which this key was loaded. This is the bundle from
+ * which shared styles where loaded.
+ *
+ * @param key
+ * @return
+ */
+ protected Bundle getAssociatedBundle(String key) {
+ return context.bundle;
+ }
+
+ protected StyleContext getAssociatedContext(String key) {
+ return context;
+ }
+
+
+
+ /**
+ * @return Returns the properties.
+ */
+ public Properties getProperties() {
+ return properties;
+ }
+
+
+ /**
+ *
+ *
+ * @param toolkit
+ * @param key
+ * @return color. May return null.
+ */
+ public Color getColor(FormToolkit toolkit, String key) {
+ FormColors colors = toolkit.getColors();
+ Color color = colors.getColor(key);
+ if (color == null) {
+ RGB rgb = getRGB(key);
+ if (rgb != null)
+ color = colors.createColor(key, rgb);
+ }
+ return color;
+ }
+
+
+
+ /**
+ * Retrieve an image from this page's properties, given a key.
+ *
+ * @param key
+ * @param defaultPageKey
+ * @param defaultKey
+ * @return
+ */
+ public Image getImage(String key, String defaultPageKey, String defaultKey) {
+ String currentKey = key;
+ String value = getProperty(currentKey);
+ if (value == null && defaultPageKey != null) {
+ currentKey = defaultPageKey;
+ value = getProperty(defaultPageKey);
+ }
+ if (value != null) {
+ if (ImageUtil.hasImage(currentKey))
+ return ImageUtil.getImage(currentKey);
+ // try to register the image.
+ StyleContext ccontext = getAssociatedContext(currentKey);
+ if (ccontext.inTheme) {
+ // if 'theme' key is set, load image
+ // relative to the file, not relative to the bundle
+ ImageUtil.registerImage(currentKey, ccontext.path, value);
+ }
+ else {
+ Bundle bundle = ccontext.bundle;
+ if (bundle == null)
+ // it means that we are getting a key defined in this page's
+ // styles. (ie: not an inherited style).
+ bundle = this.context.bundle;
+ ImageUtil.registerImage(currentKey, bundle, value);
+ }
+ Image image = ImageUtil.getImage(currentKey);
+ if (image != null)
+ return image;
+ }
+ // try default. We know default is already registered,
+ if (defaultKey != null)
+ return ImageUtil.getImage(defaultKey);
+ return null;
+ }
+
+
+ public boolean useCustomHomePagelayout() {
+ String key = "home-page-custom-layout"; //$NON-NLS-1$
+ String value = getProperty(key);
+ if (value == null)
+ value = "true"; //$NON-NLS-1$
+ return value.equalsIgnoreCase("true"); //$NON-NLS-1$
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/DialogUtil.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/DialogUtil.java
index 798a324e5..663f7ca4c 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/DialogUtil.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/DialogUtil.java
@@ -32,126 +32,126 @@ import org.eclipse.ui.internal.intro.impl.Messages;
public class DialogUtil {
- /**
- * Displays core error dialog with a message from the Core error status
- * object, and a user message. <br>
- * The user message is logged using Log.logError().
- */
- public static void displayCoreErrorDialog(Shell parent, String msg,
- CoreException coreEx) {
-
- if (msg == null)
- msg = coreEx.getMessage();
- String title = Messages.MessageDialog_errorTitle;
- if (parent == null)
- parent = getActiveShell();
- IStatus status = coreEx.getStatus();
- ErrorDialog.openError(parent, title, msg, status);
- Log.error(msg, coreEx);
- }
-
- /**
- * Displays error dialog with the given message. <br>
- */
- public static void displayErrorMessage(Shell parent, String msg,
- Throwable ex) {
- String title = Messages.MessageDialog_errorTitle;
- if (parent == null)
- parent = getActiveShell();
- MessageDialog.openError(parent, title, msg);
- Log.error(msg, ex);
- }
-
-
- /**
- * Displays error dialog with a message. <br>
- * The user message is formatted with the passed variables. Also logs the
- * error using Log.logError().
- */
- public static void displayErrorMessage(Shell parent, String msg,
- Object[] variables, Throwable ex) {
- if (msg == null)
- return;
- if (variables != null)
- msg = NLS.bind(msg, variables);
- displayErrorMessage(parent, msg, ex);
- }
-
- /**
- * Displays warning dialog with a given message. <br>
- * also logs the info using Log.logWarning(). msg error message to display
- * and log.
- */
- public static void displayWarningMessage(Shell parent, String msg) {
- String title = Messages.MessageDialog_warningTitle;
- if (parent == null)
- parent = getActiveShell();
- MessageDialog.openWarning(parent, title, msg);
- Log.warning(msg);
- }
-
- /**
- * Displays warning dialog with a message. <br>
- * also logs the info using Log.logWarning().
- */
- public static void displayWarningMessage(Shell parent, String msg,
- Object[] variables) {
- if (msg == null)
- return;
- if (variables != null)
- msg = NLS.bind(msg, variables);
- displayWarningMessage(parent, msg);
- }
-
- /**
- * Displays info dialog with a message. Also logs the info using
- * Log.logInfo().
- */
- public static void displayInfoMessage(Shell parent, String msg) {
- String title = Messages.MessageDialog_infoTitle;
- if (parent == null)
- parent = getActiveShell();
- MessageDialog.openInformation(parent, title, msg);
- Log.info(msg);
-
- }
-
- /**
- * Displays info dialog with a message. Also logs the info using
- * Log.logInfo().
- */
- public static void displayInfoMessage(Shell parent, String msg,
- Object[] variables) {
- if (msg == null)
- return;
- if (variables != null)
- msg = NLS.bind(msg, variables);
- displayInfoMessage(parent, msg);
- }
-
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- }
-
- /**
- * Utility method to best find the active shell.
- */
- public static Shell getActiveShell() {
- Display display = getCurrentDisplay();
- Shell activeShell = display.getActiveShell();
- if (activeShell == null)
- return getActiveWorkbenchWindow().getShell();
- return activeShell;
- }
-
- /**
- * Utility method to best find the active Display.
- */
- public static Display getCurrentDisplay() {
- Display display = Display.getCurrent();
- if (display != null)
- return display;
- return Display.getDefault();
- }
+ /**
+ * Displays core error dialog with a message from the Core error status
+ * object, and a user message. <br>
+ * The user message is logged using Log.logError().
+ */
+ public static void displayCoreErrorDialog(Shell parent, String msg,
+ CoreException coreEx) {
+
+ if (msg == null)
+ msg = coreEx.getMessage();
+ String title = Messages.MessageDialog_errorTitle;
+ if (parent == null)
+ parent = getActiveShell();
+ IStatus status = coreEx.getStatus();
+ ErrorDialog.openError(parent, title, msg, status);
+ Log.error(msg, coreEx);
+ }
+
+ /**
+ * Displays error dialog with the given message. <br>
+ */
+ public static void displayErrorMessage(Shell parent, String msg,
+ Throwable ex) {
+ String title = Messages.MessageDialog_errorTitle;
+ if (parent == null)
+ parent = getActiveShell();
+ MessageDialog.openError(parent, title, msg);
+ Log.error(msg, ex);
+ }
+
+
+ /**
+ * Displays error dialog with a message. <br>
+ * The user message is formatted with the passed variables. Also logs the
+ * error using Log.logError().
+ */
+ public static void displayErrorMessage(Shell parent, String msg,
+ Object[] variables, Throwable ex) {
+ if (msg == null)
+ return;
+ if (variables != null)
+ msg = NLS.bind(msg, variables);
+ displayErrorMessage(parent, msg, ex);
+ }
+
+ /**
+ * Displays warning dialog with a given message. <br>
+ * also logs the info using Log.logWarning(). msg error message to display
+ * and log.
+ */
+ public static void displayWarningMessage(Shell parent, String msg) {
+ String title = Messages.MessageDialog_warningTitle;
+ if (parent == null)
+ parent = getActiveShell();
+ MessageDialog.openWarning(parent, title, msg);
+ Log.warning(msg);
+ }
+
+ /**
+ * Displays warning dialog with a message. <br>
+ * also logs the info using Log.logWarning().
+ */
+ public static void displayWarningMessage(Shell parent, String msg,
+ Object[] variables) {
+ if (msg == null)
+ return;
+ if (variables != null)
+ msg = NLS.bind(msg, variables);
+ displayWarningMessage(parent, msg);
+ }
+
+ /**
+ * Displays info dialog with a message. Also logs the info using
+ * Log.logInfo().
+ */
+ public static void displayInfoMessage(Shell parent, String msg) {
+ String title = Messages.MessageDialog_infoTitle;
+ if (parent == null)
+ parent = getActiveShell();
+ MessageDialog.openInformation(parent, title, msg);
+ Log.info(msg);
+
+ }
+
+ /**
+ * Displays info dialog with a message. Also logs the info using
+ * Log.logInfo().
+ */
+ public static void displayInfoMessage(Shell parent, String msg,
+ Object[] variables) {
+ if (msg == null)
+ return;
+ if (variables != null)
+ msg = NLS.bind(msg, variables);
+ displayInfoMessage(parent, msg);
+ }
+
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ }
+
+ /**
+ * Utility method to best find the active shell.
+ */
+ public static Shell getActiveShell() {
+ Display display = getCurrentDisplay();
+ Shell activeShell = display.getActiveShell();
+ if (activeShell == null)
+ return getActiveWorkbenchWindow().getShell();
+ return activeShell;
+ }
+
+ /**
+ * Utility method to best find the active Display.
+ */
+ public static Display getCurrentDisplay() {
+ Display display = Display.getCurrent();
+ if (display != null)
+ return display;
+ return Display.getDefault();
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/ImageUtil.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/ImageUtil.java
index 8adf9ed68..e4d8fb3a0 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/ImageUtil.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/ImageUtil.java
@@ -31,149 +31,149 @@ import org.osgi.framework.Bundle;
*/
public final class ImageUtil {
- /**
- * Image keys, to be used by plugin (intro) registry.
- */
- // Default images
- public static final String DEFAULT_ROOT_LINK = "rootLink"; //$NON-NLS-1$
- public static final String DEFAULT_SMALL_ROOT_LINK = "rootLinkSmall"; //$NON-NLS-1$
- public static final String DEFAULT_FORM_BG = "formBg"; //$NON-NLS-1$
- public static final String DEFAULT_LINK = "link"; //$NON-NLS-1$
-
- // Standby images
- public static final String BACK = "back"; //$NON-NLS-1$
- public static final String HELP_TOPIC = "helpTopic"; //$NON-NLS-1$
-
- // Launch bar image
- public static final String RESTORE_WELCOME = "restoreWelcome"; //$NON-NLS-1$
-
- // Viewer images
- public static final String INTRO_MODEL_LEAF = "leaf"; //$NON-NLS-1$
- public static final String INTRO_MODEL_CONTAINER = "container"; //$NON-NLS-1$
- public static final String OPEN_ITNRO_VIEW = "introView"; //$NON-NLS-1$
-
- public static final String CONFIG_EXTENSION = "configExtension";//$NON-NLS-1$
-
- // Image location
- public static final String ICONS_PATH = "$nl$/icons/"; //$NON-NLS-1$
-
- /**
- * Convenience method to create an image descriptor from the Intro plugin.
- *
- * Method assumes that images are under the "icons" directory, so don't
- * append that directory name for "imageName".
- */
- public static ImageDescriptor createImageDescriptor(String imageName) {
- return createImageDescriptor(Platform
- .getBundle(IIntroConstants.PLUGIN_ID), ICONS_PATH + imageName);
- }
-
- /**
- * Convenience method to create an image descriptor.
- *
- */
- public static ImageDescriptor createImageDescriptor(Bundle bundle,
- String imageName) {
- try {
- URL imageUrl = FileLocator.find(bundle, new Path(imageName), null);
- if (imageUrl != null) {
- ImageDescriptor desc = ImageDescriptor.createFromURL(imageUrl);
- return desc;
- }
- } catch (Exception e) {
- // Should never be here.
- Log.error("could not create Image Descriptor", e); //$NON-NLS-1$
- }
- Log.warning("could not create Image Descriptor for: " + imageName //$NON-NLS-1$
- + " in bundle: " + bundle.getSymbolicName()); //$NON-NLS-1$
- return ImageDescriptor.getMissingImageDescriptor();
- }
-
- /**
- * Convenience method to create an image descriptor.
- *
- */
- public static ImageDescriptor createImageDescriptor(IPath base,
- String imageName) {
- try {
- URL imageUrl = new URL(base.append(imageName).toOSString());
- if (imageUrl != null) {
- ImageDescriptor desc = ImageDescriptor.createFromURL(imageUrl);
- return desc;
- }
- } catch (Exception e) {
- // Should never be here.
- Log.error("could not create Image Descriptor", e); //$NON-NLS-1$
- }
- Log.warning("could not create Image Descriptor for: " + imageName); //$NON-NLS-1$
- return ImageDescriptor.getMissingImageDescriptor();
- }
-
- /**
- * Convenience method to create an image from the Intro plugin.
- *
- * Method assumes that images are under the "icons" directory, so don't
- * append that directory name for "imageName".
- */
- public static Image createImage(String imageName) {
- try {
- ImageDescriptor imageDsc = createImageDescriptor(imageName);
- return imageDsc.createImage();
- } catch (Exception e) {
- // Should never be here.
- Log.error("could not create Image", e); //$NON-NLS-1$
- return ImageDescriptor.getMissingImageDescriptor().createImage();
- }
- }
-
- /**
- * Util method for image re-use in Intro Plugin.
- *
- * @param key
- * @return
- */
- public static Image getImage(String key) {
- // INTRO: Image registry should not have the same life span
- // as the intro plug-in. It should be disposed when
- // presentation is disposed, otherwise images will
- // stay around once Inro has been loaded.
- return IntroPlugin.getDefault().getVolatileImageRegistry().get(key);
- }
-
- public static boolean hasImage(String key) {
- ImageRegistry registry = IntroPlugin.getDefault().getVolatileImageRegistry();
- return (registry.getDescriptor(key) != null);
- }
-
- /**
- * Register an image descriptor in the Intro Plugin image registry. Has no
- * effect if the key has already been registered.
- *
- * @param key
- * @param imageName
- */
- public static void registerImage(String key, String imageName) {
- ImageRegistry registry = IntroPlugin.getDefault().getVolatileImageRegistry();
- if (registry.getDescriptor(key) != null)
- // key has already been registered. do nothing.
- return;
- registry.put(key, createImageDescriptor(imageName));
- }
-
- public static void registerImage(String key, Bundle bundle, String imageName) {
-
- ImageRegistry registry = IntroPlugin.getDefault().getVolatileImageRegistry();
- if (registry.getDescriptor(key) != null)
- // key has already been registered. do nothing.
- return;
- registry.put(key, createImageDescriptor(bundle, imageName));
- }
-
- public static void registerImage(String key, IPath base, String imageName) {
- ImageRegistry registry = IntroPlugin.getDefault().getVolatileImageRegistry();
- if (registry.getDescriptor(key) != null)
- // key has already been registered. do nothing.
- return;
- registry.put(key, createImageDescriptor(base, imageName));
- }
+ /**
+ * Image keys, to be used by plugin (intro) registry.
+ */
+ // Default images
+ public static final String DEFAULT_ROOT_LINK = "rootLink"; //$NON-NLS-1$
+ public static final String DEFAULT_SMALL_ROOT_LINK = "rootLinkSmall"; //$NON-NLS-1$
+ public static final String DEFAULT_FORM_BG = "formBg"; //$NON-NLS-1$
+ public static final String DEFAULT_LINK = "link"; //$NON-NLS-1$
+
+ // Standby images
+ public static final String BACK = "back"; //$NON-NLS-1$
+ public static final String HELP_TOPIC = "helpTopic"; //$NON-NLS-1$
+
+ // Launch bar image
+ public static final String RESTORE_WELCOME = "restoreWelcome"; //$NON-NLS-1$
+
+ // Viewer images
+ public static final String INTRO_MODEL_LEAF = "leaf"; //$NON-NLS-1$
+ public static final String INTRO_MODEL_CONTAINER = "container"; //$NON-NLS-1$
+ public static final String OPEN_ITNRO_VIEW = "introView"; //$NON-NLS-1$
+
+ public static final String CONFIG_EXTENSION = "configExtension";//$NON-NLS-1$
+
+ // Image location
+ public static final String ICONS_PATH = "$nl$/icons/"; //$NON-NLS-1$
+
+ /**
+ * Convenience method to create an image descriptor from the Intro plugin.
+ *
+ * Method assumes that images are under the "icons" directory, so don't
+ * append that directory name for "imageName".
+ */
+ public static ImageDescriptor createImageDescriptor(String imageName) {
+ return createImageDescriptor(Platform
+ .getBundle(IIntroConstants.PLUGIN_ID), ICONS_PATH + imageName);
+ }
+
+ /**
+ * Convenience method to create an image descriptor.
+ *
+ */
+ public static ImageDescriptor createImageDescriptor(Bundle bundle,
+ String imageName) {
+ try {
+ URL imageUrl = FileLocator.find(bundle, new Path(imageName), null);
+ if (imageUrl != null) {
+ ImageDescriptor desc = ImageDescriptor.createFromURL(imageUrl);
+ return desc;
+ }
+ } catch (Exception e) {
+ // Should never be here.
+ Log.error("could not create Image Descriptor", e); //$NON-NLS-1$
+ }
+ Log.warning("could not create Image Descriptor for: " + imageName //$NON-NLS-1$
+ + " in bundle: " + bundle.getSymbolicName()); //$NON-NLS-1$
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
+
+ /**
+ * Convenience method to create an image descriptor.
+ *
+ */
+ public static ImageDescriptor createImageDescriptor(IPath base,
+ String imageName) {
+ try {
+ URL imageUrl = new URL(base.append(imageName).toOSString());
+ if (imageUrl != null) {
+ ImageDescriptor desc = ImageDescriptor.createFromURL(imageUrl);
+ return desc;
+ }
+ } catch (Exception e) {
+ // Should never be here.
+ Log.error("could not create Image Descriptor", e); //$NON-NLS-1$
+ }
+ Log.warning("could not create Image Descriptor for: " + imageName); //$NON-NLS-1$
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
+
+ /**
+ * Convenience method to create an image from the Intro plugin.
+ *
+ * Method assumes that images are under the "icons" directory, so don't
+ * append that directory name for "imageName".
+ */
+ public static Image createImage(String imageName) {
+ try {
+ ImageDescriptor imageDsc = createImageDescriptor(imageName);
+ return imageDsc.createImage();
+ } catch (Exception e) {
+ // Should never be here.
+ Log.error("could not create Image", e); //$NON-NLS-1$
+ return ImageDescriptor.getMissingImageDescriptor().createImage();
+ }
+ }
+
+ /**
+ * Util method for image re-use in Intro Plugin.
+ *
+ * @param key
+ * @return
+ */
+ public static Image getImage(String key) {
+ // INTRO: Image registry should not have the same life span
+ // as the intro plug-in. It should be disposed when
+ // presentation is disposed, otherwise images will
+ // stay around once Inro has been loaded.
+ return IntroPlugin.getDefault().getVolatileImageRegistry().get(key);
+ }
+
+ public static boolean hasImage(String key) {
+ ImageRegistry registry = IntroPlugin.getDefault().getVolatileImageRegistry();
+ return (registry.getDescriptor(key) != null);
+ }
+
+ /**
+ * Register an image descriptor in the Intro Plugin image registry. Has no
+ * effect if the key has already been registered.
+ *
+ * @param key
+ * @param imageName
+ */
+ public static void registerImage(String key, String imageName) {
+ ImageRegistry registry = IntroPlugin.getDefault().getVolatileImageRegistry();
+ if (registry.getDescriptor(key) != null)
+ // key has already been registered. do nothing.
+ return;
+ registry.put(key, createImageDescriptor(imageName));
+ }
+
+ public static void registerImage(String key, Bundle bundle, String imageName) {
+
+ ImageRegistry registry = IntroPlugin.getDefault().getVolatileImageRegistry();
+ if (registry.getDescriptor(key) != null)
+ // key has already been registered. do nothing.
+ return;
+ registry.put(key, createImageDescriptor(bundle, imageName));
+ }
+
+ public static void registerImage(String key, IPath base, String imageName) {
+ ImageRegistry registry = IntroPlugin.getDefault().getVolatileImageRegistry();
+ if (registry.getDescriptor(key) != null)
+ // key has already been registered. do nothing.
+ return;
+ registry.put(key, createImageDescriptor(base, imageName));
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java
index 26edde1ff..2c62f49a4 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/IntroModelSerializer.java
@@ -39,336 +39,336 @@ import org.osgi.framework.Bundle;
*/
public class IntroModelSerializer {
- private StringBuilder buffer;
- private boolean filter;
-
- public IntroModelSerializer(IntroModelRoot root) {
- this(root, false);
- }
-
- public IntroModelSerializer(IntroModelRoot root, boolean filter) {
- this.buffer = new StringBuilder();
- this.filter = filter;
- printModelRootInfo(root, buffer);
-
- // Root Page
- AbstractIntroPage rootPage = root.getHomePage();
- printHomePage(rootPage, buffer);
- printPageChildren(rootPage, buffer);
-
- IntroPage[] pages = root.getPages();
- printPages(pages, buffer);
-
- buffer.append("\n\n"); //$NON-NLS-1$
- printModelFlagTests(root, buffer);
- }
-
- /*
- * Removes any platform/machine-specific paths from the given URL. This is
- * used to remove absolute paths from the serialized model in order to compare
- * results in automated tests.
- */
- private String filterURL(String url) {
- if (filter) {
- if (url != null && url.startsWith("file:/")) { //$NON-NLS-1$
- return "file:/" + "<filtered>" + url.substring(url.lastIndexOf('/')); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return url;
- }
-
- private void printModelRootInfo(IntroModelRoot model, StringBuilder text) {
- text.append("\nIntro Model Content:"); //$NON-NLS-1$
- text.append("\n======================"); //$NON-NLS-1$
- text.append("\n\nModel has valid config = " + model.hasValidConfig()); //$NON-NLS-1$
- text.append("\nPresentation Kind = " //$NON-NLS-1$
- + model.getPresentation().getImplementationKind());
- text.append("\nPresentation Shared Style = " //$NON-NLS-1$
- + model.getPresentation().getImplementationStyles());
- text.append("\nPresentation type = " //$NON-NLS-1$
- + model.getPresentation().getType());
- text.append("\nHome page id = " //$NON-NLS-1$
- + model.getPresentation().getHomePageId());
- IntroHead headContent = model.getPresentation().getHead();
- if (headContent != null)
- text.append("\nPresentation Shared Head = " + headContent.getSrc()); //$NON-NLS-1$
- text.append("\nNumber of pages (not including Root Page) = " //$NON-NLS-1$
- + model.getPages().length);
- text.append("\nNumber of shared groups = " //$NON-NLS-1$
- + model.getChildrenOfType(AbstractIntroElement.GROUP).length);
- text
- .append("\nNumber of unresolved extensions = " //$NON-NLS-1$
- + model
- .getChildrenOfType(AbstractIntroElement.CONTAINER_EXTENSION).length);
- }
-
- /**
- * @param text
- * @param root
- */
- private void printHomePage(AbstractIntroPage rootPage, StringBuilder text) {
- text.append("\n\nHOME PAGE: "); //$NON-NLS-1$
- text.append("\n--------------"); //$NON-NLS-1$
- text
- .append("\n\tis dynamic= " + ((IntroModelRoot) rootPage.getParent()).isDynamic()); //$NON-NLS-1$
-
- text.append("\n\tid = " + rootPage.getId()); //$NON-NLS-1$
- text.append("\n\ttitle = " + rootPage.getTitle()); //$NON-NLS-1$
- text.append("\n\tstyle = " + filterURL(rootPage.getStyle())); //$NON-NLS-1$
- text.append("\n\talt-style = " + filterURL(rootPage.getAltStyle())); //$NON-NLS-1$
- text.append("\n\turl = " + rootPage.getUrl()); //$NON-NLS-1$
- text.append("\n\tstyle-id = " + rootPage.getStyleId()); //$NON-NLS-1$
- printPageStyles(rootPage, text);
- }
-
- private void printPageStyles(AbstractIntroPage page, StringBuilder text) {
- text.append("\n\tpage styles are = "); //$NON-NLS-1$
- String[] styles = page.getStyles();
- for (int i = 0; i < styles.length; i++)
- text.append(filterURL(styles[i] + "\n\t\t\t")); //$NON-NLS-1$
- text.append("\n\tpage alt-styles are = "); //$NON-NLS-1$
+ private StringBuilder buffer;
+ private boolean filter;
+
+ public IntroModelSerializer(IntroModelRoot root) {
+ this(root, false);
+ }
+
+ public IntroModelSerializer(IntroModelRoot root, boolean filter) {
+ this.buffer = new StringBuilder();
+ this.filter = filter;
+ printModelRootInfo(root, buffer);
+
+ // Root Page
+ AbstractIntroPage rootPage = root.getHomePage();
+ printHomePage(rootPage, buffer);
+ printPageChildren(rootPage, buffer);
+
+ IntroPage[] pages = root.getPages();
+ printPages(pages, buffer);
+
+ buffer.append("\n\n"); //$NON-NLS-1$
+ printModelFlagTests(root, buffer);
+ }
+
+ /*
+ * Removes any platform/machine-specific paths from the given URL. This is
+ * used to remove absolute paths from the serialized model in order to compare
+ * results in automated tests.
+ */
+ private String filterURL(String url) {
+ if (filter) {
+ if (url != null && url.startsWith("file:/")) { //$NON-NLS-1$
+ return "file:/" + "<filtered>" + url.substring(url.lastIndexOf('/')); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return url;
+ }
+
+ private void printModelRootInfo(IntroModelRoot model, StringBuilder text) {
+ text.append("\nIntro Model Content:"); //$NON-NLS-1$
+ text.append("\n======================"); //$NON-NLS-1$
+ text.append("\n\nModel has valid config = " + model.hasValidConfig()); //$NON-NLS-1$
+ text.append("\nPresentation Kind = " //$NON-NLS-1$
+ + model.getPresentation().getImplementationKind());
+ text.append("\nPresentation Shared Style = " //$NON-NLS-1$
+ + model.getPresentation().getImplementationStyles());
+ text.append("\nPresentation type = " //$NON-NLS-1$
+ + model.getPresentation().getType());
+ text.append("\nHome page id = " //$NON-NLS-1$
+ + model.getPresentation().getHomePageId());
+ IntroHead headContent = model.getPresentation().getHead();
+ if (headContent != null)
+ text.append("\nPresentation Shared Head = " + headContent.getSrc()); //$NON-NLS-1$
+ text.append("\nNumber of pages (not including Root Page) = " //$NON-NLS-1$
+ + model.getPages().length);
+ text.append("\nNumber of shared groups = " //$NON-NLS-1$
+ + model.getChildrenOfType(AbstractIntroElement.GROUP).length);
+ text
+ .append("\nNumber of unresolved extensions = " //$NON-NLS-1$
+ + model
+ .getChildrenOfType(AbstractIntroElement.CONTAINER_EXTENSION).length);
+ }
+
+ /**
+ * @param text
+ * @param root
+ */
+ private void printHomePage(AbstractIntroPage rootPage, StringBuilder text) {
+ text.append("\n\nHOME PAGE: "); //$NON-NLS-1$
+ text.append("\n--------------"); //$NON-NLS-1$
+ text
+ .append("\n\tis dynamic= " + ((IntroModelRoot) rootPage.getParent()).isDynamic()); //$NON-NLS-1$
+
+ text.append("\n\tid = " + rootPage.getId()); //$NON-NLS-1$
+ text.append("\n\ttitle = " + rootPage.getTitle()); //$NON-NLS-1$
+ text.append("\n\tstyle = " + filterURL(rootPage.getStyle())); //$NON-NLS-1$
+ text.append("\n\talt-style = " + filterURL(rootPage.getAltStyle())); //$NON-NLS-1$
+ text.append("\n\turl = " + rootPage.getUrl()); //$NON-NLS-1$
+ text.append("\n\tstyle-id = " + rootPage.getStyleId()); //$NON-NLS-1$
+ printPageStyles(rootPage, text);
+ }
+
+ private void printPageStyles(AbstractIntroPage page, StringBuilder text) {
+ text.append("\n\tpage styles are = "); //$NON-NLS-1$
+ String[] styles = page.getStyles();
+ for (int i = 0; i < styles.length; i++)
+ text.append(filterURL(styles[i] + "\n\t\t\t")); //$NON-NLS-1$
+ text.append("\n\tpage alt-styles are = "); //$NON-NLS-1$
Map<String, Bundle> altStylesHashtable = page.getAltStyles();
- if (altStylesHashtable == null)
- return;
+ if (altStylesHashtable == null)
+ return;
for (Entry<String, Bundle> entry : altStylesHashtable.entrySet()) {
text.append(filterURL(entry.getKey()) + " from " + entry.getValue().getSymbolicName()); //$NON-NLS-1$
- text.append("\n\t\t"); //$NON-NLS-1$
- }
- }
-
- private void printPageChildren(AbstractIntroPage page, StringBuilder text) {
-
- text.append("\n\tpage children = " + page.getChildren().length); //$NON-NLS-1$
- text.append("\n"); //$NON-NLS-1$
- printContainerChildren(page, text, "\n\t\t"); //$NON-NLS-1$
-
- }
-
- private void printContainerChildren(AbstractIntroContainer container,
- StringBuilder text, String indent) {
-
- AbstractIntroElement[] children = container.getChildren();
- for (int i = 0; i < children.length; i++) {
- int childType = children[i].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);
- break;
- case AbstractIntroElement.LINK:
- printLink(text, (IntroLink) children[i], indent);
- break;
- case AbstractIntroElement.TEXT:
- printText(text, (IntroText) children[i], indent);
- break;
- case AbstractIntroElement.IMAGE:
- printImage(text, (IntroImage) children[i], indent);
- break;
- case AbstractIntroElement.HR:
- printSeparator(text, (IntroSeparator) children[i], indent);
- break;
- case AbstractIntroElement.HTML:
- printHtml(text, (IntroHTML) children[i], indent);
- break;
- case AbstractIntroElement.INCLUDE:
- printInclude(text, (IntroInclude) children[i], indent);
- break;
- case AbstractIntroElement.HEAD:
- printHead(text, (IntroHead) children[i], indent);
- break;
- case AbstractIntroElement.PAGE_TITLE:
- printPageTitle(text, (IntroPageTitle) children[i], indent);
- break;
- case AbstractIntroElement.ANCHOR:
- printAnchor(text, (IntroAnchor) children[i], indent);
- break;
- case AbstractIntroElement.CONTENT_PROVIDER:
- printContentProvidor(text, (IntroContentProvider) children[i],
- indent);
- break;
-
- }
- }
- }
-
- private void printGroup(StringBuilder text, IntroGroup group, String indent) {
- text.append(indent + "GROUP: id = " + group.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "label = " + group.getLabel()); //$NON-NLS-1$
- text.append(indent + "children = " + group.getChildren().length); //$NON-NLS-1$
- text.append(indent + "style-id = " + group.getStyleId()); //$NON-NLS-1$
- printContainerChildren(group, text, indent + "\t\t"); //$NON-NLS-1$
- }
-
- private void printLink(StringBuilder text, IntroLink link, String indent) {
- text.append(indent + "LINK: id = " + link.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "label = " + link.getLabel()); //$NON-NLS-1$
- text.append(indent + "text = " + link.getText()); //$NON-NLS-1$
- text.append(indent + "url = " + link.getUrl()); //$NON-NLS-1$
- text.append(indent + "style-id = " + link.getStyleId()); //$NON-NLS-1$
- }
-
- private void printText(StringBuilder text, IntroText introText, String indent) {
- text.append(indent + "TEXT: id = " + introText.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "text = " + introText.getText()); //$NON-NLS-1$
- text.append(indent + "style-id = " + introText.getStyleId()); //$NON-NLS-1$
- }
-
- private void printImage(StringBuilder text, IntroImage image, String indent) {
- text.append(indent + "IMAGE: id = " + image.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "src = " + image.getSrc()); //$NON-NLS-1$
- text.append(indent + "alt = " + image.getAlt()); //$NON-NLS-1$
- text.append(indent + "style-id = " + image.getStyleId()); //$NON-NLS-1$
- }
-
- private void printSeparator(StringBuilder text, IntroSeparator sep, String indent) {
- text.append(indent + "HR: id = " + sep.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "style-id = " + sep.getStyleId()); //$NON-NLS-1$
- }
-
- private void printHtml(StringBuilder text, IntroHTML html, String indent) {
- text.append(indent + "HTML: id = " + html.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "src = " + html.getSrc()); //$NON-NLS-1$
- text.append(indent + "isInlined = " + html.isInlined()); //$NON-NLS-1$
- text.append(indent + "style-id = " + html.getStyleId()); //$NON-NLS-1$
- if (html.getIntroImage() != null)
- printImage(text, html.getIntroImage(), indent + "\t\t"); //$NON-NLS-1$
- if (html.getIntroText() != null)
- printText(text, html.getIntroText(), indent + "\t\t"); //$NON-NLS-1$
-
- }
-
- private void printInclude(StringBuilder text, IntroInclude include,
- String indent) {
- text.append(indent + "INCLUDE: configId = " + include.getConfigId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "path = " + include.getPath()); //$NON-NLS-1$
- text.append(indent + "merge-style = " + include.getMergeStyle()); //$NON-NLS-1$
- }
-
- private void printHead(StringBuilder text, IntroHead head, String indent) {
- text.append(indent + "HEAD: src = " + head.getSrc()); //$NON-NLS-1$
- }
-
- private void printPageTitle(StringBuilder text, IntroPageTitle title,
- String indent) {
- text.append(indent + "TITLE: id = " + title.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "title = " + title.getTitle()); //$NON-NLS-1$
- text.append(indent + "style-id = " + title.getStyleId()); //$NON-NLS-1$
- }
-
- private void printAnchor(StringBuilder text, IntroAnchor anchor,
- String indent) {
- text.append(indent + "ANCHOR: id = " + anchor.getId()); //$NON-NLS-1$
- }
-
- private void printContentProvidor(StringBuilder text,
- IntroContentProvider provider, String indent) {
- text.append(indent + "CONTENT PROVIDER: id = " + provider.getId()); //$NON-NLS-1$
- indent = indent + "\t\t"; //$NON-NLS-1$
- text.append(indent + "class = " + provider.getClassName()); //$NON-NLS-1$
- text.append(indent + "pluginId = " + provider.getPluginId()); //$NON-NLS-1$
- if (provider.getIntroText() != null)
- printText(text, provider.getIntroText(), indent + "\t\t"); //$NON-NLS-1$
-
- }
-
- /**
- * Appends a given page's categories to the Text buffer.
- *
- * @param text
- */
- private void printPages(IntroPage[] pages, StringBuilder text) {
- for (int i = 0; i < pages.length; i++) {
- text.append("\n\nPAGE id = " + pages[i].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);
- }
- }
-
- private void printModelFlagTests(IntroModelRoot model, StringBuilder text) {
- text.append("Model Flag Tests: "); //$NON-NLS-1$
- text.append("\n----------------"); //$NON-NLS-1$
- if (model.getPages().length == 0) {
- text.append("\nNo first page in model\n\n"); //$NON-NLS-1$
- return;
- }
- IntroPage firstPage = model.getPages()[0];
- text.append("\n\t\tFirst page children are: "); //$NON-NLS-1$
- text
- .append("\n\t\t\tGroups: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.GROUP).length);
- text
- .append("\n\t\t\tLinks: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.LINK).length);
- text
- .append("\n\t\t\tTexts: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.TEXT).length);
- text
- .append("\n\t\t\tHTMLs: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.HTML).length);
- text
- .append("\n\t\t\tImages: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.IMAGE).length);
- text
- .append("\n\t\t\tIncludes: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.INCLUDE).length);
- text
- .append("\n\t\t\tPage Titles: " //$NON-NLS-1$
- + firstPage
- .getChildrenOfType(AbstractIntroElement.PAGE_TITLE).length);
- text
- .append("\n\t\t\tPage Heads: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.HEAD).length);
- text
- .append("\n\t\t\tModel Elements: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.ELEMENT).length);
- text
- .append("\n\t\t\tContainers: " //$NON-NLS-1$
- + firstPage
- .getChildrenOfType(AbstractIntroElement.ABSTRACT_CONTAINER).length);
- text
- .append("\n\t\t\tAll Pages: " //$NON-NLS-1$
- + firstPage
- .getChildrenOfType(AbstractIntroElement.ABSTRACT_PAGE).length);
- text
- .append("\n\t\t\tAnchors: " //$NON-NLS-1$
- + firstPage.getChildrenOfType(AbstractIntroElement.ANCHOR).length);
- text
- .append("\n\t\t\tContent providers: " //$NON-NLS-1$
- + firstPage
- .getChildrenOfType(AbstractIntroElement.CONTENT_PROVIDER).length);
- text
- .append("\n\t\t\tElements with Text child(AbstractTextElemets): " //$NON-NLS-1$
- + firstPage
- .getChildrenOfType(AbstractIntroElement.ABSTRACT_TEXT).length);
-
- AbstractIntroElement[] linksAndGroups = (AbstractIntroElement[]) firstPage
- .getChildrenOfType(AbstractIntroElement.GROUP
- | AbstractIntroElement.LINK);
- text.append("\n\t\t\tGroups and Links: " + linksAndGroups.length); //$NON-NLS-1$
- }
-
- /**
- * @return Returns the textUI.
- */
- @Override
+ text.append("\n\t\t"); //$NON-NLS-1$
+ }
+ }
+
+ private void printPageChildren(AbstractIntroPage page, StringBuilder text) {
+
+ text.append("\n\tpage children = " + page.getChildren().length); //$NON-NLS-1$
+ text.append("\n"); //$NON-NLS-1$
+ printContainerChildren(page, text, "\n\t\t"); //$NON-NLS-1$
+
+ }
+
+ private void printContainerChildren(AbstractIntroContainer container,
+ StringBuilder text, String indent) {
+
+ AbstractIntroElement[] children = container.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ int childType = children[i].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);
+ break;
+ case AbstractIntroElement.LINK:
+ printLink(text, (IntroLink) children[i], indent);
+ break;
+ case AbstractIntroElement.TEXT:
+ printText(text, (IntroText) children[i], indent);
+ break;
+ case AbstractIntroElement.IMAGE:
+ printImage(text, (IntroImage) children[i], indent);
+ break;
+ case AbstractIntroElement.HR:
+ printSeparator(text, (IntroSeparator) children[i], indent);
+ break;
+ case AbstractIntroElement.HTML:
+ printHtml(text, (IntroHTML) children[i], indent);
+ break;
+ case AbstractIntroElement.INCLUDE:
+ printInclude(text, (IntroInclude) children[i], indent);
+ break;
+ case AbstractIntroElement.HEAD:
+ printHead(text, (IntroHead) children[i], indent);
+ break;
+ case AbstractIntroElement.PAGE_TITLE:
+ printPageTitle(text, (IntroPageTitle) children[i], indent);
+ break;
+ case AbstractIntroElement.ANCHOR:
+ printAnchor(text, (IntroAnchor) children[i], indent);
+ break;
+ case AbstractIntroElement.CONTENT_PROVIDER:
+ printContentProvidor(text, (IntroContentProvider) children[i],
+ indent);
+ break;
+
+ }
+ }
+ }
+
+ private void printGroup(StringBuilder text, IntroGroup group, String indent) {
+ text.append(indent + "GROUP: id = " + group.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "label = " + group.getLabel()); //$NON-NLS-1$
+ text.append(indent + "children = " + group.getChildren().length); //$NON-NLS-1$
+ text.append(indent + "style-id = " + group.getStyleId()); //$NON-NLS-1$
+ printContainerChildren(group, text, indent + "\t\t"); //$NON-NLS-1$
+ }
+
+ private void printLink(StringBuilder text, IntroLink link, String indent) {
+ text.append(indent + "LINK: id = " + link.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "label = " + link.getLabel()); //$NON-NLS-1$
+ text.append(indent + "text = " + link.getText()); //$NON-NLS-1$
+ text.append(indent + "url = " + link.getUrl()); //$NON-NLS-1$
+ text.append(indent + "style-id = " + link.getStyleId()); //$NON-NLS-1$
+ }
+
+ private void printText(StringBuilder text, IntroText introText, String indent) {
+ text.append(indent + "TEXT: id = " + introText.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "text = " + introText.getText()); //$NON-NLS-1$
+ text.append(indent + "style-id = " + introText.getStyleId()); //$NON-NLS-1$
+ }
+
+ private void printImage(StringBuilder text, IntroImage image, String indent) {
+ text.append(indent + "IMAGE: id = " + image.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "src = " + image.getSrc()); //$NON-NLS-1$
+ text.append(indent + "alt = " + image.getAlt()); //$NON-NLS-1$
+ text.append(indent + "style-id = " + image.getStyleId()); //$NON-NLS-1$
+ }
+
+ private void printSeparator(StringBuilder text, IntroSeparator sep, String indent) {
+ text.append(indent + "HR: id = " + sep.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "style-id = " + sep.getStyleId()); //$NON-NLS-1$
+ }
+
+ private void printHtml(StringBuilder text, IntroHTML html, String indent) {
+ text.append(indent + "HTML: id = " + html.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "src = " + html.getSrc()); //$NON-NLS-1$
+ text.append(indent + "isInlined = " + html.isInlined()); //$NON-NLS-1$
+ text.append(indent + "style-id = " + html.getStyleId()); //$NON-NLS-1$
+ if (html.getIntroImage() != null)
+ printImage(text, html.getIntroImage(), indent + "\t\t"); //$NON-NLS-1$
+ if (html.getIntroText() != null)
+ printText(text, html.getIntroText(), indent + "\t\t"); //$NON-NLS-1$
+
+ }
+
+ private void printInclude(StringBuilder text, IntroInclude include,
+ String indent) {
+ text.append(indent + "INCLUDE: configId = " + include.getConfigId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "path = " + include.getPath()); //$NON-NLS-1$
+ text.append(indent + "merge-style = " + include.getMergeStyle()); //$NON-NLS-1$
+ }
+
+ private void printHead(StringBuilder text, IntroHead head, String indent) {
+ text.append(indent + "HEAD: src = " + head.getSrc()); //$NON-NLS-1$
+ }
+
+ private void printPageTitle(StringBuilder text, IntroPageTitle title,
+ String indent) {
+ text.append(indent + "TITLE: id = " + title.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "title = " + title.getTitle()); //$NON-NLS-1$
+ text.append(indent + "style-id = " + title.getStyleId()); //$NON-NLS-1$
+ }
+
+ private void printAnchor(StringBuilder text, IntroAnchor anchor,
+ String indent) {
+ text.append(indent + "ANCHOR: id = " + anchor.getId()); //$NON-NLS-1$
+ }
+
+ private void printContentProvidor(StringBuilder text,
+ IntroContentProvider provider, String indent) {
+ text.append(indent + "CONTENT PROVIDER: id = " + provider.getId()); //$NON-NLS-1$
+ indent = indent + "\t\t"; //$NON-NLS-1$
+ text.append(indent + "class = " + provider.getClassName()); //$NON-NLS-1$
+ text.append(indent + "pluginId = " + provider.getPluginId()); //$NON-NLS-1$
+ if (provider.getIntroText() != null)
+ printText(text, provider.getIntroText(), indent + "\t\t"); //$NON-NLS-1$
+
+ }
+
+ /**
+ * Appends a given page's categories to the Text buffer.
+ *
+ * @param text
+ */
+ private void printPages(IntroPage[] pages, StringBuilder text) {
+ for (int i = 0; i < pages.length; i++) {
+ text.append("\n\nPAGE id = " + pages[i].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);
+ }
+ }
+
+ private void printModelFlagTests(IntroModelRoot model, StringBuilder text) {
+ text.append("Model Flag Tests: "); //$NON-NLS-1$
+ text.append("\n----------------"); //$NON-NLS-1$
+ if (model.getPages().length == 0) {
+ text.append("\nNo first page in model\n\n"); //$NON-NLS-1$
+ return;
+ }
+ IntroPage firstPage = model.getPages()[0];
+ text.append("\n\t\tFirst page children are: "); //$NON-NLS-1$
+ text
+ .append("\n\t\t\tGroups: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.GROUP).length);
+ text
+ .append("\n\t\t\tLinks: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.LINK).length);
+ text
+ .append("\n\t\t\tTexts: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.TEXT).length);
+ text
+ .append("\n\t\t\tHTMLs: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.HTML).length);
+ text
+ .append("\n\t\t\tImages: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.IMAGE).length);
+ text
+ .append("\n\t\t\tIncludes: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.INCLUDE).length);
+ text
+ .append("\n\t\t\tPage Titles: " //$NON-NLS-1$
+ + firstPage
+ .getChildrenOfType(AbstractIntroElement.PAGE_TITLE).length);
+ text
+ .append("\n\t\t\tPage Heads: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.HEAD).length);
+ text
+ .append("\n\t\t\tModel Elements: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.ELEMENT).length);
+ text
+ .append("\n\t\t\tContainers: " //$NON-NLS-1$
+ + firstPage
+ .getChildrenOfType(AbstractIntroElement.ABSTRACT_CONTAINER).length);
+ text
+ .append("\n\t\t\tAll Pages: " //$NON-NLS-1$
+ + firstPage
+ .getChildrenOfType(AbstractIntroElement.ABSTRACT_PAGE).length);
+ text
+ .append("\n\t\t\tAnchors: " //$NON-NLS-1$
+ + firstPage.getChildrenOfType(AbstractIntroElement.ANCHOR).length);
+ text
+ .append("\n\t\t\tContent providers: " //$NON-NLS-1$
+ + firstPage
+ .getChildrenOfType(AbstractIntroElement.CONTENT_PROVIDER).length);
+ text
+ .append("\n\t\t\tElements with Text child(AbstractTextElemets): " //$NON-NLS-1$
+ + firstPage
+ .getChildrenOfType(AbstractIntroElement.ABSTRACT_TEXT).length);
+
+ AbstractIntroElement[] linksAndGroups = (AbstractIntroElement[]) firstPage
+ .getChildrenOfType(AbstractIntroElement.GROUP
+ | AbstractIntroElement.LINK);
+ text.append("\n\t\t\tGroups and Links: " + linksAndGroups.length); //$NON-NLS-1$
+ }
+
+ /**
+ * @return Returns the textUI.
+ */
+ @Override
public String toString() {
- return buffer.toString();
- }
+ return buffer.toString();
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Log.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Log.java
index f00384a52..e8c2bb96a 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Log.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Log.java
@@ -32,114 +32,114 @@ import org.eclipse.ui.internal.intro.impl.IntroPlugin;
*/
public class Log implements IIntroConstants {
- /**
- * This MUST be set to <b>false </b> in production. <br>
- * Used to compile out developement debug messages. <br>
- * Compiler compiles out code warpped wit this flag as an optimization.
- */
- public static final boolean DEBUG = false;
-
-
- // Use these flags to filter out code that may be a performance hit.
- // Flag that controls logging of warning message
- public static boolean logWarning = false;
- // Flag that controls logging of information messages
- public static boolean logInfo = false;
- // Flag that controls logging of performance messages
- public static boolean logPerformance = false;
-
- private final static ILog pluginLog = IntroPlugin.getDefault().getLog();
-
- static {
- // init debug options based on settings defined in ".options" file. If
- // the plugin is not in debug mode, no point setting debug options.
- if (IntroPlugin.getDefault().isDebugging()) {
- logWarning = true;
- logInfo = getDebugOption("/trace/logInfo"); //$NON-NLS-1$
- logPerformance = getDebugOption("/trace/logPerformance"); //$NON-NLS-1$
- }
-
- }
-
- private static boolean getDebugOption(String option) {
- return "true".equalsIgnoreCase(//$NON-NLS-1$
- Platform.getDebugOption(PLUGIN_ID + option));
- }
-
- /**
- * Log an Error message with an exception. Note that the message should
- * already be localized to proper local. Errors are always logged.
- */
- public static synchronized void error(String message, Throwable ex) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
- message, ex);
- pluginLog.log(errorStatus);
- }
-
- /**
- * Log an Information message. Note that the message should already be
- * localized to proper local. Info messages are only logged when the
- * /trace/logInfo debug option is true.
- */
- public static synchronized void info(String message) {
- if (!logInfo)
- // logging of info messages is not enabled.
- return;
-
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
- message, null);
- pluginLog.log(infoStatus);
- }
-
- /**
- * Log an Information message. Note that the message should already be
- * localized to proper local. These messages are always logged. They are not
- * controlled by any debug flags. Logging of these messages can be
- * controlled by the public flags in this class.
- */
- public static synchronized void forcedInfo(String message) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
- message, null);
- pluginLog.log(infoStatus);
- }
-
-
- /**
- * Log a Warning message. Note that the message should already be localized
- * to proper local. Warning messages are only logged when the plugin is in
- * debug mode.
- */
- public static synchronized void warning(String message) {
- if (!logWarning)
- // no warning messages (ie: plugin is not in debug mode). Default is
- // to not log warning messages.
- return;
-
- if (message == null)
- message = ""; //$NON-NLS-1$
- Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID,
- IStatus.OK, message, null);
- pluginLog.log(warningStatus);
- }
-
- /**
- * Log a development debug message. Debug messages are compiled out.
- */
- public static synchronized void debugMessage(String className,
- String message) {
- if (DEBUG) {
- MultiStatus debugStatus = new MultiStatus(PLUGIN_ID, IStatus.OK,
- className, null);
- Status infoStatus = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK,
- message, null);
- debugStatus.add(infoStatus);
- pluginLog.log(debugStatus);
- }
- }
+ /**
+ * This MUST be set to <b>false </b> in production. <br>
+ * Used to compile out developement debug messages. <br>
+ * Compiler compiles out code warpped wit this flag as an optimization.
+ */
+ public static final boolean DEBUG = false;
+
+
+ // Use these flags to filter out code that may be a performance hit.
+ // Flag that controls logging of warning message
+ public static boolean logWarning = false;
+ // Flag that controls logging of information messages
+ public static boolean logInfo = false;
+ // Flag that controls logging of performance messages
+ public static boolean logPerformance = false;
+
+ private final static ILog pluginLog = IntroPlugin.getDefault().getLog();
+
+ static {
+ // init debug options based on settings defined in ".options" file. If
+ // the plugin is not in debug mode, no point setting debug options.
+ if (IntroPlugin.getDefault().isDebugging()) {
+ logWarning = true;
+ logInfo = getDebugOption("/trace/logInfo"); //$NON-NLS-1$
+ logPerformance = getDebugOption("/trace/logPerformance"); //$NON-NLS-1$
+ }
+
+ }
+
+ private static boolean getDebugOption(String option) {
+ return "true".equalsIgnoreCase(//$NON-NLS-1$
+ Platform.getDebugOption(PLUGIN_ID + option));
+ }
+
+ /**
+ * Log an Error message with an exception. Note that the message should
+ * already be localized to proper local. Errors are always logged.
+ */
+ public static synchronized void error(String message, Throwable ex) {
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status errorStatus = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK,
+ message, ex);
+ pluginLog.log(errorStatus);
+ }
+
+ /**
+ * Log an Information message. Note that the message should already be
+ * localized to proper local. Info messages are only logged when the
+ * /trace/logInfo debug option is true.
+ */
+ public static synchronized void info(String message) {
+ if (!logInfo)
+ // logging of info messages is not enabled.
+ return;
+
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
+ message, null);
+ pluginLog.log(infoStatus);
+ }
+
+ /**
+ * Log an Information message. Note that the message should already be
+ * localized to proper local. These messages are always logged. They are not
+ * controlled by any debug flags. Logging of these messages can be
+ * controlled by the public flags in this class.
+ */
+ public static synchronized void forcedInfo(String message) {
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status infoStatus = new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK,
+ message, null);
+ pluginLog.log(infoStatus);
+ }
+
+
+ /**
+ * Log a Warning message. Note that the message should already be localized
+ * to proper local. Warning messages are only logged when the plugin is in
+ * debug mode.
+ */
+ public static synchronized void warning(String message) {
+ if (!logWarning)
+ // no warning messages (ie: plugin is not in debug mode). Default is
+ // to not log warning messages.
+ return;
+
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ Status warningStatus = new Status(IStatus.WARNING, PLUGIN_ID,
+ IStatus.OK, message, null);
+ pluginLog.log(warningStatus);
+ }
+
+ /**
+ * Log a development debug message. Debug messages are compiled out.
+ */
+ public static synchronized void debugMessage(String className,
+ String message) {
+ if (DEBUG) {
+ MultiStatus debugStatus = new MultiStatus(PLUGIN_ID, IStatus.OK,
+ className, null);
+ Status infoStatus = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK,
+ message, null);
+ debugStatus.add(infoStatus);
+ pluginLog.log(debugStatus);
+ }
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/StringUtil.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/StringUtil.java
index d52936422..1a8a2e81e 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/StringUtil.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/StringUtil.java
@@ -18,13 +18,13 @@ import java.net.URLDecoder;
public class StringUtil {
- public static String concat(String... strings) {
- StringBuilder buffer = new StringBuilder();
- for (String string : strings) {
+ public static String concat(String... strings) {
+ StringBuilder buffer = new StringBuilder();
+ for (String string : strings) {
buffer.append(string);
}
- return buffer.toString();
- }
+ return buffer.toString();
+ }
public static String decode(String s, String enc) throws UnsupportedEncodingException {
try {
@@ -36,8 +36,8 @@ public class StringUtil {
}
}
- // Removes leading and trailing whitespace and replaces other
- // occurrences with a single space.
+ // Removes leading and trailing whitespace and replaces other
+ // occurrences with a single space.
public static String normalizeWhiteSpace(String input) {
if (input == null) {
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Util.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Util.java
index 412fb9e65..96e6b168d 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Util.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/util/Util.java
@@ -31,174 +31,174 @@ public class Util {
- /**
- * Handle the exception by logging to the Log. <br>
- * Variables are subsituted in the message.
- */
- public static void handleException(String msg, Exception e,
- Object[] variables) {
- if (msg == null)
- return;
- if (variables != null) {
- // if variables is not null, errorId will never be null.
- msg = NLS.bind(msg, variables);
- }
- Log.error(msg, e);
- }
-
- /**
- * Handle the exception by displaying an Error Dialog. <br>
- * Also, the error is logged by the Log.
- */
- public static void handleExceptionWithPopUp(Shell parent, String msg,
- Exception e) {
- // if it is a core exception, use ErrorDialog. If the error id is null
- // this translates to giving null to this dialog which is handled by
- // Eclipse by displaying the detyailed message directly.
- if (e instanceof CoreException) {
- if (parent == null)
- parent = DialogUtil.getActiveShell();
- DialogUtil.displayCoreErrorDialog(parent, msg, (CoreException) e);
-
- return;
- }
-
- // any other exception, use MessageDialog.
- // if errorID is null, use error message.
- if (msg == null)
- msg = e.getMessage();
- if (parent == null)
- parent = DialogUtil.getActiveShell();
- DialogUtil.displayErrorMessage(parent, msg, e);
- }
-
- /**
- * Utility method that will add a debug listener to the given control. All
- * common events are added.
- *
- * @param control
- * @return
- */
- public static Listener addDebugListener(Control control) {
- Listener listener = e -> {
- switch (e.type) {
- case SWT.Selection:
- System.out.println("Selection EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.Dispose:
- System.out.println("Dispose EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.Paint:
- System.out.println("Paint EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.Resize:
- System.out.println("Resize EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.MouseDoubleClick:
- System.out.println("MouseDoubleClick EVENT: " //$NON-NLS-1$
- + e.toString());
- break;
- case SWT.MouseDown:
- System.out.println("MouseDown EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.MouseUp:
- System.out.println("MouseUp EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.MouseMove:
- System.out.println("MouseMove EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.MouseEnter:
- System.out.println("MouseEnter EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.MouseExit:
- System.out.println("MouseExit EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.MouseHover:
- System.out.println("MouseHover EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.FocusIn:
- System.out.println("FocusIn EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.FocusOut:
- System.out.println("FocusOut EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.KeyDown:
- System.out.println("KeyDown EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.KeyUp:
- System.out.println("KeyUp EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.Traverse:
- System.out.println("Traverse EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.Show:
- System.out.println("Show EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- case SWT.Hide:
- System.out.println("Hide EVENT: " + e.toString()); //$NON-NLS-1$
- break;
- default:
- System.out.println(e.toString());
- }
+ /**
+ * Handle the exception by logging to the Log. <br>
+ * Variables are subsituted in the message.
+ */
+ public static void handleException(String msg, Exception e,
+ Object[] variables) {
+ if (msg == null)
+ return;
+ if (variables != null) {
+ // if variables is not null, errorId will never be null.
+ msg = NLS.bind(msg, variables);
+ }
+ Log.error(msg, e);
+ }
+
+ /**
+ * Handle the exception by displaying an Error Dialog. <br>
+ * Also, the error is logged by the Log.
+ */
+ public static void handleExceptionWithPopUp(Shell parent, String msg,
+ Exception e) {
+ // if it is a core exception, use ErrorDialog. If the error id is null
+ // this translates to giving null to this dialog which is handled by
+ // Eclipse by displaying the detyailed message directly.
+ if (e instanceof CoreException) {
+ if (parent == null)
+ parent = DialogUtil.getActiveShell();
+ DialogUtil.displayCoreErrorDialog(parent, msg, (CoreException) e);
+
+ return;
+ }
+
+ // any other exception, use MessageDialog.
+ // if errorID is null, use error message.
+ if (msg == null)
+ msg = e.getMessage();
+ if (parent == null)
+ parent = DialogUtil.getActiveShell();
+ DialogUtil.displayErrorMessage(parent, msg, e);
+ }
+
+ /**
+ * Utility method that will add a debug listener to the given control. All
+ * common events are added.
+ *
+ * @param control
+ * @return
+ */
+ public static Listener addDebugListener(Control control) {
+ Listener listener = e -> {
+ switch (e.type) {
+ case SWT.Selection:
+ System.out.println("Selection EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.Dispose:
+ System.out.println("Dispose EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.Paint:
+ System.out.println("Paint EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.Resize:
+ System.out.println("Resize EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.MouseDoubleClick:
+ System.out.println("MouseDoubleClick EVENT: " //$NON-NLS-1$
+ + e.toString());
+ break;
+ case SWT.MouseDown:
+ System.out.println("MouseDown EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.MouseUp:
+ System.out.println("MouseUp EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.MouseMove:
+ System.out.println("MouseMove EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.MouseEnter:
+ System.out.println("MouseEnter EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.MouseExit:
+ System.out.println("MouseExit EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.MouseHover:
+ System.out.println("MouseHover EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.FocusIn:
+ System.out.println("FocusIn EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.FocusOut:
+ System.out.println("FocusOut EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.KeyDown:
+ System.out.println("KeyDown EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.KeyUp:
+ System.out.println("KeyUp EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.Traverse:
+ System.out.println("Traverse EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.Show:
+ System.out.println("Show EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ case SWT.Hide:
+ System.out.println("Hide EVENT: " + e.toString()); //$NON-NLS-1$
+ break;
+ default:
+ System.out.println(e.toString());
+ }
};
- int[] allEvents = new int[] { SWT.Selection, SWT.Dispose, SWT.Paint,
- SWT.Resize, SWT.MouseDoubleClick, SWT.MouseDown, SWT.MouseUp,
- // SWT.MouseMove,
- SWT.MouseEnter, SWT.MouseExit, SWT.MouseHover, SWT.FocusIn,
- SWT.FocusOut, SWT.KeyDown, SWT.KeyUp, SWT.Traverse, SWT.Show,
- SWT.Hide };
- for (int i = 0; i < allEvents.length; i++) {
- control.addListener(allEvents[i], listener);
- }
- return listener;
- }
-
- public static void sleep(int delay) {
- try {
- Thread.sleep(delay);
- } catch (InterruptedException e) {
- // no-op
- }
- }
-
- public static void highlight(Control control, int color) {
- control.setBackground(control.getDisplay().getSystemColor(color));
- }
-
- public static void highlightFocusControl() {
- Control control = Display.getCurrent().getFocusControl();
- if (control != null)
- control.setBackground(Display.getCurrent().getSystemColor(
- SWT.COLOR_DARK_RED));
- }
-
- /**
- * Launch an external brwoser on the given url.
- */
- public static boolean openBrowser(String href) {
- try {
- URL url = new URL(href);
- IWorkbenchBrowserSupport support = PlatformUI.getWorkbench()
- .getBrowserSupport();
- support.getExternalBrowser().openURL(url);
- return true;
- } catch (PartInitException e) {
- Log.error("Intro failed to get Browser support.", e); //$NON-NLS-1$
- return false;
- } catch (MalformedURLException e) {
- Log.error("Intro failed to display: " + href, e); //$NON-NLS-1$
- return false;
- }
- }
-
- public static void logPerformanceTime(String message, long startTime) {
- long endTime = System.currentTimeMillis();
- Log.forcedInfo("Intro Performance - " + message + (endTime - startTime) //$NON-NLS-1$
- + "ms"); //$NON-NLS-1$
- }
-
- public static void logPerformanceMessage(String message, long time) {
- Log.forcedInfo("Intro Performance - " + message + " " + time + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
+ int[] allEvents = new int[] { SWT.Selection, SWT.Dispose, SWT.Paint,
+ SWT.Resize, SWT.MouseDoubleClick, SWT.MouseDown, SWT.MouseUp,
+ // SWT.MouseMove,
+ SWT.MouseEnter, SWT.MouseExit, SWT.MouseHover, SWT.FocusIn,
+ SWT.FocusOut, SWT.KeyDown, SWT.KeyUp, SWT.Traverse, SWT.Show,
+ SWT.Hide };
+ for (int i = 0; i < allEvents.length; i++) {
+ control.addListener(allEvents[i], listener);
+ }
+ return listener;
+ }
+
+ public static void sleep(int delay) {
+ try {
+ Thread.sleep(delay);
+ } catch (InterruptedException e) {
+ // no-op
+ }
+ }
+
+ public static void highlight(Control control, int color) {
+ control.setBackground(control.getDisplay().getSystemColor(color));
+ }
+
+ public static void highlightFocusControl() {
+ Control control = Display.getCurrent().getFocusControl();
+ if (control != null)
+ control.setBackground(Display.getCurrent().getSystemColor(
+ SWT.COLOR_DARK_RED));
+ }
+
+ /**
+ * Launch an external brwoser on the given url.
+ */
+ public static boolean openBrowser(String href) {
+ try {
+ URL url = new URL(href);
+ IWorkbenchBrowserSupport support = PlatformUI.getWorkbench()
+ .getBrowserSupport();
+ support.getExternalBrowser().openURL(url);
+ return true;
+ } catch (PartInitException e) {
+ Log.error("Intro failed to get Browser support.", e); //$NON-NLS-1$
+ return false;
+ } catch (MalformedURLException e) {
+ Log.error("Intro failed to display: " + href, e); //$NON-NLS-1$
+ return false;
+ }
+ }
+
+ public static void logPerformanceTime(String message, long startTime) {
+ long endTime = System.currentTimeMillis();
+ Log.forcedInfo("Intro Performance - " + message + (endTime - startTime) //$NON-NLS-1$
+ + "ms"); //$NON-NLS-1$
+ }
+
+ public static void logPerformanceMessage(String message, long time) {
+ Log.forcedInfo("Intro Performance - " + message + " " + time + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/CustomizableIntroPart.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/CustomizableIntroPart.java
index 17a131176..b5c51630a 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/CustomizableIntroPart.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/CustomizableIntroPart.java
@@ -83,194 +83,194 @@ import org.eclipse.ui.part.IntroPart;
* clicked, signaling that the standby part is no longer needed.
*/
public final class CustomizableIntroPart extends IntroPart implements
- IRegistryChangeListener {
+ IRegistryChangeListener {
- private IntroPartPresentation presentation;
- private StandbyPart standbyPart;
- private Composite container;
- private IMemento memento;
- IntroModelRoot model;
- // this flag is used to recreate a cached standby part. It is used once and
- // the set to false when the standby part is first created.
- private boolean restoreStandby;
+ private IntroPartPresentation presentation;
+ private StandbyPart standbyPart;
+ private Composite container;
+ private IMemento memento;
+ IntroModelRoot model;
+ // this flag is used to recreate a cached standby part. It is used once and
+ // the set to false when the standby part is first created.
+ private boolean restoreStandby;
- // Adapter factory to abstract out the StandbyPart implementation from APIs.
- IAdapterFactory factory = new IAdapterFactory() {
+ // Adapter factory to abstract out the StandbyPart implementation from APIs.
+ IAdapterFactory factory = new IAdapterFactory() {
@Override
public Class<?>[] getAdapterList() {
- return new Class[] { StandbyPart.class, IntroPartPresentation.class };
- }
+ return new Class[] { StandbyPart.class, IntroPartPresentation.class };
+ }
@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
- if (!(adaptableObject instanceof CustomizableIntroPart))
- return null;
+ if (!(adaptableObject instanceof CustomizableIntroPart))
+ return null;
- if (adapterType.equals(StandbyPart.class)) {
+ if (adapterType.equals(StandbyPart.class)) {
return adapterType.cast(getStandbyPart());
- } else if (adapterType.equals(IntroPartPresentation.class)) {
+ } else if (adapterType.equals(IntroPartPresentation.class)) {
return adapterType.cast(getPresentation());
- } else
- return null;
- }
- };
-
- public CustomizableIntroPart() {
- // register adapter to hide standbypart.
- Platform.getAdapterManager().registerAdapters(factory,
- CustomizableIntroPart.class);
- // model can not be loaded here because the configElement of this part
- // is still not loaded here.
-
- // if we are logging performance, start the UI creation start time.
- // Clock stops at the end of the standbyStateChanged event.
- if (Log.logPerformance) {
- if (PerformanceStats.ENABLED)
- PerformanceStats.getStats(
- IIntroConstants.PERF_VIEW_CREATION_TIME,
- IIntroConstants.INTRO).startRun();
- else
- // capture start time to be used when only Intro performance
- // trace
- // is turned on.
- IntroPlugin.getDefault().setUICreationStartTime(
- System.currentTimeMillis());
- }
- }
-
- @Override
+ } else
+ return null;
+ }
+ };
+
+ public CustomizableIntroPart() {
+ // register adapter to hide standbypart.
+ Platform.getAdapterManager().registerAdapters(factory,
+ CustomizableIntroPart.class);
+ // model can not be loaded here because the configElement of this part
+ // is still not loaded here.
+
+ // if we are logging performance, start the UI creation start time.
+ // Clock stops at the end of the standbyStateChanged event.
+ if (Log.logPerformance) {
+ if (PerformanceStats.ENABLED)
+ PerformanceStats.getStats(
+ IIntroConstants.PERF_VIEW_CREATION_TIME,
+ IIntroConstants.INTRO).startRun();
+ else
+ // capture start time to be used when only Intro performance
+ // trace
+ // is turned on.
+ IntroPlugin.getDefault().setUICreationStartTime(
+ System.currentTimeMillis());
+ }
+ }
+
+ @Override
public void init(IIntroSite site, IMemento memento)
- throws PartInitException {
- super.init(site, memento);
- IntroPlugin.getDefault().closeLaunchBar();
- // load the correct model based in the current Intro Part id. Set the
- // IntroPartId in the manager class.
- String introId = getConfigurationElement().getAttribute("id"); //$NON-NLS-1$
- ExtensionPointManager extensionPointManager = IntroPlugin.getDefault()
- .getExtensionPointManager();
- extensionPointManager.setIntroId(introId);
- model = extensionPointManager.getCurrentModel();
-
- if (model != null && model.hasValidConfig()) {
-
- boolean startAtHomePage = ReopenUtil.isReopenPreference();
+ throws PartInitException {
+ super.init(site, memento);
+ IntroPlugin.getDefault().closeLaunchBar();
+ // load the correct model based in the current Intro Part id. Set the
+ // IntroPartId in the manager class.
+ String introId = getConfigurationElement().getAttribute("id"); //$NON-NLS-1$
+ ExtensionPointManager extensionPointManager = IntroPlugin.getDefault()
+ .getExtensionPointManager();
+ extensionPointManager.setIntroId(introId);
+ model = extensionPointManager.getCurrentModel();
+
+ if (model != null && model.hasValidConfig()) {
+
+ boolean startAtHomePage = ReopenUtil.isReopenPreference();
if (startAtHomePage) {
- PlatformUI.getPreferenceStore().setValue(
- IWorkbenchPreferenceConstants.SHOW_INTRO, true);
- memento = null;
- }
- // we have a valid config contribution, get presentation. Make sure
- // you pass correct memento.
- presentation = model.getPresentation();
- if (presentation != null)
- presentation.init(this, getMemento(memento,
- IIntroConstants.MEMENTO_PRESENTATION_TAG));
-
- // standby part is not created here for performance.
-
- // cache memento, and detemine if we have a cached standby part.
- this.memento = memento;
- restoreStandby = needToRestoreStandby(memento);
-
- // add the registry listerner for dynamic awarness.
- Platform.getExtensionRegistry().addRegistryChangeListener(this,
- IIntroConstants.PLUGIN_ID);
- }
-
- if (model == null || !model.hasValidConfig())
- DialogUtil.displayErrorMessage(site.getShell(),
- Messages.CustomizableIntroPart_configNotFound,
- new Object[] { ModelLoaderUtil.getLogString(
- getConfigurationElement(), null) }, null);
-
- }
-
- /**
- * Creates the UI based on how the InroPart has been configured.
- *
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
+ PlatformUI.getPreferenceStore().setValue(
+ IWorkbenchPreferenceConstants.SHOW_INTRO, true);
+ memento = null;
+ }
+ // we have a valid config contribution, get presentation. Make sure
+ // you pass correct memento.
+ presentation = model.getPresentation();
+ if (presentation != null)
+ presentation.init(this, getMemento(memento,
+ IIntroConstants.MEMENTO_PRESENTATION_TAG));
+
+ // standby part is not created here for performance.
+
+ // cache memento, and detemine if we have a cached standby part.
+ this.memento = memento;
+ restoreStandby = needToRestoreStandby(memento);
+
+ // add the registry listerner for dynamic awarness.
+ Platform.getExtensionRegistry().addRegistryChangeListener(this,
+ IIntroConstants.PLUGIN_ID);
+ }
+
+ if (model == null || !model.hasValidConfig())
+ DialogUtil.displayErrorMessage(site.getShell(),
+ Messages.CustomizableIntroPart_configNotFound,
+ new Object[] { ModelLoaderUtil.getLogString(
+ getConfigurationElement(), null) }, null);
+
+ }
+
+ /**
+ * Creates the UI based on how the InroPart has been configured.
+ *
+ * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
public void createPartControl(Composite parent) {
- container = new Composite(parent, SWT.NULL);
- StackLayout layout = new StackLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- container.setLayout(layout);
-
- if (model != null && model.hasValidConfig()) {
- presentation.createPartControl(container);
- // do not create the standby part here for performance.
- }
-
- if (Log.logPerformance) {
- PerformanceStats stats = PerformanceStats.getStats(
- IIntroConstants.PERF_UI_ZOOM, IIntroConstants.INTRO);
- stats.startRun();
- }
-
- }
-
-
-
-
- /**
- * Determine if we need to recreate a standby part. Return true if we have a
- * standby part memento that is not for the empty part AND stangby memento
- * has been tagged for restore, ie: it was open when workbench closed.
- *
- * @param memento
- * @return <code>true</code> if we need to recreate a standby part
- */
- private boolean needToRestoreStandby(IMemento memento) {
- // If we have a standby memento, it means we closed with standby open,
- // and so recreate it.
- IMemento standbyMemento = getMemento(memento, IIntroConstants.MEMENTO_STANDBY_PART_TAG);
- if (standbyMemento == null)
- return false;
- String restore = standbyMemento.getString(IIntroConstants.MEMENTO_RESTORE_ATT);
- if (restore == null)
- return false;
- String cachedStandbyPart = standbyMemento
- .getString(IIntroConstants.MEMENTO_STANDBY_CONTENT_PART_ID_ATT);
- if (cachedStandbyPart != null
- && cachedStandbyPart.equals(IIntroConstants.EMPTY_STANDBY_CONTENT_PART))
- return false;
-
- return cachedStandbyPart != null ? true : false;
- }
-
- /*
- * Handled state changes. Recreates the standby part if workbench was shut
- * down with one.
- *
- * @see org.eclipse.ui.IIntroPart#standbyStateChanged(boolean)
- */
- @Override
+ container = new Composite(parent, SWT.NULL);
+ StackLayout layout = new StackLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ container.setLayout(layout);
+
+ if (model != null && model.hasValidConfig()) {
+ presentation.createPartControl(container);
+ // do not create the standby part here for performance.
+ }
+
+ if (Log.logPerformance) {
+ PerformanceStats stats = PerformanceStats.getStats(
+ IIntroConstants.PERF_UI_ZOOM, IIntroConstants.INTRO);
+ stats.startRun();
+ }
+
+ }
+
+
+
+
+ /**
+ * Determine if we need to recreate a standby part. Return true if we have a
+ * standby part memento that is not for the empty part AND stangby memento
+ * has been tagged for restore, ie: it was open when workbench closed.
+ *
+ * @param memento
+ * @return <code>true</code> if we need to recreate a standby part
+ */
+ private boolean needToRestoreStandby(IMemento memento) {
+ // If we have a standby memento, it means we closed with standby open,
+ // and so recreate it.
+ IMemento standbyMemento = getMemento(memento, IIntroConstants.MEMENTO_STANDBY_PART_TAG);
+ if (standbyMemento == null)
+ return false;
+ String restore = standbyMemento.getString(IIntroConstants.MEMENTO_RESTORE_ATT);
+ if (restore == null)
+ return false;
+ String cachedStandbyPart = standbyMemento
+ .getString(IIntroConstants.MEMENTO_STANDBY_CONTENT_PART_ID_ATT);
+ if (cachedStandbyPart != null
+ && cachedStandbyPart.equals(IIntroConstants.EMPTY_STANDBY_CONTENT_PART))
+ return false;
+
+ return cachedStandbyPart != null ? true : false;
+ }
+
+ /*
+ * Handled state changes. Recreates the standby part if workbench was shut
+ * down with one.
+ *
+ * @see org.eclipse.ui.IIntroPart#standbyStateChanged(boolean)
+ */
+ @Override
public void standbyStateChanged(boolean standby) {
- // do this only if there is a valid config.
- if (model == null || !model.hasValidConfig())
- return;
+ // do this only if there is a valid config.
+ if (model == null || !model.hasValidConfig())
+ return;
- if (!standby)
- // we started of not in standby, no need to restore standby.
- restoreStandby = false;
+ if (!standby)
+ // we started of not in standby, no need to restore standby.
+ restoreStandby = false;
- boolean isStandbyPartNeeded = isStandbyPartNeeded();
- isStandbyPartNeeded = isStandbyPartNeeded | restoreStandby;
+ boolean isStandbyPartNeeded = isStandbyPartNeeded();
+ isStandbyPartNeeded = isStandbyPartNeeded | restoreStandby;
- try {
+ try {
if (standbyPart == null && standby && isStandbyPartNeeded)
- // if standby part is not created yet, create it only if in
- // standby, and we need to.
- createStandbyPart();
+ // if standby part is not created yet, create it only if in
+ // standby, and we need to.
+ createStandbyPart();
handleSetFocus(isStandbyPartNeeded);
setTopControl(isStandbyPartNeeded ? getStandbyControl()
- : getPresentationControl());
+ : getPresentationControl());
// triger state change in presentation to enable/disable toobar
// actions. For this, we need to disable actions as long as we are in
// standby, or we need to show standby part.
@@ -278,177 +278,177 @@ public final class CustomizableIntroPart extends IntroPart implements
} catch (RuntimeException e) {
Log.error("Exception thrown in intro", e); //$NON-NLS-1$
}
- }
-
- /**
- * Returns true if we need to show the standby part. False in all other
- * cases. This basically overrides the workbench behavior of Standby/normal
- * states. The design here is that if the showStandbyPart flag is set, then
- * we always need to show the standby part.
- *
- * @return <code>true</code> if we need to show the standby part
- */
- private boolean isStandbyPartNeeded() {
- return container.getData(IIntroConstants.SHOW_STANDBY_PART) == null ? false : true;
- }
-
- /*
- * Create standby part. Called only when really needed. We reset the restore
- * falg, but we need to tag the intro part as needing standby.
- */
- private void createStandbyPart() {
- standbyPart = new StandbyPart(model);
- standbyPart.init(this, getMemento(memento, IIntroConstants.MEMENTO_STANDBY_PART_TAG));
- standbyPart.createPartControl((Composite) getControl());
- restoreStandby = false;
- container.setData(IIntroConstants.SHOW_STANDBY_PART, "true"); //$NON-NLS-1$
- }
-
- private void handleSetFocus(boolean standby) {
- if (standby) {
- // standby part is null when Intro has not gone into standby state
- // yet.
- if (standbyPart != null)
- standbyPart.setFocus();
- } else
- presentation.setFocus();
- }
-
- @Override
+ }
+
+ /**
+ * Returns true if we need to show the standby part. False in all other
+ * cases. This basically overrides the workbench behavior of Standby/normal
+ * states. The design here is that if the showStandbyPart flag is set, then
+ * we always need to show the standby part.
+ *
+ * @return <code>true</code> if we need to show the standby part
+ */
+ private boolean isStandbyPartNeeded() {
+ return container.getData(IIntroConstants.SHOW_STANDBY_PART) == null ? false : true;
+ }
+
+ /*
+ * Create standby part. Called only when really needed. We reset the restore
+ * falg, but we need to tag the intro part as needing standby.
+ */
+ private void createStandbyPart() {
+ standbyPart = new StandbyPart(model);
+ standbyPart.init(this, getMemento(memento, IIntroConstants.MEMENTO_STANDBY_PART_TAG));
+ standbyPart.createPartControl((Composite) getControl());
+ restoreStandby = false;
+ container.setData(IIntroConstants.SHOW_STANDBY_PART, "true"); //$NON-NLS-1$
+ }
+
+ private void handleSetFocus(boolean standby) {
+ if (standby) {
+ // standby part is null when Intro has not gone into standby state
+ // yet.
+ if (standbyPart != null)
+ standbyPart.setFocus();
+ } else
+ presentation.setFocus();
+ }
+
+ @Override
public void setFocus() {
- handleSetFocus(IntroPlugin.isIntroStandby());
- }
-
- private void setTopControl(Control c) {
- // container has stack layout. safe to cast.
- StackLayout layout = (StackLayout) container.getLayout();
- layout.topControl = c;
- container.layout();
- }
-
- private Control getPresentationControl() {
- return container.getChildren()[0];
- }
-
- private Control getStandbyControl() {
- // the Container top control may have only one child if the standby
- // part is not created yet. This happens if the intro never goes into
- // standby. Doing this for performance.
- if (standbyPart != null)
- return container.getChildren()[1];
- return null;
- }
-
- IntroPartPresentation getPresentation() {
- return presentation;
- }
-
- @Override
+ handleSetFocus(IntroPlugin.isIntroStandby());
+ }
+
+ private void setTopControl(Control c) {
+ // container has stack layout. safe to cast.
+ StackLayout layout = (StackLayout) container.getLayout();
+ layout.topControl = c;
+ container.layout();
+ }
+
+ private Control getPresentationControl() {
+ return container.getChildren()[0];
+ }
+
+ private Control getStandbyControl() {
+ // the Container top control may have only one child if the standby
+ // part is not created yet. This happens if the intro never goes into
+ // standby. Doing this for performance.
+ if (standbyPart != null)
+ return container.getChildren()[1];
+ return null;
+ }
+
+ IntroPartPresentation getPresentation() {
+ return presentation;
+ }
+
+ @Override
public void dispose() {
- super.dispose();
- // call dispose on both parts.
- if (presentation != null)
- presentation.dispose();
- if (standbyPart != null)
- standbyPart.dispose();
- // clear all loaded models since we are disposing of the Intro Part.
- IntroPlugin.getDefault().getExtensionPointManager().clear();
- ContentProviderManager.getInst().clear();
- // clean platform adapter.
- Platform.getAdapterManager().unregisterAdapters(factory,
- CustomizableIntroPart.class);
- if (model != null && model.hasValidConfig())
- Platform.getExtensionRegistry().removeRegistryChangeListener(this);
-
- }
-
- /**
- * @return Returns the standbyPart.
- */
- StandbyPart getStandbyPart() {
- return standbyPart;
- }
-
- /**
- * Returns the primary control associated with this Intro part.
- *
- * @return the SWT control which displays this Intro part's content, or
- * <code>null</code> if this standby part's controls have not yet
- * been created.
- */
- public Control getControl() {
- return container;
- }
-
- @Override
+ super.dispose();
+ // call dispose on both parts.
+ if (presentation != null)
+ presentation.dispose();
+ if (standbyPart != null)
+ standbyPart.dispose();
+ // clear all loaded models since we are disposing of the Intro Part.
+ IntroPlugin.getDefault().getExtensionPointManager().clear();
+ ContentProviderManager.getInst().clear();
+ // clean platform adapter.
+ Platform.getAdapterManager().unregisterAdapters(factory,
+ CustomizableIntroPart.class);
+ if (model != null && model.hasValidConfig())
+ Platform.getExtensionRegistry().removeRegistryChangeListener(this);
+
+ }
+
+ /**
+ * @return Returns the standbyPart.
+ */
+ StandbyPart getStandbyPart() {
+ return standbyPart;
+ }
+
+ /**
+ * Returns the primary control associated with this Intro part.
+ *
+ * @return the SWT control which displays this Intro part's content, or
+ * <code>null</code> if this standby part's controls have not yet
+ * been created.
+ */
+ public Control getControl() {
+ return container;
+ }
+
+ @Override
public void saveState(IMemento memento) {
- // give presentation and standby part there own children to create a
- // name space for each. But save either the presentation or the standby
- // part as needing to be restored. This way if we close with a standby
- // mode, we dont get the cached standby part.
-
- // Find out if presentation or standby is at the top and restore
- // them. Container has stack layout. safe to cast.
- boolean restorePresentation = false;
- StackLayout layout = (StackLayout) container.getLayout();
- if (getPresentationControl().equals(layout.topControl))
- restorePresentation = true;
-
- IMemento presentationMemento = memento
- .createChild(IIntroConstants.MEMENTO_PRESENTATION_TAG);
- IMemento standbyPartMemento = memento
- .createChild(IIntroConstants.MEMENTO_STANDBY_PART_TAG);
- if (restorePresentation)
- presentationMemento.putString(IIntroConstants.MEMENTO_RESTORE_ATT, "true"); //$NON-NLS-1$
- else
- standbyPartMemento.putString(IIntroConstants.MEMENTO_RESTORE_ATT, "true"); //$NON-NLS-1$
- if (presentation != null)
- presentation.saveState(presentationMemento);
- if (standbyPart != null)
- standbyPart.saveState(standbyPartMemento);
- }
-
- private IMemento getMemento(IMemento memento, String key) {
- if (memento == null)
- return null;
- return memento.getChild(key);
- }
-
- /**
- * Support dynamic awarness.
- *
- * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
- */
- @Override
+ // give presentation and standby part there own children to create a
+ // name space for each. But save either the presentation or the standby
+ // part as needing to be restored. This way if we close with a standby
+ // mode, we dont get the cached standby part.
+
+ // Find out if presentation or standby is at the top and restore
+ // them. Container has stack layout. safe to cast.
+ boolean restorePresentation = false;
+ StackLayout layout = (StackLayout) container.getLayout();
+ if (getPresentationControl().equals(layout.topControl))
+ restorePresentation = true;
+
+ IMemento presentationMemento = memento
+ .createChild(IIntroConstants.MEMENTO_PRESENTATION_TAG);
+ IMemento standbyPartMemento = memento
+ .createChild(IIntroConstants.MEMENTO_STANDBY_PART_TAG);
+ if (restorePresentation)
+ presentationMemento.putString(IIntroConstants.MEMENTO_RESTORE_ATT, "true"); //$NON-NLS-1$
+ else
+ standbyPartMemento.putString(IIntroConstants.MEMENTO_RESTORE_ATT, "true"); //$NON-NLS-1$
+ if (presentation != null)
+ presentation.saveState(presentationMemento);
+ if (standbyPart != null)
+ standbyPart.saveState(standbyPartMemento);
+ }
+
+ private IMemento getMemento(IMemento memento, String key) {
+ if (memento == null)
+ return null;
+ return memento.getChild(key);
+ }
+
+ /**
+ * Support dynamic awarness.
+ *
+ * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
+ */
+ @Override
public void registryChanged(final IRegistryChangeEvent event) {
- // Clear cached models first, then update UI by delegating to
- // implementation. wrap in synchExec because notification is
- // asynchronous. The design here is that the notification is centralized
- // here, then this event propagates and each receiving class reacts
- // accordingly.
- Display.getDefault().syncExec(() -> {
- String currentPageId = model.getCurrentPageId();
- // clear model, including content providers.
- ExtensionPointManager.getInst().clear();
- ContentProviderManager.getInst().clear();
- // refresh to new model.
- model = ExtensionPointManager.getInst().getCurrentModel();
- // reuse existing presentation, since we just nulled it.
- model.setPresentation(getPresentation());
- // keep same page on refresh. No need for notification here.
- model.setCurrentPageId(currentPageId, false);
- if (getPresentation() != null)
- getPresentation().registryChanged(event);
+ // Clear cached models first, then update UI by delegating to
+ // implementation. wrap in synchExec because notification is
+ // asynchronous. The design here is that the notification is centralized
+ // here, then this event propagates and each receiving class reacts
+ // accordingly.
+ Display.getDefault().syncExec(() -> {
+ String currentPageId = model.getCurrentPageId();
+ // clear model, including content providers.
+ ExtensionPointManager.getInst().clear();
+ ContentProviderManager.getInst().clear();
+ // refresh to new model.
+ model = ExtensionPointManager.getInst().getCurrentModel();
+ // reuse existing presentation, since we just nulled it.
+ model.setPresentation(getPresentation());
+ // keep same page on refresh. No need for notification here.
+ model.setCurrentPageId(currentPageId, false);
+ if (getPresentation() != null)
+ getPresentation().registryChanged(event);
});
- }
+ }
- /*
- * Internal test hook (Non-API).
- */
- public boolean internal_isFinishedLoading() {
- BrowserIntroPartImplementation impl = (BrowserIntroPartImplementation)presentation.getIntroPartImplementation();
- return impl.isFinishedLoading();
- }
+ /*
+ * Internal test hook (Non-API).
+ */
+ public boolean internal_isFinishedLoading() {
+ BrowserIntroPartImplementation impl = (BrowserIntroPartImplementation)presentation.getIntroPartImplementation();
+ return impl.isFinishedLoading();
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroAction.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroAction.java
index c993d7181..85f8ffecd 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroAction.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroAction.java
@@ -29,13 +29,13 @@ import org.eclipse.ui.intro.IIntroSite;
*/
public interface IIntroAction {
- /**
- * Called to run this intro command. The properties represents the key=value
- * pairs extracted from the intro URL query.
- *
- * @param site The part to execute the command on.
- * @param params Parameters for the command as extracted from the URL.
- */
- public void run(IIntroSite site, Properties params);
+ /**
+ * Called to run this intro command. The properties represents the key=value
+ * pairs extracted from the intro URL query.
+ *
+ * @param site The part to execute the command on.
+ * @param params Parameters for the command as extracted from the URL.
+ */
+ public void run(IIntroSite site, Properties params);
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroContentProvider.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroContentProvider.java
index 7241f5710..bb7031478 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroContentProvider.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroContentProvider.java
@@ -65,52 +65,52 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
* @since 3.0.1
*/
public interface IIntroContentProvider {
- /**
- * Initializes the content provider. An IIntroContentProviderSite is passed,
- * which will be called on to recompute or layout the content when the
- * content becomes stale.
- *
- * @param site
- * the site of this IIntroContentProvider
- */
- public void init(IIntroContentProviderSite site);
+ /**
+ * Initializes the content provider. An IIntroContentProviderSite is passed,
+ * which will be called on to recompute or layout the content when the
+ * content becomes stale.
+ *
+ * @param site
+ * the site of this IIntroContentProvider
+ */
+ public void init(IIntroContentProviderSite site);
- /**
- * Creates HTML content in the provided PrintWriter. This content will be
- * included in the generated HTML page when embedded HTML widget is used to
- * render intro content.
- *
- * @param id
- * the unique identifier of the content element. The same content
- * provider class can be reused for several elements and the id
- * can be used to tell them apart.
- * @param out
- * the output print writer to generate HTML content into
- */
- public void createContent(String id, PrintWriter out);
+ /**
+ * Creates HTML content in the provided PrintWriter. This content will be
+ * included in the generated HTML page when embedded HTML widget is used to
+ * render intro content.
+ *
+ * @param id
+ * the unique identifier of the content element. The same content
+ * provider class can be reused for several elements and the id
+ * can be used to tell them apart.
+ * @param out
+ * the output print writer to generate HTML content into
+ */
+ public void createContent(String id, PrintWriter out);
- /**
- * Creates SWT content in the provided Composite. This method is called when
- * Eclipse Forms are used to render intro content.
- *
- * @param id
- * the unique identifier of the content element
- * @param parent
- * the parent composite that should be used when creating SWT
- * widgets
- * @param toolkit
- * the form toolkit that should be used when creating new widgets
- */
- public void createContent(String id, Composite parent, FormToolkit toolkit);
+ /**
+ * Creates SWT content in the provided Composite. This method is called when
+ * Eclipse Forms are used to render intro content.
+ *
+ * @param id
+ * the unique identifier of the content element
+ * @param parent
+ * the parent composite that should be used when creating SWT
+ * widgets
+ * @param toolkit
+ * the form toolkit that should be used when creating new widgets
+ */
+ public void createContent(String id, Composite parent, FormToolkit toolkit);
- /**
- * Dispose of the ContentProvider. This will only be called when the Intro
- * view is closed. In other words, the content provider will not be disposed
- * of until the last possible minute. This gives the implementor the chance
- * to cache content and avoid regenerating content on every page switch.
- */
- public void dispose();
+ /**
+ * Dispose of the ContentProvider. This will only be called when the Intro
+ * view is closed. In other words, the content provider will not be disposed
+ * of until the last possible minute. This gives the implementor the chance
+ * to cache content and avoid regenerating content on every page switch.
+ */
+ public void dispose();
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroContentProviderSite.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroContentProviderSite.java
index d2caa2ac5..000d95ac2 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroContentProviderSite.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroContentProviderSite.java
@@ -28,19 +28,19 @@ package org.eclipse.ui.intro.config;
* @noextend This interface is not intended to be extended by clients.
*/
public interface IIntroContentProviderSite {
- /**
- * This method will be called when the IIntroContentProvider is notified
- * that its content has become stale. For an HTML presentation, the whole
- * page should be regenerated. An SWT presentation should cause the page's
- * layout to be updated.
- *
- * @param provider
- * the content provider that requests a reflow
- * @param incremental
- * if <code>true</code>, an attempt should be made to
- * incrementally reflow the page. Otherwise, the page should be
- * recreated from scratch. This is just a hint and the
- * implementation of the interface can ignore it.
- */
- public void reflow(IIntroContentProvider provider, boolean incremental);
+ /**
+ * This method will be called when the IIntroContentProvider is notified
+ * that its content has become stale. For an HTML presentation, the whole
+ * page should be regenerated. An SWT presentation should cause the page's
+ * layout to be updated.
+ *
+ * @param provider
+ * the content provider that requests a reflow
+ * @param incremental
+ * if <code>true</code>, an attempt should be made to
+ * incrementally reflow the page. Otherwise, the page should be
+ * recreated from scratch. This is just a hint and the
+ * implementation of the interface can ignore it.
+ */
+ public void reflow(IIntroContentProvider provider, boolean incremental);
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroURL.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroURL.java
index 21719770a..bda1d24d8 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroURL.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroURL.java
@@ -45,26 +45,26 @@ package org.eclipse.ui.intro.config;
*/
public interface IIntroURL {
- /**
- * Executes whatever valid Intro command is embedded in this Intro URL.
- * Returns true if action succeeded, and false otherwise.
- *
- */
- public boolean execute();
+ /**
+ * Executes whatever valid Intro command is embedded in this Intro URL.
+ * Returns true if action succeeded, and false otherwise.
+ *
+ */
+ public boolean execute();
- /**
- * @return Returns the command imbedded in this URL.
- */
- public String getAction();
+ /**
+ * @return Returns the command imbedded in this URL.
+ */
+ public String getAction();
- /**
- * Return a parameter defined in the Intro URL. Returns null if the
- * parameter is not defined.
- *
- * @param parameterId
- * the id of the parameter being requested
- * @return the value of the parameter, or <code>null</code> if the
- * parameter is not defined
- */
- public String getParameter(String parameterId);
+ /**
+ * Return a parameter defined in the Intro URL. Returns null if the
+ * parameter is not defined.
+ *
+ * @param parameterId
+ * the id of the parameter being requested
+ * @return the value of the parameter, or <code>null</code> if the
+ * parameter is not defined
+ */
+ public String getParameter(String parameterId);
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroXHTMLContentProvider.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroXHTMLContentProvider.java
index 68367e921..fd227eaf2 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroXHTMLContentProvider.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IIntroXHTMLContentProvider.java
@@ -24,34 +24,34 @@ import org.w3c.dom.Element;
*/
public interface IIntroXHTMLContentProvider extends IIntroContentProvider {
- /**
- * Create XHTML content in the provided parent DOM Element. A typical usage
- * for this method would be: <br>
- *
- * <br>
- * <code>
- * &lt;contentProvider id=&quot;contentProviderId&quot;
- * class=&quot;xx.yy.IntroContentProvider&quot;
- * pluginId=&quot;xx.yy.id&quot;/&gt; <br></code> <br>
- *
- * A parent DOM Element will be passed to allow for adding dynamic content
- * by manipulating the Java XML DOM for the XHTML file. A div is created
- * with an id equal to the id specified in the contentProvider element, and
- * is passed as the parent. In the above example, the DOM element
- * representing a div with id=myContentProviderDivId would be the parent
- * passed.
- *
- * @param id
- * the unique identifier of the content element. The same content
- * provider class can be reused for several elements and the id
- * can be used to tell them apart.
- *
- * @param parent
- * the parent xml Element where dynamic content will be added as
- * children.
- *
- */
- public void createContent(String id, Element parent);
+ /**
+ * Create XHTML content in the provided parent DOM Element. A typical usage
+ * for this method would be: <br>
+ *
+ * <br>
+ * <code>
+ * &lt;contentProvider id=&quot;contentProviderId&quot;
+ * class=&quot;xx.yy.IntroContentProvider&quot;
+ * pluginId=&quot;xx.yy.id&quot;/&gt; <br></code> <br>
+ *
+ * A parent DOM Element will be passed to allow for adding dynamic content
+ * by manipulating the Java XML DOM for the XHTML file. A div is created
+ * with an id equal to the id specified in the contentProvider element, and
+ * is passed as the parent. In the above example, the DOM element
+ * representing a div with id=myContentProviderDivId would be the parent
+ * passed.
+ *
+ * @param id
+ * the unique identifier of the content element. The same content
+ * provider class can be reused for several elements and the id
+ * can be used to tell them apart.
+ *
+ * @param parent
+ * the parent xml Element where dynamic content will be added as
+ * children.
+ *
+ */
+ public void createContent(String id, Element parent);
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IStandbyContentPart.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IStandbyContentPart.java
index df70184f2..5bf08fd54 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IStandbyContentPart.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IStandbyContentPart.java
@@ -44,92 +44,92 @@ import org.eclipse.ui.intro.IIntroPart;
*/
public interface IStandbyContentPart {
- /**
- * Creates the SWT controls for this standby part.
- * <p>
- * Clients should not call this method. The intro framework calls this
- * method when it needs to.
- *
- * @param parent
- * the parent control
- * @param toolkit
- * the form toolkit being used by the IIntroPart implementation
- */
- public void createPartControl(Composite parent, FormToolkit toolkit);
+ /**
+ * Creates the SWT controls for this standby part.
+ * <p>
+ * Clients should not call this method. The intro framework calls this
+ * method when it needs to.
+ *
+ * @param parent
+ * the parent control
+ * @param toolkit
+ * the form toolkit being used by the IIntroPart implementation
+ */
+ public void createPartControl(Composite parent, FormToolkit toolkit);
- /**
- * Returns the primary control associated with this standby part. The
- * control is typically set during the createPartControl() call when this
- * part is being created.
- *
- * @return the SWT control which displays this standby part's content, or
- * <code>null</code> if this standby part's controls have not yet
- * been created.
- */
- public Control getControl();
+ /**
+ * Returns the primary control associated with this standby part. The
+ * control is typically set during the createPartControl() call when this
+ * part is being created.
+ *
+ * @return the SWT control which displays this standby part's content, or
+ * <code>null</code> if this standby part's controls have not yet
+ * been created.
+ */
+ public Control getControl();
- /**
- * Initializes this intro standby content part with the given intro site. A
- * memento is passed to the part which contains a snapshot of the part state
- * from a previous session. Where possible, the part should try to recreate
- * that state.
- * <p>
- * This method is automatically called by the workbench shortly after part
- * construction. It marks the start of this parts' lifecycle. Clients must
- * not call this method.
- * </p>
- *
- * @param introPart
- * the intro part hosting this stanndby content part.
- * @param memento
- * this part state or <code>null</code> if there is no previous
- * saved state
- * @exception PartInitException
- * if this part was not initialized successfully.
- */
- public void init(IIntroPart introPart, IMemento memento)
- throws PartInitException;
+ /**
+ * Initializes this intro standby content part with the given intro site. A
+ * memento is passed to the part which contains a snapshot of the part state
+ * from a previous session. Where possible, the part should try to recreate
+ * that state.
+ * <p>
+ * This method is automatically called by the workbench shortly after part
+ * construction. It marks the start of this parts' lifecycle. Clients must
+ * not call this method.
+ * </p>
+ *
+ * @param introPart
+ * the intro part hosting this stanndby content part.
+ * @param memento
+ * this part state or <code>null</code> if there is no previous
+ * saved state
+ * @exception PartInitException
+ * if this part was not initialized successfully.
+ */
+ public void init(IIntroPart introPart, IMemento memento)
+ throws PartInitException;
- /**
- * Sets the input to show in this standby part. Note that input can be null,
- * such as when the part if created through an Intro URL that does not have
- * an input specified, or when this standby part is being recreated from a
- * previous workbench session. In this case, the standby part is responsible
- * for handling a null input, and recreating itself from a cached IMemento.
- *
- * @param input
- * the input object to be used by this standby part.
- */
- public void setInput(Object input);
+ /**
+ * Sets the input to show in this standby part. Note that input can be null,
+ * such as when the part if created through an Intro URL that does not have
+ * an input specified, or when this standby part is being recreated from a
+ * previous workbench session. In this case, the standby part is responsible
+ * for handling a null input, and recreating itself from a cached IMemento.
+ *
+ * @param input
+ * the input object to be used by this standby part.
+ */
+ public void setInput(Object input);
- /**
- * Asks this standby part to take focus.
- * <p>
- * Clients should not call this method (the intro framework calls this
- * method at appropriate times).
- * </p>
- */
- public void setFocus();
+ /**
+ * Asks this standby part to take focus.
+ * <p>
+ * Clients should not call this method (the intro framework calls this
+ * method at appropriate times).
+ * </p>
+ */
+ public void setFocus();
- /**
- * Disposes of this standby part.
- * <p>
- * Clients should not call this method. The intro framework calls this
- * method when the Customizable IntroPart is closed.
- * </p>
- */
- public void dispose();
+ /**
+ * Disposes of this standby part.
+ * <p>
+ * Clients should not call this method. The intro framework calls this
+ * method when the Customizable IntroPart is closed.
+ * </p>
+ */
+ public void dispose();
- /**
- * Saves the object state within a memento.
- * <p>
- * This method is automatically called by the workbench at appropriate
- * times. Clients must not call this method directly.
- * </p>
- *
- * @param memento
- * a memento to receive the object state
- */
- public void saveState(IMemento memento);
+ /**
+ * Saves the object state within a memento.
+ * <p>
+ * This method is automatically called by the workbench at appropriate
+ * times. Clients must not call this method directly.
+ * </p>
+ *
+ * @param memento
+ * a memento to receive the object state
+ */
+ public void saveState(IMemento memento);
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroURLFactory.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroURLFactory.java
index 16b73af72..654152ca9 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroURLFactory.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/config/IntroURLFactory.java
@@ -31,44 +31,44 @@ import org.eclipse.ui.internal.intro.impl.model.url.IntroURLParser;
*/
public final class IntroURLFactory {
- /**
- * Non-instantiable.
- */
- private IntroURLFactory() {
- // do nothing
- }
+ /**
+ * Non-instantiable.
+ */
+ private IntroURLFactory() {
+ // do nothing
+ }
- /**
- * Parses the given string, and returns an IntroURL if the string is a valid
- * Intro URL. Returns null in all other cases. Example usage:
- *
- * <pre>
- * StringBuilder url = new StringBuilder();
- * url.append(&quot;http://org.eclipse.ui.intro/showStandby?&quot;);
- * url.append(&quot;pluginId=org.eclipse.pde.ui&quot;);
- * url.append(&quot;&amp;&quot;);
- * url.append(&quot;partId=org.eclipse.pde.ui.sampleStandbyPart&quot;);
- * url.append(&quot;&amp;&quot;);
- * url.append(&quot;input=&quot;);
- * url.append(sampleId);
- * IIntroURL introURL = IntroURLFactory.createIntroURL(url.toString());
- * if (introURL != null) {
- * introURL.execute();
- * }
- * </pre>
- *
- * @param url
- * the url to construct an IntroURL from
- * @return an IntroURL, or <code>null</code> if the url is invalid
- */
- public static IIntroURL createIntroURL(String url) {
- IntroURLParser parser = new IntroURLParser(url);
- if (parser.hasIntroUrl()) {
- IntroURL introURL = parser.getIntroURL();
- return introURL;
- }
- return null;
- }
+ /**
+ * Parses the given string, and returns an IntroURL if the string is a valid
+ * Intro URL. Returns null in all other cases. Example usage:
+ *
+ * <pre>
+ * StringBuilder url = new StringBuilder();
+ * url.append(&quot;http://org.eclipse.ui.intro/showStandby?&quot;);
+ * url.append(&quot;pluginId=org.eclipse.pde.ui&quot;);
+ * url.append(&quot;&amp;&quot;);
+ * url.append(&quot;partId=org.eclipse.pde.ui.sampleStandbyPart&quot;);
+ * url.append(&quot;&amp;&quot;);
+ * url.append(&quot;input=&quot;);
+ * url.append(sampleId);
+ * IIntroURL introURL = IntroURLFactory.createIntroURL(url.toString());
+ * if (introURL != null) {
+ * introURL.execute();
+ * }
+ * </pre>
+ *
+ * @param url
+ * the url to construct an IntroURL from
+ * @return an IntroURL, or <code>null</code> if the url is invalid
+ */
+ public static IIntroURL createIntroURL(String url) {
+ IntroURLParser parser = new IntroURLParser(url);
+ if (parser.hasIntroUrl()) {
+ IntroURL introURL = parser.getIntroURL();
+ return introURL;
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/AlwaysWelcomeCheckbox.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/AlwaysWelcomeCheckbox.java
index 997f59ae7..78f0d5400 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/AlwaysWelcomeCheckbox.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/AlwaysWelcomeCheckbox.java
@@ -83,8 +83,8 @@ public class AlwaysWelcomeCheckbox implements IIntroContentProvider,IIntroAction
{
out.print(" checked=\"checked\""); //$NON-NLS-1$
- PlatformUI.getPreferenceStore().setValue(
- IWorkbenchPreferenceConstants.SHOW_INTRO, alwaysShowIntro);
+ PlatformUI.getPreferenceStore().setValue(
+ IWorkbenchPreferenceConstants.SHOW_INTRO, alwaysShowIntro);
}
out.println("/><label for=\"run-action-" + id + "\">"+getText()+"</label></div>"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
@@ -96,7 +96,7 @@ public class AlwaysWelcomeCheckbox implements IIntroContentProvider,IIntroAction
if (disposed)
return;
- boolean alwaysShowIntro = getAlwaysShowIntroPref();
+ boolean alwaysShowIntro = getAlwaysShowIntroPref();
Button checkBox = new Button(parent,SWT.CHECK);
toolkit.adapt(checkBox,false,false);
@@ -112,7 +112,7 @@ public class AlwaysWelcomeCheckbox implements IIntroContentProvider,IIntroAction
if (alwaysShowIntro)
PlatformUI.getPreferenceStore().setValue(
- IWorkbenchPreferenceConstants.SHOW_INTRO, alwaysShowIntro);
+ IWorkbenchPreferenceConstants.SHOW_INTRO, alwaysShowIntro);
}
@Override
@@ -141,14 +141,14 @@ public class AlwaysWelcomeCheckbox implements IIntroContentProvider,IIntroAction
{
// Retrieve current state of IUniversalIntroConst.ALWAYS_SHOW_INTRO, change it, and save it back
// to both ALWAYS_SHOW_INTRO and SHOW_INTRO
- boolean alwaysShowIntro = !getAlwaysShowIntroPref();
+ boolean alwaysShowIntro = !getAlwaysShowIntroPref();
- // local preference store
- setAlwaysShowIntroPref(alwaysShowIntro);
+ // local preference store
+ setAlwaysShowIntroPref(alwaysShowIntro);
- // workbench preference store
- PlatformUI.getPreferenceStore().setValue(
- IWorkbenchPreferenceConstants.SHOW_INTRO, alwaysShowIntro);
+ // workbench preference store
+ PlatformUI.getPreferenceStore().setValue(
+ IWorkbenchPreferenceConstants.SHOW_INTRO, alwaysShowIntro);
}

Back to the top